@fiddle-digital/string-tune 1.2.1-alpha.2 → 1.2.1-alpha.4
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.cjs +14 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ai=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Xn=Object.getOwnPropertyNames;var Kn=Object.prototype.hasOwnProperty;var Zn=(d,t)=>{for(var e in t)ai(d,e,{get:t[e],enumerable:!0})},Qn=(d,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xn(t))!Kn.call(d,i)&&i!==e&&ai(d,i,{get:()=>t[i],enumerable:!(r=qn(t,i))||r.enumerable});return d};var Jn=d=>Qn(ai({},"__esModule",{value:!0}),d);var ua={};Zn(ua,{CursorReactiveModule:()=>kt,DOMBatcher:()=>Pt,GridAdapter:()=>G,ScrollController:()=>J,StringAnchor:()=>Xe,StringCursor:()=>Fe,StringData:()=>Gt,StringDelayLerpTracker:()=>lr,StringDevIconRegistry:()=>se,StringDevInview:()=>si,StringDevLayout:()=>jr,StringDevModule:()=>Z,StringDevOverlayRegistry:()=>_t,StringDevProgress:()=>oi,StringDevRulers:()=>ei,StringFPSTracker:()=>dr,StringForm:()=>mr,StringGlide:()=>Ke,StringImpulse:()=>Ve,StringLazy:()=>Ue,StringLerp:()=>Ze,StringLerpTracker:()=>cr,StringLoading:()=>je,StringMagnetic:()=>Ge,StringMarquee:()=>We,StringMasonry:()=>ze,StringModule:()=>x,StringObject:()=>Tt,StringParallax:()=>Qe,StringPositionTracker:()=>ur,StringProgress:()=>Dt,StringProgressPart:()=>wr,StringRandom:()=>Cr,StringResponsive:()=>qe,StringScrollContainer:()=>Mr,StringScrollbar:()=>er,StringScroller:()=>Er,StringSequence:()=>hr,StringSignal:()=>xr,StringSplit:()=>ar,StringSpotlight:()=>$e,StringTune:()=>Di,StringVideoAutoplay:()=>gr,buildDevtoolsThemeBlock:()=>yr,default:()=>Di,ensureStringDevtoolsSharedStyles:()=>Bt,frameDOM:()=>U,resolveDevtoolsIcon:()=>V,styleTxn:()=>L});module.exports=Jn(ua);var ye=class{context;SETTLE_THRESHOLD_SQ=.01;smoothingFactor;lastMouseX=0;lastMouseY=0;lastMouseTime=0;_lerpStepXArgs={from:0,to:0,progress:0};_lerpStepYArgs={from:0,to:0,progress:0};constructor(t=.1,e){this.smoothingFactor=t,this.context=e,this.onSettingsChange({isDesktop:e.data.viewport.windowWidth>1024,isForceRebuild:!1,widthChanged:!0,heightChanged:!0,scrollHeightChanged:!0})}onMouseMove(t){let e=this.context.data.cursor;e.targetX=t.clientX,e.targetY=t.clientY;let r=performance.now(),i=Math.max(1,r-this.lastMouseTime);e.velocityX=(t.clientX-this.lastMouseX)/i,e.velocityY=(t.clientY-this.lastMouseY)/i,this.lastMouseX=t.clientX,this.lastMouseY=t.clientY,this.lastMouseTime=r}onFrame(){let t=this.context.data.cursor,e=t.targetX,r=t.targetY,i=t.smoothedX,n=t.smoothedY;this._lerpStepXArgs.from=i,this._lerpStepXArgs.to=e,this._lerpStepXArgs.progress=this.smoothingFactor,this._lerpStepYArgs.from=n,this._lerpStepYArgs.to=r,this._lerpStepYArgs.progress=this.smoothingFactor;let s=this.context.tools.lerp.process(this._lerpStepXArgs),o=this.context.tools.lerp.process(this._lerpStepYArgs);s*s+o*o<this.SETTLE_THRESHOLD_SQ?(t.smoothedX=e,t.smoothedY=r,t.stepX=0,t.stepY=0):(t.smoothedX+=s,t.smoothedY+=o,t.stepX=s,t.stepY=o)}onSettingsChange(t){let e=Number(this.context.settings["cursor-lerp"]);this.setLerpFactor(e)}setLerpFactor(t){this.smoothingFactor=this.context.tools.adaptiveLerp.process({value:t,inMin:.1,inMax:1,outMin:.05,outMax:.65})}};var Ct=class{listeners={};stateEvents=new Set;lastPayloads={};constructor(){this.stateEvents.add("screen:mobile"),this.stateEvents.add("screen:tablet"),this.stateEvents.add("screen:laptop"),this.stateEvents.add("screen:desktop"),this.stateEvents.add("start")}registerStateEvent(t,e){this.stateEvents.add(t),e!==void 0&&(this.lastPayloads[t]=e)}on(t,e,r){let i=r?`${t}:${r}`:t;this.listeners[i]||(this.listeners[i]=new Set),this.listeners[i].add(e),this.stateEvents.has(i)&&this.lastPayloads[i]!==void 0&&e(this.lastPayloads[i])}off(t,e,r){let i=r?`${t}:${r}`:t;this.listeners[i]&&this.listeners[i].delete(e)}emit(t,e){this.stateEvents.has(t)&&(this.lastPayloads[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 Se=class{constructor(t){this.data=t}modules=[];uiModules=[];allModules=[];register(t){if(t.type===1?this.modules.push(t):t.type===2&&this.uiModules.push(t),t.cssProperties&&t.cssProperties.length>0&&typeof window.CSS<"u"&&"registerProperty"in window.CSS)for(let e=0;e<t.cssProperties.length;e++)try{window.CSS.registerProperty(t.cssProperties[e])}catch{}t.onSubscribe(),this.rebuildAllModules()}find(t){for(let e=0;e<this.allModules.length;e++){let r=this.allModules[e];if(r instanceof t)return r}}onInit(){this.callAll("onInit")}onFrame(){this.callAll("onFrame")}onMutate(){this.callAll("onMutate")}onScrollMeasure(){this.callAll("onScrollMeasure")}onMouseMoveMeasure(){this.callAll("onMouseMoveMeasure")}onScroll(){this.callAll("onScroll")}onResizeWidth(){this.callAll("onResizeWidth")}onResize(){this.callAll("onResize")}onRebuild(){this.callAll("onRebuild")}onMouseMove(t){this.callAll("onMouseMove",t)}onWheel(t){this.callAll("onWheel",t)}onDirectionChange(){this.callAll("onDirectionChange")}onScrollStart(){this.callAll("onScrollStart")}onScrollStop(){this.callAll("onScrollStop")}onAxisChange(){this.callAll("onAxisChange")}onDeviceChange(){this.callAll("onDeviceChange")}onScrollConfigChange(){this.callAll("onScrollConfigChange")}onSettingsChange(t){this.callAll("onSettingsChange")}onDOMMutate(t,e){this.callAll("onDOMMutate",t,e)}destroy(){this.callAll("onUnsubscribe"),this.callAll("destroy"),this.modules=[],this.uiModules=[],this.allModules=[]}get all(){return this.allModules}get core(){return this.modules}get ui(){return this.uiModules}callAll(t,e,r){this.modules.length>0&&this.callLifecycleStrict(this.modules,t,e,r),this.uiModules.length>0&&this.callLifecycleStrict(this.uiModules,t,e,r)}callLifecycleStrict(t,e,r,i){let n=t.length;switch(e){case"onFrame":case"onMutate":case"onScrollMeasure":case"onMouseMoveMeasure":case"onScroll":for(let s=0;s<n;s++){let o=t[s];o&&o[e](this.data)}break;case"onDOMMutate":for(let s=0;s<n;s++){let o=t[s];o&&o[e](r,i)}break;case"onMouseMove":case"onWheel":for(let s=0;s<n;s++){let o=t[s];o&&o[e](r)}break;default:for(let s=0;s<n;s++){let o=t[s];o&&o[e]()}break}}rebuildAllModules(){this.allModules.length=0;for(let t=0;t<this.modules.length;t++)this.allModules.push(this.modules[t]);for(let t=0;t<this.uiModules.length;t++)this.allModules.push(this.uiModules[t])}};var Le=class{constructor(t,e,r){this.parent=r;this.id=t,this.htmlElement=e}id;htmlElement;properties=new Map;easingFn;get parentObject(){return this.parent}setProperty(t,e){this.properties.set(t,e)}getProperty(t){return this.properties.get(t)??null}setEasing(t){this.easingFn=t??void 0}getEasing(){return this.easingFn}applyProgress(t,e){let r=this.easingFn??e;return r?r(t):t}};var Tt=class{htmlElement;id="";keys=[];tokens=[];mirrors=new Map;_cachedMirrorObjects=[];_cachedConnects=[];_mirrorsDirty=!1;properties=new Map;modules=[];events=new Ct;eventNameCache=new Map;eventNameSuffixCache=new Map;constructor(t,e){this.htmlElement=e,this.id=t}getScopedEventName(t,e){if(e==null){let s=this.eventNameCache.get(t);if(s)return s;let o=`${t}:${this.id}`;return this.eventNameCache.set(t,o),o}let r=this.eventNameSuffixCache.get(t);r||(r=new Map,this.eventNameSuffixCache.set(t,r));let i=r.get(e);if(i)return i;let n=`${t}:${this.id}:${e}`;return r.set(e,n),n}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)})}remove(){this.modules.forEach(t=>{t.removeObject(this.id)})}setInviewAutoBlocked(t){this.setProperty("inview-auto-blocked",t)}isInviewAutoBlocked(){return this.getProperty("inview-auto-blocked")===!0}setInviewManualActive(t){this.setProperty("inview-manual-active",t)}isInviewManualActive(){return this.getProperty("inview-manual-active")===!0}syncInviewClass(){if(this.isInviewAutoBlocked()){this.htmlElement.classList.remove("-inview");return}if(this.isInviewManualActive()){this.htmlElement.classList.add("-inview");return}if(this.getProperty("is-inview")===!0){this.htmlElement.classList.add("-inview");return}this.getProperty("repeat")&&this.htmlElement.classList.remove("-inview")}show(){this.isInviewAutoBlocked()||this.htmlElement.classList.add("-inview")}hide(){if(this.isInviewAutoBlocked()){this.htmlElement.classList.remove("-inview");return}if(this.isInviewManualActive())return;this.getProperty("repeat")&&this.htmlElement.classList.remove("-inview")}connect(t){return this.modules.includes(t)?!1:(this.modules.push(t),!0)}disconnect(t){let e=this.modules.indexOf(t);return e===-1?!1:(this.modules.splice(e,1),!0)}isConnectedTo(t){return this.modules.includes(t)}setTokens(t){this.tokens=t,this.keys=t.map(e=>e.key)}getToken(t){for(let e=0;e<this.tokens.length;e++)if(this.tokens[e].key===t)return this.tokens[e];return null}updateMirrorsCache(){if(this._mirrorsDirty){this._cachedMirrorObjects=Array.from(this.mirrors.values());let t=this._cachedMirrorObjects.length;this._cachedConnects=new Array(t);for(let e=0;e<t;e++)this._cachedConnects[e]=this._cachedMirrorObjects[e].htmlElement;this._mirrorsDirty=!1}}addMirror(t){this.mirrors.has(t.id)||(this.mirrors.set(t.id,t),this._mirrorsDirty=!0)}removeMirror(t){this.mirrors.delete(t)&&(this._mirrorsDirty=!0)}get mirrorObjects(){return this.updateMirrorsCache(),this._cachedMirrorObjects}get connects(){return this.updateMirrorsCache(),this._cachedConnects}};var Pt=class{readQueue=[];writeQueue=[];computeQueue=[];isProcessing=!1;pendingFrame=null;rectCache=new WeakMap;dimensionCache=new WeakMap;scheduleRead(t,e=0){this.readQueue.push({priority:e,execute:t}),this.scheduleFlush()}scheduleCompute(t,e=0){this.computeQueue.push({priority:e,execute:t}),this.scheduleFlush()}scheduleWrite(t,e=0){this.writeQueue.push({priority:e,execute:t}),this.scheduleFlush()}batchModuleInitialization(t){t.forEach(({module:e,object:r,element:i,attributes:n,globalId:s})=>{this.scheduleRead(()=>{let o=i.getBoundingClientRect();this.rectCache.set(i,o),this.dimensionCache.set(i,{width:i.offsetWidth||i.clientWidth||o.width,height:i.offsetHeight||i.clientHeight||o.height}),e.initializeObject(s,r,i,n)},1)}),t.forEach(({module:e,object:r,windowSize:i})=>{this.scheduleCompute(()=>{e.calculatePositions(r,i)},2)}),t.forEach(({module:e,object:r})=>{this.scheduleWrite(()=>{e.connectObject(r),e.addObject(r.id,r)},3)})}getCachedRect(t){return this.rectCache.get(t)}getCachedDimensions(t){return this.dimensionCache.get(t)}scheduleFlush(){this.pendingFrame!==null||this.isProcessing||(this.pendingFrame=requestAnimationFrame(()=>{this.flush()}))}flush(){this.isProcessing=!0,this.pendingFrame=null;let t=(e,r)=>r.priority-e.priority;try{[...this.readQueue].sort(t).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Read task error:",s)}}),this.readQueue=[],[...this.computeQueue].sort(t).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Compute task error:",s)}}),this.computeQueue=[],[...this.writeQueue].sort(t).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Write task error:",s)}}),this.writeQueue=[]}finally{this.rectCache=new WeakMap,this.dimensionCache=new WeakMap,this.isProcessing=!1}}flushSync(){this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.flush()}clear(){this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.readQueue=[],this.writeQueue=[],this.computeQueue=[],this.rectCache=new WeakMap,this.dimensionCache=new WeakMap}};var Ee=class{desktop={rebuild:{width:!0,height:!0,scrollHeight:!0}};mobile={rebuild:{width:!0,height:!0,scrollHeight:!0}}};var ts=Object.freeze({}),x=class{attributesToMap;cssProperties=[];objectMapOnPage=new Map;allObjectMapOnPage=new Map;objectsOnPage=[];allObjectsOnPage=[];objectMap=new Map;allObjectMap=new Map;objects=[];allObjects=[];htmlKey="";defaultModeScope="all";_type=1;get type(){return this._type}get key(){return this.htmlKey}tools;data;settings;events;centers;hover;objectManager;signals;permissions=new Ee;constructor(t){this.tools=t.tools,this.data=t.data,this.settings=t.settings,this.events=t.events,this.centers=t.centers,this.hover=t.hover,this.objectManager=t.objectManager,this.signals=t.signals,this.attributesToMap=[{key:"active",type:"boolean",fallback:this.settings.active},{key:"fixed",type:"boolean",fallback:this.settings.fixed},{key:"outside-container",type:"boolean",fallback:this.settings["outside-container"]},{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:"offset-enter",type:"dimension",fallback:this.settings["offset-enter"]},{key:"offset-exit",type:"dimension",fallback:this.settings["offset-exit"]},{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 n=i.top;return Math.floor(n)+this.data.scroll.transformedCurrent}},{key:"end",type:"number",fallback:(e,r,i)=>{let n=i.top,s=i.height;return n+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},{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"]}]}initializeObject(t,e,r,i){let n=this.tools.boundingClientRect.process({element:r});for(let{key:s,type:o,fallback:a,transform:l}of this.attributesToMap){let c=typeof a=="function"?a(r,e,n):a,u=i[s]??i[`string-${s}`]??i[`data-string-${s}`],p=this.tools.domAttribute.process({element:r,key:s,fallback:u??this.settings[s]??c}),g=this.parseAttribute(p,o,{element:r,boundingRect:n,viewportHeight:this.data.viewport.windowHeight,baseRem:this.data.viewport.baseRem});l&&(g=l(g)),e.setProperty(s,g)}this.cacheLayoutSnapshot(e,r)}cacheLayoutSnapshot(t,e){let r=this.data.scroll.container??document.body??document.documentElement,i=this.data.scroll.elementContainer??document.documentElement,n=this.tools.transformNullify.process({element:e}),s=window.getComputedStyle(e),o=this.getOffsetSize(e,s),a=0,l=0,c=n.width,u=n.height;if((!Number.isFinite(c)||c<=0)&&(c=o.width),(!Number.isFinite(u)||u<=0)&&(u=o.height),Number.isFinite(n.left)&&Number.isFinite(n.top)&&n.width>0&&n.height>0)if(r===document.body||r===document.documentElement)a=n.left+i.scrollLeft,l=n.top+i.scrollTop;else{let p=r.getBoundingClientRect();a=n.left-p.left+r.scrollLeft,l=n.top-p.top+r.scrollTop}else{let p=this.getOffsetChainPosition(e);if(r===document.body||r===document.documentElement)a=p.left,l=p.top;else{let g=this.getOffsetChainPosition(r);a=p.left-g.left+r.scrollLeft,l=p.top-g.top+r.scrollTop}}t.setProperty("layout-doc-left",a),t.setProperty("layout-doc-top",l),t.setProperty("layout-width",c),t.setProperty("layout-height",u),t.setProperty("layout-border-radius",s.borderRadius||"0px")}getOffsetSize(t,e){let r=parseFloat(e.width),i=parseFloat(e.height);return{width:t.offsetWidth||t.clientWidth||(Number.isFinite(r)?r:0),height:t.offsetHeight||t.clientHeight||(Number.isFinite(i)?i:0)}}getOffsetChainPosition(t){let e=0,r=0,i=t;for(;i;)e+=i.offsetLeft||0,r+=i.offsetTop||0,i=i.offsetParent;return{left:e,top:r}}calculatePositions(t,e){let r=t.getProperty("start"),i=t.getProperty("size"),n=t.getProperty("offset-enter")??t.getProperty("offset-bottom"),s=t.getProperty("offset-exit")??t.getProperty("offset-top"),o=t.getProperty("enter-el"),a=t.getProperty("enter-vp"),l=t.getProperty("exit-el"),c=t.getProperty("exit-vp"),u=-0,p=-0,g=-0,m=-0;o==="top"&&a==="top"||o==="left"&&a==="left"?(g=-e+1,u=r-n):o==="top"&&a==="bottom"||o==="left"&&a==="right"?u=r-e-n:o==="bottom"&&a==="top"||o==="right"&&a==="left"?(g=-e-i+1,u=r+i-n):(o==="bottom"&&a==="bottom"||o==="right"&&a==="right")&&(g=-i+1,u=r-e+i-n),l==="top"&&c==="top"||l==="left"&&c==="left"?(m=-i+1,p=r+s):l==="top"&&c==="bottom"||l==="left"&&c==="right"?(m=-e-i+1,p=r-e+s):l==="bottom"&&c==="top"||l==="right"&&c==="left"?p=r+i+s:(l==="bottom"&&c==="bottom"||l==="right"&&c==="right")&&(m=-e+1,p=r-e+i+s),t.setProperty("start-bias",g),t.setProperty("end-bias",m),t.setProperty("start-position",u-this.data.scroll.topPosition),t.setProperty("end-position",p-this.data.scroll.topPosition),t.setProperty("difference-position",p-u);let h=t.getProperty("inview-top")??-0,f=t.getProperty("inview-bottom")??-0;t.setProperty("inview-start-position",t.getProperty("start-position")+h),t.setProperty("inview-end-position",t.getProperty("end-position")+f)}parseAttribute(t,e,r=ts){if(t==null)return null;let i=typeof t=="string"?t:String(t);if(typeof e=="object"&&e.type==="enum")return e.values.includes(i)?i:e.values[0];switch(e){case"number":return typeof t=="string"?+t||parseFloat(t):t;case"boolean":return i===""||i==="true";case"json":try{return JSON.parse(i)}catch{return null}case"tuple":return i.trim().split(/\s+/);case"easing":return this.tools.easingFunction.process({easing:i});case"color":return this.tools.colorParser.process({value:i});case"dimension":return t===0||t=="0"?0:r.element!=null&&r.viewportHeight!=null&&r.baseRem!=null&&r.boundingRect!=null?this.tools.unitParser.process({value:t,element:r.element,viewportHeight:r.viewportHeight,boundingRect:r.boundingRect,baseRem:r.baseRem}):0;case"breakpoint-dimension":if(r.element!=null&&r.viewportHeight!=null&&r.baseRem!=null&&r.boundingRect!=null){let n=i.trim().split("|"),s=[];for(let o of n)if(o.includes(":")){let[a,l]=o.split(":");s.push({breakpoint:parseInt(a),value:this.tools.unitParser.process({value:`${l}|`,element:r.element,viewportHeight:r.viewportHeight,boundingRect:r.boundingRect,baseRem:r.baseRem})})}else s.push({breakpoint:0,value:this.tools.unitParser.process({value:o,element:r.element,viewportHeight:r.viewportHeight,boundingRect:r.boundingRect,baseRem:r.baseRem})});return s}default:return t}}canConnect(t){return t.keys.includes(this.htmlKey)}isTokenEnabledInCurrentMode(t){let e=this.data.scroll.mode;return t.modeSpec.kind==="all"?!0:t.modeSpec.kind==="include"?t.modeSpec.values.includes(e):this.defaultModeScope==="all"?!0:this.defaultModeScope.includes(e)}isObjectEnabledInCurrentMode(t){let e=t.getToken(this.htmlKey);return e?this.isTokenEnabledInCurrentMode(e):!1}disconnectObject(t){t.disconnect(this)}connectObject(t){t.connect(this)&&this.onObjectConnected(t)}enterObject(t,e){this.allObjectMap.has(t)||(this.allObjectMap.set(t,e),this.allObjects.push(e)),this.isObjectEnabledInCurrentMode(e)&&!this.objectMap.has(t)&&(this.objectMap.set(t,e),this.objects.push(e))}fastRemoveFromArray(t,e){if(e===-1)return;let r=t.length-1;e!==r&&(t[e]=t[r]),t.pop()}exitObject(t){let e=this.objectMap.get(t);if(e){this.objectMap.delete(t);let n=this.objects.indexOf(e);this.fastRemoveFromArray(this.objects,n)}let r=this.allObjectMap.get(t);if(!r)return;this.allObjectMap.delete(t);let i=this.allObjects.indexOf(r);this.fastRemoveFromArray(this.allObjects,i)}addObject(t,e){this.allObjectMapOnPage.has(t)||(this.allObjectMapOnPage.set(t,e),this.allObjectsOnPage.push(e)),this.isObjectEnabledInCurrentMode(e)&&!this.objectMapOnPage.has(t)&&(this.objectMapOnPage.set(t,e),this.objectsOnPage.push(e))}removeObject(t){let e=this.objectMapOnPage.get(t);if(e){this.objectMapOnPage.delete(t);let n=this.objectsOnPage.indexOf(e);this.fastRemoveFromArray(this.objectsOnPage,n)}let r=this.allObjectMapOnPage.get(t);if(!r)return;this.allObjectMapOnPage.delete(t);let i=this.allObjectsOnPage.indexOf(r);this.fastRemoveFromArray(this.allObjectsOnPage,i),this.exitObject(t),this.onObjectDisconnected(r)}onObjectConnected(t){}onObjectDisconnected(t){}get respectSelfDisable(){return!0}isPrimaryElementEnabled(t){return!this.respectSelfDisable||t.getProperty("self-disable")!==!0}applyToElementAndConnects(t,e,r=e){this.isPrimaryElementEnabled(t)&&e(t.htmlElement),t.mirrorObjects.forEach(i=>r(i.htmlElement,i))}applyVarToElement(t,e,r){this.isPrimaryElementEnabled(t)&&this.tools.styleTxn.setVar(t.htmlElement,e,r)}applyPropToElement(t,e,r){this.isPrimaryElementEnabled(t)&&this.tools.styleTxn.setProp(t.htmlElement,e,r)}applyVarToConnects(t,e,r){for(let i of t.mirrorObjects)this.tools.styleTxn.setVar(i.htmlElement,e,r)}applyPropToConnects(t,e,r){for(let i of t.mirrorObjects)this.tools.styleTxn.setProp(i.htmlElement,e,r)}getObjectEventName(t,e,r){return t.getScopedEventName(e,r)}emitSignal(t,e,r){t.setProperty(`signal:${e}`,r),this.signals.publish(t.id,e,r)}getSignal(t,e){return this.signals.get(t,e)}clearManagedStyles(t){let e=i=>{for(let s=0;s<this.cssProperties.length;s++)i.style.removeProperty(this.cssProperties[s].name);let n=t.getProperty("key");typeof n=="string"&&n.length>0&&i.style.removeProperty(n)};e(t.htmlElement);let r=t.mirrorObjects;for(let i=0;i<r.length;i++)e(r[i].htmlElement)}onObjectModeActivated(t){}onObjectModeDeactivated(t){this.clearManagedStyles(t)}rebuildActiveObjectsForCurrentMode(){let t=new Map(this.objectMapOnPage);this.objectMapOnPage=new Map,this.objectsOnPage=[];for(let e=0;e<this.allObjectsOnPage.length;e++){let r=this.allObjectsOnPage[e];this.isObjectEnabledInCurrentMode(r)&&(this.objectMapOnPage.set(r.id,r),this.objectsOnPage.push(r))}this.objectMap=new Map,this.objects=[];for(let e=0;e<this.allObjects.length;e++){let r=this.allObjects[e];this.isObjectEnabledInCurrentMode(r)&&(this.objectMap.set(r.id,r),this.objects.push(r))}t.forEach((e,r)=>{this.objectMapOnPage.has(r)||this.onObjectModeDeactivated(e)}),this.objectMapOnPage.forEach((e,r)=>{t.has(r)||this.onObjectModeActivated(e)})}destroy(){this.objects=[],this.allObjects=[],this.objectMap=new Map,this.allObjectMap=new Map,this.objectsOnPage=[],this.allObjectsOnPage=[],this.objectMapOnPage=new Map,this.allObjectMapOnPage=new Map}onInit(){}onSubscribe(){}onUnsubscribe(){}onFrame(t){}onMutate(t){}onScrollMeasure(t){}onMouseMoveMeasure(t){}onResize(){}onResizeWidth(){}onRebuild(){}onScroll(t){}onDirectionChange(){}onScrollStart(){}onScrollStop(){}onScrollDirectionChange(){}onAxisChange(){}onDeviceChange(){}onScrollConfigChange(){this.rebuildActiveObjectsForCurrentMode()}onSettingsChange(){}onDOMRebuild(){}onMouseMove(t){}onWheel(t){}onDOMMutate(t,e){}};var Me=class{constructor(t,e,r,i){this.data=t;this.modules=e;this.events=r;this.tools=i}objects=new Map;connectQueue=[];connectableModulesBuffer=[];mirrors=new Map;mirrorId=1;globalId=1;domBatcher=new Pt;domBatcherEnabled=!1;inviewStarts=[];inviewEnds=[];inviewActive=new Set;inviewStartIdx=0;inviewEndIdx=0;inviewIndexDirty=!0;lastInviewScrollPos=0;intersectionObserverEnabled=!0;domObserver=null;get all(){return this.objects}add(t){let e=`string-${this.globalId++}`,r="string-id";t.getAttribute("string-id")&&(e=t.getAttribute("string-id"),r="string-id"),t.getAttribute("data-string-id")&&(e=t.getAttribute("data-string-id"),r="data-string-id");let i=e&&this.objects.has(e)?this.objects.get(e):new Tt(e,t);t.setAttribute(r,i.id);let n=t.getAttribute("string")??t.getAttribute("data-string");n&&i.setTokens(this.parseStringTokens(n)),t.setAttribute("string-inited",""),this.objects.set(i.id,i);let s=this.getAllAttributes(t),o=this.modules.core;for(let u=0;u<o.length;u++){let p=o[u];"setupCoreProperties"in p&&typeof p.setupCoreProperties=="function"&&p.setupCoreProperties(i,t,s)}let a=this.connectableModulesBuffer;a.length=0;let l=this.modules.all,c=null;for(let u=0;u<l.length;u++){let p=l[u];p instanceof x&&p.key===""&&(c=p),p instanceof x&&p.canConnect(i)&&a.push(p)}if(a.length===0&&c&&(i.setProperty("inview-fallback",!0),a.push(c)),this.domBatcherEnabled&&a.length>0){let u=new Array(a.length);for(let p=0;p<a.length;p++)u[p]={module:a[p],object:i,element:t,attributes:s,globalId:this.globalId,windowSize:this.data.viewport.windowHeight};this.domBatcher.batchModuleInitialization(u),this.domBatcher.scheduleWrite(()=>{this.initObservers(i,t),this.checkInviewForObject(i)})}else{for(let u=0;u<a.length;u++){let p=a[u];p.initializeObject(this.globalId,i,t,s),p.calculatePositions(i,this.data.viewport.windowHeight),p.connectObject(i),p.addObject(i.id,i)}this.initObservers(i,t),this.checkInviewForObject(i)}if(this.connectQueue.length>0){let u=0;for(let p=0;p<this.connectQueue.length;p++){let g=this.connectQueue[p];if(g.id===i.id){this.attachMirrorToObject(i,g.element);continue}this.connectQueue[u++]=g}this.connectQueue.length=u}a.length=0,this.inviewIndexDirty=!0}setDOMBatcherEnabled(t){this.domBatcherEnabled=t,t||this.domBatcher.flushSync()}setIntersectionObserverEnabled(t){if(this.intersectionObserverEnabled!==t){this.intersectionObserverEnabled=t;for(let e of this.objects.values())e.getProperty("observer-progress")?.disconnect(),t&&this.initObservers(e,e.htmlElement)}}attachModule(t){this.objects.forEach(e=>{if(!t.canConnect(e))return;let r=e.htmlElement,i=this.getAllAttributes(r);t.initializeObject(this.globalId,e,r,i),t.calculatePositions(e,this.data.viewport.windowHeight),t.connectObject(e),t.addObject(e.id,e),e.getProperty("active")===!0&&t.enterObject(e.id,e)})}refreshModuleConnectionsForCurrentMode(){let t=this.modules.all;for(let e of this.objects.values()){let r=e.htmlElement;if(!r||!r.isConnected)continue;let i=null;for(let n=0;n<t.length;n++){let s=t[n];if(!(s instanceof x)||!e.keys.includes(s.key))continue;let o=s.canConnect(e),a=e.isConnectedTo(s);if(o&&!a){i==null&&(i=this.getAllAttributes(r)),s.initializeObject(this.globalId,e,r,i),s.calculatePositions(e,this.data.viewport.windowHeight),s.connectObject(e),s.addObject(e.id,e),e.getProperty("active")===!0&&s.enterObject(e.id,e);continue}!o&&a&&(s.exitObject(e.id),s.removeObject(e.id),s.disconnectObject(e))}}}invalidateInviewIndex(){this.inviewIndexDirty=!0}refreshLayoutForRoot(t){if(!t)return;let e=new Set,r=n=>{let s=n.getAttribute("string-id")??n.getAttribute("data-string-id");if(!s)return;let o=this.objects.get(s);o&&e.add(o)};if(t instanceof HTMLElement){r(t);let n=t.querySelectorAll("[string-id],[data-string-id]");for(let s=0;s<n.length;s++)r(n[s])}if(e.size===0)return;let i=this.data.viewport.windowHeight;for(let n of e){let s=n.htmlElement;if(!s||!s.isConnected)continue;let o=this.getAllAttributes(s),a=this.modules.all;for(let l=0;l<a.length;l++){let c=a[l];c instanceof x&&c.canConnect(n)&&(c.initializeObject(this.globalId,n,s,o),c.calculatePositions(n,i))}}this.inviewIndexDirty=!0,this.checkInview()}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(),e.remove(),e.mirrorObjects.forEach(r=>{let i=this.getMirrorIds(r.htmlElement);this.setMirrorIds(r.htmlElement,i.filter(s=>s!==r.id)),this.mirrors.delete(r.id);let n=r.htmlElement.getAttribute("string-copy-from")??r.htmlElement.getAttribute("data-string-copy-from");n&&this.enqueueConnection(n,r.htmlElement)}),this.objects.delete(t),this.inviewActive.delete(e),this.inviewIndexDirty=!0)}enqueueConnection(t,e){let r=this.splitPipeAndTrim(t);for(let i=0;i<r.length;i++){let n=r[i];this.connectQueue.some(s=>s.id===n&&s.element===e)||this.connectQueue.push({id:n,element:e})}}linkMirror(t,e){let r=this.splitPipeAndTrim(t);for(let i=0;i<r.length;i++){let n=r[i],s=this.objects.get(n);s?this.attachMirrorToObject(s,e):this.enqueueConnection(n,e)}}attachMirrorToObject(t,e){let r=this.getMirrorIds(e);for(let c of r){let u=this.mirrors.get(c);if(u&&u.parentObject===t)return u}let i=`string-mirror-${this.mirrorId++}`,n=new Le(i,e,t);this.setMirrorIds(e,[...r,i]),t.addMirror(n),this.mirrors.set(i,n);let s=e.getAttribute("string-easing")??e.getAttribute("data-string-easing");s&&s.trim().length>0&&(n.setEasing(this.tools.easingFunction.process({easing:s})),n.setProperty("easing",s));let o=t.getProperty("key"),a=t.getProperty("progress-raw"),l=t.getProperty("progress-value");if(typeof a=="number"){let c=t.getProperty("easing")??void 0,u=n.applyProgress(a,c);n.setProperty("progress",u),o&&this.tools.styleTxn.setVar(n.htmlElement,o,u)}else typeof l=="number"&&(n.setProperty("progress",l),o&&this.tools.styleTxn.setVar(n.htmlElement,o,l));return n}detachMirrorByElement(t){let e=this.getMirrorIds(t);e.length!==0&&(e.forEach(r=>this.detachMirrorById(r)),this.clearMirrorIds(t))}detachMirrorById(t){let e=this.mirrors.get(t);e&&(e.parentObject.removeMirror(t),this.mirrors.delete(t))}getMirrorIds(t){let e=t.getAttribute("string-mirror-id")??t.getAttribute("data-string-mirror-id");return e?this.splitPipeAndTrim(e):[]}setMirrorIds(t,e){if(e.length===0){this.clearMirrorIds(t);return}t.setAttribute("string-mirror-id",e.join("|"))}clearMirrorIds(t){t.removeAttribute("string-mirror-id"),t.removeAttribute("data-string-mirror-id")}getAllAttributes(t){let e={},r=t.attributes;for(let i=0;i<r.length;i++){let n=r[i];e[n.name]=n.value}return e}initObservers(t,e){if(!this.intersectionObserverEnabled)return;let r=t.getProperty("offset-exit")??t.getProperty("offset-top")??0,i=t.getProperty("offset-enter")??t.getProperty("offset-bottom")??0;t.getProperty("observer-progress")?.disconnect();let n=g=>{g.forEach(m=>{this.events.emit(t.getScopedEventName("object:activate"),m.isIntersecting),m.isIntersecting?t.enter():t.leave()})},s=t.getProperty("outside-container"),o=e.getAttribute("string-outside-container")??e.getAttribute("data-string-outside-container"),a=o!=null?o.trim().toLowerCase():null,l=a===""||a==="true"||a==="1",c=s!=null?s===!0:l,u=this.data.scroll.container===document.body||c?null:this.data.scroll.container,p=new IntersectionObserver(n,{root:u,rootMargin:`${i+this.data.viewport.windowHeight}px 0px ${r+this.data.viewport.windowHeight}px 0px`,threshold:0});p.observe(e),t.setProperty("observer-progress",p)}observeDOM(){this.domObserver?.disconnect();let t=new MutationObserver(e=>{let r=!1,i=!1;for(let n=0;n<e.length;n++){let s=e[n];if(s.type==="childList"){let o=!1;for(let a=0;a<s.removedNodes.length;a++){let l=s.removedNodes[a];if(l.nodeType!==Node.ELEMENT_NODE)continue;o=!0;let c=l;if(this.detachMirrorByElement(c),this.isFixed(c))continue;(c.hasAttribute("string")||c.hasAttribute("data-string"))&&(this.handleRemoved(c),i=!0);let u=c.querySelectorAll("[string],[data-string]");for(let g=0;g<u.length;g++){let m=u[g];this.isFixed(m)||(this.handleRemoved(m),i=!0)}let p=c.querySelectorAll("[string-copy-from],[data-string-copy-from]");for(let g=0;g<p.length;g++)this.detachMirrorByElement(p[g])}for(let a=0;a<s.addedNodes.length;a++){let l=s.addedNodes[a];if(l.nodeType!==Node.ELEMENT_NODE)continue;o=!0;let c=l;if(this.isFixed(c))continue;c.hasAttribute("string")&&!c.hasAttribute("string-inited")&&(this.add(c),i=!0);let u=c.querySelectorAll("[string]:not([string-inited]),[data-string]:not([string-inited])");for(let m=0;m<u.length;m++)this.add(u[m]),i=!0;let p=c.getAttribute("string-copy-from")??c.getAttribute("data-string-copy-from");p&&this.linkMirror(p,c);let g=c.querySelectorAll("[string-copy-from],[data-string-copy-from]");for(let m=0;m<g.length;m++){let h=g[m],f=h.getAttribute("string-copy-from")??h.getAttribute("data-string-copy-from");f&&this.linkMirror(f,h)}}o&&(this.modules.onDOMMutate(s.addedNodes,s.removedNodes),r=!0)}}if(r){let n=this.modules.all;for(let s=0;s<n.length;s++)n[s].onDOMRebuild();i&&this.events.emit("dom:changed",null)}});t.observe(document.body,{childList:!0,subtree:!0}),this.domObserver=t}handleRemoved(t){let e=t.getAttribute("string-id")??t.getAttribute("data-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(t){for(let e of this.objects.values()){if(!e.htmlElement||!e.htmlElement.isConnected)continue;let r=null,i=this.modules.all;for(let n=0;n<i.length;n++){let s=i[n],o=!1;t.isDesktop?(s.permissions.desktop.rebuild.scrollHeight&&t.scrollHeightChanged&&(o=!0),s.permissions.desktop.rebuild.width&&t.widthChanged&&(o=!0),s.permissions.desktop.rebuild.height&&t.heightChanged&&(o=!0)):(s.permissions.mobile.rebuild.scrollHeight&&t.scrollHeightChanged&&(o=!0),s.permissions.mobile.rebuild.width&&t.widthChanged&&(o=!0),s.permissions.mobile.rebuild.height&&t.heightChanged&&(o=!0)),(o||t.isForceRebuild)&&s.canConnect(e)&&(r==null&&(r=this.getAllAttributes(e.htmlElement)),s.initializeObject(this.globalId,e,e.htmlElement,r),s.calculatePositions(e,this.data.viewport.windowHeight),s.connectObject(e))}}this.inviewIndexDirty=!0}isFixed(t){return t.hasAttribute("string-fixed")}checkInview(){let t=this.data.scroll.transformedCurrent;this.updateInviewWindow(t);for(let e of this.inviewActive)this.checkInviewForObject(e)}checkInviewForObject(t){let e=this.data.scroll.transformedCurrent;if(!this.intersectionObserverEnabled){let c=t.getProperty("start-position"),u=t.getProperty("end-position");if(c!=null&&u!=null){let p=Math.min(c,u),g=Math.max(c,u),m=t.getProperty("is-active")??!1,h=e>=p&&e<=g;h!==m&&(t.setProperty("is-active",h),this.events.emit(t.getScopedEventName("object:activate"),h),h?t.enter():t.leave())}}let r=t.getProperty("inview-start-position"),i=t.getProperty("inview-end-position"),n=t.getProperty("is-inview")??!1,s=Math.min(r,i),o=Math.max(r,i),a=e>=s&&e<=o,l=null;if(!n&&a){let c=Math.abs(e-s),u=Math.abs(o-e);l=c<=u?"enter-top":"enter-bottom"}else n&&!a&&(l=e<s?"exit-top":"exit-bottom");a!==n&&(t.setProperty("is-inview",a),t.setInviewAutoBlocked(!1),t.setInviewManualActive(!1),a?t.show():t.hide(),this.events.emit(t.getScopedEventName("object:inview"),{inView:a,direction:l}))}updateInviewWindow(t){let e=this.data.viewport.windowHeight,r=t-e,i=t+this.data.viewport.windowHeight+e;for((this.inviewIndexDirty||t<this.lastInviewScrollPos)&&this.rebuildInviewIndex(r,i);this.inviewStartIdx<this.inviewStarts.length&&this.inviewStarts[this.inviewStartIdx].pos<=i;)this.inviewActive.add(this.inviewStarts[this.inviewStartIdx].object),this.inviewStartIdx++;for(;this.inviewEndIdx<this.inviewEnds.length&&this.inviewEnds[this.inviewEndIdx].pos<r;)this.inviewActive.delete(this.inviewEnds[this.inviewEndIdx].object),this.inviewEndIdx++;this.lastInviewScrollPos=t}rebuildInviewIndex(t,e){this.inviewStarts=[],this.inviewEnds=[];for(let r of this.objects.values()){let i=r.getProperty("inview-start-position"),n=r.getProperty("inview-end-position");i==null||n==null||(this.inviewStarts.push({pos:Math.min(i,n),object:r}),this.inviewEnds.push({pos:Math.max(i,n),object:r}))}this.inviewStarts.sort((r,i)=>r.pos-i.pos),this.inviewEnds.sort((r,i)=>r.pos-i.pos),this.inviewActive.clear(),this.inviewStartIdx=this.upperBound(this.inviewStarts,e),this.inviewEndIdx=this.upperBound(this.inviewEnds,t-1);for(let r=0;r<this.inviewStartIdx;r++)this.inviewActive.add(this.inviewStarts[r].object);for(let r=0;r<this.inviewEndIdx;r++)this.inviewActive.delete(this.inviewEnds[r].object);this.inviewIndexDirty=!1}upperBound(t,e){let r=0,i=t.length;for(;r<i;){let n=r+i>>>1;t[n].pos<=e?r=n+1:i=n}return r}splitPipeAndTrim(t){let e=t.split("|"),r=[];for(let i=0;i<e.length;i++){let n=e[i].trim();n.length>0&&r.push(n)}return r}parseStringTokens(t){let e=this.splitTopLevelPipe(t),r=[];for(let i=0;i<e.length;i++){let n=e[i].trim();if(n.length===0)continue;let s=n.match(/^([^\[\]]+?)(?:\[([^\]]*)\])?$/);if(!s){r.push({raw:n,key:n,modeSpec:{kind:"default",values:[]}});continue}let o=s[1].trim(),a=s[2];if(!o)continue;if(a==null){r.push({raw:n,key:o,modeSpec:{kind:"default",values:[]}});continue}let l=a.trim();if(l.length===0){r.push({raw:n,key:o,modeSpec:{kind:"all",values:[]}});continue}let c=this.splitTopLevelPipe(l).map(u=>u.trim()).filter(u=>u.length>0);r.push({raw:n,key:o,modeSpec:c.length>0?{kind:"include",values:c}:{kind:"all",values:[]}})}return r}splitTopLevelPipe(t){let e=[],r="",i=0;for(let n=0;n<t.length;n++){let s=t[n];if(s==="["){i++,r+=s;continue}if(s==="]"){i=Math.max(0,i-1),r+=s;continue}if(s==="|"&&i===0){e.push(r),r="";continue}r+=s}return r.length>0&&e.push(r),e}destroy(){this.domObserver?.disconnect(),this.domObserver=null,this.domBatcher.clear()}};var q={SCROLL_FORWARD:"-scroll-forward",SCROLL_BACKWARD:"-scroll-backward",SCROLLING_FORWARD:"-scrolling-forward",SCROLLING_BACKWARD:"-scrolling-backward"};var J=class{context;document;name="";isProg=!1;isParallaxEnabled=!1;_isVertical=!0;_scrollDirState=-1;_lastAppliedDirState=-1;isLastBottomScrollDirection=!0;scrollTriggerRules=[];isActive=!1;set scrollDirection(t){this._isVertical=t==="vertical"}constructor(t){this.document=document,this.context=t}onChangeDirection=()=>{};onScrollStart=()=>{};onScrollStop=()=>{};onCalcUpdate(){if(!this.isActive)return;let t=this.context.data.scroll.scrollContainer,e=this.context.data.scroll.current;t&&(this._isVertical?t.scrollTo(0,e):t.scrollTo(e,0)),this._isVertical&&this.triggerScrollRules()}onFrame(){}onWheel(t){}onScroll(t){}onTouchStart(t){}onTouchMove(t){}onTouchEnd(t){}disableScrollEvents(){}enableScrollEvents(){}activate(){this.isActive||(this.isActive=!0,this.enableScrollEvents())}deactivate(){if(!this.isActive)return;this.isActive=!1,this.disableScrollEvents(),this.isProg=!1;let t=this.context.data.scroll;t.target=t.current,t.delta=0,t.lerped=0,t.displacement=0,this.clearScrollingClasses(),this._scrollDirState=-1,this._lastAppliedDirState=-1,this.onScrollStop()}destroy(){}updateScrollDirection(t){this.isLastBottomScrollDirection=t;let e=t?1:0;if(this._scrollDirState===-1){this._scrollDirState=e;return}if(this._scrollDirState=e,this.context.data.scroll.isScrollingDown=t,this.onChangeDirection(),this.context.events.emit("scroll:direction:change",t),this.context.settings["global-class"]&&this._lastAppliedDirState!==e){let r=document.documentElement.classList;t?(r.remove(q.SCROLLING_BACKWARD,q.SCROLL_BACKWARD),r.add(q.SCROLLING_FORWARD,q.SCROLL_FORWARD)):(r.remove(q.SCROLLING_FORWARD,q.SCROLL_FORWARD),r.add(q.SCROLLING_BACKWARD,q.SCROLL_BACKWARD)),this._lastAppliedDirState=e}}clearScrollingClasses(){document.documentElement.classList.remove(q.SCROLLING_BACKWARD,q.SCROLLING_FORWARD,q.SCROLL_BACKWARD,q.SCROLL_FORWARD)}triggerScrollRules(){let t=this.scrollTriggerRules,e=t.length,r=this.context.data.scroll.current,i=this.isLastBottomScrollDirection;for(let n=0;n<e;n++){let s=t[n],a=(s.direction==="any"||i&&s.direction==="forward"||!i&&s.direction==="backward")&&r>=s.offset;a&&!s.isActive?(s.isActive=!0,s.onEnter?.(),s.toggleClass&&s.toggleClass.target.classList.add(s.toggleClass.className)):!a&&s.isActive&&(s.isActive=!1,s.onLeave?.(),s.toggleClass&&s.toggleClass.target.classList.remove(s.toggleClass.className))}}addScrollMark(t){this.scrollTriggerRules.push(t)}removeScrollMark(t){let e=this.scrollTriggerRules;for(let r=0;r<e.length;r++)if(e[r].id===t){e.splice(r,1);break}}scrollTo(t,e){}};var we=class extends J{name="default";previousScrollTop=0;previousScrollTime=0;isScrolling=!1;lastScrollEventTime=0;nativeVelocity=0;nativeVelocityTarget=0;scrollStopDelay=120;nativeVelocityFollow=.2;nativeVelocityDecay=.84;nativeVelocityBoost=2;nativeVelocityDeadzone=.25;constructor(t){super(t)}onFrame(){let t=0;if(this.context.data.scroll.delta!==0){let r=this.context.data.scroll.delta*this.context.data.scroll.speedAccelerate;this.context.data.scroll.delta-=r,t=r,Math.abs(t)<.1&&(this.context.data.scroll.delta=0,t=0)}let e=performance.now();this.nativeVelocityTarget*=this.nativeVelocityDecay,Math.abs(this.nativeVelocityTarget)<this.nativeVelocityDeadzone&&(this.nativeVelocityTarget=0),this.nativeVelocity+=(this.nativeVelocityTarget-this.nativeVelocity)*this.nativeVelocityFollow,Math.abs(this.nativeVelocity)<this.nativeVelocityDeadzone&&(this.nativeVelocity=0),Math.abs(this.nativeVelocity)>Math.abs(t)&&(t=this.nativeVelocity),this.context.data.scroll.lerped=t,this.isScrolling&&!(this.context.data.scroll.delta!==0||this.nativeVelocityTarget!==0||this.nativeVelocity!==0)&&e-this.lastScrollEventTime>this.scrollStopDelay&&(this.isScrolling=!1,this.onScrollStop(),this.clearScrollingClasses())}onScroll(t){let e=performance.now(),r=this.context.data.scroll.elementContainer.scrollTop,i=r-this.previousScrollTop;if(this.context.data.scroll.current=r,this.context.data.scroll.target=r,this.context.data.scroll.transformedCurrent=r*this.context.data.viewport.transformScale,i!==0){this.updateScrollDirection(i>0);let n=this.previousScrollTime===0?16.6667:e-this.previousScrollTime,s=i*(16.6667/Math.max(8,n))*this.nativeVelocityBoost;this.nativeVelocityTarget=s,this.previousScrollTop=r,this.previousScrollTime=e}this.triggerScrollRules(),this.lastScrollEventTime=e,this.isScrolling||(this.isScrolling=!0,this.onScrollStart())}onWheel(t){t.deltaY!==0&&(this.context.data.scroll.delta===0&&!this.isScrolling&&(this.isScrolling=!0,this.onScrollStart()),this.context.data.scroll.delta+=t.deltaY,this.lastScrollEventTime=performance.now())}deactivate(){super.deactivate(),this.isScrolling=!1,this.lastScrollEventTime=0,this.previousScrollTop=this.context.data.scroll.current,this.previousScrollTime=0,this.nativeVelocity=0,this.nativeVelocityTarget=0}scrollTo(t,e){this.context.data.scroll.target=t,this.context.data.scroll.current=t,this.context.data.scroll.delta=0,this.context.data.scroll.lerped=0,this.nativeVelocity=0,this.nativeVelocityTarget=0,this.previousScrollTop=t,this.previousScrollTime=0,this.triggerScrollRules(),this._scrollDirection==="vertical"?this.context.data.scroll.scrollContainer?.scrollTo({top:t,left:0,behavior:e?"auto":"smooth"}):this.context.data.scroll.scrollContainer?.scrollTo({left:t,top:0,behavior:e?"auto":"smooth"})}};var xe=class extends J{name="disable";preventScroll=t=>{t.preventDefault()};preventKeyScroll=t=>{["ArrowUp","ArrowDown","PageUp","PageDown"," ","Home","End"].includes(t.key)&&t.preventDefault()};onPreventScroll=this.preventScroll.bind(this);onPreventKeyScroll=this.preventKeyScroll.bind(this);constructor(t){super(t)}enableScrollEvents(){window.addEventListener("touchmove",this.onPreventScroll,{passive:!1}),window.addEventListener("keydown",this.onPreventKeyScroll)}disableScrollEvents(){window.removeEventListener("touchmove",this.onPreventScroll),window.removeEventListener("keydown",this.onPreventKeyScroll)}onFrame(){}onWheel(t){t.preventDefault()}onScroll(t){t.preventDefault()}};var Ce=class extends J{name="smooth";scrollForce=0;wheelImpulse=0;previousCurrent=0;scrollToSequence=0;activeScrollToId=null;velocityThreshold=.01;stepResult={current:.1,target:.1,delta:.1,lerped:.1,scrollForce:.1,absVelocity:.1};constructor(t){super(t),this.stepResult.current=0,this.stepResult.target=0,this.stepResult.delta=0,this.stepResult.lerped=0,this.stepResult.scrollForce=0,this.stepResult.absVelocity=0}stopScroll(){let t=this.context.data.scroll;t.lerped=0,t.delta=0,t.target=t.current,this.onCalcUpdate(),this.isProg=!1,this.clearScrollingClasses(),this._scrollDirState=-1,this._lastAppliedDirState=-1,this.activeScrollToId=null}onFrame(){let t=this.context.data.scroll;if(t.delta!==0){this.computeStep(t.current,t.target,t.delta,t.speed,t.speedAccelerate,t.bottomPosition,this.stepResult),this.scrollForce=this.stepResult.scrollForce,t.target=this.stepResult.target,t.delta=this.stepResult.delta,t.lerped=this.stepResult.lerped,t.current=this.stepResult.current;let e=this.context.data.viewport.transformScale;t.transformedCurrent=e!==1?t.current*e:t.current,this.updateScrollDirection(t.lerped>0),this.stepResult.absVelocity<this.velocityThreshold?(t.current=Math.round(t.target),this.previousCurrent=t.current,this.onCalcUpdate(),this.stopScroll(),this.onScrollStop()):(this.isProg=!0,this.previousCurrent!==t.current&&(this.previousCurrent=t.current,this.onCalcUpdate()))}}onWheel(t){if(t.deltaY!==0&&t.preventDefault(),this.wheelImpulse=t.deltaY,this.wheelImpulse===0)return;let e=this.context.data.scroll;e.delta===0&&this.onScrollStart();let r=this.wheelImpulse<0,i=e.target===0&&r,n=e.target===e.bottomPosition&&!r;!i&&!n&&(e.delta+=this.wheelImpulse)}onScroll(t){if(!this.isProg){let e=this.context.data.scroll,r=e.elementContainer.scrollTop,i=r-e.current;e.current=r,e.target=r,e.delta=0,e.lerped=i,e.displacement=0;let n=this.context.data.viewport.transformScale;e.transformedCurrent=n!==1?r*n:r,this.scrollForce=0,this.wheelImpulse=0,this.isProg=!1,this.previousCurrent=r,this.activeScrollToId=null,i!==0&&(this.updateScrollDirection(i>0),this.triggerScrollRules())}}deactivate(){super.deactivate(),this.scrollForce=0,this.wheelImpulse=0,this.previousCurrent=this.context.data.scroll.current}scrollTo(t,e){let r=this.context.data.scroll,i=++this.scrollToSequence;if(this.activeScrollToId=i,e){r.current=t,r.target=t,r.delta=0,r.lerped=0;let n=this.context.data.viewport.transformScale;r.transformedCurrent=n!==1?t*n:t,this.onCalcUpdate();return}r.target=t,r.delta=1}computeStep(t,e,r,i,n,s,o){let a=r*n,l=Math.min(Math.max(0,e+a),s),c=(l-t)*i,u=r-a,p=t+c;o.current=p,o.target=l,o.delta=u,o.lerped=c,o.scrollForce=a,o.absVelocity=Math.abs(c)}};var Te=class{constructor(t){this.context=t;this.registerMode("smooth",new Ce(t)),this.registerMode("default",new we(t)),this.registerMode("disable",new xe(t)),this.updateResponsiveMode()}modes=new Map;boundEvents=null;scrollMarks=[];registerMode(t,e){let r=this.context.data.scroll.mode===t,i=this.modes.get(t);i&&(r&&i.deactivate(),i.destroy()),e.name||(e.name=String(t)),this.modes.set(t,e),this.boundEvents&&(e.onScrollStart=this.boundEvents.onScrollStart,e.onScrollStop=this.boundEvents.onScrollStop,e.onChangeDirection=this.boundEvents.onDirectionChange),this.scrollMarks.length>0&&this.scrollMarks.forEach(n=>e.addScrollMark(n)),r&&e.activate()}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<1024?this.context.data.scroll.modeMobile:this.context.data.scroll.modeDesktop;this.setMode(e)}updatePosition(){this.get().onCalcUpdate()}setMode(t){if(!this.modes.has(t)){console.warn(`[ScrollManager] Unknown scroll mode: ${t}`);return}if(this.context.data.scroll.mode===t){this.get().activate();return}this.get().deactivate(),this.context.data.scroll.mode=t,this.get().activate(),this.boundEvents?.onModeChange()}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)}onTouchStart(t){this.get().onTouchStart(t)}onTouchMove(t){this.get().onTouchMove(t)}onTouchEnd(t){this.get().onTouchEnd(t)}bindEvents(t){this.boundEvents=t,this.modes.forEach(e=>{e.onScrollStart=t.onScrollStart,e.onScrollStop=t.onScrollStop,e.onChangeDirection=t.onDirectionChange})}addScrollMark(t){this.scrollMarks.push(t),this.modes.forEach(e=>{e.addScrollMark(t)})}removeScrollMark(t){this.scrollMarks=this.scrollMarks.filter(e=>e.id!==t),this.modes.forEach(e=>{e.removeScrollMark(t)})}destroy(){this.modes.forEach(t=>{t.deactivate(),t.destroy()})}};var Pe=class{targetX=0;targetY=0;smoothedX=0;smoothedY=0;stepX=0;stepY=0;velocityX=0;velocityY=0};var Ae=class{threeInstance=null};var ke=class{target=0;current=0;transformedCurrent=0;delta=0;lerped=0;displacement=0;isScrollingDown=!1;topPosition=0;bottomPosition=0;direction="vertical";elementContainer=document.documentElement;scrollContainer=window;container=document.body;mode="smooth";modeMobile="default";modeDesktop="smooth";speed=.1;speedAccelerate=.25};var Oe=class{fpsTracker=!1;positionTracker=!1;suppressMasonryResize=!1};var De=class{now=0;previous=0;delta=0;elapsed=0};var Ie=class{windowWidth=0;windowHeight=0;contentWidth=0;contentHeight=0;scaleWidth=1;scaleHeight=1;transformScale=1;baseRem=16};var Gt=class{scroll=new ke;viewport=new Ie;cursor=new Pe;render=new Ae;time=new De;system=new Oe};var $t=class{process({element:t}){return t.getBoundingClientRect()}};var Ut=class{process({element:t,key:e,fallback:r=null}){return t.getAttribute(`string-${e}`)??t.getAttribute(`data-string-${e}`)??r}};var jt=class{process({record:t,name:e,fallback:r=null}){return t[e]??t[`data-${e}`]??r}};var St=class{process({element:t}){let e=t.getBoundingClientRect(),i=getComputedStyle(t).transform.match(/-?[\d.]+/g)?.map(parseFloat)??[];if(i.length===6){let[n,s,o,a,l,c]=i,u=n*a-s*o;return{width:e.width/(n||1),height:e.height/(a||1),left:(e.left*a-e.top*o+o*c-l*a)/u,top:(-e.left*s+e.top*n+l*s-n*c)/u}}return e}};var Yt=class{constructor(t=new St){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 qt=class{process({from:t,to:e,progress:r}){return(e-t)*r}};var Xt=class{process({value:t,element:e,viewportHeight:r,baseRem:i,boundingRect:n}){let o=(typeof t=="number"?String(t):t).split("|").map(l=>l.trim()).filter(Boolean),a=0;for(let l of o){let c=l,u=!1;c.startsWith("-")&&(u=!0,c=c.slice(1));let p=0;c==="selfHeight"?p=e.offsetHeight:c.endsWith("px")?p=parseFloat(c):c.endsWith("%")?p=parseFloat(c)/100*r:c.endsWith("rem")?p=parseFloat(c)*i:c.endsWith("sh")?p=parseFloat(c)*n.height/100:p=parseFloat(c),a+=u?-p:p}return a}};var Kt=class{process({value:t,inMin:e=.1,inMax:r=1,outMin:i=.05,outMax:n=.65}){if(t<e)return n;if(t>1&&(t=1),t<=r){let s=(t-e)/(r-e);return n-s*(n-i)}return i}};var ut={left:0,center:.5,right:1},pt={top:0,center:.5,bottom:1},Zt=class{process({value:t}){if(!t)return"center";let e=t.trim();if(e.startsWith("random(")&&e.endsWith(")")){let r=e.slice(7,-1).split(",").map(n=>n.trim()).filter(Boolean),i=Math.floor(Math.random()*r.length);return r[i]}return e}toNormalized({value:t}){let r=this.process({value:t}).toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return{x:.5,y:.5};if(r.length===1){let a=r[0],l=this.parseValue(a);return a in ut&&!(a in pt)?{x:l,y:.5}:a in pt&&!(a in ut)?{x:.5,y:l}:{x:l,y:l}}let[i,n]=r,s=i in pt&&!(i in ut),o=n in ut&&!(n in pt);return s||o?{x:this.parseValue(n,"horizontal"),y:this.parseValue(i,"vertical")}:{x:this.parseValue(i,"horizontal"),y:this.parseValue(n,"vertical")}}parseValue(t,e){if(e==="horizontal"&&t in ut)return ut[t];if(e==="vertical"&&t in pt)return pt[t];if(t in ut)return ut[t];if(t in pt)return pt[t];if(t.endsWith("%")){let i=parseFloat(t);if(!isNaN(i))return i/100}let r=parseFloat(t);return isNaN(r)?.5:r>1?r/100:r}};var Qt=class{process({value:t}){let e=t.trim().toLowerCase();if(e.startsWith("#")){let n=e.slice(1);n.length===3&&(n=n.split("").map(c=>c+c).join(""));let s=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16),l=n.length===8?parseInt(n.slice(6,8),16)/255:1;return{r:s,g:o,b:a,a:l}}let r=e.match(/rgba?\(([^)]+)\)/);if(r){let[n,s,o,a=1]=r[1].split(",").map(l=>parseFloat(l.trim()));return{r:n,g:s,b:o,a}}let i=e.match(/hsla?\(([^)]+)\)/);if(i){let[n,s,o,a="1"]=i[1].split(",").map(p=>p.trim()),[l,c,u]=this.hslToRgb(parseFloat(n),parseFloat(s),parseFloat(o));return{r:l,g:c,b:u,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=(c,u,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<1/6?c+(u-c)*6*p:p<1/2?u:p<2/3?c+(u-c)*(2/3-p)*6:c),n=r<.5?r*(1+e):r+e-r*e,s=2*r-n,o=Math.round(i(s,n,t+1/3)*255),a=Math.round(i(s,n,t)*255),l=Math.round(i(s,n,t-1/3)*255);return[o,a,l]}};var Jt=class{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,n,s,o]=r.slice(1).map(Number);return this.cubicBezier(i,n,s,o)}return i=>i}cubicBezier(t,e,r,i){let n=3*t,s=3*(r-t)-n,o=1-n-s,a=3*e,l=3*(i-e)-a,c=1-a-l;function u(h){return((o*h+s)*h+n)*h}function p(h){return((c*h+l)*h+a)*h}function g(h){return(3*o*h+2*s)*h+n}function m(h,f=1e-5){let b,y,v=h,S,E,M;for(M=0;M<8;M++){if(S=u(v)-h,Math.abs(S)<f)return v;if(E=g(v),Math.abs(E)<1e-6)break;v=v-S/E}for(b=0,y=1,v=h;b<y;){if(S=u(v)-h,Math.abs(S)<f)return v;S>0?y=v:b=v,v=(y+b)/2}return v}return function(h){return p(m(h))}}};var te=class{process({distance:t,radius:e,strength:r}){if(t>=e)return 0;let i=(e-t)/e;return r*i}};var ee=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 re=class{process({from:t,to:e,progress:r}){return{x:(e.x-t.x)*r,y:(e.y-t.y)*r}}};var ie=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 n=i[1].split(",").map(s=>parseFloat(s.trim()));if(n.length>=1&&!isNaN(n[0]))return n[0]}}if(r.startsWith("scale(")){let i=r.match(/scale\(([^)]+)\)/);if(i&&i[1]){let n=i[1].split(",").map(s=>parseFloat(s.trim()));if(n.length>=1&&!isNaN(n[0]))return n[0]}}if(r.startsWith("scaleX(")){let i=r.match(/scaleX\(([^)]+)\)/);if(i&&i[1]){let n=parseFloat(i[1].trim());if(!isNaN(n))return n}}if(r.startsWith("scale3d(")){let i=r.match(/scale3d\(([^)]+)\)/);if(i&&i[1]){let n=i[1].split(",").map(s=>parseFloat(s.trim()));if(n.length>=1&&!isNaN(n[0]))return n[0]}}if(r.startsWith("matrix3d(")){let i=r.match(/matrix3d\(([^)]+)\)/);if(i&&i[1]){let n=i[1].split(",").map(s=>parseFloat(s.trim()));if(n.length>=1&&!isNaN(n[0]))return n[0]}}}catch(i){return console.error(`Error parsing transform string "${r}":`,i),1}return 1}};var Re=class{process({attributeValue:t}){let e={segment:"legacy",line:[],word:[],char:[],charLine:[],charWord:[],wordLine:[],fit:!1,trimInlineGaps:!1};return t&&t.split("|").forEach(i=>{let n=i.trim();if(!n)return;let s=n.match(/^([\w-]+)(\[(.*?)\])?$/);if(s){let o=this.toCamelCase(s[1]),a=s[3]||"",l=a.split(";").map(u=>u.trim()).filter(u=>u.length>0),c=this.parseParamsArray(l);switch(o){case"segment":{let u=this.parseSegmentMode(a);u?e.segment=u:console.warn(`SplitOptionsParserTool: Unsupported segment mode "${a}" in part "${n}"`);break}case"line":e.line.push(c);break;case"word":e.word.push(c);break;case"char":e.char.push(c);break;case"charLine":e.charLine.push(c);break;case"charWord":e.charWord.push(c);break;case"wordLine":e.wordLine.push(c);break;case"fit":e.fit=!0;break;case"trimInlineGaps":e.trimInlineGaps=!0;break;default:console.warn(`SplitOptionsParserTool: Unrecognized option type "${o}" in part "${n}"`);break}}else console.warn(`SplitOptionsParserTool: Could not parse part format "${n}"`)}),e}toCamelCase(t){return t.replace(/-([a-z])/g,(e,r)=>r.toUpperCase())}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*\)/);if(i){let n=parseInt(i[1],10),s=parseInt(i[2],10);e.random={min:Math.min(n,s),max:Math.max(n,s)}}}else["start","center","end"].includes(r)&&(e.align=r)}),e}parseSegmentMode(t){let e=t.trim().toLowerCase();return e==="legacy"||e==="visual"?e:null}};var ne=class{process({value:t}){let e=[],r="",i=0;for(let n=0;n<t.length;n++){let s=t[n];s==="("&&i++,s===")"&&i--,s==="|"&&i===0?(r.trim()&&e.push(r.trim()),r=""):r+=s}return r.trim()&&e.push(r.trim()),e.map(n=>{let s=n.match(/^(\w+)(?:\((.*)\))?$/);if(s){let[,a,l]=s;return l?{key:a,params:l.split(",").map(c=>c.trim())}:{key:a}}let o=n.indexOf(":");if(o!==-1){let a=n.slice(0,o).trim(),l=n.slice(o+1).trim(),c=l?l.split(",").map(u=>u.trim()):void 0;return{key:a,params:c}}return{key:n}})}};var He=class{process({rules:t,value:e,type:r="input",context:i}){let n=[];for(let c of t){var s=null,o=null,a=!0,l=!0;r=="input"&&(o=this.inputValidators[c.key],!o)||r=="beforeinput"&&(s=this.beforeInputValidators[c.key],!s)||(o&&(a=o(e,c.params,i)),s&&(l=s(e,c.params,i)),l||n.push(this.getErrorMessage(c.key,c.params)),a||n.push(this.getErrorMessage(c.key,c.params)))}return{valid:n.length===0,errors:n}}inputValidators={required:t=>t!=null&&String(t).trim()!=="",min:(t,e)=>typeof t=="string"&&t.length>=Number(e?.[0]??0),max:(t,e)=>typeof t=="string"&&t.length<=Number(e?.[0]??Number.MAX_SAFE_INTEGER),checked:t=>{if(Array.isArray(t))return t.length>0;if(t===!0||t==="true"||t===1||t==="1")return!0;if(typeof t=="string"){let e=t.trim().toLowerCase();return e==="false"||e==="0"?!1:e.length>0}return!!t},email:t=>typeof t=="string"&&/^[^\s@]+@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(t),phone:t=>{if(typeof t!="string")return!1;let e=t.trim();if(e===""||!/^[0-9()\s+-.]+$/.test(e))return!1;let r=e.replace(/\D/g,"").length;return r>=7&&r<=15},number:t=>typeof t=="string"&&/^-?\d+(\.\d+)?$/.test(t),integer:t=>typeof t=="string"&&/^-?\d+$/.test(t),url:t=>typeof t=="string"&&/^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-._~:\/?#[\]@!$&'()*+,;=]*)?$/.test(t),regex:(t,e)=>this.testByRegex(t,e?.[0]),alpha:t=>this.testByRegex(t,"^[A-Za-z]+$",!0),alpha_num:t=>this.testByRegex(t,"^[A-Za-z0-9]+$",!0),alpha_dash:t=>this.testByRegex(t,"^[A-Za-z0-9_-]+$",!0),same:(t,e,r)=>{let i=e?.[0],n=this.getContextValue(r,i);return i&&n===void 0?!1:this.areValuesEqual(t,n)},different:(t,e,r)=>{let i=e?.[0],n=this.getContextValue(r,i);return i&&n===void 0?!1:!this.areValuesEqual(t,n)},range:(t,e)=>{if(t==null||t==="")return!0;let r=Number(t),i=Number(e?.[0]),n=Number(e?.[1]);return Number.isNaN(r)||Number.isNaN(i)||Number.isNaN(n)?!1:r>=i&&r<=n},digits:(t,e)=>{if(typeof t!="string")return!1;let r=Number(e?.[0]??0);return r<=0?!1:new RegExp(`^\\d{${r}}$`).test(t)},ip:t=>typeof t=="string"&&(this.isIPv4(t)||this.isIPv6(t)),mimes:(t,e)=>this.validateMimes(t,e),max_size:(t,e)=>{let r=Number(e?.[0]);return!r||r<=0?!0:this.validateMaxSize(t,r)},after:(t,e,r)=>this.compareDates(t,e,r,"after"),before:(t,e,r)=>this.compareDates(t,e,r,"before")};beforeInputValidators={number:t=>/^-?\d*\.?\d*$/.test(t),integer:t=>/^-?\d*$/.test(t),email:t=>/^[\w@.\-+]*$/.test(t),phone:t=>/^[0-9()\s+-.]*$/.test(t),letters:t=>/^[a-zA-Z]*$/.test(t),lettersSpaces:t=>/^[a-zA-Z\s]*$/.test(t),lettersNumbers:t=>/^[a-zA-Z0-9]*$/.test(t),alpha:t=>/^[A-Za-z]*$/.test(t),alpha_num:t=>/^[A-Za-z0-9]*$/.test(t),alpha_dash:t=>/^[A-Za-z0-9_-]*$/.test(t),digits:(t,e)=>{let r=Number(e?.[0]??0);return r<=0?/^\d*$/.test(t):new RegExp(`^\\d{0,${r}}$`).test(t)},url:t=>/^[a-zA-Z0-9\-._~:\/?#\[\]@!$&'()*+,;=%]*$/.test(t),pattern:(t,e)=>{try{return new RegExp(e?.[0]||"").test(t)}catch{return!0}}};getErrorMessage(t,e){switch(t){case"required":return"This field is required";case"email":return"Invalid email address";case"min":return`Minimum ${e?.[0]} characters`;case"max":return`Maximum ${e?.[0]} characters`;case"phone":return"Invalid phone number";case"number":return"Only numbers are allowed";case"integer":return"Only whole numbers are allowed";case"url":return"Invalid URL address";case"checked":return"You must accept";case"regex":return"Value does not match the required pattern";case"alpha":return"Only letters are allowed";case"alpha_num":return"Only letters and numbers are allowed";case"alpha_dash":return"Only letters, numbers, dashes, and underscores are allowed";case"same":return"Values do not match";case"different":return"Values must be different";case"range":return`Value must be between ${e?.[0]} and ${e?.[1]}`;case"digits":return`Value must contain exactly ${e?.[0]} digits`;case"ip":return"Invalid IP address";case"mimes":return`Allowed file types: ${e?.join(", ")}`;case"max_size":return`File must be smaller than ${e?.[0]} KB`;case"after":return`Date must be after ${e?.[0]}`;case"before":return`Date must be before ${e?.[0]}`;default:return"Invalid value"}}validateMimes(t,e){if(!e||e.length===0)return!0;let r=this.extractFiles(t);if(r.length===0)return!0;let i=e.map(n=>n.trim().toLowerCase());return r.every(n=>this.isMimeAllowed(n,i))}validateMaxSize(t,e){let r=this.extractFiles(t);if(r.length===0)return!0;let i=e*1024;return r.every(n=>typeof n.size!="number"?!0:n.size<=i)}extractFiles(t){if(!t)return[];let e=[];return typeof File<"u"&&t instanceof File?(e.push(t),e):typeof FileList<"u"&&t instanceof FileList?Array.from(t):Array.isArray(t)?(t.forEach(r=>{e.push(...this.extractFiles(r))}),e):typeof t=="object"&&("name"in t||"size"in t||"type"in t)?(e.push(t),e):(typeof t=="string"&&t!==""&&e.push({name:t}),e)}isMimeAllowed(t,e){let r=(t.type||"").toLowerCase(),i=this.getFileExtension(t.name);return e.some(n=>{let s=n.replace(/^\./,"").toLowerCase();return s?s.includes("/")?r===s:i===s:!1})}getFileExtension(t){if(!t)return"";let e=t.split(".");return e.length<=1?"":(e.pop()||"").toLowerCase()}compareDates(t,e,r,i){if(t==null||t==="")return!0;let n=e?.[0];if(!n)return!0;let s=this.toDate(t),o=this.resolveDateReference(n,r);return!s||!o?!1:i==="after"?s.getTime()>o.getTime():s.getTime()<o.getTime()}resolveDateReference(t,e){let r=this.getContextValue(e,t);if(r!==void 0)return this.toDate(r);if(t.toLowerCase()==="now")return new Date;if(t.toLowerCase()==="today"){let i=new Date;return i.setHours(0,0,0,0),i}return this.toDate(t)}toDate(t){if(t==null||t==="")return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;if(typeof t=="number"){let e=new Date(t);return Number.isNaN(e.getTime())?null:e}if(typeof t=="string"){let e=Date.parse(t);if(!Number.isNaN(e))return new Date(e)}return null}testByRegex(t,e,r=!1){if(e==null||e==="")return!0;let i=typeof t=="string"?t:t==null?"":String(t);if(r&&i==="")return!0;try{let{source:n,flags:s}=this.normalizeRegex(e);return new RegExp(n,s).test(i)}catch{return!0}}normalizeRegex(t){let e=t.trim();if(e.startsWith("/")&&e.lastIndexOf("/")>0){let r=e.lastIndexOf("/"),i=e.slice(1,r),n=e.slice(r+1);return{source:i,flags:n}}return{source:e,flags:""}}getContextValue(t,e){if(!(!t||!e)){if(t.values&&Object.prototype.hasOwnProperty.call(t.values,e))return t.values[e];if(t.getValue)return t.getValue(e)}}areValuesEqual(t,e){return Array.isArray(t)||Array.isArray(e)?JSON.stringify(t)===JSON.stringify(e):t===e}isIPv4(t){let e=t.split(".");return e.length!==4?!1:e.every(r=>{if(!/^\d+$/.test(r))return!1;let i=Number(r);return i>=0&&i<=255})}isIPv6(t){if(!t)return!1;if(t==="::")return!0;let e=t.split("::");if(e.length>2)return!1;let r=/^[0-9a-fA-F]{1,4}$/,i=t.split(":");return e.length===2?i.every(n=>n===""||r.test(n))&&i.length<=8:i.length===8&&i.every(n=>r.test(n))}};var li=class{pendingVars=new Map;pendingProps=new Map;isOpen=!1;canUseTypedOM(t){return"attributeStyleMap"in t&&typeof CSS<"u"&&typeof CSS.number=="function"&&typeof CSS.px=="function"}writeVar(t,e,r){let i=t.style;if(this.canUseTypedOM(t)&&typeof r=="number"&&Number.isFinite(r))try{t.attributeStyleMap.set(e,CSS.number(r));return}catch{}i.setProperty(e,String(r))}begin(){this.isOpen||(this.isOpen=!0)}setVars(t,e){if(!this.isOpen){console.warn("StyleTxn: call begin() first to set custom properties.");return}let r=this.pendingVars.get(t)??{};for(let[i,n]of Object.entries(e))r[i]!==n&&(r[i]=n);this.pendingVars.set(t,r)}setVar(t,e,r){if(!this.isOpen){console.warn("StyleTxn: call begin() first to set custom properties.");return}let i=this.pendingVars.get(t)??{};i[e]!==r&&(i[e]=r,this.pendingVars.set(t,i))}setVarDirect(t,e,r){this.writeVar(t,e,r)}setProps(t,e){if(!this.isOpen){console.warn("StyleTxn: call begin() first to set standard properties.");return}let r=this.pendingProps.get(t)??{};for(let[i,n]of Object.entries(e))r[i]!==n&&(r[i]=n);this.pendingProps.set(t,r)}setProp(t,e,r){if(!this.isOpen){console.warn("StyleTxn: call begin() first to set standard properties.");return}let i=this.pendingProps.get(t)??{};i[e]!==r&&(i[e]=r,this.pendingProps.set(t,i))}run(t){let e=this.isOpen;e||this.begin();try{t(),e||this.commit()}catch(r){throw e||this.cancel(),r}}commit(){if(this.isOpen){this.isOpen=!1;for(let[t,e]of this.pendingVars)for(let[r,i]of Object.entries(e))this.writeVar(t,r,i);this.pendingVars.clear();for(let[t,e]of this.pendingProps){let r=t.style;for(let[i,n]of Object.entries(e))r[i]=String(n)}this.pendingProps.clear()}}cancel(){this.pendingVars.clear(),this.pendingProps.clear(),this.isOpen=!1}},L=new li;var Be=class{domAttribute=new Ut;recordAttribute=new jt;transformNullify=new St;boundingClientRect=new $t;relativePosition=new Yt(this.transformNullify);unitParser=new Xt;lerp=new qt;adaptiveLerp=new Kt;originParser=new Zt;colorParser=new Qt;validation=new He;easingFunction=new Jt;magneticPull=new te;lerpColor=new ee;lerpVector=new re;transformScaleParser=new ie;optionsParser=new Re;ruleParser=new ne;styleTxn=L};function _e(){let d=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)").matches:!1,t=typeof navigator<"u"?(navigator.maxTouchPoints||0)>0:!1,e=typeof window<"u"?window.innerWidth<=768:!1;return d||t||e}var Fi=new WeakMap,$=5e-4,At="default",di="[string-cursor],[data-string-cursor]",Vi="[string-cursor-content],[data-string-cursor-content]",ci=1/240,X=(d,t)=>{let e=Math.pow(10,t);return Math.round(d*e)/e};function es(d){let t=Fi.get(d);return t||(t={prevX:Number.NaN,prevY:Number.NaN},Fi.set(d,t)),t}var Fe=class extends x{cursorPrev={x:Number.NaN,y:Number.NaN,stepX:Number.NaN,stepY:Number.NaN};cursorPortals=new Map;hoveredObjects=new Set;globalListenersBound=!1;boundBeforeUnload=()=>this.cleanupHoverTargets();boundPageHide=()=>this.cleanupHoverTargets();boundVisibilityChange=()=>{document.hidden&&this.cleanupHoverTargets()};enabled=!0;lastFrameTime=0;constructor(t){super(t),this.htmlKey="cursor",this.cssProperties=[{name:"--x",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--y",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--x-lerp",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--y-lerp",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--x-px",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--y-px",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--dx",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--dy",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--angle",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--angle-deg",syntax:"<number>",initialValue:"0",inherits:!0}],this.permissions.mobile.rebuild.height=!1,this.permissions.mobile.rebuild.width=!1,this.permissions.mobile.rebuild.scrollHeight=!1,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:"cursor-target",type:"string",fallback:this.settings["cursor-target"]??At},{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:"cursor-enter",type:{type:"enum",values:["snap","smooth"]},fallback:"snap"},{key:"cursor-leave",type:{type:"enum",values:["snap","smooth"]},fallback:"smooth"},{key:"cursor-leave-hold",type:"boolean",fallback:!1},{key:"lerp",type:"number",fallback:this.settings.lerp,transform:e=>this.tools.adaptiveLerp.process({value:e,inMin:.1,inMax:1,outMin:.05,outMax:.65})},{key:"cursor-float",type:"number",fallback:2},{key:"cursor-vars",type:"string",fallback:""}],_e()&&(this.enabled=!1),this.collectCursorPortals(),this.enabled&&this.bindGlobalLifecycleListeners()}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i),e.setProperty("mouse-x",0),e.setProperty("mouse-y",0),e.setProperty("mouse-pixel-x",0),e.setProperty("mouse-pixel-y",0),e.setProperty("is-mouse-over",!1),e.setProperty("is-mouse-move",!1),e.setProperty("__cursor-vars",this.parseCursorVars(e.getProperty("cursor-vars")));let n=r.getBoundingClientRect();e.setProperty("cached-width",n.width||r.offsetWidth||1),e.setProperty("cached-height",n.height||r.offsetHeight||1)}onResize(){super.onResize(),this.objects.forEach(t=>{let e=t.htmlElement.getBoundingClientRect();t.setProperty("cached-width",e.width||t.htmlElement.offsetWidth||1),t.setProperty("cached-height",e.height||t.htmlElement.offsetHeight||1)})}onMutate(t){if(!this.enabled)return;let e=performance.now(),r=this.lastFrameTime?(e-this.lastFrameTime)/1e3:.016;this.lastFrameTime=e,r>.1&&(r=.1),r<ci&&(r=ci);let i=this.data.cursor.targetX,n=this.data.cursor.targetY;if(this.objects.forEach(s=>{let o=s.getProperty("is-mouse-over"),a=s.getProperty("cursor-target-disable"),l=s.getProperty("lerp")??.15,c=this.getFrameAdjustedLerp(l,r),u=this.getObjectDimensions(s),{halfWidth:p,halfHeight:g,width:m,height:h}=u;if(o&&!a){let{cx:f,cy:b}=this.centers.getCenter(s),y=i-(f-p),v=n-(b-g),S=s.getProperty("mouse-pixel-x")??0,E=s.getProperty("mouse-pixel-y")??0,M=S-y,C=E-v;if(M*M+C*C>1e-4){let I=s.getProperty("is-mouse-move")??!1,H=s.getProperty("cursor-enter")??"snap",w=s.getProperty("alignment")??"center";if(!I){if(s.setProperty("is-mouse-move",!0),H==="snap")s.setProperty("mouse-pixel-x",y),s.setProperty("mouse-pixel-y",v),s.setProperty("mouse-x",y),s.setProperty("mouse-y",v),S=y,E=v;else{let N=s.getProperty("mouse-x")??0,z=s.getProperty("mouse-y")??0;S=this.reverseOffset(w,N,m),E=this.reverseOffset(w,z,h),s.setProperty("mouse-pixel-x",S),s.setProperty("mouse-pixel-y",E)}this.events.emit(this.getObjectEventName(s,"cursor:start"),null)}let _=this.tools.lerp.process({from:S,to:y,progress:c}),k=this.tools.lerp.process({from:E,to:v,progress:c}),O=S+_,T=E+k,P=Math.abs(O-S)>$||Math.abs(T-E)>$;s.setProperty("mouse-pixel-x",O),s.setProperty("mouse-pixel-y",T);let R=this.calculateOffset(w,O,m),B=this.calculateOffset(w,T,h);s.setProperty("mouse-x",R),s.setProperty("mouse-y",B),this.setMouseCoordinates(s,R,B,O,T)&&this.events.emit(this.getObjectEventName(s,"cursor:move"),{x:R,y:B}),P&&this.events.emit(this.getObjectEventName(s,"cursor:pixel"),{x:O,y:T})}else{s.setProperty("mouse-pixel-x",y),s.setProperty("mouse-pixel-y",v),s.getProperty("is-mouse-move")&&(s.setProperty("is-mouse-move",!1),this.events.emit(this.getObjectEventName(s,"cursor:end"),null));let I=s.getProperty("alignment")??"center",H=this.calculateOffset(I,y,m),w=this.calculateOffset(I,v,h);this.setMouseCoordinates(s,H,w,y,v)}}else{if(s.getProperty("cursor-leave-hold")??!1){s.getProperty("is-mouse-move")&&(s.setProperty("is-mouse-move",!1),this.events.emit(this.getObjectEventName(s,"cursor:end"),null));return}if((s.getProperty("cursor-leave")??"smooth")==="snap"){s.setProperty("is-mouse-move",!1),s.setProperty("mouse-x",0),s.setProperty("mouse-y",0),s.setProperty("mouse-pixel-x",0),s.setProperty("mouse-pixel-y",0),this.setMouseCoordinates(s,0,0,0,0);return}let y=s.getProperty("mouse-x")??0,v=s.getProperty("mouse-y")??0;if(y!==0||v!==0){s.setProperty("is-mouse-move",!1);let S=this.calculateOffset("center",p,m),E=this.calculateOffset("center",g,h),M=y+this.tools.lerp.process({from:y,to:S,progress:c}),C=v+this.tools.lerp.process({from:v,to:E,progress:c});s.setProperty("mouse-x",M),s.setProperty("mouse-y",C),Math.abs(M)<.001&&Math.abs(C)<.001?(s.setProperty("mouse-x",0),s.setProperty("mouse-y",0),s.setProperty("mouse-pixel-x",0),s.setProperty("mouse-pixel-y",0),this.setMouseCoordinates(s,0,0,0,0)):this.setMouseCoordinates(s,M,C)}}}),this.cursorPortals.size>0){let{stepX:s,stepY:o,smoothedX:a,smoothedY:l}=this.data.cursor,c=this.cursorPrev;(!Number.isFinite(c.x)||Math.abs(a-c.x)>$||Math.abs(l-c.y)>$||Math.abs(s-c.stepX)>$||Math.abs(o-c.stepY)>$)&&(this.events.emit("cursor",{stepX:s,stepY:o,x:a,y:l}),this.cursorPrev={x:a,y:l,stepX:s,stepY:o});let p=this.data.cursor.targetX,g=this.data.cursor.targetY;this.cursorPortals.forEach(m=>{m.forEach(h=>{this.updatePortalPosition(h,p,g,r)})})}}onObjectConnected(t){let e=t.htmlElement;this.centers.attach(t),t.setProperty("mouseleave",()=>{this.onMouseLeave(t)}),t.setProperty("mouseenter",()=>{this.onMouseEnter(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"))}getCursorClass(t){let e=t.getProperty("cursor-class");return e!=null&&e.length>0?e:null}onMouseEnter(t){if(!document.contains(t.htmlElement))return;t.setProperty("is-mouse-over",!0),this.hoveredObjects.add(t);let e=this.getCursorClass(t);this.withPortalsForObject(t,r=>{e&&r.element.classList.add(e),this.incrementPortalHover(r)}),t.htmlElement.addEventListener("mouseleave",t.getProperty("mouseleave"))}onMouseLeave(t){t.setProperty("is-mouse-over",!1),this.hoveredObjects.delete(t);let e=this.getCursorClass(t);this.withPortalsForObject(t,r=>{e&&r.element.classList.remove(e),this.decrementPortalHover(r)}),document.contains(t.htmlElement)&&t.htmlElement.removeEventListener("mouseleave",t.getProperty("mouseleave"))}onEnterObject(t){t.htmlElement.addEventListener("mouseenter",t.getProperty("mouseenter"))}onLeaveObject(t){t.htmlElement.removeEventListener("mouseenter",t.getProperty("mouseenter")),t.htmlElement.removeEventListener("mouseleave",t.getProperty("mouseleave"))}safariNavigationCleanup(t){t.getProperty("is-mouse-over")&&this.onMouseLeave(t)}onElementRemovedFromDOM(t){t.getProperty("is-mouse-over")&&this.onMouseLeave(t)}onObjectDisconnected(t){t.getProperty("is-mouse-over")&&this.onMouseLeave(t)}onDOMRebuild(){this.enabled&&this.collectCursorPortals()}onDOMMutate(t,e){this.enabled&&((this.shouldRefreshPortals(t)||this.shouldRefreshPortals(e))&&this.collectCursorPortals(),e.length>0&&this.handleRemovedNodes(e))}collectCursorPortals(){this.cursorPortals.clear(),document.querySelectorAll(di).forEach(e=>{if(!(e instanceof HTMLElement))return;let r=this.resolvePortalId(e),i=this.resolvePortalLerp(e),n=e.matches(Vi)?e:e.querySelector(Vi),s=this.data.cursor.targetX,o=this.data.cursor.targetY,a={id:r,element:e,content:n,prev:{x:s,y:o,stepX:0,stepY:0},hoverCount:0,showTimer:null,lerp:i},l=this.cursorPortals.get(r);l?l.push(a):this.cursorPortals.set(r,[a])})}resolvePortalId(t){let e=[t.getAttribute("data-string-cursor"),t.getAttribute("string-cursor"),t.getAttribute("data-string-cursor-id"),t.getAttribute("string-cursor-id")];for(let r of e)if(r&&r.trim().length>0)return r.trim();return At}resolvePortalLerp(t){let e=t.getAttribute("data-string-cursor-lerp")??t.getAttribute("string-cursor-lerp")??this.settings["cursor-lerp"];if(!e)return null;let r=parseFloat(e);if(!Number.isFinite(r))return null;let i=Math.min(1,Math.max(.01,r));return this.tools.adaptiveLerp.process({value:i,inMin:.1,inMax:1,outMin:.05,outMax:.65})}shouldRefreshPortals(t){for(let e of Array.from(t))if(e instanceof Element&&(e.matches(di)||e.querySelector(di)))return!0;return!1}withPortalsForObject(t,e){this.getPortalsForObject(t).forEach(i=>e(i))}getPortalsForObject(t){if(this.cursorPortals.size===0)return[];let e=this.extractPortalIds(t),r=[];if(e.forEach(i=>{if(i==="*"){this.cursorPortals.forEach(o=>{o.forEach(a=>r.push(a))});return}let n=i.length>0?i:At,s=this.cursorPortals.get(n);s&&s.forEach(o=>r.push(o))}),r.length===0){let i=this.cursorPortals.get(At)??this.cursorPortals.values().next().value;i&&i.length>0&&i.forEach(n=>r.push(n))}return r}extractPortalIds(t){if(!t)return[At];let e=t.getProperty("cursor-target");return typeof e!="string"||e.trim().length===0?[At]:e.split(/[,|]/).map(r=>r.trim()).filter(Boolean)}incrementPortalHover(t){t.hoverCount++,t.element.classList.remove("-show"),this.restartPortalShowTimer(t)}decrementPortalHover(t){t.hoverCount=Math.max(0,t.hoverCount-1),t.hoverCount===0&&(this.clearPortalShowTimer(t),t.element.classList.remove("-show"))}restartPortalShowTimer(t){if(this.clearPortalShowTimer(t),!t.element.isConnected){t.showTimer=null;return}t.element.classList.add("-show"),t.showTimer=null}clearPortalShowTimer(t){t.showTimer&&(clearTimeout(t.showTimer),t.showTimer=null)}updatePortalPosition(t,e,r,i){if(!t.element.isConnected)return;let n=t.prev,s=Number.isFinite(n.x)?n.x:e,o=Number.isFinite(n.y)?n.y:r,a=t.lerp??.1,l=this.getFrameAdjustedLerp(a,i),c=(e-s)*l,u=(r-o)*l,p=i>1e-4?i:1/60,g=c/(p*60),m=u/(p*60);if(Math.abs(c)<$&&Math.abs(u)<$)return;let h=s+c,f=o+u;this.writePortalVars(t.element,{"--x":X(h,2),"--y":X(f,2),"--x-lerp":X(g,3),"--y-lerp":X(m,3)}),n.x=h,n.y=f,n.stepX=c,n.stepY=u}handleRemovedNodes(t){this.hoveredObjects.size!==0&&Array.from(this.hoveredObjects).forEach(e=>{e.htmlElement.isConnected||this.onElementRemovedFromDOM(e)})}cleanupHoverTargets(){this.hoveredObjects.size!==0&&Array.from(this.hoveredObjects).forEach(t=>this.safariNavigationCleanup(t))}bindGlobalLifecycleListeners(){this.globalListenersBound||(window.addEventListener("beforeunload",this.boundBeforeUnload),window.addEventListener("pagehide",this.boundPageHide),document.addEventListener("visibilitychange",this.boundVisibilityChange),this.globalListenersBound=!0)}unbindGlobalLifecycleListeners(){this.globalListenersBound&&(window.removeEventListener("beforeunload",this.boundBeforeUnload),window.removeEventListener("pagehide",this.boundPageHide),document.removeEventListener("visibilitychange",this.boundVisibilityChange),this.globalListenersBound=!1)}setMouseCoordinates(t,e,r,i,n){if(t.getProperty("cursor-target-style-disable"))return!1;let s=es(t),o=t.getProperty("cursor-float")??2,a=Math.pow(10,o),l=Math.abs(e)<$&&Number.isFinite(s.prevX)&&Math.abs(s.prevX)<$?s.prevX:Math.round(e*a)/a,c=Math.abs(r)<$&&Number.isFinite(s.prevY)&&Math.abs(s.prevY)<$?s.prevY:Math.round(r*a)/a;if(Number.isFinite(s.prevX)&&Math.abs(l-s.prevX)<=$&&Number.isFinite(s.prevY)&&Math.abs(c-s.prevY)<=$)return!1;s.prevX=l,s.prevY=c;let u=t.getProperty("__cursor-vars"),p={"--x":X(l,o),"--y":X(c,o)};if(u&&u.size>0){let m=Number.isFinite(i)?i:t.getProperty("mouse-pixel-x"),h=Number.isFinite(n)?n:t.getProperty("mouse-pixel-y"),f=t.getProperty("__prev-x-px"),b=t.getProperty("__prev-y-px"),y=Number.isFinite(f)?m-f:0,v=Number.isFinite(b)?h-b:0;t.setProperty("__prev-x-px",m),t.setProperty("__prev-y-px",h);let S=y===0&&v===0?0:Math.atan2(v,y),E=S*180/Math.PI;u.has("xpx")&&(p["--x-px"]=X(m,2)),u.has("ypx")&&(p["--y-px"]=X(h,2)),u.has("dx")&&(p["--dx"]=X(y,3)),u.has("dy")&&(p["--dy"]=X(v,3)),u.has("angle")&&(p["--angle"]=X(S,4)),u.has("angle-deg")&&(p["--angle-deg"]=X(E,2))}let g=()=>{this.applyToElementAndConnects(t,m=>{L.setVars(m,p)})};return L.isOpen?g():L.run(g),!0}writePortalVars(t,e){if(L.isOpen){L.setVars(t,e);return}L.run(()=>{L.setVars(t,e)})}parseCursorVars(t){return t?new Set(t.split(/[|,]/).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0)):new Set}getFrameAdjustedLerp(t,e){let r=Math.min(.99,Math.max(.001,t));if(!Number.isFinite(e)||e<=0)return r;let n=Math.max(e,ci)*60,s=1-Math.pow(1-r,n);return Math.min(.999,Math.max(1e-4,s))}getObjectDimensions(t){let e=t.getProperty("cached-width"),r=t.getProperty("cached-height");if(typeof e=="number"&&typeof r=="number"&&e>0&&r>0){let g=e/2,m=r/2;return{width:e,height:r,halfWidth:g,halfHeight:m}}let i=t.htmlElement,n=i.offsetWidth||i.clientWidth||i.scrollWidth||1,s=i.offsetHeight||i.clientHeight||i.scrollHeight||1,o=t.getProperty("half-width"),a=t.getProperty("half-height"),l=typeof o=="number"&&Number.isFinite(o)?o:n/2,c=typeof a=="number"&&Number.isFinite(a)?a:s/2,u=l>0?l*2:n,p=c>0?c*2:s;return t.setProperty("cached-width",u),t.setProperty("cached-height",p),{width:u,height:p,halfWidth:l,halfHeight:c}}calculateOffset(t,e,r){switch(t){case"start":return e/r;case"end":return(e-r)/r;case"center":default:return(e-r/2)/(r/2)}}reverseOffset(t,e,r){switch(t){case"start":return e*r;case"end":return e*r+r;case"center":default:return e*(r/2)+r/2}}removeObject(t){if(!this.enabled)return super.removeObject(t);let e=this.objectMapOnPage.get(t);e&&this.centers.detach(e),super.removeObject(t)}destroy(){this.unbindGlobalLifecycleListeners(),this.hoveredObjects.clear(),super.destroy()}};var Ve=class extends x{originObservers=new WeakMap;constructor(t){super(t),this.htmlKey="impulse",this.cssProperties=[{name:"--push-x",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--push-y",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--push-rotation",syntax:"<number>",initialValue:"0",inherits:!0}],this.attributesToMap.push({key:"position-strength",type:"number",fallback:this.settings["position-strength"]},{key:"position-tension",type:"number",fallback:this.settings["position-tension"]},{key:"position-friction",type:"number",fallback:this.settings["position-friction"]},{key:"position-max-velocity",type:"number",fallback:this.settings["position-max-velocity"]},{key:"position-update-threshold",type:"number",fallback:this.settings["position-update-threshold"]},{key:"rotation-strength",type:"number",fallback:this.settings["rotation-strength"]},{key:"rotation-tension",type:"number",fallback:this.settings["rotation-tension"]},{key:"rotation-friction",type:"number",fallback:this.settings["rotation-friction"]},{key:"rotation-max-angular-velocity",type:"number",fallback:this.settings["rotation-max-angular-velocity"]},{key:"rotation-max-angle",type:"number",fallback:this.settings["rotation-max-angle"]},{key:"rotation-update-threshold",type:"number",fallback:this.settings["rotation-update-threshold"]},{key:"max-offset",type:"number",fallback:this.settings["max-offset"]},{key:"sleep-epsilon",type:"number",fallback:this.settings["sleep-epsilon"]},{key:"continuous-push",type:"boolean",fallback:this.settings["continuous-push"]},{key:"rotation-origin",type:"string",fallback:this.settings["rotation-origin"]??"center center"})}onObjectConnected(t){super.onObjectConnected(t),t.setProperty("offset-x",0),t.setProperty("offset-y",0),t.setProperty("velocity-x",0),t.setProperty("velocity-y",0),t.setProperty("angle-deg",0),t.setProperty("ang-vel-deg",0),t.setProperty("__prev-css-x",0),t.setProperty("__prev-css-y",0),t.setProperty("__prev-css-rot",0),t.setProperty("__push-latch",!1),t.setProperty("__rotate-latch",!1),this.cacheRotationOrigin(t),this.observeRotationOrigin(t),this.hover.track(t),this.centers.attach(t)}onObjectDisconnected(t){this.hover.untrack(t),this.centers.detach(t);let e=this.originObservers.get(t);e&&(e.disconnect(),this.originObservers.delete(t))}onMouseMove(t){if(!t)return;let e=this.data.cursor.velocityX,r=this.data.cursor.velocityY;if(e===0&&r===0)return;let i=this.data.cursor.targetX,n=this.data.cursor.targetY;for(let s of this.objects){let o=s.htmlElement.getBoundingClientRect();if(i>=o.left&&i<=o.right&&n>=o.top&&n<=o.bottom){{let u=o.width||1,p=Math.max(0,Math.min(1,(this.data.cursor.targetX-o.left)/u));this.events.emit(this.getObjectEventName(s,"object:impulse","side"),{value:p})}let l=s.getProperty("position-strength")||0;if(l!==0){let u=s.getProperty("continuous-push")??!0,p=s.getProperty("__push-latch")===!0;if(u||!p){let g=s.getProperty("velocity-x")||0,m=s.getProperty("velocity-y")||0;g+=e*l,m+=r*l,s.setProperty("velocity-x",g),s.setProperty("velocity-y",m),u||s.setProperty("__push-latch",!0)}}let c=s.getProperty("rotation-strength")??.75;if(c!==0){let u=s.getProperty("continuous-push")??!0,p=s.getProperty("__rotate-latch")===!0;if(u||!p){let{centerX:g,centerY:m}=this.getRotationOriginFromRect(s,o),h=i-g,f=n-m,b=h*r-f*e,y=s.getProperty("ang-vel-deg")||0;y+=b*c*.02,s.setProperty("ang-vel-deg",y),u||s.setProperty("__rotate-latch",!0)}}}}}cacheRotationOrigin(t){let e=t.getProperty("rotation-origin")??"center center",{x:r,y:i}=this.tools.originParser.toNormalized({value:e});t.setProperty("__rotation-origin-x",r),t.setProperty("__rotation-origin-y",i)}observeRotationOrigin(t){let e="string-rotation-origin",r="data-string-rotation-origin",i=new MutationObserver(n=>{for(let s of n)if(s.type==="attributes"&&(s.attributeName===e||s.attributeName===r)){let o=t.htmlElement.getAttribute(e)??t.htmlElement.getAttribute(r);o!==null&&t.setProperty("rotation-origin",o),this.cacheRotationOrigin(t);break}});i.observe(t.htmlElement,{attributes:!0,attributeFilter:[e,r]}),this.originObservers.set(t,i)}getRotationOriginFromRect(t,e){let r=t.getProperty("__rotation-origin-x")??.5,i=t.getProperty("__rotation-origin-y")??.5;return{centerX:e.left+e.width*r,centerY:e.top+e.height*i}}onFrame(t){let e=this.data.cursor.targetX,r=this.data.cursor.targetY;for(let i of this.objects){let n=i.htmlElement.getBoundingClientRect(),s=e>=n.left&&e<=n.right&&r>=n.top&&r<=n.bottom;!s&&i.getProperty("__push-latch")===!0&&i.setProperty("__push-latch",!1),!s&&i.getProperty("__rotate-latch")===!0&&i.setProperty("__rotate-latch",!1)}for(let i=0;i<this.objects.length;i++){let n=this.objects[i],s=n.getProperty("offset-x")||0,o=n.getProperty("offset-y")||0,a=n.getProperty("velocity-x")||0,l=n.getProperty("velocity-y")||0,c=n.getProperty("position-tension")??.05,u=n.getProperty("position-friction")??.15,p=n.getProperty("position-max-velocity")??120,g=n.getProperty("max-offset")??220;a-=c*s,l-=c*o;let m=1-u;a*=m,l*=m,a>p?a=p:a<-p&&(a=-p),l>p?l=p:l<-p&&(l=-p),s+=a,o+=l,s>g?s=g:s<-g&&(s=-g),o>g?o=g:o<-g&&(o=-g);let h=n.getProperty("angle-deg")||0,f=n.getProperty("ang-vel-deg")||0,b=n.getProperty("rotation-tension")??.06,y=n.getProperty("rotation-friction")??.18,v=n.getProperty("rotation-max-angular-velocity")??6,S=n.getProperty("rotation-max-angle")??18;f-=b*h,f*=1-y,f>v?f=v:f<-v&&(f=-v),h+=f,h>S?(h=S,f*=.35):h<-S&&(h=-S,f*=.35);let E=n.getProperty("sleep-epsilon")??.01,M=a*a+l*l<E*E&&s*s+o*o<E*E,C=Math.abs(f)<E&&Math.abs(h)<E;M?(a||l||s||o)&&(n.setProperty("offset-x",0),n.setProperty("offset-y",0),n.setProperty("velocity-x",0),n.setProperty("velocity-y",0),s=o=a=l=0):(n.setProperty("offset-x",s),n.setProperty("offset-y",o),n.setProperty("velocity-x",a),n.setProperty("velocity-y",l)),C?(h||f)&&(n.setProperty("angle-deg",0),n.setProperty("ang-vel-deg",0),h=f=0):(n.setProperty("angle-deg",h),n.setProperty("ang-vel-deg",f));let A=n.getProperty("position-update-threshold")??.1,I=n.getProperty("rotation-update-threshold")??.15,H=n.getProperty("__prev-css-x")||0,w=n.getProperty("__prev-css-y")||0,_=n.getProperty("__prev-css-rot")||0,k=Math.round(s*10)/10,O=Math.round(o*10)/10,T=Math.round(h*10)/10,P=Math.abs(k-H)>A||Math.abs(O-w)>A,R=Math.abs(T-_)>I;(P||R)&&(n.setProperty("__next-css-x",k),n.setProperty("__next-css-y",O),n.setProperty("__next-css-rot",T)),n.setProperty("__needs-position-update",P),n.setProperty("__needs-rotation-update",R)}}onMutate(){for(let t=0;t<this.objects.length;t++){let e=this.objects[t],r=e.getProperty("__needs-position-update")===!0,i=e.getProperty("__needs-rotation-update")===!0;if(!r&&!i)continue;let n=e.getProperty("__next-css-x")||0,s=e.getProperty("__next-css-y")||0,o=e.getProperty("__next-css-rot")||0;this.applyToElementAndConnects(e,a=>{r&&(L.setVar(a,"--push-x",n),L.setVar(a,"--push-y",s)),i&&L.setVar(a,"--push-rotation",o)}),r&&(e.setProperty("__prev-css-x",n),e.setProperty("__prev-css-y",s),this.events.emit(this.getObjectEventName(e,"object:impulse","move"),{x:n,y:s})),i&&(e.setProperty("__prev-css-rot",o),this.events.emit(this.getObjectEventName(e,"object:impulse","rotate"),{rotation:o})),e.setProperty("__needs-position-update",!1),e.setProperty("__needs-rotation-update",!1)}}};var gt=new WeakMap,ui=60,Wi=(d,t)=>t>0?d>=t?d%t:d<0?(d%t+t)%t:d:0,rs=d=>Number.isFinite(d)?Math.max(0,Math.abs(d)):ui,We=class extends x{onFontsReadyBound;constructor(t){super(t),this.htmlKey="marquee",this.cssProperties=[{name:"--marquee-progress",syntax:"<number>",initialValue:"0",inherits:!1}],this.permissions.mobile.rebuild.height=!1,this.permissions.mobile.rebuild.width=!1,this.permissions.mobile.rebuild.scrollHeight=!1,this.attributesToMap=[...this.attributesToMap,{key:"marquee-direction",type:{type:"enum",values:["left","right"]},fallback:this.settings["marquee-direction"]??"left"},{key:"marquee-speed",type:"number",fallback:this.settings["marquee-speed"]??ui},{key:"marquee-gap",type:"dimension",fallback:this.settings["marquee-gap"]??0},{key:"marquee-fill",type:"boolean",fallback:this.settings["marquee-fill"]??!1},{key:"marquee-pause-on-hover",type:"boolean",fallback:this.settings["marquee-pause-on-hover"]??!1},{key:"marquee-progress",type:"boolean",fallback:this.settings["marquee-progress"]??!1},{key:"marquee-part-class",type:"string",fallback:this.settings["marquee-part-class"]??""}],this.onFontsReadyBound=this.onFontsReady.bind(this)}onInit(){"fonts"in document&&document.fonts&&(document.fonts.ready.then(this.onFontsReadyBound),document.fonts.addEventListener?.("loadingdone",this.onFontsReadyBound))}onUnsubscribe(){"fonts"in document&&document.fonts&&document.fonts.removeEventListener?.("loadingdone",this.onFontsReadyBound)}onObjectConnected(t){super.onObjectConnected(t);let e=gt.get(t);e||(e=this.createState(t.htmlElement),gt.set(t,e),this.mountStructure(e)),this.syncConfig(t,e),this.refresh(e)}onObjectDisconnected(t){let e=gt.get(t);e&&(e.host.removeEventListener("mouseenter",this.onMouseEnter),e.host.removeEventListener("mouseleave",this.onMouseLeave))}onResizeWidth(){for(let t=0;t<this.objectsOnPage.length;t++){let e=gt.get(this.objectsOnPage[t]);e&&(this.syncConfig(this.objectsOnPage[t],e),this.refresh(e))}}onFrame(t){let e=Math.max(.004166666666666667,Math.min(.1,(t.time.delta||16.6667)/1e3));L.run(()=>{for(let r=0;r<this.objectsOnPage.length;r++){let i=gt.get(this.objectsOnPage[r]);if(!i||!(i.cycleWidth>0))continue;!(i.pauseOnHover&&i.hovering)&&i.speed>0&&(i.position=Wi(i.position+i.speed*e,i.cycleWidth));let n=i.direction==="right"?i.position-i.cycleWidth:-i.position;n!==i.lastAppliedTranslate&&(i.lastAppliedTranslate=n,L.setProp(i.track,"transform",`translate3d(${n}px, 0, 0)`),this.updatePartProgress(i,n))}})}createState(t){let e=document.createElement("div"),r=document.createElement("span");return e.setAttribute("data-string-marquee-track",""),r.setAttribute("data-string-marquee-part",""),t.addEventListener("mouseenter",this.onMouseEnter),t.addEventListener("mouseleave",this.onMouseLeave),{host:t,track:e,part:r,parts:[r],clones:[],direction:"left",speed:ui,gap:0,fill:!1,pauseOnHover:!1,progressEnabled:!1,hovering:!1,position:0,hostWidth:0,partWidth:0,cycleWidth:0,lastAppliedTranslate:Number.NaN,partProgressApplied:[Number.NaN],partClass:""}}mountStructure(t){let{host:e,track:r,part:i}=t;for(;e.firstChild;)i.appendChild(e.firstChild);r.appendChild(i),e.appendChild(r),L.run(()=>{L.setProps(e,{overflow:"hidden"}),L.setProps(r,{display:"flex",flexWrap:"nowrap",width:"max-content",willChange:"transform"}),L.setProps(i,{flex:"0 0 auto"})})}syncConfig(t,e){e.direction=t.getProperty("marquee-direction")??"left",e.speed=rs(t.getProperty("marquee-speed")),e.gap=Math.max(0,t.getProperty("marquee-gap")??0),e.fill=t.getProperty("marquee-fill")===!0,e.pauseOnHover=t.getProperty("marquee-pause-on-hover")===!0,e.progressEnabled=t.getProperty("marquee-progress")===!0,e.partClass=t.getProperty("marquee-part-class")??""}refresh(t){this.syncPartClass(t),this.syncCopies(t),t.hostWidth=t.host.getBoundingClientRect().width,t.partWidth=t.part.getBoundingClientRect().width,t.cycleWidth=t.partWidth>0?t.partWidth+t.gap:0,t.position=Wi(t.position,t.cycleWidth),t.lastAppliedTranslate=Number.NaN;for(let e=0;e<t.partProgressApplied.length;e++)t.partProgressApplied[e]=Number.NaN;L.run(()=>{if(L.setProp(t.track,"columnGap",`${t.gap}px`),L.setProp(t.track,"transform","translate3d(0, 0, 0)"),!t.progressEnabled)for(let e=0;e<t.parts.length;e++)L.setVar(t.parts[e],"--marquee-progress",0)})}syncCopies(t){for(let o=0;o<t.clones.length;o++)t.clones[o].remove();t.clones.length=0;let e=t.host.getBoundingClientRect().width,r=t.part.getBoundingClientRect().width;if(!(e>0)||!(r>0))return;let i=r+t.gap,n=t.fill?Math.max(2,Math.ceil(e*2/i)+1):2,s=document.createDocumentFragment();for(let o=1;o<n;o++){let a=t.part.cloneNode(!0);a.removeAttribute("data-string-marquee-part"),a.setAttribute("aria-hidden","true"),s.appendChild(a),t.clones.push(a)}t.track.appendChild(s),t.parts=[t.part,...t.clones],t.partProgressApplied=new Array(t.parts.length).fill(Number.NaN)}syncPartClass(t){t.part.className=t.partClass}updatePartProgress(t,e){if(!t.progressEnabled||!(t.hostWidth>0)||!(t.partWidth>0))return;let r=t.hostWidth+t.partWidth;if(r>0)for(let i=0;i<t.parts.length;i++){let s=(e+i*t.cycleWidth+t.partWidth)/r,o=s<=0?0:s>=1?1:s,a=t.direction==="right"?o:1-o;t.partProgressApplied[i]!==a&&(t.partProgressApplied[i]=a,L.setVar(t.parts[i],"--marquee-progress",a))}}onFontsReady(){for(let t=0;t<this.objectsOnPage.length;t++){let e=gt.get(this.objectsOnPage[t]);e&&this.refresh(e)}}onMouseEnter=t=>{let e=t.currentTarget;if(e)for(let r=0;r<this.objectsOnPage.length;r++){let i=gt.get(this.objectsOnPage[r]);if(i?.host===e){i.hovering=!0;return}}};onMouseLeave=t=>{let e=t.currentTarget;if(e)for(let r=0;r<this.objectsOnPage.length;r++){let i=gt.get(this.objectsOnPage[r]);if(i?.host===e){i.hovering=!1;return}}}};var pi=class{measureQueue=[];mutateQueue=[];scheduled=!1;measure(t){this.measureQueue.push(t),this.schedule()}mutate(t){this.mutateQueue.push(t),this.schedule()}schedule(){this.scheduled||(this.scheduled=!0)}flush(){if(!this.scheduled)return;let t=this.measureQueue;this.measureQueue=[];for(let r=0;r<t.length;r++)try{t[r]()}catch(i){console.error("Error in frameDOM measure task:",i)}let e=this.mutateQueue;this.mutateQueue=[];for(let r=0;r<e.length;r++)try{e[r]()}catch(i){console.error("Error in frameDOM mutate task:",i)}this.scheduled=!1}},U=new pi;var is=20,rt={MANUAL_COLS_KEY:"masonry-manual-cols",MANUAL_GAP_KEY:"masonry-manual-gap",DEFAULT_DURATION:600,DEFAULT_EASING:"cubic-bezier(0.25, 1, 0.5, 1)"};function Ni(d){if(!d)return rt.DEFAULT_DURATION;let t=parseFloat(d);return isNaN(t)?rt.DEFAULT_DURATION:t}function Ne(d,t){let e=[...d].sort((i,n)=>n.breakpoint-i.breakpoint),r=e.find(i=>t>=i.breakpoint);return r?r.value:e[e.length-1]?.value}var ze=class extends x{states=new WeakMap;constructor(t){super(t),this.htmlKey="masonry",this.attributesToMap.push({key:"masonry-cols",type:"breakpoint-dimension",fallback:"2|640:3|1024:4"},{key:"masonry-gap",type:"breakpoint-dimension",fallback:"16|640:24|1024:32"},{key:"masonry-mode",type:"string",fallback:"auto"})}parseEasing(t){return this.tools.easingFunction.process({easing:t||rt.DEFAULT_EASING})}onObjectConnected(t){super.onObjectConnected(t);let e=t.htmlElement;L.begin(),L.setProps(e,{position:"relative",boxSizing:"border-box"}),L.commit();let r=this.createState(t,e);this.states.set(t,r),this.attachImgLoaders(t,r,e),this.scheduleLayout(t,!1,"init");let i=t.id;this.events.on(`masonry:update:${i}`,n=>{n.mode&&t.setProperty("masonry-mode",n.mode),n.cols!==void 0&&t.setProperty(rt.MANUAL_COLS_KEY,Number(n.cols)),n.gap!==void 0&&t.setProperty(rt.MANUAL_GAP_KEY,Number(n.gap)),this.scheduleLayout(t,!0,"external-event")})}onFrame(t){let e=t.time.now;this.objectsOnPage.forEach(r=>{let i=this.states.get(r);if(!i||!i.isAnimating)return;let n=0;L.run(()=>{if(i.isAnimatingHeight){let s=e-i.heightStartTime,o=Math.min(1,s/i.heightDuration),a=i.heightEase(o),l=i.startHeight+(i.targetHeight-i.startHeight)*a;L.setProps(r.htmlElement,{height:`${l}px`}),o<1?n++:i.isAnimatingHeight=!1}i.items.forEach((s,o)=>{if(!s.isMoving)return;let a=e-s.startTime,l=a*s.invPosDur,c=l>1?1:l,u=s.posEase(c);s.cx=s.sx+s.dx*u,s.cy=s.sy+s.dy*u;let p=a*s.invSizeDur,g=p>1?1:p,m=s.sizeEase(g);s.cw=s.sw+s.dw*m,L.setProps(o,{transform:`translate3d(${s.cx}px, ${s.cy}px, 0)`,...Math.abs(s.dw)>.05?{width:`${s.cw}px`}:{},willChange:"transform, width"}),c<1||g<1?n++:(s.isMoving=!1,L.setProps(o,{transform:`translate3d(${s.tx}px, ${s.ty}px, 0)`,width:`${s.tw}px`,willChange:"auto"}),s.cx=s.tx,s.cy=s.ty,s.cw=s.tw)})}),n===0&&this.handleAnimationEnd(r,i,e)})}onResize(){this.data.system.suppressMasonryResize||this.objectsOnPage.forEach(t=>{this.states.has(t)&&this.scheduleLayout(t,!0,"window-resize")})}cleanupObject(t){let e=this.states.get(t);e&&(e.ro.disconnect(),e.mo.disconnect(),e.resizeDebounceId&&clearTimeout(e.resizeDebounceId),this.states.delete(t))}createState(t,e){let r=e.getBoundingClientRect(),i=o=>{if(!o.length)return;let a=o[0].contentRect,l=this.states.get(t);if(!l||Math.abs(a.width-l.lastObservedWidth)<=.5&&Math.abs(a.height-l.lastObservedHeight)<=.5)return;l.lastObservedWidth=a.width,l.lastObservedHeight=a.height;let c=getComputedStyle(e),u=parseFloat(c.paddingLeft)||0,p=parseFloat(c.paddingRight)||0,g=a.width-u-p;if(g<=0)return;let{columns:m,gap:h}=this.getGridSettings(t),f=(g-h*(m-1))/m;m===l.lastLayoutColumns&&h===l.lastLayoutGap&&Math.abs(f-l.lastLayoutColumnWidth)<=.5||(l.resizeDebounceId&&window.clearTimeout(l.resizeDebounceId),l.resizeDebounceId=window.setTimeout(()=>{l.isResizing=!0,this.scheduleLayout(t,!0,"resize-observer"),l.isResizing=!1},is))},n=o=>{let a=this.states.get(t);if(!a)return;let l=!1;for(let c of o)c.removedNodes.length&&c.removedNodes.forEach(u=>{if(u.nodeType===1){let p=u;this.cleanupImgListeners(a,p),a.items.delete(p),l=!0}}),c.addedNodes.length&&c.addedNodes.forEach(u=>{u.nodeType===1&&(this.attachImgLoaders(t,a,u),l=!0)});l&&this.scheduleLayout(t,!0,"mutation-observer")},s={ro:new ResizeObserver(i),mo:new MutationObserver(n),isResizing:!1,lastObservedWidth:r.width,lastObservedHeight:r.height,lastLayoutColumns:0,lastLayoutGap:0,lastLayoutColumnWidth:-1,lastChildrenHash:0,lastHeightsHash:0,childIds:new WeakMap,nextChildId:1,imgUnsubs:new WeakMap,layoutScheduled:!1,items:new Map,startHeight:e.offsetHeight,targetHeight:e.offsetHeight,heightStartTime:0,heightDuration:rt.DEFAULT_DURATION,heightEase:this.parseEasing(null),isAnimatingHeight:!1,isAnimating:!1,pendingHeight:void 0,pendingHeightAnimate:!1,expectedEndTime:0};return s.ro.observe(e),s.mo.observe(e,{childList:!0}),s}handleAnimationEnd(t,e,r){if(e.pendingHeight!==void 0){let i=e.pendingHeight,n=e.pendingHeightAnimate;if(e.pendingHeight=void 0,e.pendingHeightAnimate=!1,n){e.startHeight=t.htmlElement.offsetHeight,e.targetHeight=i,e.heightStartTime=r,e.heightDuration=rt.DEFAULT_DURATION,e.heightEase=this.parseEasing(null),e.isAnimatingHeight=!0,e.isAnimating=!0;return}L.run(()=>{L.setProps(t.htmlElement,{height:`${i}px`})})}e.isAnimating&&this.events.emit("masonry:shuffle:end",{object:t}),e.isAnimating=!1,this.objectManager.refreshLayoutForRoot(t.htmlElement),e.endTimerId&&(window.clearTimeout(e.endTimerId),e.endTimerId=void 0),requestAnimationFrame(()=>{this.events.emit("resize",!0)})}scheduleLayout(t,e,r){let i=this.states.get(t);!i||i.layoutScheduled||(i.layoutScheduled=!0,U.measure(()=>{i.layoutScheduled=!1,this.performSyncLayout(t,i,e,r)}))}performSyncLayout(t,e,r,i){let n=t.htmlElement,s=Array.from(n.children);if(s.length===0)return;let o=n.getBoundingClientRect(),a=getComputedStyle(n),l=parseFloat(a.paddingLeft)||0,c=parseFloat(a.paddingRight)||0,u=parseFloat(a.paddingTop)||0,p=o.width-l-c;if(p<=0)return;let{columns:g,gap:m}=this.getGridSettings(t),h=(p-m*(g-1))/g,b=(t.getProperty("masonry-mode")||"auto")==="auto"&&r&&!e.isResizing&&i!=="window-resize"&&i!=="resize-observer",y=g===e.lastLayoutColumns&&m===e.lastLayoutGap&&Math.abs(h-e.lastLayoutColumnWidth)<=.5,v=0;s.forEach(k=>{let O=e.childIds.get(k);O||(O=e.nextChildId++,e.childIds.set(k,O)),v=v*31+O>>>0}),e.lastLayoutColumns=g,e.lastLayoutGap=m,e.lastLayoutColumnWidth=h,e.lastChildrenHash=v;let S=new Map;r&&s.forEach(k=>{let O=e.items.get(k);O&&S.set(k,O.cw)}),L.begin(),s.forEach(k=>{L.setProps(k,{position:"absolute",top:"0",left:"0",width:`${h}px`})}),L.commit();let E=s.map(k=>k.offsetHeight),M=0;E.forEach(k=>M=M*31+Math.round(k*2)>>>0),e.lastHeightsHash=M,r&&S.size>0&&L.run(()=>{S.forEach((k,O)=>{L.setProps(O,{width:`${k}px`})})});let C=new Array(g).fill(0),A=performance.now(),I=!1,H=0;s.forEach((k,O)=>{let T=E[O],P=0,R=C[0];for(let Y=1;Y<g;Y++)C[Y]<R&&(R=C[Y],P=Y);let B=P*(h+m)+l,W=R+u,N=h;C[P]=R+T+m;let z=Ni(k.getAttribute("string-masonry-position-time")),nt=Ni(k.getAttribute("string-masonry-size-time")),yt=z>0?1/z:1e3,st=nt>0?1/nt:1e3,dt=this.parseEasing(k.getAttribute("string-masonry-position-easing")),xt=this.parseEasing(k.getAttribute("string-masonry-size-easing")),D=e.items.get(k);if(D)Math.abs(D.tx-B)+Math.abs(D.ty-W)+Math.abs(D.tw-N)>.5&&(D.sx=D.cx,D.sy=D.cy,D.sw=D.cw,D.tx=B,D.ty=W,D.tw=N,D.dx=D.tx-D.sx,D.dy=D.ty-D.sy,D.dw=D.tw-D.sw,D.posEase=dt,D.invPosDur=yt,D.sizeEase=xt,D.invSizeDur=st,D.startTime=A,D.isMoving=!0,I=!0,H=Math.max(H,z,nt));else{let Y=B,ct=r?W+30:W;D={sx:Y,sy:ct,sw:N,tx:B,ty:W,tw:N,dx:0,dy:0,dw:0,cx:Y,cy:ct,cw:N,startTime:A,posEase:dt,invPosDur:yt,sizeEase:xt,invSizeDur:st,isMoving:r},e.items.set(k,D),r?(D.dx=D.tx-D.sx,D.dy=D.ty-D.sy,D.dw=D.tw-D.sw,I=!0,H=Math.max(H,z,nt)):L.run(()=>{L.setProps(k,{transform:`translate3d(${B}px, ${W}px, 0)`,width:`${N}px`,willChange:"auto"})})}});let w=Math.max(...C);if(Math.abs(e.targetHeight-w)>1)if(r){let k=n.getBoundingClientRect(),O=this.data.viewport.windowHeight;var _=!1;if(k.bottom>=-100&&k.bottom<=O+100){let T=k.top+w-O;if(Math.abs(T)>1&&w<n.offsetHeight){let P=k.top+this.data.scroll.current+w-O;this.events.emit("scrollTo",P),_=!0}}w>=e.targetHeight?(b?(e.startHeight=n.offsetHeight,e.heightStartTime=A,e.heightDuration=rt.DEFAULT_DURATION,e.heightEase=this.parseEasing(null),e.isAnimatingHeight=!0):L.run(()=>{L.setProps(t.htmlElement,{height:`${w}px`}),requestAnimationFrame(()=>{this.events.emit("resize",!0)})}),e.targetHeight=w,e.pendingHeight=void 0):(e.pendingHeight=w,e.pendingHeightAnimate=b,e.targetHeight=w,_||L.run(()=>{L.setProps(t.htmlElement,{height:`${w}px`}),requestAnimationFrame(()=>{this.events.emit("resize",!0)})})),I=!0}else e.targetHeight=w,e.pendingHeight=void 0,L.run(()=>{L.setProps(t.htmlElement,{height:`${w}px`})});I&&(e.isAnimating||this.events.emit("masonry:shuffle:start",{object:t}),e.isAnimating=!0,H>0&&(e.expectedEndTime=A+H+32,e.endTimerId&&window.clearTimeout(e.endTimerId),e.endTimerId=window.setTimeout(()=>{e.isAnimating&&(e.pendingHeight!==void 0||e.isAnimatingHeight||(this.events.emit("masonry:shuffle:end",{object:t}),e.isAnimating=!1,e.endTimerId=void 0))},H+50)))}getGridSettings(t){let e=this.data.viewport.windowWidth;if((t.getProperty("masonry-mode")||"auto")==="manual"){let s=t.getProperty(rt.MANUAL_COLS_KEY),o=t.getProperty(rt.MANUAL_GAP_KEY),a=t.getProperty("masonry-cols")||[],l=t.getProperty("masonry-gap")||[];return{columns:Math.max(1,Math.round(s??Ne(a,e)??2)),gap:Math.max(0,o??Ne(l,e)??16)}}let i=t.getProperty("masonry-cols")||[{breakpoint:0,value:2}],n=t.getProperty("masonry-gap")||[{breakpoint:0,value:16}];return{columns:Math.max(1,Math.round(Ne(i,e)??2)),gap:Math.max(0,Ne(n,e)??16)}}attachImgLoaders(t,e,r){(r.tagName==="IMG"?[r]:Array.from(r.querySelectorAll("img"))).forEach(n=>{let s=n;if(s.complete||e.imgUnsubs.has(s))return;let o=()=>{this.scheduleLayout(t,!0,"img-load"),this.cleanupImgListeners(e,s)};s.addEventListener("load",o),s.addEventListener("error",o),e.imgUnsubs.set(s,()=>{s.removeEventListener("load",o),s.removeEventListener("error",o)})})}cleanupImgListeners(t,e){let r=i=>{let n=t.imgUnsubs.get(i);n&&(n(),t.imgUnsubs.delete(i))};e.tagName==="IMG"?r(e):e.querySelectorAll("img").forEach(i=>r(i))}};var Ge=class extends x{constructor(t){super(t),this.htmlKey="magnetic",this._type=2,this.cssProperties=[{name:"--magnetic-x",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--magnetic-y",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--magnetic-target-x",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--magnetic-target-y",syntax:"<number>",initialValue:"0",inherits:!0}],this.permissions.mobile.rebuild.height=!1,this.permissions.mobile.rebuild.width=!1,this.permissions.mobile.rebuild.scrollHeight=!1,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("magnetic-active",!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("magnetic-lerp",.1),e.setProperty("event-magnetic-name",this.getObjectEventName(e,"magnetic:move")),e.setProperty("__next-magnetic-x",0),e.setProperty("__next-magnetic-y",0),e.setProperty("__needs-magnetic-update",!1)}onMouseMove(t){for(let e=0;e<this.objects.length;e++){let r=this.objects[e],n=r.htmlElement.getBoundingClientRect(),s=n.left+n.width/2,o=n.top+n.height/2,a=t.clientX-s,l=t.clientY-o,c=Math.sqrt(a**2+l**2),u=r.getProperty("radius")??0,p=r.getProperty("strength")??0,g=this.tools.magneticPull.process({distance:c,radius:u,strength:p});r.setProperty("magnetic-target-x",a*g),r.setProperty("magnetic-target-y",l*g),g>0&&r.setProperty("magnetic-active",!0)}}onFrame(t){for(let e=0;e<this.objects.length;e++){let r=this.objects[e];if(r.getProperty("magnetic-active")===!0){let i=r.getProperty("magnetic-x")??0,n=r.getProperty("magnetic-y")??0,s=r.getProperty("magnetic-lerp")??.1,o=r.getProperty("magnetic-target-x")??0,a=r.getProperty("magnetic-target-y")??0,l=this.tools.lerp.process({from:i,to:o,progress:s}),c=this.tools.lerp.process({from:n,to:a,progress:s});l>-.01&&l<.01&&(l=0,r.setProperty("magnetic-x",o)),c>-.01&&c<.01&&(c=0,r.setProperty("magnetic-y",a)),i+=l,n+=c,r.setProperty("magnetic-x",i),r.setProperty("magnetic-y",n);let u=r.getProperty("event-magnetic-name");u&&this.events.emit(u,{x:i,y:n}),r.setProperty("__next-magnetic-x",i),r.setProperty("__next-magnetic-y",n),r.setProperty("__needs-magnetic-update",!0),o===i&&a===n&&r.setProperty("magnetic-active",!1)}}}onMutate(){for(let t=0;t<this.objects.length;t++){let e=this.objects[t];if(!(e.getProperty("__needs-magnetic-update")===!0))continue;let i=e.getProperty("__next-magnetic-x")??e.getProperty("magnetic-x")??0,n=e.getProperty("__next-magnetic-y")??e.getProperty("magnetic-y")??0;this.applyToElementAndConnects(e,s=>{L.setVar(s,"--magnetic-x",i),L.setVar(s,"--magnetic-y",n)}),e.setProperty("__needs-magnetic-update",!1)}}};var kt=class extends x{nearOnly=!0;useAllObjects=!1;maxDistanceMultiplier=1;updateThreshold=.1;enabled=!0;constructor(t){super(t),_e()&&(this.enabled=!1)}onObjectConnected(t){this.enabled&&(super.onObjectConnected(t),this.centers.attach(t),this.hover.track(t))}removeObject(t){if(!this.enabled)return super.removeObject(t);let e=this.objectMapOnPage.get(t);e&&(this.centers.detach(e),this.hover.untrack(e)),super.removeObject(t)}onScroll(){this.enabled&&(this.centers.invalidateAll(),this.scheduleCursorUpdate())}onMouseMoveMeasure(t){this.enabled&&(super.onMouseMoveMeasure(t),this.refreshPointerState())}onScrollMeasure(t){this.enabled&&(super.onScrollMeasure(t),this.refreshPointerState())}getCursorTargets(t=!1){if(!this.enabled)return[];let e=this.hover.activeObjects();return this.nearOnly&&e.length?e:this.useAllObjects?this.objectsOnPage:this.objects.length>0?this.objects:t?this.objectsOnPage:this.objects}refreshPointerState(t,e=!1){if(!this.enabled)return;let r=this.data.cursor.targetX,i=this.data.cursor.targetY,n=t?[t]:this.getCursorTargets(e),s=!this.nearOnly&&this.maxDistanceMultiplier>0?Math.pow(this.data.viewport.windowWidth*this.maxDistanceMultiplier,2):null;for(let o of n){let{cx:a,cy:l}=this.centers.getCenter(o),c=r-a,u=i-l,p=c*c+u*u;if(this.nearOnly){if(p>this.data.viewport.windowWidth*this.data.viewport.windowWidth&&!this.hover.isActive(o))continue}else if(s!==null&&p>s)continue;o.setProperty("dx",c),o.setProperty("dy",u),o.setProperty("dist",Math.sqrt(p))}}scrollUpdateScheduled=!1;scheduleCursorUpdate(){!this.enabled||this.scrollUpdateScheduled||(this.scrollUpdateScheduled=!0,U.measure(()=>{this.refreshPointerState(),U.mutate(()=>{this.scrollUpdateScheduled=!1,L.run(()=>{this.onCursorScrollUpdate()})})}))}onCursorScrollUpdate(){}};var gi=Math.PI*2,ns=180/Math.PI,Gi=d=>d<0?0:d>1?1:d,ss=(d,t)=>{let e=(t-d)%gi;return e>Math.PI&&(e-=gi),e<-Math.PI&&(e+=gi),d+e},os={computeStep(d,t,e,r,i,n,s,o,a,l,c,u,p,g,m,h,f){let b=a;(h===1||e>r)&&(b=Math.atan2(t,d));let y=i>0?Math.min(e,i):e,v=s,S=o;if(g===1)v=b,S=y;else{let A=ss(s,b),I=Gi(n);v+=(A-v)*I,S+=(y-S)*I}let E=v*ns-90,M=m===1||Number.isNaN(l)||Math.abs(E-l)>u,C=m===1||Number.isNaN(c)||Math.abs(S-c)>p;f.angle=v,f.dist=S,f.tAngle=b,f.tDist=y,f.degRaw=E,f.cssDeg=Math.round(E*10)/10,f.cssDist=Math.round(S*10)/10,f.angleChanged=M?1:0,f.distChanged=C?1:0}},as={bypassDeadzone:!0},ls={forceImmediate:!0,forceEmit:!0,bypassDeadzone:!0},zi=new WeakMap,ds=d=>{let t=zi.get(d);return t||(t={angle:0,dist:0,tAngle:0,tDist:0,prevDeg:NaN,prevDist:NaN},zi.set(d,t)),t},$e=class extends kt{stepResult={angle:0,dist:0,tAngle:0,tDist:0,degRaw:0,cssDeg:0,cssDist:0,angleChanged:0,distChanged:0};constructor(t){super(t),this.htmlKey="spotlight",this.cssProperties=[{name:"--spotlight-angle",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--spotlight-distance",syntax:"<number>",initialValue:"0",inherits:!0}],this.nearOnly=!1,this.useAllObjects=!1,this.maxDistanceMultiplier=1,this.attributesToMap.push({key:"lerp",type:"number",fallback:this.settings.lerp,transform:e=>Gi(this.tools.adaptiveLerp.process({value:e,inMin:.1,inMax:1,outMin:.05,outMax:.65}))},{key:"angle-threshold",type:"number",fallback:.2},{key:"distance-threshold",type:"number",fallback:.5},{key:"deadzone",type:"number",fallback:4},{key:"dist-max",type:"number",fallback:0})}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i),e.setProperty("spotlight-angle-rad",0),e.setProperty("spotlight-distance",0),e.setProperty("spotlight-angle-rad-target",0),e.setProperty("spotlight-distance-target",0),U.measure(()=>{this.refreshPointerState(e,!0),U.mutate(()=>{L.run(()=>{this.updateSpotlightState(e,ls)})})})}onMutate(t){if(this.enabled){super.onMutate(t);let e=this.getCursorTargets(!1),r=e.length>0?e:this.getCursorTargets(!0);for(let i=0;i<r.length;i++){let n=r[i];this.updateSpotlightState(n)}}}onCursorScrollUpdate(){let t=this.getCursorTargets(!1),e=t.length>0?t:this.getCursorTargets(!0);for(let r=0;r<e.length;r++){let i=e[r];this.updateSpotlightState(i,as)}}updateSpotlightState(t,e={}){let r=t.getProperty("dx"),i=t.getProperty("dy"),n=t.getProperty("dist");if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(n))return;let s=ds(t);os.computeStep(r,i,n,t.getProperty("deadzone")??4,t.getProperty("dist-max")??0,t.getProperty("lerp")??.15,s.angle,s.dist,s.tAngle,s.prevDeg,s.prevDist,t.getProperty("angle-threshold")??.2,t.getProperty("distance-threshold")??.5,e.forceImmediate===!0?1:0,e.forceEmit===!0?1:0,e.bypassDeadzone===!0?1:0,this.stepResult),s.angle=this.stepResult.angle,s.dist=this.stepResult.dist,s.tAngle=this.stepResult.tAngle,s.tDist=this.stepResult.tDist,t.setProperty("spotlight-distance-target",s.tDist),t.setProperty("spotlight-angle-rad-target",s.tAngle),t.setProperty("spotlight-angle-rad",s.angle),t.setProperty("spotlight-distance",s.dist),(this.stepResult.angleChanged===1||this.stepResult.distChanged===1)&&(this.writeSpotlightVars(t,this.stepResult.cssDeg,this.stepResult.cssDist),s.prevDeg=this.stepResult.degRaw,s.prevDist=s.dist,this.events.emit(this.getObjectEventName(t,"spotlight:update"),{distance:this.stepResult.cssDist,angleDeg:this.stepResult.cssDeg}))}writeSpotlightVars(t,e,r){let i=()=>{this.applyToElementAndConnects(t,n=>{L.setVar(n,"--spotlight-angle",e),L.setVar(n,"--spotlight-distance",r)})};if(L.isOpen){i();return}L.run(i)}};var $i="-aspect-ready";function cs(d){if(!d)return!1;let t=d.toLowerCase();return!!(t.endsWith(".svg")||t.startsWith("data:image/svg"))}function Ui(d){let t=new DataView(d);return d.byteLength<28?{width:0,height:0}:t.getUint32(0)!==2303741511||t.getUint32(4)!==218765834?{width:0,height:0}:t.getUint32(8)!==13||t.getUint32(12)!==1229472850?{width:0,height:0}:{width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}function ji(d){let t=new DataView(d);if(t.getUint16(0)!==65496)return{width:0,height:0};let e=2;for(;e+9<d.byteLength;){let r=t.getUint16(e);if(e+=2,r===65498||r===65497)break;let i=t.getUint16(e);if(i<2||e+i>d.byteLength)break;if(r>=65472&&r<=65475||r>=65477&&r<=65479||r>=65481&&r<=65483||r>=65485&&r<=65487)return{height:t.getUint16(e+3),width:t.getUint16(e+5)};e+=i}return{width:0,height:0}}function Yi(d){let t=new DataView(d);if(d.byteLength<16)return{width:0,height:0};if(t.getUint32(0,!0)!==1179011410||t.getUint32(8,!0)!==1346520407)return{width:0,height:0};let e=12;for(;e+8<=d.byteLength;){let r=t.getUint32(e,!1),i=t.getUint32(e+4,!0),n=e+8;if(r===1448097880){let s=(t.getUint16(n+4,!0)|t.getUint8(n+6)<<16)+1,o=(t.getUint16(n+7,!0)|t.getUint8(n+9)<<16)+1;return{width:s,height:o}}if(r===1448097824&&n+10<=d.byteLength&&t.getUint8(n+3)===157&&t.getUint8(n+4)===1&&t.getUint8(n+5)===42){let s=t.getUint16(n+6,!0)&16383,o=t.getUint16(n+8,!0)&16383;return{width:s,height:o}}if(r===1448097868&&n+5<=d.byteLength&&t.getUint8(n)===47){let s=t.getUint8(n+1),o=t.getUint8(n+2),a=t.getUint8(n+3),l=t.getUint8(n+4),c=1+((o&63)<<8|s),u=1+((l&15)<<10|a<<2|(o&192)>>6);return{width:c,height:u}}e=n+i+(i&1)}return{width:0,height:0}}function qi(d,t){let e=(t||"").toLowerCase();if(e.includes("png"))return Ui(d);if(e.includes("jpeg")||e.includes("jpg"))return ji(d);if(e.includes("webp"))return Yi(d);let r=Ui(d);return r.width||(r=ji(d),r.width)||(r=Yi(d),r.width)?r:{width:0,height:0}}async function us(d,t,e){let r=await fetch(d,{mode:"cors",credentials:t?.credentials??"omit",referrerPolicy:t?.referrerPolicy,signal:t?.signal,cache:"default"});if(!r.ok||!r.body)throw new Error(`HTTP ${r.status}`);let i=r.headers.get("content-type"),n=r.body.getReader(),s=1048576,o=4096,a=new Uint8Array(s),l=0,c=0,u=[],p=null,g=!1;for(;;){let{done:f,value:b}=await n.read();if(f)break;if(!b)continue;let y=b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength);if(u.push(y),!p&&l<s){let v=Math.min(b.byteLength,s-l);if(v>0&&(a.set(b.subarray(0,v),l),l+=v),l-c>=o){let S=l===a.byteLength?a:a.slice(0,l),E=qi(S.buffer,i);E.width&&E.height&&(p=E,!g&&e&&(e(p),g=!0)),c=l}}}if(!p){let f=await new Response(new Blob(u)).arrayBuffer(),b=qi(f,i);b.width&&b.height&&(p=b,!g&&e&&(e(p),g=!0))}let m=new Blob(u,{type:i||"application/octet-stream"}),h=URL.createObjectURL(m);return{dims:p,blobUrl:h,contentType:i}}var Ue=class extends x{isStartLoaded=!1;loadingCount=0;imageStates=new WeakMap;constructor(t){super(t),this.htmlKey="lazy"}onInit(){document.querySelectorAll("img[string-lazy], img[data-string-lazy]").forEach(e=>this.ensureState(e)),this.isStartLoaded=!0}onObjectConnected(t){let e=t.htmlElement;if(!(e instanceof HTMLImageElement))return;e.getAttribute("src")||e.setAttribute("src","data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1' height='1' viewBox='0 0 1 1'%3E%3C/svg%3E");let r=this.ensureState(e);!r.aspectReady&&!r.aspectLoading&&this.prepareAspectRatio(e);let i=s=>{this.handleInView(e,r,!!s?.inView)};r.unsubscribe&&r.unsubscribe();let n=this.getObjectEventName(t,"object:inview");this.events.on(n,i),r.unsubscribe=()=>this.events.off(n,i),this.isStartLoaded&&(t.getProperty("is-inview")??!1)&&this.handleInView(e,r,!0)}onObjectDisconnected(t){let e=t.htmlElement;if(!(e instanceof HTMLImageElement))return;let r=this.imageStates.get(e);r&&(r.pendingActivation=!1,r.controller&&r.controller.abort(),r.blobUrl&&URL.revokeObjectURL(r.blobUrl),r.unsubscribe&&(r.unsubscribe(),r.unsubscribe=void 0))}ensureState(t){let e=this.imageStates.get(t);if(!e){let r=this.readSource(t);return e={src:r,aspectReady:!1,contentReady:!1,aspectLoading:!1,contentLoading:!1,pendingActivation:!1,rangeAttempted:!1,fetching:!1},this.imageStates.set(t,e),t.classList.contains("lazyLoad")||t.classList.add("lazyLoad"),t.dataset&&!t.dataset.stringLazySrc&&r&&(t.dataset.stringLazySrc=r),e}return e.src||(e.src=this.readSource(t)),e}readSource(t){let e=this.tools.domAttribute.process({element:t,key:this.htmlKey,fallback:""});return typeof e=="string"?e:e==null?"":String(e)}handleInView(t,e,r){e.pendingActivation=r,r&&(e.aspectReady?this.maybeActivateImage(t,e):e.aspectLoading||this.prepareAspectRatio(t))}async prepareAspectRatio(t){let e=this.ensureState(t);if(!e.src||e.aspectLoading||e.aspectReady)return;if(cs(e.src)){e.aspectReady=!0,e.allowSrcFallback=!0,this.maybeActivateImage(t,e);return}e.aspectLoading=!0,e.fetching=!0;let r=t.getAttribute("crossorigin"),i=t.getAttribute("referrerpolicy"),n=new AbortController;e.controller=n;try{let{blobUrl:s}=await us(e.src,{credentials:r==="use-credentials"?"include":"omit",referrerPolicy:i||void 0,signal:n.signal},o=>{o.width>0&&o.height>0&&!e.aspectReady&&(t.style.aspectRatio=`${o.width} / ${o.height}`,t.classList.add($i),e.width=o.width,e.height=o.height,e.aspectReady=!0)});e.blobUrl=s,!e.aspectReady&&e.width&&e.height&&(t.style.aspectRatio=`${e.width} / ${e.height}`,t.classList.add($i),e.aspectReady=!0)}catch{e.allowSrcFallback=!0,e.aspectReady=!0}finally{e.fetching=!1,e.aspectLoading=!1,this.maybeActivateImage(t,e)}}maybeActivateImage(t,e){!e.pendingActivation||e.contentReady||e.contentLoading||!e.aspectReady||!e.src||e.fetching&&!e.blobUrl||(e.blobUrl||e.allowSrcFallback)&&this.activateImage(t,e)}activateImage(t,e){e.contentLoading=!0,this.loadingCount++;let r=s=>{e.contentLoading&&(e.contentLoading=!1,e.pendingActivation=!1,this.loadingCount=Math.max(0,this.loadingCount-1),s&&(e.contentReady=!0,t.classList.add("-loaded")),this.loadingCount===0&&this.events.emit("image:load:all",null))},i=()=>r(!0),n=()=>r(!1);t.addEventListener("load",i,{once:!0}),t.addEventListener("error",n,{once:!0}),t.decoding="async",t.loading=t.loading||"lazy",e.blobUrl?(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.src=e.blobUrl):t.src=e.src,t.complete&&t.naturalWidth>0&&t.naturalHeight>0&&(t.removeEventListener("load",i),t.removeEventListener("error",n),r(!0))}};var je=class extends x{loadingTimeout=0;constructor(t){super(t),this._type=2,this.loadingTimeout=this.settings.timeout}onInit(){setTimeout(()=>{document.documentElement.classList.add("-loaded")},this.loadingTimeout)}};var Ye=class extends x{constructor(t){super(t),this.htmlKey=""}canConnect(t){return t.keys[0]==null||t.getProperty("inview-fallback")===!0}};var Ot=class{min=void 0;max=void 0;enable=!0;constructor(t){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}},qe=class extends x{queries={0:new Ot({max:359}),1:new Ot({min:360,max:1023}),2:new Ot({min:1024,max:1365}),3:new Ot({min:1366})};isMobileMedia=!1;isTabletMedia=!1;isLaptopMedia=!1;isDesktopMedia=!1;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)};constructor(t){super(t),this._type=2}onConnect(){}onInit(){if(this.settings!=null&&this.settings.settings!=null){let t=this.settings.settings;t.mobile?(this.queries[0].enable=!0,this.queries[0].setRange(t.mobile.min==null?null:t.mobile.min,t.mobile.max??null),this.matchMedias[0]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[0].enable=!1,t.tablet?(this.queries[1].enable=!0,this.queries[1].setRange(t.tablet.min==null?null:t.tablet.min,t.tablet.max??null),this.matchMedias[1]=window.matchMedia(this.queries[1].mediaQuery)):this.queries[1].enable=!1,t.laptop?(this.queries[2].enable=!0,this.queries[2].setRange(t.laptop.min==null?null:t.laptop.min,t.laptop.max??null),this.matchMedias[2]=window.matchMedia(this.queries[2].mediaQuery)):this.queries[2].enable=!1,t.desktop?(this.queries[3].enable=!0,this.queries[3].setRange(t.desktop.min==null?null:t.desktop.min,t.desktop.max??null),this.matchMedias[3]=window.matchMedia(this.queries[3].mediaQuery)):this.queries[3].enable=!1}this.updateElements()}onResize(){this.updateElements()}updateElements(){let t=this.matchMedias[0].matches&&this.queries[0].enable,e=this.matchMedias[1].matches&&this.queries[1].enable,r=this.matchMedias[2].matches&&this.queries[2].enable,i=this.matchMedias[3].matches&&this.queries[3].enable;this.isMobileMedia!=t&&this.events.emit("screen:mobile",t),this.isTabletMedia!=e&&this.events.emit("screen:tablet",e),this.isLaptopMedia!=r&&this.events.emit("screen:laptop",r),this.isDesktopMedia!=i&&this.events.emit("screen:desktop",i),this.isMobileMedia=t,this.isTabletMedia=e,this.isLaptopMedia=r,this.isDesktopMedia=i,document.querySelectorAll("[string-mobile], [string-tablet], [string-laptop], [string-desktop]").forEach(s=>{let o=!1;s.hasAttribute("string-mobile")&&t&&(o=!0),s.hasAttribute("string-tablet")&&e&&(o=!0),s.hasAttribute("string-laptop")&&r&&(o=!0),s.hasAttribute("string-desktop")&&i&&(o=!0),o?s.style.display=null:s.style.display="none"})}};var Xe=class extends x{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,n=this.tools.originParser.process({value:r}),s=this.tools.originParser.process({value:i});return{x:n,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 ps=.05,gs=.01,Xi=1,hs=-1,ms=1,Ke=class extends x{defaultModeScope=["smooth"];previousLerp=0;displacement=0;acceleration=0;velocityMultiplier=.00125;isInitialScroll=!0;baseVelocityMultiplier=.00125;reducedVelocityMultiplier=this.baseVelocityMultiplier/20;negativeVelocityMultiplier=-1e-4;maxDisplacementValue=0;constructor(t){super(t),this.htmlKey="glide",this.cssProperties=[{name:"--glide",syntax:"<number>",initialValue:"0",inherits:!0}],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}]}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i),e.setProperty("glide-value",e.getProperty("glide")??0),e.setProperty("event-glide-name",this.getObjectEventName(e,"object:glide")),e.setProperty("__next-glide",0),e.setProperty("__next-glide-transform","translate3d(0, 0px, 0)"),e.setProperty("__needs-glide-var-update",!1),e.setProperty("__needs-glide-transform-update",!1)}setupItem=t=>{let e=t.getProperty("glide-value")??0,r=-this.data.scroll.displacement*this.maxDisplacementValue*e,i=t.getProperty("event-glide-name");i&&this.events.emit(i,r);let n=`translate3d(0, ${r}px, 0)`;t.setProperty("__next-glide-transform",n),t.setProperty("__needs-glide-transform-update",!0)};updateTransforms(){for(let t=0;t<this.objects.length;t++)this.setupItem(this.objects[t])}resetObjectStyles(t){for(let e=0;e<t.length;e++){let r=t[e];r.setProperty("__next-glide-transform","translate3d(0, 0px, 0)"),r.setProperty("__needs-glide-transform-update",!0),r.setProperty("__next-glide",0),r.setProperty("__needs-glide-var-update",!0)}}calcExpanderFactor(t){let e=t?this.data.scroll.lerped<this.previousLerp:this.data.scroll.lerped>this.previousLerp;this.velocityMultiplier=e?this.isInitialScroll?this.baseVelocityMultiplier:this.reducedVelocityMultiplier:this.negativeVelocityMultiplier,e||(this.isInitialScroll=!1)}onStart(){this.maxDisplacementValue=this.data.viewport.windowHeight*.1}onResize(){this.maxDisplacementValue=this.data.viewport.windowHeight*.1}resetState(){this.displacement=0,this.acceleration=0,this.isInitialScroll=!0,this.velocityMultiplier=this.baseVelocityMultiplier}onScrollStart(){this.resetState()}onScrollStop(){this.resetState(),this.previousLerp=0,this.data.scroll.displacement=0,this.resetObjectStyles(this.objects),this.flushPendingGlideStyles()}onFrame(t){this.calcExpanderFactor(this.data.scroll.isScrollingDown===!1),this.acceleration=Math.min(Xi,this.acceleration+ps),this.displacement=Math.max(gs,Math.min(Xi,this.displacement+this.velocityMultiplier)),this.data.scroll.displacement=Math.min(ms,Math.max(hs,this.data.scroll.lerped*this.displacement*this.acceleration));let e=this.data.scroll.displacement;for(let r=0;r<this.objects.length;r++){let i=this.objects[r];i.setProperty("__next-glide",e),i.setProperty("__needs-glide-var-update",!0)}this.previousLerp=this.data.scroll.lerped,this.updateTransforms()}onObjectModeDeactivated(t){super.onObjectModeDeactivated(t),this.resetObjectStyles([t]),L.run(()=>{this.applyPendingGlideStylesForObject(t)})}onMutate(){this.applyPendingGlideStyles()}applyPendingGlideStylesForObject(t){let e=t.getProperty("__next-glide")??0,r=t.getProperty("__next-glide-transform")??"translate3d(0, 0px, 0)";this.applyVarToElement(t,"--glide",e),this.applyVarToConnects(t,"--glide",e),this.applyPropToElement(t,"transform",r),t.setProperty("__needs-glide-var-update",!1),t.setProperty("__needs-glide-transform-update",!1)}applyPendingGlideStyles(){for(let t=0;t<this.objects.length;t++){let e=this.objects[t],r=e.getProperty("__needs-glide-var-update")===!0,i=e.getProperty("__needs-glide-transform-update")===!0;if(!(!r&&!i)){if(r){let n=e.getProperty("__next-glide")??this.data.scroll.displacement;this.applyVarToElement(e,"--glide",n),this.applyVarToConnects(e,"--glide",n),e.setProperty("__needs-glide-var-update",!1)}if(i){let n=e.getProperty("__next-glide-transform")??"translate3d(0, 0px, 0)";this.applyPropToElement(e,"transform",n),e.setProperty("__needs-glide-transform-update",!1)}}}}flushPendingGlideStyles(){if(L.isOpen){this.applyPendingGlideStyles();return}L.run(()=>{this.applyPendingGlideStyles()})}};var Ze=class extends x{hasInitializedCSS=!1;defaultModeScope=["smooth"];constructor(t){super(t),this.htmlKey="lerp",this.cssProperties=[{name:"--lerp",syntax:"<number>",initialValue:"0",inherits:!0}],this.attributesToMap=[]}onObjectConnected(t){super.onObjectConnected(t),t.setProperty("lerp-value",0),t.setProperty("lerp-applied",0),t.setProperty("event-lerp-name",this.getObjectEventName(t,"object:lerp"))}onResize(){super.onResize(),!this.hasInitializedCSS&&this.objectsOnPage.length>0&&(this.hasInitializedCSS=!0,L.run(()=>{for(let t=0;t<this.objectsOnPage.length;t++)this.updateObjectLerp(this.objectsOnPage[t],!0)}))}onScrollStop(){for(let t=0;t<this.objects.length;t++)this.recomputeLerp(this.objects[t],0)}onFrame(t){let e=t.scroll.lerped;for(let r=0;r<this.objects.length;r++)this.recomputeLerp(this.objects[r],e)}recomputeLerp(t,e){(t.getProperty("lerp-value")??0)!==e&&(t.setProperty("lerp-value",e),this.updateObjectLerp(t))}onMutate(){L.run(()=>{let t=this.objects.length;for(let e=0;e<t;e++)this.updateObjectLerp(this.objects[e])})}updateObjectLerp(t,e=!1){let r=t.getProperty("lerp-value")??0,i=t.getProperty("lerp-applied");if(!e&&i===r)return;t.setProperty("lerp-applied",r);let n=r?.toString()??"0",s=t.getProperty("event-lerp-name");s&&this.events.emit(s,r),L.run(()=>{this.applyVarToElement(t,"--lerp",n),this.applyVarToConnects(t,"--lerp",n)})}onObjectDisconnected(t){super.onObjectDisconnected(t);let e=i=>{i.style.removeProperty("--lerp")};e(t.htmlElement);let r=t.mirrorObjects;for(let i=0;i<r.length;i++)e(r[i].htmlElement)}};var Lt="__string-dev-progress-override",Ki={computeRawProgress(d,t,e){if(e===0)return 0;let r=(d-t)/e;return r<=0?0:r>=1?1:r},computeRawProgressBatch(d,t,e,r,i){for(let n=0;n<i;n++){let s=e[n];if(s===0){r[n]=0;continue}let o=(d-t[n])/s;o<=0?r[n]=0:o>=1?r[n]=1:r[n]=o}}},Dt=class extends x{updateScheduled=!1;batchStarts=new Float64Array(0);batchDiffs=new Float64Array(0);batchOut=new Float64Array(0);constructor(t){super(t),this.htmlKey="progress",this.cssProperties=[{name:"--progress",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--progress-slice",syntax:"<number>",initialValue:"0",inherits:!0}],this.attributesToMap=[...this.attributesToMap,{key:"easing",type:"easing",fallback:this.settings.easing},{key:"precision",type:"number",fallback:this.settings.precision??-1}]}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i)}sanitizeRawProgress(t){if(!Number.isFinite(t)||t<=0)return 0;if(t>=1)return 1;let e=1e-4;return t>1-e?t=1:t<e&&(t=0),t}resolveRawProgress(t,e,r,i){let n=t.getProperty(Lt);return n!=null?this.sanitizeRawProgress(n):Ki.computeRawProgress(e,r,i)}applyRawProgress(t,e){let r=this.sanitizeRawProgress(e),i=t.getProperty("easing"),n=typeof i=="function"?i(r):r,s=t.getProperty("precision")??-1,o=s>=0?Math.round(n*10**s)/10**s:n;t.getProperty("progress-value")!==o&&(t.setProperty("progress-raw",r),t.setProperty("progress-value",o))}recomputeProgress(t){let e=t.getProperty("start-position")??t.getProperty("progress-start-position")??0,r=t.getProperty("difference-position")??t.getProperty("progress-difference-position")??0;t.setProperty("progress-start-position",e),t.setProperty("progress-difference-position",r);let i=this.resolveRawProgress(t,this.data.scroll.transformedCurrent,e,r);this.applyRawProgress(t,i)}ensureBatchCapacity(t){this.batchStarts.length>=t||(this.batchStarts=new Float64Array(t),this.batchDiffs=new Float64Array(t),this.batchOut=new Float64Array(t))}calculatePositions(t,e){super.calculatePositions(t,e),t.setProperty("progress-start-position",t.getProperty("start-position")??t.getProperty("progress-start-position")??0),t.setProperty("progress-difference-position",t.getProperty("difference-position")??t.getProperty("progress-difference-position")??0),this.recomputeProgress(t)}onScroll(t){super.onScroll(t)}onObjectConnected(t){super.onObjectConnected(t)}onScrollMeasure(t){let e=this.objects.length;if(e!==0){this.ensureBatchCapacity(e);for(let r=0;r<e;r++){let i=this.objects[r],n=i.getProperty("start-position")??i.getProperty("progress-start-position")??0,s=i.getProperty("difference-position")??i.getProperty("progress-difference-position")??0;i.setProperty("progress-start-position",n),i.setProperty("progress-difference-position",s),this.batchStarts[r]=n,this.batchDiffs[r]=s}Ki.computeRawProgressBatch(this.data.scroll.transformedCurrent,this.batchStarts,this.batchDiffs,this.batchOut,e);for(let r=0;r<e;r++){let i=this.objects[r],n=i.getProperty(Lt),s=n!=null?this.sanitizeRawProgress(n):this.batchOut[r];this.applyRawProgress(i,s)}}}onMutate(){L.run(()=>{let t=this.objects.length;for(let e=0;e<t;e++)this.updateObjectProgress(this.objects[e])})}updateObjectProgress(t){let e=t.getProperty("progress-value")??0;if(t.getProperty("progress-applied")===e)return;let i=t.getProperty("key"),n=t.getProperty("precision")??-1;t.setProperty("progress-applied",e);let s=t.getProperty("progress-raw")??e,o=t.getProperty("easing"),a=t.getProperty("event-progress-name")??t.getScopedEventName("object:progress");t.setProperty("event-progress-name",a),a&&this.events.emit(a,e),this.emitSignal(t,"progress",e),i&&this.applyVarToElement(t,i,e);for(let l=0;l<t.mirrorObjects.length;l++){let c=t.mirrorObjects[l],u=c.applyProgress(s,typeof o=="function"?o:void 0),p=n>=0?Math.round(u*10**n)/10**n:u;c.setProperty("progress",p),i&&this.tools.styleTxn.setVar(c.htmlElement,i,p)}}onObjectDisconnected(t){super.onObjectDisconnected(t);let e=t.getProperty("key");if(!e)return;let r=n=>{n.style.removeProperty(e)};r(t.htmlElement);let i=t.mirrorObjects;for(let n=0;n<i.length;n++)r(i[n].htmlElement)}};var Qe=class extends Dt{defaultModeScope=["smooth"];updateScheduledTransform=!1;calculateParallaxForObject;constructor(t){super(t),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"]}],this.calculateParallaxForObject=this.calculateParallax}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i);let n=e.getProperty("parallax-bias")??0,s=Math.abs(e.getProperty("parallax")??.2);e.setProperty("parallax-sign",Math.sign(e.getProperty("parallax"))),e.setProperty("parallax",s),e.setProperty("parallax-position-start",-.5+.5*n),e.setProperty("parallax-position-end",.5+.5*(1-n));let o=this.data.viewport.windowHeight;e.setProperty("offset-top",s*o),e.setProperty("offset-bottom",s*o)}calculatePositions(t,e){super.calculatePositions(t,e),t.setProperty("parallax-transform-value",this.calculateParallaxForObject(t))}onScroll(t){super.onScroll(t)}onScrollMeasure(t){super.onScrollMeasure(t);for(let e=0;e<this.objects.length;e++){let r=this.objects[e];r.setProperty("parallax-transform-value",this.calculateParallaxForObject(r))}}onMutate(){L.run(()=>{for(let t=0;t<this.objects.length;t++){let e=this.objects[t],r=e.getProperty("progress-value")??0;e.getProperty("parallax-progress-applied")!==r&&(e.setProperty("parallax-transform-value",this.calculateParallaxForObject(e)),e.setProperty("parallax-progress-applied",r));let n=e.getProperty("parallax-transform-value");n&&(this.applyPropToElement(e,"transform",n.transform),this.applyPropToConnects(e,"transform",n.transform))}})}calculateParallax=t=>{let e=t.getProperty("progress-value")??0,r=t.getProperty("parallax")??0,i=t.getProperty("parallax-position-start")??0,n=t.getProperty("parallax-position-end")??1,s=t.getProperty("parallax-sign")??1,o=this.data.viewport.windowHeight/this.data.viewport.transformScale,a=s*r*(o*i+e*o*n);return this.events.emit(this.getObjectEventName(t,"object:parallax"),a),{transform:`translate3d(0, ${a}px, 0)`}}};var Je=class{scrollbar;thumb;isDragging=!1;onScrollTo;startY=0;startScrollPosition=0;data;constructor(t,e,r,i){this.data=t,this.scrollbar=e,this.thumb=r,this.onScrollTo=i}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,this.onScrollTo(r),this.updateThumb()}};var tr=class{scrollbar;thumb;isDragging=!1;onScrollTo;startCoordinate=0;startScrollPosition=0;data;constructor(t,e,r,i){this.data=t,this.scrollbar=e,this.thumb=r,this.onScrollTo=i}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,n=Math.max(0,Math.min(r,i));this.data.scroll.current=n,this.data.scroll.target=n,this.onScrollTo(n),this.updateThumb()}};var er=class extends x{scrollbar;thumb;scrollTimeout;isDragging=!1;scrollMode="smooth";mouseUpEventBind;mouseDownEventBind;mouseMoveEventBind;scrollbarState;scrollbarStateHorizontal;scrollbarStateVertical;requestScrollTo;constructor(t){super(t),this.mouseUpEventBind=this.mouseUpEvent.bind(this),this.mouseDownEventBind=this.mouseDownEvent.bind(this),this.mouseMoveEventBind=this.mouseMoveEvent.bind(this),this.requestScrollTo=e=>{this.events.emit("scrollTo",{position:e,immediate:!0})}}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(t){this.updateThumb(),this.showScrollbar(),this.hideScrollbar()}onResize(){this.scrollbarState.onResize()}onRebuild(){this.scrollbarState.onResize()}addCustomStyles(){let t=document.createElement("style");t.textContent=`
|
|
1
|
+
"use strict";var ai=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Xn=Object.getOwnPropertyNames;var Kn=Object.prototype.hasOwnProperty;var Zn=(l,t)=>{for(var e in t)ai(l,e,{get:t[e],enumerable:!0})},Qn=(l,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xn(t))!Kn.call(l,i)&&i!==e&&ai(l,i,{get:()=>t[i],enumerable:!(r=qn(t,i))||r.enumerable});return l};var Jn=l=>Qn(ai({},"__esModule",{value:!0}),l);var ga={};Zn(ga,{CursorReactiveModule:()=>kt,DOMBatcher:()=>Pt,GridAdapter:()=>G,ScrollController:()=>J,StringAnchor:()=>Xe,StringCursor:()=>Fe,StringData:()=>Gt,StringDelayLerpTracker:()=>lr,StringDevIconRegistry:()=>se,StringDevInview:()=>si,StringDevLayout:()=>jr,StringDevModule:()=>Z,StringDevOverlayRegistry:()=>_t,StringDevProgress:()=>oi,StringDevRulers:()=>ei,StringFPSTracker:()=>dr,StringForm:()=>mr,StringGlide:()=>Ke,StringImpulse:()=>Ve,StringLazy:()=>Ue,StringLerp:()=>Ze,StringLerpTracker:()=>cr,StringLoading:()=>je,StringMagnetic:()=>Ge,StringMarquee:()=>We,StringMasonry:()=>ze,StringModule:()=>x,StringObject:()=>Tt,StringParallax:()=>Qe,StringPositionTracker:()=>ur,StringProgress:()=>Dt,StringProgressPart:()=>wr,StringRandom:()=>Cr,StringResponsive:()=>qe,StringScrollContainer:()=>Mr,StringScrollbar:()=>er,StringScroller:()=>Er,StringSequence:()=>hr,StringSignal:()=>xr,StringSplit:()=>ar,StringSpotlight:()=>$e,StringTune:()=>Di,StringVideoAutoplay:()=>gr,buildDevtoolsThemeBlock:()=>yr,default:()=>Di,ensureStringDevtoolsSharedStyles:()=>Bt,frameDOM:()=>U,resolveDevtoolsIcon:()=>V,styleTxn:()=>L});module.exports=Jn(ga);var ye=class{context;SETTLE_THRESHOLD_SQ=.01;smoothingFactor;lastMouseX=0;lastMouseY=0;lastMouseTime=0;_lerpStepXArgs={from:0,to:0,progress:0};_lerpStepYArgs={from:0,to:0,progress:0};constructor(t=.1,e){this.smoothingFactor=t,this.context=e,this.onSettingsChange({isDesktop:e.data.viewport.windowWidth>1024,isForceRebuild:!1,widthChanged:!0,heightChanged:!0,scrollHeightChanged:!0})}onMouseMove(t){let e=this.context.data.cursor;e.targetX=t.clientX,e.targetY=t.clientY;let r=performance.now(),i=Math.max(1,r-this.lastMouseTime);e.velocityX=(t.clientX-this.lastMouseX)/i,e.velocityY=(t.clientY-this.lastMouseY)/i,this.lastMouseX=t.clientX,this.lastMouseY=t.clientY,this.lastMouseTime=r}onFrame(){let t=this.context.data.cursor,e=t.targetX,r=t.targetY,i=t.smoothedX,n=t.smoothedY;this._lerpStepXArgs.from=i,this._lerpStepXArgs.to=e,this._lerpStepXArgs.progress=this.smoothingFactor,this._lerpStepYArgs.from=n,this._lerpStepYArgs.to=r,this._lerpStepYArgs.progress=this.smoothingFactor;let s=this.context.tools.lerp.process(this._lerpStepXArgs),o=this.context.tools.lerp.process(this._lerpStepYArgs);s*s+o*o<this.SETTLE_THRESHOLD_SQ?(t.smoothedX=e,t.smoothedY=r,t.stepX=0,t.stepY=0):(t.smoothedX+=s,t.smoothedY+=o,t.stepX=s,t.stepY=o)}onSettingsChange(t){let e=Number(this.context.settings["cursor-lerp"]);this.setLerpFactor(e)}setLerpFactor(t){this.smoothingFactor=this.context.tools.adaptiveLerp.process({value:t,inMin:.1,inMax:1,outMin:.05,outMax:.65})}};var Ct=class{listeners={};stateEvents=new Set;lastPayloads={};constructor(){this.stateEvents.add("screen:mobile"),this.stateEvents.add("screen:tablet"),this.stateEvents.add("screen:laptop"),this.stateEvents.add("screen:desktop"),this.stateEvents.add("start")}registerStateEvent(t,e){this.stateEvents.add(t),e!==void 0&&(this.lastPayloads[t]=e)}on(t,e,r){let i=r?`${t}:${r}`:t;this.listeners[i]||(this.listeners[i]=new Set),this.listeners[i].add(e),this.stateEvents.has(i)&&this.lastPayloads[i]!==void 0&&e(this.lastPayloads[i])}off(t,e,r){let i=r?`${t}:${r}`:t;this.listeners[i]&&this.listeners[i].delete(e)}emit(t,e){this.stateEvents.has(t)&&(this.lastPayloads[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 Se=class{constructor(t){this.data=t}modules=[];uiModules=[];allModules=[];register(t){if(t.type===1?this.modules.push(t):t.type===2&&this.uiModules.push(t),t.cssProperties&&t.cssProperties.length>0&&typeof window.CSS<"u"&&"registerProperty"in window.CSS)for(let e=0;e<t.cssProperties.length;e++)try{window.CSS.registerProperty(t.cssProperties[e])}catch{}t.onSubscribe(),this.rebuildAllModules()}find(t){for(let e=0;e<this.allModules.length;e++){let r=this.allModules[e];if(r instanceof t)return r}}onInit(){this.callAll("onInit")}onFrame(){this.callAll("onFrame")}onMutate(){this.callAll("onMutate")}onScrollMeasure(){this.callAll("onScrollMeasure")}onMouseMoveMeasure(){this.callAll("onMouseMoveMeasure")}onScroll(){this.callAll("onScroll")}onResizeWidth(){this.callAll("onResizeWidth")}onResize(){this.callAll("onResize")}onRebuild(){this.callAll("onRebuild")}onMouseMove(t){this.callAll("onMouseMove",t)}onWheel(t){this.callAll("onWheel",t)}onDirectionChange(){this.callAll("onDirectionChange")}onScrollStart(){this.callAll("onScrollStart")}onScrollStop(){this.callAll("onScrollStop")}onAxisChange(){this.callAll("onAxisChange")}onDeviceChange(){this.callAll("onDeviceChange")}onScrollConfigChange(){this.callAll("onScrollConfigChange")}onSettingsChange(t){this.callAll("onSettingsChange")}onDOMMutate(t,e){this.callAll("onDOMMutate",t,e)}destroy(){this.callAll("onUnsubscribe"),this.callAll("destroy"),this.modules=[],this.uiModules=[],this.allModules=[]}get all(){return this.allModules}get core(){return this.modules}get ui(){return this.uiModules}callAll(t,e,r){this.modules.length>0&&this.callLifecycleStrict(this.modules,t,e,r),this.uiModules.length>0&&this.callLifecycleStrict(this.uiModules,t,e,r)}callLifecycleStrict(t,e,r,i){let n=t.length;switch(e){case"onFrame":case"onMutate":case"onScrollMeasure":case"onMouseMoveMeasure":case"onScroll":for(let s=0;s<n;s++){let o=t[s];o&&o[e](this.data)}break;case"onDOMMutate":for(let s=0;s<n;s++){let o=t[s];o&&o[e](r,i)}break;case"onMouseMove":case"onWheel":for(let s=0;s<n;s++){let o=t[s];o&&o[e](r)}break;default:for(let s=0;s<n;s++){let o=t[s];o&&o[e]()}break}}rebuildAllModules(){this.allModules.length=0;for(let t=0;t<this.modules.length;t++)this.allModules.push(this.modules[t]);for(let t=0;t<this.uiModules.length;t++)this.allModules.push(this.uiModules[t])}};var Le=class{constructor(t,e,r){this.parent=r;this.id=t,this.htmlElement=e}id;htmlElement;properties=new Map;easingFn;get parentObject(){return this.parent}setProperty(t,e){this.properties.set(t,e)}getProperty(t){return this.properties.get(t)??null}setEasing(t){this.easingFn=t??void 0}getEasing(){return this.easingFn}applyProgress(t,e){let r=this.easingFn??e;return r?r(t):t}};var Tt=class{htmlElement;id="";keys=[];tokens=[];mirrors=new Map;_cachedMirrorObjects=[];_cachedConnects=[];_mirrorsDirty=!1;properties=new Map;modules=[];events=new Ct;eventNameCache=new Map;eventNameSuffixCache=new Map;constructor(t,e){this.htmlElement=e,this.id=t}getScopedEventName(t,e){if(e==null){let s=this.eventNameCache.get(t);if(s)return s;let o=`${t}:${this.id}`;return this.eventNameCache.set(t,o),o}let r=this.eventNameSuffixCache.get(t);r||(r=new Map,this.eventNameSuffixCache.set(t,r));let i=r.get(e);if(i)return i;let n=`${t}:${this.id}:${e}`;return r.set(e,n),n}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)})}remove(){this.modules.forEach(t=>{t.removeObject(this.id)})}setInviewAutoBlocked(t){this.setProperty("inview-auto-blocked",t)}isInviewAutoBlocked(){return this.getProperty("inview-auto-blocked")===!0}setInviewManualActive(t){this.setProperty("inview-manual-active",t)}isInviewManualActive(){return this.getProperty("inview-manual-active")===!0}syncInviewClass(){if(this.isInviewAutoBlocked()){this.htmlElement.classList.remove("-inview");return}if(this.isInviewManualActive()){this.htmlElement.classList.add("-inview");return}if(this.getProperty("is-inview")===!0){this.htmlElement.classList.add("-inview");return}this.getProperty("repeat")&&this.htmlElement.classList.remove("-inview")}show(){this.isInviewAutoBlocked()||this.htmlElement.classList.add("-inview")}hide(){if(this.isInviewAutoBlocked()){this.htmlElement.classList.remove("-inview");return}if(this.isInviewManualActive())return;this.getProperty("repeat")&&this.htmlElement.classList.remove("-inview")}connect(t){return this.modules.includes(t)?!1:(this.modules.push(t),!0)}disconnect(t){let e=this.modules.indexOf(t);return e===-1?!1:(this.modules.splice(e,1),!0)}isConnectedTo(t){return this.modules.includes(t)}setTokens(t){this.tokens=t,this.keys=t.map(e=>e.key)}getToken(t){for(let e=0;e<this.tokens.length;e++)if(this.tokens[e].key===t)return this.tokens[e];return null}updateMirrorsCache(){if(this._mirrorsDirty){this._cachedMirrorObjects=Array.from(this.mirrors.values());let t=this._cachedMirrorObjects.length;this._cachedConnects=new Array(t);for(let e=0;e<t;e++)this._cachedConnects[e]=this._cachedMirrorObjects[e].htmlElement;this._mirrorsDirty=!1}}addMirror(t){this.mirrors.has(t.id)||(this.mirrors.set(t.id,t),this._mirrorsDirty=!0)}removeMirror(t){this.mirrors.delete(t)&&(this._mirrorsDirty=!0)}get mirrorObjects(){return this.updateMirrorsCache(),this._cachedMirrorObjects}get connects(){return this.updateMirrorsCache(),this._cachedConnects}};var Pt=class{readQueue=[];writeQueue=[];computeQueue=[];isProcessing=!1;pendingFrame=null;rectCache=new WeakMap;dimensionCache=new WeakMap;scheduleRead(t,e=0){this.readQueue.push({priority:e,execute:t}),this.scheduleFlush()}scheduleCompute(t,e=0){this.computeQueue.push({priority:e,execute:t}),this.scheduleFlush()}scheduleWrite(t,e=0){this.writeQueue.push({priority:e,execute:t}),this.scheduleFlush()}batchModuleInitialization(t){t.forEach(({module:e,object:r,element:i,attributes:n,globalId:s})=>{this.scheduleRead(()=>{let o=i.getBoundingClientRect();this.rectCache.set(i,o),this.dimensionCache.set(i,{width:i.offsetWidth||i.clientWidth||o.width,height:i.offsetHeight||i.clientHeight||o.height}),e.initializeObject(s,r,i,n)},1)}),t.forEach(({module:e,object:r,windowSize:i})=>{this.scheduleCompute(()=>{e.calculatePositions(r,i)},2)}),t.forEach(({module:e,object:r})=>{this.scheduleWrite(()=>{e.connectObject(r),e.addObject(r.id,r)},3)})}getCachedRect(t){return this.rectCache.get(t)}getCachedDimensions(t){return this.dimensionCache.get(t)}scheduleFlush(){this.pendingFrame!==null||this.isProcessing||(this.pendingFrame=requestAnimationFrame(()=>{this.flush()}))}flush(){this.isProcessing=!0,this.pendingFrame=null;let t=(e,r)=>r.priority-e.priority;try{[...this.readQueue].sort(t).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Read task error:",s)}}),this.readQueue=[],[...this.computeQueue].sort(t).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Compute task error:",s)}}),this.computeQueue=[],[...this.writeQueue].sort(t).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Write task error:",s)}}),this.writeQueue=[]}finally{this.rectCache=new WeakMap,this.dimensionCache=new WeakMap,this.isProcessing=!1}}flushSync(){this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.flush()}clear(){this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.readQueue=[],this.writeQueue=[],this.computeQueue=[],this.rectCache=new WeakMap,this.dimensionCache=new WeakMap}};var Ee=class{desktop={rebuild:{width:!0,height:!0,scrollHeight:!0}};mobile={rebuild:{width:!0,height:!0,scrollHeight:!0}}};var ts=Object.freeze({}),x=class{attributesToMap;cssProperties=[];objectMapOnPage=new Map;allObjectMapOnPage=new Map;objectsOnPage=[];allObjectsOnPage=[];objectMap=new Map;allObjectMap=new Map;objects=[];allObjects=[];htmlKey="";defaultModeScope="all";_type=1;get type(){return this._type}get key(){return this.htmlKey}tools;data;settings;events;centers;hover;objectManager;signals;permissions=new Ee;constructor(t){this.tools=t.tools,this.data=t.data,this.settings=t.settings,this.events=t.events,this.centers=t.centers,this.hover=t.hover,this.objectManager=t.objectManager,this.signals=t.signals,this.attributesToMap=[{key:"active",type:"boolean",fallback:this.settings.active},{key:"fixed",type:"boolean",fallback:this.settings.fixed},{key:"outside-container",type:"boolean",fallback:this.settings["outside-container"]},{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:"offset-enter",type:"dimension",fallback:this.settings["offset-enter"]},{key:"offset-exit",type:"dimension",fallback:this.settings["offset-exit"]},{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 n=i.top;return Math.floor(n)+this.data.scroll.transformedCurrent}},{key:"end",type:"number",fallback:(e,r,i)=>{let n=i.top,s=i.height;return n+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},{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"]}]}initializeObject(t,e,r,i){let n=this.tools.boundingClientRect.process({element:r});for(let{key:s,type:o,fallback:a,transform:d}of this.attributesToMap){let c=typeof a=="function"?a(r,e,n):a,u=i[s]??i[`string-${s}`]??i[`data-string-${s}`],p=this.tools.domAttribute.process({element:r,key:s,fallback:u??this.settings[s]??c}),g=this.parseAttribute(p,o,{element:r,boundingRect:n,viewportHeight:this.data.viewport.windowHeight,baseRem:this.data.viewport.baseRem});d&&(g=d(g)),e.setProperty(s,g)}this.cacheLayoutSnapshot(e,r)}cacheLayoutSnapshot(t,e){let r=this.data.scroll.container??document.body??document.documentElement,i=this.data.scroll.elementContainer??document.documentElement,n=this.tools.transformNullify.process({element:e}),s=window.getComputedStyle(e),o=this.getOffsetSize(e,s),a=0,d=0,c=n.width,u=n.height;if((!Number.isFinite(c)||c<=0)&&(c=o.width),(!Number.isFinite(u)||u<=0)&&(u=o.height),Number.isFinite(n.left)&&Number.isFinite(n.top)&&n.width>0&&n.height>0)if(r===document.body||r===document.documentElement)a=n.left+i.scrollLeft,d=n.top+i.scrollTop;else{let p=r.getBoundingClientRect();a=n.left-p.left+r.scrollLeft,d=n.top-p.top+r.scrollTop}else{let p=this.getOffsetChainPosition(e);if(r===document.body||r===document.documentElement)a=p.left,d=p.top;else{let g=this.getOffsetChainPosition(r);a=p.left-g.left+r.scrollLeft,d=p.top-g.top+r.scrollTop}}t.setProperty("layout-doc-left",a),t.setProperty("layout-doc-top",d),t.setProperty("layout-width",c),t.setProperty("layout-height",u),t.setProperty("layout-border-radius",s.borderRadius||"0px")}getOffsetSize(t,e){let r=parseFloat(e.width),i=parseFloat(e.height);return{width:t.offsetWidth||t.clientWidth||(Number.isFinite(r)?r:0),height:t.offsetHeight||t.clientHeight||(Number.isFinite(i)?i:0)}}getOffsetChainPosition(t){let e=0,r=0,i=t;for(;i;)e+=i.offsetLeft||0,r+=i.offsetTop||0,i=i.offsetParent;return{left:e,top:r}}calculatePositions(t,e){let r=t.getProperty("start"),i=t.getProperty("size"),n=t.getProperty("offset-enter")??t.getProperty("offset-bottom"),s=t.getProperty("offset-exit")??t.getProperty("offset-top"),o=t.getProperty("enter-el"),a=t.getProperty("enter-vp"),d=t.getProperty("exit-el"),c=t.getProperty("exit-vp"),u=-0,p=-0,g=-0,m=-0;o==="top"&&a==="top"||o==="left"&&a==="left"?(g=-e+1,u=r-n):o==="top"&&a==="bottom"||o==="left"&&a==="right"?u=r-e-n:o==="bottom"&&a==="top"||o==="right"&&a==="left"?(g=-e-i+1,u=r+i-n):(o==="bottom"&&a==="bottom"||o==="right"&&a==="right")&&(g=-i+1,u=r-e+i-n),d==="top"&&c==="top"||d==="left"&&c==="left"?(m=-i+1,p=r+s):d==="top"&&c==="bottom"||d==="left"&&c==="right"?(m=-e-i+1,p=r-e+s):d==="bottom"&&c==="top"||d==="right"&&c==="left"?p=r+i+s:(d==="bottom"&&c==="bottom"||d==="right"&&c==="right")&&(m=-e+1,p=r-e+i+s),t.setProperty("start-bias",g),t.setProperty("end-bias",m),t.setProperty("start-position",u-this.data.scroll.topPosition),t.setProperty("end-position",p-this.data.scroll.topPosition),t.setProperty("difference-position",p-u);let h=t.getProperty("inview-top")??-0,f=t.getProperty("inview-bottom")??-0;t.setProperty("inview-start-position",t.getProperty("start-position")+h),t.setProperty("inview-end-position",t.getProperty("end-position")+f)}parseAttribute(t,e,r=ts){if(t==null)return null;let i=typeof t=="string"?t:String(t);if(typeof e=="object"&&e.type==="enum")return e.values.includes(i)?i:e.values[0];switch(e){case"number":return typeof t=="string"?+t||parseFloat(t):t;case"boolean":return i===""||i==="true";case"json":try{return JSON.parse(i)}catch{return null}case"tuple":return i.trim().split(/\s+/);case"easing":return this.tools.easingFunction.process({easing:i});case"color":return this.tools.colorParser.process({value:i});case"dimension":return t===0||t=="0"?0:r.element!=null&&r.viewportHeight!=null&&r.baseRem!=null&&r.boundingRect!=null?this.tools.unitParser.process({value:t,element:r.element,viewportHeight:r.viewportHeight,boundingRect:r.boundingRect,baseRem:r.baseRem}):0;case"breakpoint-dimension":if(r.element!=null&&r.viewportHeight!=null&&r.baseRem!=null&&r.boundingRect!=null){let n=i.trim().split("|"),s=[];for(let o of n)if(o.includes(":")){let[a,d]=o.split(":");s.push({breakpoint:parseInt(a),value:this.tools.unitParser.process({value:`${d}|`,element:r.element,viewportHeight:r.viewportHeight,boundingRect:r.boundingRect,baseRem:r.baseRem})})}else s.push({breakpoint:0,value:this.tools.unitParser.process({value:o,element:r.element,viewportHeight:r.viewportHeight,boundingRect:r.boundingRect,baseRem:r.baseRem})});return s}default:return t}}canConnect(t){return t.keys.includes(this.htmlKey)}isTokenEnabledInCurrentMode(t){let e=this.data.scroll.mode;return t.modeSpec.kind==="all"?!0:t.modeSpec.kind==="include"?t.modeSpec.values.includes(e):this.defaultModeScope==="all"?!0:this.defaultModeScope.includes(e)}isObjectEnabledInCurrentMode(t){let e=t.getToken(this.htmlKey);return e?this.isTokenEnabledInCurrentMode(e):!1}disconnectObject(t){t.disconnect(this)}connectObject(t){t.connect(this)&&this.onObjectConnected(t)}enterObject(t,e){this.allObjectMap.has(t)||(this.allObjectMap.set(t,e),this.allObjects.push(e)),this.isObjectEnabledInCurrentMode(e)&&!this.objectMap.has(t)&&(this.objectMap.set(t,e),this.objects.push(e))}fastRemoveFromArray(t,e){if(e===-1)return;let r=t.length-1;e!==r&&(t[e]=t[r]),t.pop()}exitObject(t){let e=this.objectMap.get(t);if(e){this.objectMap.delete(t);let n=this.objects.indexOf(e);this.fastRemoveFromArray(this.objects,n)}let r=this.allObjectMap.get(t);if(!r)return;this.allObjectMap.delete(t);let i=this.allObjects.indexOf(r);this.fastRemoveFromArray(this.allObjects,i)}addObject(t,e){this.allObjectMapOnPage.has(t)||(this.allObjectMapOnPage.set(t,e),this.allObjectsOnPage.push(e)),this.isObjectEnabledInCurrentMode(e)&&!this.objectMapOnPage.has(t)&&(this.objectMapOnPage.set(t,e),this.objectsOnPage.push(e))}removeObject(t){let e=this.objectMapOnPage.get(t);if(e){this.objectMapOnPage.delete(t);let n=this.objectsOnPage.indexOf(e);this.fastRemoveFromArray(this.objectsOnPage,n)}let r=this.allObjectMapOnPage.get(t);if(!r)return;this.allObjectMapOnPage.delete(t);let i=this.allObjectsOnPage.indexOf(r);this.fastRemoveFromArray(this.allObjectsOnPage,i),this.exitObject(t),this.onObjectDisconnected(r)}onObjectConnected(t){}onObjectDisconnected(t){}get respectSelfDisable(){return!0}isPrimaryElementEnabled(t){return!this.respectSelfDisable||t.getProperty("self-disable")!==!0}applyToElementAndConnects(t,e,r=e){this.isPrimaryElementEnabled(t)&&e(t.htmlElement),t.mirrorObjects.forEach(i=>r(i.htmlElement,i))}applyVarToElement(t,e,r){this.isPrimaryElementEnabled(t)&&this.tools.styleTxn.setVar(t.htmlElement,e,r)}applyPropToElement(t,e,r){this.isPrimaryElementEnabled(t)&&this.tools.styleTxn.setProp(t.htmlElement,e,r)}applyVarToConnects(t,e,r){for(let i of t.mirrorObjects)this.tools.styleTxn.setVar(i.htmlElement,e,r)}applyPropToConnects(t,e,r){for(let i of t.mirrorObjects)this.tools.styleTxn.setProp(i.htmlElement,e,r)}getObjectEventName(t,e,r){return t.getScopedEventName(e,r)}emitSignal(t,e,r){t.setProperty(`signal:${e}`,r),this.signals.publish(t.id,e,r)}getSignal(t,e){return this.signals.get(t,e)}clearManagedStyles(t){let e=i=>{for(let s=0;s<this.cssProperties.length;s++)i.style.removeProperty(this.cssProperties[s].name);let n=t.getProperty("key");typeof n=="string"&&n.length>0&&i.style.removeProperty(n)};e(t.htmlElement);let r=t.mirrorObjects;for(let i=0;i<r.length;i++)e(r[i].htmlElement)}onObjectModeActivated(t){}onObjectModeDeactivated(t){this.clearManagedStyles(t)}rebuildActiveObjectsForCurrentMode(){let t=new Map(this.objectMapOnPage);this.objectMapOnPage=new Map,this.objectsOnPage=[];for(let e=0;e<this.allObjectsOnPage.length;e++){let r=this.allObjectsOnPage[e];this.isObjectEnabledInCurrentMode(r)&&(this.objectMapOnPage.set(r.id,r),this.objectsOnPage.push(r))}this.objectMap=new Map,this.objects=[];for(let e=0;e<this.allObjects.length;e++){let r=this.allObjects[e];this.isObjectEnabledInCurrentMode(r)&&(this.objectMap.set(r.id,r),this.objects.push(r))}t.forEach((e,r)=>{this.objectMapOnPage.has(r)||this.onObjectModeDeactivated(e)}),this.objectMapOnPage.forEach((e,r)=>{t.has(r)||this.onObjectModeActivated(e)})}destroy(){this.objects=[],this.allObjects=[],this.objectMap=new Map,this.allObjectMap=new Map,this.objectsOnPage=[],this.allObjectsOnPage=[],this.objectMapOnPage=new Map,this.allObjectMapOnPage=new Map}onInit(){}onSubscribe(){}onUnsubscribe(){}onFrame(t){}onMutate(t){}onScrollMeasure(t){}onMouseMoveMeasure(t){}onResize(){}onResizeWidth(){}onRebuild(){}onScroll(t){}onDirectionChange(){}onScrollStart(){}onScrollStop(){}onScrollDirectionChange(){}onAxisChange(){}onDeviceChange(){}onScrollConfigChange(){this.rebuildActiveObjectsForCurrentMode()}onSettingsChange(){}onDOMRebuild(){}onMouseMove(t){}onWheel(t){}onDOMMutate(t,e){}};var Me=class{constructor(t,e,r,i){this.data=t;this.modules=e;this.events=r;this.tools=i}objects=new Map;connectQueue=[];connectableModulesBuffer=[];mirrors=new Map;mirrorId=1;globalId=1;domBatcher=new Pt;domBatcherEnabled=!1;inviewStarts=[];inviewEnds=[];inviewActive=new Set;inviewStartIdx=0;inviewEndIdx=0;inviewIndexDirty=!0;lastInviewScrollPos=0;intersectionObserverEnabled=!0;domObserver=null;get all(){return this.objects}add(t){let e=`string-${this.globalId++}`,r="string-id";t.getAttribute("string-id")&&(e=t.getAttribute("string-id"),r="string-id"),t.getAttribute("data-string-id")&&(e=t.getAttribute("data-string-id"),r="data-string-id");let i=e&&this.objects.has(e)?this.objects.get(e):new Tt(e,t);t.setAttribute(r,i.id);let n=t.getAttribute("string")??t.getAttribute("data-string");n&&i.setTokens(this.parseStringTokens(n)),t.setAttribute("string-inited",""),this.objects.set(i.id,i);let s=this.getAllAttributes(t),o=this.modules.core;for(let u=0;u<o.length;u++){let p=o[u];"setupCoreProperties"in p&&typeof p.setupCoreProperties=="function"&&p.setupCoreProperties(i,t,s)}let a=this.connectableModulesBuffer;a.length=0;let d=this.modules.all,c=null;for(let u=0;u<d.length;u++){let p=d[u];p instanceof x&&p.key===""&&(c=p),p instanceof x&&p.canConnect(i)&&a.push(p)}if(a.length===0&&c&&(i.setProperty("inview-fallback",!0),a.push(c)),this.domBatcherEnabled&&a.length>0){let u=new Array(a.length);for(let p=0;p<a.length;p++)u[p]={module:a[p],object:i,element:t,attributes:s,globalId:this.globalId,windowSize:this.data.viewport.windowHeight};this.domBatcher.batchModuleInitialization(u),this.domBatcher.scheduleWrite(()=>{this.initObservers(i,t),this.checkInviewForObject(i)})}else{for(let u=0;u<a.length;u++){let p=a[u];p.initializeObject(this.globalId,i,t,s),p.calculatePositions(i,this.data.viewport.windowHeight),p.connectObject(i),p.addObject(i.id,i)}this.initObservers(i,t),this.checkInviewForObject(i)}if(this.connectQueue.length>0){let u=0;for(let p=0;p<this.connectQueue.length;p++){let g=this.connectQueue[p];if(g.id===i.id){this.attachMirrorToObject(i,g.element);continue}this.connectQueue[u++]=g}this.connectQueue.length=u}a.length=0,this.inviewIndexDirty=!0}setDOMBatcherEnabled(t){this.domBatcherEnabled=t,t||this.domBatcher.flushSync()}setIntersectionObserverEnabled(t){if(this.intersectionObserverEnabled!==t){this.intersectionObserverEnabled=t;for(let e of this.objects.values())e.getProperty("observer-progress")?.disconnect(),t&&this.initObservers(e,e.htmlElement)}}attachModule(t){this.objects.forEach(e=>{if(!t.canConnect(e))return;let r=e.htmlElement,i=this.getAllAttributes(r);t.initializeObject(this.globalId,e,r,i),t.calculatePositions(e,this.data.viewport.windowHeight),t.connectObject(e),t.addObject(e.id,e),e.getProperty("active")===!0&&t.enterObject(e.id,e)})}refreshModuleConnectionsForCurrentMode(){let t=this.modules.all;for(let e of this.objects.values()){let r=e.htmlElement;if(!r||!r.isConnected)continue;let i=null;for(let n=0;n<t.length;n++){let s=t[n];if(!(s instanceof x)||!e.keys.includes(s.key))continue;let o=s.canConnect(e),a=e.isConnectedTo(s);if(o&&!a){i==null&&(i=this.getAllAttributes(r)),s.initializeObject(this.globalId,e,r,i),s.calculatePositions(e,this.data.viewport.windowHeight),s.connectObject(e),s.addObject(e.id,e),e.getProperty("active")===!0&&s.enterObject(e.id,e);continue}!o&&a&&(s.exitObject(e.id),s.removeObject(e.id),s.disconnectObject(e))}}}invalidateInviewIndex(){this.inviewIndexDirty=!0}refreshLayoutForRoot(t){if(!t)return;let e=new Set,r=n=>{let s=n.getAttribute("string-id")??n.getAttribute("data-string-id");if(!s)return;let o=this.objects.get(s);o&&e.add(o)};if(t instanceof HTMLElement){r(t);let n=t.querySelectorAll("[string-id],[data-string-id]");for(let s=0;s<n.length;s++)r(n[s])}if(e.size===0)return;let i=this.data.viewport.windowHeight;for(let n of e){let s=n.htmlElement;if(!s||!s.isConnected)continue;let o=this.getAllAttributes(s),a=this.modules.all;for(let d=0;d<a.length;d++){let c=a[d];c instanceof x&&c.canConnect(n)&&(c.initializeObject(this.globalId,n,s,o),c.calculatePositions(n,i))}}this.inviewIndexDirty=!0,this.checkInview()}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(),e.remove(),e.mirrorObjects.forEach(r=>{let i=this.getMirrorIds(r.htmlElement);this.setMirrorIds(r.htmlElement,i.filter(s=>s!==r.id)),this.mirrors.delete(r.id);let n=r.htmlElement.getAttribute("string-copy-from")??r.htmlElement.getAttribute("data-string-copy-from");n&&this.enqueueConnection(n,r.htmlElement)}),this.objects.delete(t),this.inviewActive.delete(e),this.inviewIndexDirty=!0)}enqueueConnection(t,e){let r=this.splitPipeAndTrim(t);for(let i=0;i<r.length;i++){let n=r[i];this.connectQueue.some(s=>s.id===n&&s.element===e)||this.connectQueue.push({id:n,element:e})}}linkMirror(t,e){let r=this.splitPipeAndTrim(t);for(let i=0;i<r.length;i++){let n=r[i],s=this.objects.get(n);s?this.attachMirrorToObject(s,e):this.enqueueConnection(n,e)}}attachMirrorToObject(t,e){let r=this.getMirrorIds(e);for(let c of r){let u=this.mirrors.get(c);if(u&&u.parentObject===t)return u}let i=`string-mirror-${this.mirrorId++}`,n=new Le(i,e,t);this.setMirrorIds(e,[...r,i]),t.addMirror(n),this.mirrors.set(i,n);let s=e.getAttribute("string-easing")??e.getAttribute("data-string-easing");s&&s.trim().length>0&&(n.setEasing(this.tools.easingFunction.process({easing:s})),n.setProperty("easing",s));let o=t.getProperty("key"),a=t.getProperty("progress-raw"),d=t.getProperty("progress-value");if(typeof a=="number"){let c=t.getProperty("easing")??void 0,u=n.applyProgress(a,c);n.setProperty("progress",u),o&&this.tools.styleTxn.setVar(n.htmlElement,o,u)}else typeof d=="number"&&(n.setProperty("progress",d),o&&this.tools.styleTxn.setVar(n.htmlElement,o,d));return n}detachMirrorByElement(t){let e=this.getMirrorIds(t);e.length!==0&&(e.forEach(r=>this.detachMirrorById(r)),this.clearMirrorIds(t))}detachMirrorById(t){let e=this.mirrors.get(t);e&&(e.parentObject.removeMirror(t),this.mirrors.delete(t))}getMirrorIds(t){let e=t.getAttribute("string-mirror-id")??t.getAttribute("data-string-mirror-id");return e?this.splitPipeAndTrim(e):[]}setMirrorIds(t,e){if(e.length===0){this.clearMirrorIds(t);return}t.setAttribute("string-mirror-id",e.join("|"))}clearMirrorIds(t){t.removeAttribute("string-mirror-id"),t.removeAttribute("data-string-mirror-id")}getAllAttributes(t){let e={},r=t.attributes;for(let i=0;i<r.length;i++){let n=r[i];e[n.name]=n.value}return e}initObservers(t,e){if(!this.intersectionObserverEnabled)return;let r=t.getProperty("offset-exit")??t.getProperty("offset-top")??0,i=t.getProperty("offset-enter")??t.getProperty("offset-bottom")??0;t.getProperty("observer-progress")?.disconnect();let n=g=>{g.forEach(m=>{this.events.emit(t.getScopedEventName("object:activate"),m.isIntersecting),m.isIntersecting?t.enter():t.leave()})},s=t.getProperty("outside-container"),o=e.getAttribute("string-outside-container")??e.getAttribute("data-string-outside-container"),a=o!=null?o.trim().toLowerCase():null,d=a===""||a==="true"||a==="1",c=s!=null?s===!0:d,u=this.data.scroll.container===document.body||c?null:this.data.scroll.container,p=new IntersectionObserver(n,{root:u,rootMargin:`${i+this.data.viewport.windowHeight}px 0px ${r+this.data.viewport.windowHeight}px 0px`,threshold:0});p.observe(e),t.setProperty("observer-progress",p)}observeDOM(){this.domObserver?.disconnect();let t=new MutationObserver(e=>{let r=!1,i=!1;for(let n=0;n<e.length;n++){let s=e[n];if(s.type==="childList"){let o=!1;for(let a=0;a<s.removedNodes.length;a++){let d=s.removedNodes[a];if(d.nodeType!==Node.ELEMENT_NODE)continue;o=!0;let c=d;if(this.detachMirrorByElement(c),this.isFixed(c))continue;(c.hasAttribute("string")||c.hasAttribute("data-string"))&&(this.handleRemoved(c),i=!0);let u=c.querySelectorAll("[string],[data-string]");for(let g=0;g<u.length;g++){let m=u[g];this.isFixed(m)||(this.handleRemoved(m),i=!0)}let p=c.querySelectorAll("[string-copy-from],[data-string-copy-from]");for(let g=0;g<p.length;g++)this.detachMirrorByElement(p[g])}for(let a=0;a<s.addedNodes.length;a++){let d=s.addedNodes[a];if(d.nodeType!==Node.ELEMENT_NODE)continue;o=!0;let c=d;if(this.isFixed(c))continue;c.hasAttribute("string")&&!c.hasAttribute("string-inited")&&(this.add(c),i=!0);let u=c.querySelectorAll("[string]:not([string-inited]),[data-string]:not([string-inited])");for(let m=0;m<u.length;m++)this.add(u[m]),i=!0;let p=c.getAttribute("string-copy-from")??c.getAttribute("data-string-copy-from");p&&this.linkMirror(p,c);let g=c.querySelectorAll("[string-copy-from],[data-string-copy-from]");for(let m=0;m<g.length;m++){let h=g[m],f=h.getAttribute("string-copy-from")??h.getAttribute("data-string-copy-from");f&&this.linkMirror(f,h)}}o&&(this.modules.onDOMMutate(s.addedNodes,s.removedNodes),r=!0)}}if(r){let n=this.modules.all;for(let s=0;s<n.length;s++)n[s].onDOMRebuild();i&&this.events.emit("dom:changed",null)}});t.observe(document.body,{childList:!0,subtree:!0}),this.domObserver=t}handleRemoved(t){let e=t.getAttribute("string-id")??t.getAttribute("data-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(t){for(let e of this.objects.values()){if(!e.htmlElement||!e.htmlElement.isConnected)continue;let r=null,i=this.modules.all;for(let n=0;n<i.length;n++){let s=i[n],o=!1;t.isDesktop?(s.permissions.desktop.rebuild.scrollHeight&&t.scrollHeightChanged&&(o=!0),s.permissions.desktop.rebuild.width&&t.widthChanged&&(o=!0),s.permissions.desktop.rebuild.height&&t.heightChanged&&(o=!0)):(s.permissions.mobile.rebuild.scrollHeight&&t.scrollHeightChanged&&(o=!0),s.permissions.mobile.rebuild.width&&t.widthChanged&&(o=!0),s.permissions.mobile.rebuild.height&&t.heightChanged&&(o=!0)),(o||t.isForceRebuild)&&s.canConnect(e)&&(r==null&&(r=this.getAllAttributes(e.htmlElement)),s.initializeObject(this.globalId,e,e.htmlElement,r),s.calculatePositions(e,this.data.viewport.windowHeight),s.connectObject(e))}}this.inviewIndexDirty=!0}isFixed(t){return t.hasAttribute("string-fixed")}checkInview(){let t=this.data.scroll.transformedCurrent;this.updateInviewWindow(t);for(let e of this.inviewActive)this.checkInviewForObject(e)}checkInviewForObject(t){let e=this.data.scroll.transformedCurrent;if(!this.intersectionObserverEnabled){let c=t.getProperty("start-position"),u=t.getProperty("end-position");if(c!=null&&u!=null){let p=Math.min(c,u),g=Math.max(c,u),m=t.getProperty("is-active")??!1,h=e>=p&&e<=g;h!==m&&(t.setProperty("is-active",h),this.events.emit(t.getScopedEventName("object:activate"),h),h?t.enter():t.leave())}}let r=t.getProperty("inview-start-position"),i=t.getProperty("inview-end-position"),n=t.getProperty("is-inview")??!1,s=Math.min(r,i),o=Math.max(r,i),a=e>=s&&e<=o,d=null;if(!n&&a){let c=Math.abs(e-s),u=Math.abs(o-e);d=c<=u?"enter-top":"enter-bottom"}else n&&!a&&(d=e<s?"exit-top":"exit-bottom");a!==n&&(t.setProperty("is-inview",a),t.setInviewAutoBlocked(!1),t.setInviewManualActive(!1),a?t.show():t.hide(),this.events.emit(t.getScopedEventName("object:inview"),{inView:a,direction:d}))}updateInviewWindow(t){let e=this.data.viewport.windowHeight,r=t-e,i=t+this.data.viewport.windowHeight+e;for((this.inviewIndexDirty||t<this.lastInviewScrollPos)&&this.rebuildInviewIndex(r,i);this.inviewStartIdx<this.inviewStarts.length&&this.inviewStarts[this.inviewStartIdx].pos<=i;)this.inviewActive.add(this.inviewStarts[this.inviewStartIdx].object),this.inviewStartIdx++;for(;this.inviewEndIdx<this.inviewEnds.length&&this.inviewEnds[this.inviewEndIdx].pos<r;)this.inviewActive.delete(this.inviewEnds[this.inviewEndIdx].object),this.inviewEndIdx++;this.lastInviewScrollPos=t}rebuildInviewIndex(t,e){this.inviewStarts=[],this.inviewEnds=[];for(let r of this.objects.values()){let i=r.getProperty("inview-start-position"),n=r.getProperty("inview-end-position");i==null||n==null||(this.inviewStarts.push({pos:Math.min(i,n),object:r}),this.inviewEnds.push({pos:Math.max(i,n),object:r}))}this.inviewStarts.sort((r,i)=>r.pos-i.pos),this.inviewEnds.sort((r,i)=>r.pos-i.pos),this.inviewActive.clear(),this.inviewStartIdx=this.upperBound(this.inviewStarts,e),this.inviewEndIdx=this.upperBound(this.inviewEnds,t-1);for(let r=0;r<this.inviewStartIdx;r++)this.inviewActive.add(this.inviewStarts[r].object);for(let r=0;r<this.inviewEndIdx;r++)this.inviewActive.delete(this.inviewEnds[r].object);this.inviewIndexDirty=!1}upperBound(t,e){let r=0,i=t.length;for(;r<i;){let n=r+i>>>1;t[n].pos<=e?r=n+1:i=n}return r}splitPipeAndTrim(t){let e=t.split("|"),r=[];for(let i=0;i<e.length;i++){let n=e[i].trim();n.length>0&&r.push(n)}return r}parseStringTokens(t){let e=this.splitTopLevelPipe(t),r=[];for(let i=0;i<e.length;i++){let n=e[i].trim();if(n.length===0)continue;let s=n.match(/^([^\[\]]+?)(?:\[([^\]]*)\])?$/);if(!s){r.push({raw:n,key:n,modeSpec:{kind:"default",values:[]}});continue}let o=s[1].trim(),a=s[2];if(!o)continue;if(a==null){r.push({raw:n,key:o,modeSpec:{kind:"default",values:[]}});continue}let d=a.trim();if(d.length===0){r.push({raw:n,key:o,modeSpec:{kind:"all",values:[]}});continue}let c=this.splitTopLevelPipe(d).map(u=>u.trim()).filter(u=>u.length>0);r.push({raw:n,key:o,modeSpec:c.length>0?{kind:"include",values:c}:{kind:"all",values:[]}})}return r}splitTopLevelPipe(t){let e=[],r="",i=0;for(let n=0;n<t.length;n++){let s=t[n];if(s==="["){i++,r+=s;continue}if(s==="]"){i=Math.max(0,i-1),r+=s;continue}if(s==="|"&&i===0){e.push(r),r="";continue}r+=s}return r.length>0&&e.push(r),e}destroy(){this.domObserver?.disconnect(),this.domObserver=null,this.domBatcher.clear()}};var q={SCROLL_FORWARD:"-scroll-forward",SCROLL_BACKWARD:"-scroll-backward",SCROLLING_FORWARD:"-scrolling-forward",SCROLLING_BACKWARD:"-scrolling-backward"};var J=class{context;document;name="";isProg=!1;isParallaxEnabled=!1;_isVertical=!0;_scrollDirState=-1;_lastAppliedDirState=-1;isLastBottomScrollDirection=!0;scrollTriggerRules=[];isActive=!1;set scrollDirection(t){this._isVertical=t==="vertical"}constructor(t){this.document=document,this.context=t}onChangeDirection=()=>{};onScrollStart=()=>{};onScrollStop=()=>{};onCalcUpdate(){if(!this.isActive)return;let t=this.context.data.scroll.scrollContainer,e=this.context.data.scroll.current;t&&(this._isVertical?t.scrollTo(0,e):t.scrollTo(e,0)),this._isVertical&&this.triggerScrollRules()}onFrame(){}onWheel(t){}onScroll(t){}onTouchStart(t){}onTouchMove(t){}onTouchEnd(t){}disableScrollEvents(){}enableScrollEvents(){}activate(){this.isActive||(this.isActive=!0,this.enableScrollEvents())}deactivate(){if(!this.isActive)return;this.isActive=!1,this.disableScrollEvents(),this.isProg=!1;let t=this.context.data.scroll;t.target=t.current,t.delta=0,t.lerped=0,t.displacement=0,this.clearScrollingClasses(),this._scrollDirState=-1,this._lastAppliedDirState=-1,this.onScrollStop()}destroy(){}updateScrollDirection(t){this.isLastBottomScrollDirection=t;let e=t?1:0;if(this._scrollDirState===-1){this._scrollDirState=e;return}if(this._scrollDirState=e,this.context.data.scroll.isScrollingDown=t,this.onChangeDirection(),this.context.events.emit("scroll:direction:change",t),this.context.settings["global-class"]&&this._lastAppliedDirState!==e){let r=document.documentElement.classList;t?(r.remove(q.SCROLLING_BACKWARD,q.SCROLL_BACKWARD),r.add(q.SCROLLING_FORWARD,q.SCROLL_FORWARD)):(r.remove(q.SCROLLING_FORWARD,q.SCROLL_FORWARD),r.add(q.SCROLLING_BACKWARD,q.SCROLL_BACKWARD)),this._lastAppliedDirState=e}}clearScrollingClasses(){document.documentElement.classList.remove(q.SCROLLING_BACKWARD,q.SCROLLING_FORWARD,q.SCROLL_BACKWARD,q.SCROLL_FORWARD)}triggerScrollRules(){let t=this.scrollTriggerRules,e=t.length,r=this.context.data.scroll.current,i=this.isLastBottomScrollDirection;for(let n=0;n<e;n++){let s=t[n],a=(s.direction==="any"||i&&s.direction==="forward"||!i&&s.direction==="backward")&&r>=s.offset;a&&!s.isActive?(s.isActive=!0,s.onEnter?.(),s.toggleClass&&s.toggleClass.target.classList.add(s.toggleClass.className)):!a&&s.isActive&&(s.isActive=!1,s.onLeave?.(),s.toggleClass&&s.toggleClass.target.classList.remove(s.toggleClass.className))}}addScrollMark(t){this.scrollTriggerRules.push(t)}removeScrollMark(t){let e=this.scrollTriggerRules;for(let r=0;r<e.length;r++)if(e[r].id===t){e.splice(r,1);break}}scrollTo(t,e){}};var we=class extends J{name="default";previousScrollTop=0;previousScrollTime=0;isScrolling=!1;lastScrollEventTime=0;nativeVelocity=0;nativeVelocityTarget=0;scrollStopDelay=120;nativeVelocityFollow=.2;nativeVelocityDecay=.84;nativeVelocityBoost=2;nativeVelocityDeadzone=.25;constructor(t){super(t)}onFrame(){let t=0;if(this.context.data.scroll.delta!==0){let r=this.context.data.scroll.delta*this.context.data.scroll.speedAccelerate;this.context.data.scroll.delta-=r,t=r,Math.abs(t)<.1&&(this.context.data.scroll.delta=0,t=0)}let e=performance.now();this.nativeVelocityTarget*=this.nativeVelocityDecay,Math.abs(this.nativeVelocityTarget)<this.nativeVelocityDeadzone&&(this.nativeVelocityTarget=0),this.nativeVelocity+=(this.nativeVelocityTarget-this.nativeVelocity)*this.nativeVelocityFollow,Math.abs(this.nativeVelocity)<this.nativeVelocityDeadzone&&(this.nativeVelocity=0),Math.abs(this.nativeVelocity)>Math.abs(t)&&(t=this.nativeVelocity),this.context.data.scroll.lerped=t,this.isScrolling&&!(this.context.data.scroll.delta!==0||this.nativeVelocityTarget!==0||this.nativeVelocity!==0)&&e-this.lastScrollEventTime>this.scrollStopDelay&&(this.isScrolling=!1,this.onScrollStop(),this.clearScrollingClasses())}onScroll(t){let e=performance.now(),r=this.context.data.scroll.elementContainer.scrollTop,i=r-this.previousScrollTop;if(this.context.data.scroll.current=r,this.context.data.scroll.target=r,this.context.data.scroll.transformedCurrent=r*this.context.data.viewport.transformScale,i!==0){this.updateScrollDirection(i>0);let n=this.previousScrollTime===0?16.6667:e-this.previousScrollTime,s=i*(16.6667/Math.max(8,n))*this.nativeVelocityBoost;this.nativeVelocityTarget=s,this.previousScrollTop=r,this.previousScrollTime=e}this.triggerScrollRules(),this.lastScrollEventTime=e,this.isScrolling||(this.isScrolling=!0,this.onScrollStart())}onWheel(t){t.deltaY!==0&&(this.context.data.scroll.delta===0&&!this.isScrolling&&(this.isScrolling=!0,this.onScrollStart()),this.context.data.scroll.delta+=t.deltaY,this.lastScrollEventTime=performance.now())}deactivate(){super.deactivate(),this.isScrolling=!1,this.lastScrollEventTime=0,this.previousScrollTop=this.context.data.scroll.current,this.previousScrollTime=0,this.nativeVelocity=0,this.nativeVelocityTarget=0}scrollTo(t,e){this.context.data.scroll.target=t,this.context.data.scroll.current=t,this.context.data.scroll.delta=0,this.context.data.scroll.lerped=0,this.nativeVelocity=0,this.nativeVelocityTarget=0,this.previousScrollTop=t,this.previousScrollTime=0,this.triggerScrollRules(),this._scrollDirection==="vertical"?this.context.data.scroll.scrollContainer?.scrollTo({top:t,left:0,behavior:e?"auto":"smooth"}):this.context.data.scroll.scrollContainer?.scrollTo({left:t,top:0,behavior:e?"auto":"smooth"})}};var xe=class extends J{name="disable";preventScroll=t=>{t.preventDefault()};preventKeyScroll=t=>{["ArrowUp","ArrowDown","PageUp","PageDown"," ","Home","End"].includes(t.key)&&t.preventDefault()};onPreventScroll=this.preventScroll.bind(this);onPreventKeyScroll=this.preventKeyScroll.bind(this);constructor(t){super(t)}enableScrollEvents(){window.addEventListener("touchmove",this.onPreventScroll,{passive:!1}),window.addEventListener("keydown",this.onPreventKeyScroll)}disableScrollEvents(){window.removeEventListener("touchmove",this.onPreventScroll),window.removeEventListener("keydown",this.onPreventKeyScroll)}onFrame(){}onWheel(t){t.preventDefault()}onScroll(t){t.preventDefault()}};var Ce=class extends J{name="smooth";scrollForce=0;wheelImpulse=0;previousCurrent=0;scrollToSequence=0;activeScrollToId=null;velocityThreshold=.01;stepResult={current:.1,target:.1,delta:.1,lerped:.1,scrollForce:.1,absVelocity:.1};constructor(t){super(t),this.stepResult.current=0,this.stepResult.target=0,this.stepResult.delta=0,this.stepResult.lerped=0,this.stepResult.scrollForce=0,this.stepResult.absVelocity=0}stopScroll(){let t=this.context.data.scroll;t.lerped=0,t.delta=0,t.target=t.current,this.onCalcUpdate(),this.isProg=!1,this.clearScrollingClasses(),this._scrollDirState=-1,this._lastAppliedDirState=-1,this.activeScrollToId=null}onFrame(){let t=this.context.data.scroll;if(t.delta!==0){this.computeStep(t.current,t.target,t.delta,t.speed,t.speedAccelerate,t.bottomPosition,this.stepResult),this.scrollForce=this.stepResult.scrollForce,t.target=this.stepResult.target,t.delta=this.stepResult.delta,t.lerped=this.stepResult.lerped,t.current=this.stepResult.current;let e=this.context.data.viewport.transformScale;t.transformedCurrent=e!==1?t.current*e:t.current,this.updateScrollDirection(t.lerped>0),this.stepResult.absVelocity<this.velocityThreshold?(t.current=Math.round(t.target),this.previousCurrent=t.current,this.onCalcUpdate(),this.stopScroll(),this.onScrollStop()):(this.isProg=!0,this.previousCurrent!==t.current&&(this.previousCurrent=t.current,this.onCalcUpdate()))}}onWheel(t){if(t.deltaY!==0&&t.preventDefault(),this.wheelImpulse=t.deltaY,this.wheelImpulse===0)return;let e=this.context.data.scroll;e.delta===0&&this.onScrollStart();let r=this.wheelImpulse<0,i=e.target===0&&r,n=e.target===e.bottomPosition&&!r;!i&&!n&&(e.delta+=this.wheelImpulse)}onScroll(t){if(!this.isProg){let e=this.context.data.scroll,r=e.elementContainer.scrollTop,i=r-e.current;e.current=r,e.target=r,e.delta=0,e.lerped=i,e.displacement=0;let n=this.context.data.viewport.transformScale;e.transformedCurrent=n!==1?r*n:r,this.scrollForce=0,this.wheelImpulse=0,this.isProg=!1,this.previousCurrent=r,this.activeScrollToId=null,i!==0&&(this.updateScrollDirection(i>0),this.triggerScrollRules())}}deactivate(){super.deactivate(),this.scrollForce=0,this.wheelImpulse=0,this.previousCurrent=this.context.data.scroll.current}scrollTo(t,e){let r=this.context.data.scroll,i=++this.scrollToSequence;if(this.activeScrollToId=i,e){r.current=t,r.target=t,r.delta=0,r.lerped=0;let n=this.context.data.viewport.transformScale;r.transformedCurrent=n!==1?t*n:t,this.onCalcUpdate();return}r.target=t,r.delta=1}computeStep(t,e,r,i,n,s,o){let a=r*n,d=Math.min(Math.max(0,e+a),s),c=(d-t)*i,u=r-a,p=t+c;o.current=p,o.target=d,o.delta=u,o.lerped=c,o.scrollForce=a,o.absVelocity=Math.abs(c)}};var Te=class{constructor(t){this.context=t;this.registerMode("smooth",new Ce(t)),this.registerMode("default",new we(t)),this.registerMode("disable",new xe(t)),this.updateResponsiveMode()}modes=new Map;boundEvents=null;scrollMarks=[];registerMode(t,e){let r=this.context.data.scroll.mode===t,i=this.modes.get(t);i&&(r&&i.deactivate(),i.destroy()),e.name||(e.name=String(t)),this.modes.set(t,e),this.boundEvents&&(e.onScrollStart=this.boundEvents.onScrollStart,e.onScrollStop=this.boundEvents.onScrollStop,e.onChangeDirection=this.boundEvents.onDirectionChange),this.scrollMarks.length>0&&this.scrollMarks.forEach(n=>e.addScrollMark(n)),r&&e.activate()}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<1024?this.context.data.scroll.modeMobile:this.context.data.scroll.modeDesktop;this.setMode(e)}updatePosition(){this.get().onCalcUpdate()}setMode(t){if(!this.modes.has(t)){console.warn(`[ScrollManager] Unknown scroll mode: ${t}`);return}if(this.context.data.scroll.mode===t){this.get().activate();return}this.get().deactivate(),this.context.data.scroll.mode=t,this.get().activate(),this.boundEvents?.onModeChange()}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)}onTouchStart(t){this.get().onTouchStart(t)}onTouchMove(t){this.get().onTouchMove(t)}onTouchEnd(t){this.get().onTouchEnd(t)}bindEvents(t){this.boundEvents=t,this.modes.forEach(e=>{e.onScrollStart=t.onScrollStart,e.onScrollStop=t.onScrollStop,e.onChangeDirection=t.onDirectionChange})}addScrollMark(t){this.scrollMarks.push(t),this.modes.forEach(e=>{e.addScrollMark(t)})}removeScrollMark(t){this.scrollMarks=this.scrollMarks.filter(e=>e.id!==t),this.modes.forEach(e=>{e.removeScrollMark(t)})}destroy(){this.modes.forEach(t=>{t.deactivate(),t.destroy()})}};var Pe=class{targetX=0;targetY=0;smoothedX=0;smoothedY=0;stepX=0;stepY=0;velocityX=0;velocityY=0};var Ae=class{threeInstance=null};var ke=class{target=0;current=0;transformedCurrent=0;delta=0;lerped=0;displacement=0;isScrollingDown=!1;topPosition=0;bottomPosition=0;direction="vertical";elementContainer=document.documentElement;scrollContainer=window;container=document.body;mode="smooth";modeMobile="default";modeDesktop="smooth";speed=.1;speedAccelerate=.25};var Oe=class{fpsTracker=!1;positionTracker=!1;suppressMasonryResize=!1};var De=class{now=0;previous=0;delta=0;elapsed=0};var Ie=class{windowWidth=0;windowHeight=0;contentWidth=0;contentHeight=0;scaleWidth=1;scaleHeight=1;transformScale=1;baseRem=16};var Gt=class{scroll=new ke;viewport=new Ie;cursor=new Pe;render=new Ae;time=new De;system=new Oe};var $t=class{process({element:t}){return t.getBoundingClientRect()}};var Ut=class{process({element:t,key:e,fallback:r=null}){return t.getAttribute(`string-${e}`)??t.getAttribute(`data-string-${e}`)??r}};var jt=class{process({record:t,name:e,fallback:r=null}){return t[e]??t[`data-${e}`]??r}};var St=class{process({element:t}){let e=t.getBoundingClientRect(),i=getComputedStyle(t).transform.match(/-?[\d.]+/g)?.map(parseFloat)??[];if(i.length===6){let[n,s,o,a,d,c]=i,u=n*a-s*o;return{width:e.width/(n||1),height:e.height/(a||1),left:(e.left*a-e.top*o+o*c-d*a)/u,top:(-e.left*s+e.top*n+d*s-n*c)/u}}return e}};var Yt=class{constructor(t=new St){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 qt=class{process({from:t,to:e,progress:r}){return(e-t)*r}};var Xt=class{process({value:t,element:e,viewportHeight:r,baseRem:i,boundingRect:n}){let o=(typeof t=="number"?String(t):t).split("|").map(d=>d.trim()).filter(Boolean),a=0;for(let d of o){let c=d,u=!1;c.startsWith("-")&&(u=!0,c=c.slice(1));let p=0;c==="selfHeight"?p=e.offsetHeight:c.endsWith("px")?p=parseFloat(c):c.endsWith("%")?p=parseFloat(c)/100*r:c.endsWith("rem")?p=parseFloat(c)*i:c.endsWith("sh")?p=parseFloat(c)*n.height/100:p=parseFloat(c),a+=u?-p:p}return a}};var Kt=class{process({value:t,inMin:e=.1,inMax:r=1,outMin:i=.05,outMax:n=.65}){if(t<e)return n;if(t>1&&(t=1),t<=r){let s=(t-e)/(r-e);return n-s*(n-i)}return i}};var ut={left:0,center:.5,right:1},pt={top:0,center:.5,bottom:1},Zt=class{process({value:t}){if(!t)return"center";let e=t.trim();if(e.startsWith("random(")&&e.endsWith(")")){let r=e.slice(7,-1).split(",").map(n=>n.trim()).filter(Boolean),i=Math.floor(Math.random()*r.length);return r[i]}return e}toNormalized({value:t}){let r=this.process({value:t}).toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return{x:.5,y:.5};if(r.length===1){let a=r[0],d=this.parseValue(a);return a in ut&&!(a in pt)?{x:d,y:.5}:a in pt&&!(a in ut)?{x:.5,y:d}:{x:d,y:d}}let[i,n]=r,s=i in pt&&!(i in ut),o=n in ut&&!(n in pt);return s||o?{x:this.parseValue(n,"horizontal"),y:this.parseValue(i,"vertical")}:{x:this.parseValue(i,"horizontal"),y:this.parseValue(n,"vertical")}}parseValue(t,e){if(e==="horizontal"&&t in ut)return ut[t];if(e==="vertical"&&t in pt)return pt[t];if(t in ut)return ut[t];if(t in pt)return pt[t];if(t.endsWith("%")){let i=parseFloat(t);if(!isNaN(i))return i/100}let r=parseFloat(t);return isNaN(r)?.5:r>1?r/100:r}};var Qt=class{process({value:t}){let e=t.trim().toLowerCase();if(e.startsWith("#")){let n=e.slice(1);n.length===3&&(n=n.split("").map(c=>c+c).join(""));let s=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16),d=n.length===8?parseInt(n.slice(6,8),16)/255:1;return{r:s,g:o,b:a,a:d}}let r=e.match(/rgba?\(([^)]+)\)/);if(r){let[n,s,o,a=1]=r[1].split(",").map(d=>parseFloat(d.trim()));return{r:n,g:s,b:o,a}}let i=e.match(/hsla?\(([^)]+)\)/);if(i){let[n,s,o,a="1"]=i[1].split(",").map(p=>p.trim()),[d,c,u]=this.hslToRgb(parseFloat(n),parseFloat(s),parseFloat(o));return{r:d,g:c,b:u,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=(c,u,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<1/6?c+(u-c)*6*p:p<1/2?u:p<2/3?c+(u-c)*(2/3-p)*6:c),n=r<.5?r*(1+e):r+e-r*e,s=2*r-n,o=Math.round(i(s,n,t+1/3)*255),a=Math.round(i(s,n,t)*255),d=Math.round(i(s,n,t-1/3)*255);return[o,a,d]}};var Jt=class{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,n,s,o]=r.slice(1).map(Number);return this.cubicBezier(i,n,s,o)}return i=>i}cubicBezier(t,e,r,i){let n=3*t,s=3*(r-t)-n,o=1-n-s,a=3*e,d=3*(i-e)-a,c=1-a-d;function u(h){return((o*h+s)*h+n)*h}function p(h){return((c*h+d)*h+a)*h}function g(h){return(3*o*h+2*s)*h+n}function m(h,f=1e-5){let b,y,v=h,S,E,M;for(M=0;M<8;M++){if(S=u(v)-h,Math.abs(S)<f)return v;if(E=g(v),Math.abs(E)<1e-6)break;v=v-S/E}for(b=0,y=1,v=h;b<y;){if(S=u(v)-h,Math.abs(S)<f)return v;S>0?y=v:b=v,v=(y+b)/2}return v}return function(h){return p(m(h))}}};var te=class{process({distance:t,radius:e,strength:r}){if(t>=e)return 0;let i=(e-t)/e;return r*i}};var ee=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 re=class{process({from:t,to:e,progress:r}){return{x:(e.x-t.x)*r,y:(e.y-t.y)*r}}};var ie=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 n=i[1].split(",").map(s=>parseFloat(s.trim()));if(n.length>=1&&!isNaN(n[0]))return n[0]}}if(r.startsWith("scale(")){let i=r.match(/scale\(([^)]+)\)/);if(i&&i[1]){let n=i[1].split(",").map(s=>parseFloat(s.trim()));if(n.length>=1&&!isNaN(n[0]))return n[0]}}if(r.startsWith("scaleX(")){let i=r.match(/scaleX\(([^)]+)\)/);if(i&&i[1]){let n=parseFloat(i[1].trim());if(!isNaN(n))return n}}if(r.startsWith("scale3d(")){let i=r.match(/scale3d\(([^)]+)\)/);if(i&&i[1]){let n=i[1].split(",").map(s=>parseFloat(s.trim()));if(n.length>=1&&!isNaN(n[0]))return n[0]}}if(r.startsWith("matrix3d(")){let i=r.match(/matrix3d\(([^)]+)\)/);if(i&&i[1]){let n=i[1].split(",").map(s=>parseFloat(s.trim()));if(n.length>=1&&!isNaN(n[0]))return n[0]}}}catch(i){return console.error(`Error parsing transform string "${r}":`,i),1}return 1}};var Re=class{process({attributeValue:t}){let e={segment:"legacy",line:[],word:[],char:[],charLine:[],charWord:[],wordLine:[],fit:!1,trimInlineGaps:!1};return t&&t.split("|").forEach(i=>{let n=i.trim();if(!n)return;let s=n.match(/^([\w-]+)(\[(.*?)\])?$/);if(s){let o=this.toCamelCase(s[1]),a=s[3]||"",d=a.split(";").map(u=>u.trim()).filter(u=>u.length>0),c=this.parseParamsArray(d);switch(o){case"segment":{let u=this.parseSegmentMode(a);u?e.segment=u:console.warn(`SplitOptionsParserTool: Unsupported segment mode "${a}" in part "${n}"`);break}case"line":e.line.push(c);break;case"word":e.word.push(c);break;case"char":e.char.push(c);break;case"charLine":e.charLine.push(c);break;case"charWord":e.charWord.push(c);break;case"wordLine":e.wordLine.push(c);break;case"fit":e.fit=!0;break;case"trimInlineGaps":e.trimInlineGaps=!0;break;default:console.warn(`SplitOptionsParserTool: Unrecognized option type "${o}" in part "${n}"`);break}}else console.warn(`SplitOptionsParserTool: Could not parse part format "${n}"`)}),e}toCamelCase(t){return t.replace(/-([a-z])/g,(e,r)=>r.toUpperCase())}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*\)/);if(i){let n=parseInt(i[1],10),s=parseInt(i[2],10);e.random={min:Math.min(n,s),max:Math.max(n,s)}}}else["start","center","end"].includes(r)&&(e.align=r)}),e}parseSegmentMode(t){let e=t.trim().toLowerCase();return e==="legacy"||e==="visual"?e:null}};var ne=class{process({value:t}){let e=[],r="",i=0;for(let n=0;n<t.length;n++){let s=t[n];s==="("&&i++,s===")"&&i--,s==="|"&&i===0?(r.trim()&&e.push(r.trim()),r=""):r+=s}return r.trim()&&e.push(r.trim()),e.map(n=>{let s=n.match(/^(\w+)(?:\((.*)\))?$/);if(s){let[,a,d]=s;return d?{key:a,params:d.split(",").map(c=>c.trim())}:{key:a}}let o=n.indexOf(":");if(o!==-1){let a=n.slice(0,o).trim(),d=n.slice(o+1).trim(),c=d?d.split(",").map(u=>u.trim()):void 0;return{key:a,params:c}}return{key:n}})}};var He=class{process({rules:t,value:e,type:r="input",context:i}){let n=[];for(let c of t){var s=null,o=null,a=!0,d=!0;r=="input"&&(o=this.inputValidators[c.key],!o)||r=="beforeinput"&&(s=this.beforeInputValidators[c.key],!s)||(o&&(a=o(e,c.params,i)),s&&(d=s(e,c.params,i)),d||n.push(this.getErrorMessage(c.key,c.params)),a||n.push(this.getErrorMessage(c.key,c.params)))}return{valid:n.length===0,errors:n}}inputValidators={required:t=>t!=null&&String(t).trim()!=="",min:(t,e)=>typeof t=="string"&&t.length>=Number(e?.[0]??0),max:(t,e)=>typeof t=="string"&&t.length<=Number(e?.[0]??Number.MAX_SAFE_INTEGER),checked:t=>{if(Array.isArray(t))return t.length>0;if(t===!0||t==="true"||t===1||t==="1")return!0;if(typeof t=="string"){let e=t.trim().toLowerCase();return e==="false"||e==="0"?!1:e.length>0}return!!t},email:t=>typeof t=="string"&&/^[^\s@]+@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(t),phone:t=>{if(typeof t!="string")return!1;let e=t.trim();if(e===""||!/^[0-9()\s+-.]+$/.test(e))return!1;let r=e.replace(/\D/g,"").length;return r>=7&&r<=15},number:t=>typeof t=="string"&&/^-?\d+(\.\d+)?$/.test(t),integer:t=>typeof t=="string"&&/^-?\d+$/.test(t),url:t=>typeof t=="string"&&/^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-._~:\/?#[\]@!$&'()*+,;=]*)?$/.test(t),regex:(t,e)=>this.testByRegex(t,e?.[0]),alpha:t=>this.testByRegex(t,"^[A-Za-z]+$",!0),alpha_num:t=>this.testByRegex(t,"^[A-Za-z0-9]+$",!0),alpha_dash:t=>this.testByRegex(t,"^[A-Za-z0-9_-]+$",!0),same:(t,e,r)=>{let i=e?.[0],n=this.getContextValue(r,i);return i&&n===void 0?!1:this.areValuesEqual(t,n)},different:(t,e,r)=>{let i=e?.[0],n=this.getContextValue(r,i);return i&&n===void 0?!1:!this.areValuesEqual(t,n)},range:(t,e)=>{if(t==null||t==="")return!0;let r=Number(t),i=Number(e?.[0]),n=Number(e?.[1]);return Number.isNaN(r)||Number.isNaN(i)||Number.isNaN(n)?!1:r>=i&&r<=n},digits:(t,e)=>{if(typeof t!="string")return!1;let r=Number(e?.[0]??0);return r<=0?!1:new RegExp(`^\\d{${r}}$`).test(t)},ip:t=>typeof t=="string"&&(this.isIPv4(t)||this.isIPv6(t)),mimes:(t,e)=>this.validateMimes(t,e),max_size:(t,e)=>{let r=Number(e?.[0]);return!r||r<=0?!0:this.validateMaxSize(t,r)},after:(t,e,r)=>this.compareDates(t,e,r,"after"),before:(t,e,r)=>this.compareDates(t,e,r,"before")};beforeInputValidators={number:t=>/^-?\d*\.?\d*$/.test(t),integer:t=>/^-?\d*$/.test(t),email:t=>/^[\w@.\-+]*$/.test(t),phone:t=>/^[0-9()\s+-.]*$/.test(t),letters:t=>/^[a-zA-Z]*$/.test(t),lettersSpaces:t=>/^[a-zA-Z\s]*$/.test(t),lettersNumbers:t=>/^[a-zA-Z0-9]*$/.test(t),alpha:t=>/^[A-Za-z]*$/.test(t),alpha_num:t=>/^[A-Za-z0-9]*$/.test(t),alpha_dash:t=>/^[A-Za-z0-9_-]*$/.test(t),digits:(t,e)=>{let r=Number(e?.[0]??0);return r<=0?/^\d*$/.test(t):new RegExp(`^\\d{0,${r}}$`).test(t)},url:t=>/^[a-zA-Z0-9\-._~:\/?#\[\]@!$&'()*+,;=%]*$/.test(t),pattern:(t,e)=>{try{return new RegExp(e?.[0]||"").test(t)}catch{return!0}}};getErrorMessage(t,e){switch(t){case"required":return"This field is required";case"email":return"Invalid email address";case"min":return`Minimum ${e?.[0]} characters`;case"max":return`Maximum ${e?.[0]} characters`;case"phone":return"Invalid phone number";case"number":return"Only numbers are allowed";case"integer":return"Only whole numbers are allowed";case"url":return"Invalid URL address";case"checked":return"You must accept";case"regex":return"Value does not match the required pattern";case"alpha":return"Only letters are allowed";case"alpha_num":return"Only letters and numbers are allowed";case"alpha_dash":return"Only letters, numbers, dashes, and underscores are allowed";case"same":return"Values do not match";case"different":return"Values must be different";case"range":return`Value must be between ${e?.[0]} and ${e?.[1]}`;case"digits":return`Value must contain exactly ${e?.[0]} digits`;case"ip":return"Invalid IP address";case"mimes":return`Allowed file types: ${e?.join(", ")}`;case"max_size":return`File must be smaller than ${e?.[0]} KB`;case"after":return`Date must be after ${e?.[0]}`;case"before":return`Date must be before ${e?.[0]}`;default:return"Invalid value"}}validateMimes(t,e){if(!e||e.length===0)return!0;let r=this.extractFiles(t);if(r.length===0)return!0;let i=e.map(n=>n.trim().toLowerCase());return r.every(n=>this.isMimeAllowed(n,i))}validateMaxSize(t,e){let r=this.extractFiles(t);if(r.length===0)return!0;let i=e*1024;return r.every(n=>typeof n.size!="number"?!0:n.size<=i)}extractFiles(t){if(!t)return[];let e=[];return typeof File<"u"&&t instanceof File?(e.push(t),e):typeof FileList<"u"&&t instanceof FileList?Array.from(t):Array.isArray(t)?(t.forEach(r=>{e.push(...this.extractFiles(r))}),e):typeof t=="object"&&("name"in t||"size"in t||"type"in t)?(e.push(t),e):(typeof t=="string"&&t!==""&&e.push({name:t}),e)}isMimeAllowed(t,e){let r=(t.type||"").toLowerCase(),i=this.getFileExtension(t.name);return e.some(n=>{let s=n.replace(/^\./,"").toLowerCase();return s?s.includes("/")?r===s:i===s:!1})}getFileExtension(t){if(!t)return"";let e=t.split(".");return e.length<=1?"":(e.pop()||"").toLowerCase()}compareDates(t,e,r,i){if(t==null||t==="")return!0;let n=e?.[0];if(!n)return!0;let s=this.toDate(t),o=this.resolveDateReference(n,r);return!s||!o?!1:i==="after"?s.getTime()>o.getTime():s.getTime()<o.getTime()}resolveDateReference(t,e){let r=this.getContextValue(e,t);if(r!==void 0)return this.toDate(r);if(t.toLowerCase()==="now")return new Date;if(t.toLowerCase()==="today"){let i=new Date;return i.setHours(0,0,0,0),i}return this.toDate(t)}toDate(t){if(t==null||t==="")return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;if(typeof t=="number"){let e=new Date(t);return Number.isNaN(e.getTime())?null:e}if(typeof t=="string"){let e=Date.parse(t);if(!Number.isNaN(e))return new Date(e)}return null}testByRegex(t,e,r=!1){if(e==null||e==="")return!0;let i=typeof t=="string"?t:t==null?"":String(t);if(r&&i==="")return!0;try{let{source:n,flags:s}=this.normalizeRegex(e);return new RegExp(n,s).test(i)}catch{return!0}}normalizeRegex(t){let e=t.trim();if(e.startsWith("/")&&e.lastIndexOf("/")>0){let r=e.lastIndexOf("/"),i=e.slice(1,r),n=e.slice(r+1);return{source:i,flags:n}}return{source:e,flags:""}}getContextValue(t,e){if(!(!t||!e)){if(t.values&&Object.prototype.hasOwnProperty.call(t.values,e))return t.values[e];if(t.getValue)return t.getValue(e)}}areValuesEqual(t,e){return Array.isArray(t)||Array.isArray(e)?JSON.stringify(t)===JSON.stringify(e):t===e}isIPv4(t){let e=t.split(".");return e.length!==4?!1:e.every(r=>{if(!/^\d+$/.test(r))return!1;let i=Number(r);return i>=0&&i<=255})}isIPv6(t){if(!t)return!1;if(t==="::")return!0;let e=t.split("::");if(e.length>2)return!1;let r=/^[0-9a-fA-F]{1,4}$/,i=t.split(":");return e.length===2?i.every(n=>n===""||r.test(n))&&i.length<=8:i.length===8&&i.every(n=>r.test(n))}};var li=class{pendingVars=new Map;pendingProps=new Map;isOpen=!1;canUseTypedOM(t){return"attributeStyleMap"in t&&typeof CSS<"u"&&typeof CSS.number=="function"&&typeof CSS.px=="function"}writeVar(t,e,r){let i=t.style;if(this.canUseTypedOM(t)&&typeof r=="number"&&Number.isFinite(r))try{t.attributeStyleMap.set(e,CSS.number(r));return}catch{}i.setProperty(e,String(r))}begin(){this.isOpen||(this.isOpen=!0)}setVars(t,e){if(!this.isOpen){console.warn("StyleTxn: call begin() first to set custom properties.");return}let r=this.pendingVars.get(t)??{};for(let[i,n]of Object.entries(e))r[i]!==n&&(r[i]=n);this.pendingVars.set(t,r)}setVar(t,e,r){if(!this.isOpen){console.warn("StyleTxn: call begin() first to set custom properties.");return}let i=this.pendingVars.get(t)??{};i[e]!==r&&(i[e]=r,this.pendingVars.set(t,i))}setVarDirect(t,e,r){this.writeVar(t,e,r)}setProps(t,e){if(!this.isOpen){console.warn("StyleTxn: call begin() first to set standard properties.");return}let r=this.pendingProps.get(t)??{};for(let[i,n]of Object.entries(e))r[i]!==n&&(r[i]=n);this.pendingProps.set(t,r)}setProp(t,e,r){if(!this.isOpen){console.warn("StyleTxn: call begin() first to set standard properties.");return}let i=this.pendingProps.get(t)??{};i[e]!==r&&(i[e]=r,this.pendingProps.set(t,i))}run(t){let e=this.isOpen;e||this.begin();try{t(),e||this.commit()}catch(r){throw e||this.cancel(),r}}commit(){if(this.isOpen){this.isOpen=!1;for(let[t,e]of this.pendingVars)for(let[r,i]of Object.entries(e))this.writeVar(t,r,i);this.pendingVars.clear();for(let[t,e]of this.pendingProps){let r=t.style;for(let[i,n]of Object.entries(e))r[i]=String(n)}this.pendingProps.clear()}}cancel(){this.pendingVars.clear(),this.pendingProps.clear(),this.isOpen=!1}},L=new li;var Be=class{domAttribute=new Ut;recordAttribute=new jt;transformNullify=new St;boundingClientRect=new $t;relativePosition=new Yt(this.transformNullify);unitParser=new Xt;lerp=new qt;adaptiveLerp=new Kt;originParser=new Zt;colorParser=new Qt;validation=new He;easingFunction=new Jt;magneticPull=new te;lerpColor=new ee;lerpVector=new re;transformScaleParser=new ie;optionsParser=new Re;ruleParser=new ne;styleTxn=L};function _e(){let l=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)").matches:!1,t=typeof navigator<"u"?(navigator.maxTouchPoints||0)>0:!1,e=typeof window<"u"?window.innerWidth<=768:!1;return l||t||e}var Fi=new WeakMap,$=5e-4,At="default",di="[string-cursor],[data-string-cursor]",Vi="[string-cursor-content],[data-string-cursor-content]",ci=1/240,X=(l,t)=>{let e=Math.pow(10,t);return Math.round(l*e)/e};function es(l){let t=Fi.get(l);return t||(t={prevX:Number.NaN,prevY:Number.NaN},Fi.set(l,t)),t}var Fe=class extends x{cursorPrev={x:Number.NaN,y:Number.NaN,stepX:Number.NaN,stepY:Number.NaN};cursorPortals=new Map;hoveredObjects=new Set;globalListenersBound=!1;boundBeforeUnload=()=>this.cleanupHoverTargets();boundPageHide=()=>this.cleanupHoverTargets();boundVisibilityChange=()=>{document.hidden&&this.cleanupHoverTargets()};enabled=!0;lastFrameTime=0;constructor(t){super(t),this.htmlKey="cursor",this.cssProperties=[{name:"--x",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--y",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--x-lerp",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--y-lerp",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--x-px",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--y-px",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--dx",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--dy",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--angle",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--angle-deg",syntax:"<number>",initialValue:"0",inherits:!0}],this.permissions.mobile.rebuild.height=!1,this.permissions.mobile.rebuild.width=!1,this.permissions.mobile.rebuild.scrollHeight=!1,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:"cursor-target",type:"string",fallback:this.settings["cursor-target"]??At},{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:"cursor-enter",type:{type:"enum",values:["snap","smooth"]},fallback:"snap"},{key:"cursor-leave",type:{type:"enum",values:["snap","smooth"]},fallback:"smooth"},{key:"cursor-leave-hold",type:"boolean",fallback:!1},{key:"lerp",type:"number",fallback:this.settings.lerp,transform:e=>this.tools.adaptiveLerp.process({value:e,inMin:.1,inMax:1,outMin:.05,outMax:.65})},{key:"cursor-float",type:"number",fallback:2},{key:"cursor-vars",type:"string",fallback:""}],_e()&&(this.enabled=!1),this.collectCursorPortals(),this.enabled&&this.bindGlobalLifecycleListeners()}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i),e.setProperty("mouse-x",0),e.setProperty("mouse-y",0),e.setProperty("mouse-pixel-x",0),e.setProperty("mouse-pixel-y",0),e.setProperty("is-mouse-over",!1),e.setProperty("is-mouse-move",!1),e.setProperty("__cursor-vars",this.parseCursorVars(e.getProperty("cursor-vars")));let n=r.getBoundingClientRect();e.setProperty("cached-width",n.width||r.offsetWidth||1),e.setProperty("cached-height",n.height||r.offsetHeight||1)}onResize(){super.onResize(),this.objects.forEach(t=>{let e=t.htmlElement.getBoundingClientRect();t.setProperty("cached-width",e.width||t.htmlElement.offsetWidth||1),t.setProperty("cached-height",e.height||t.htmlElement.offsetHeight||1)})}onMutate(t){if(!this.enabled)return;let e=performance.now(),r=this.lastFrameTime?(e-this.lastFrameTime)/1e3:.016;this.lastFrameTime=e,r>.1&&(r=.1),r<ci&&(r=ci);let i=this.data.cursor.targetX,n=this.data.cursor.targetY;if(this.objects.forEach(s=>{let o=s.getProperty("is-mouse-over"),a=s.getProperty("cursor-target-disable"),d=s.getProperty("lerp")??.15,c=this.getFrameAdjustedLerp(d,r),u=this.getObjectDimensions(s),{halfWidth:p,halfHeight:g,width:m,height:h}=u;if(o&&!a){let{cx:f,cy:b}=this.centers.getCenter(s),y=i-(f-p),v=n-(b-g),S=s.getProperty("mouse-pixel-x")??0,E=s.getProperty("mouse-pixel-y")??0,M=S-y,C=E-v;if(M*M+C*C>1e-4){let I=s.getProperty("is-mouse-move")??!1,H=s.getProperty("cursor-enter")??"snap",w=s.getProperty("alignment")??"center";if(!I){if(s.setProperty("is-mouse-move",!0),H==="snap")s.setProperty("mouse-pixel-x",y),s.setProperty("mouse-pixel-y",v),s.setProperty("mouse-x",y),s.setProperty("mouse-y",v),S=y,E=v;else{let N=s.getProperty("mouse-x")??0,z=s.getProperty("mouse-y")??0;S=this.reverseOffset(w,N,m),E=this.reverseOffset(w,z,h),s.setProperty("mouse-pixel-x",S),s.setProperty("mouse-pixel-y",E)}this.events.emit(this.getObjectEventName(s,"cursor:start"),null)}let _=this.tools.lerp.process({from:S,to:y,progress:c}),k=this.tools.lerp.process({from:E,to:v,progress:c}),O=S+_,T=E+k,P=Math.abs(O-S)>$||Math.abs(T-E)>$;s.setProperty("mouse-pixel-x",O),s.setProperty("mouse-pixel-y",T);let R=this.calculateOffset(w,O,m),B=this.calculateOffset(w,T,h);s.setProperty("mouse-x",R),s.setProperty("mouse-y",B),this.setMouseCoordinates(s,R,B,O,T)&&this.events.emit(this.getObjectEventName(s,"cursor:move"),{x:R,y:B}),P&&this.events.emit(this.getObjectEventName(s,"cursor:pixel"),{x:O,y:T})}else{s.setProperty("mouse-pixel-x",y),s.setProperty("mouse-pixel-y",v),s.getProperty("is-mouse-move")&&(s.setProperty("is-mouse-move",!1),this.events.emit(this.getObjectEventName(s,"cursor:end"),null));let I=s.getProperty("alignment")??"center",H=this.calculateOffset(I,y,m),w=this.calculateOffset(I,v,h);this.setMouseCoordinates(s,H,w,y,v)}}else{if(s.getProperty("cursor-leave-hold")??!1){s.getProperty("is-mouse-move")&&(s.setProperty("is-mouse-move",!1),this.events.emit(this.getObjectEventName(s,"cursor:end"),null));return}if((s.getProperty("cursor-leave")??"smooth")==="snap"){s.setProperty("is-mouse-move",!1),s.setProperty("mouse-x",0),s.setProperty("mouse-y",0),s.setProperty("mouse-pixel-x",0),s.setProperty("mouse-pixel-y",0),this.setMouseCoordinates(s,0,0,0,0);return}let y=s.getProperty("mouse-x")??0,v=s.getProperty("mouse-y")??0;if(y!==0||v!==0){s.setProperty("is-mouse-move",!1);let S=this.calculateOffset("center",p,m),E=this.calculateOffset("center",g,h),M=y+this.tools.lerp.process({from:y,to:S,progress:c}),C=v+this.tools.lerp.process({from:v,to:E,progress:c});s.setProperty("mouse-x",M),s.setProperty("mouse-y",C),Math.abs(M)<.001&&Math.abs(C)<.001?(s.setProperty("mouse-x",0),s.setProperty("mouse-y",0),s.setProperty("mouse-pixel-x",0),s.setProperty("mouse-pixel-y",0),this.setMouseCoordinates(s,0,0,0,0)):this.setMouseCoordinates(s,M,C)}}}),this.cursorPortals.size>0){let{stepX:s,stepY:o,smoothedX:a,smoothedY:d}=this.data.cursor,c=this.cursorPrev;(!Number.isFinite(c.x)||Math.abs(a-c.x)>$||Math.abs(d-c.y)>$||Math.abs(s-c.stepX)>$||Math.abs(o-c.stepY)>$)&&(this.events.emit("cursor",{stepX:s,stepY:o,x:a,y:d}),this.cursorPrev={x:a,y:d,stepX:s,stepY:o});let p=this.data.cursor.targetX,g=this.data.cursor.targetY;this.cursorPortals.forEach(m=>{m.forEach(h=>{this.updatePortalPosition(h,p,g,r)})})}}onObjectConnected(t){let e=t.htmlElement;this.centers.attach(t),t.setProperty("mouseleave",()=>{this.onMouseLeave(t)}),t.setProperty("mouseenter",()=>{this.onMouseEnter(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"))}getCursorClass(t){let e=t.getProperty("cursor-class");return e!=null&&e.length>0?e:null}onMouseEnter(t){if(!document.contains(t.htmlElement))return;t.setProperty("is-mouse-over",!0),this.hoveredObjects.add(t);let e=this.getCursorClass(t);this.withPortalsForObject(t,r=>{e&&r.element.classList.add(e),this.incrementPortalHover(r)}),t.htmlElement.addEventListener("mouseleave",t.getProperty("mouseleave"))}onMouseLeave(t){t.setProperty("is-mouse-over",!1),this.hoveredObjects.delete(t);let e=this.getCursorClass(t);this.withPortalsForObject(t,r=>{e&&r.element.classList.remove(e),this.decrementPortalHover(r)}),document.contains(t.htmlElement)&&t.htmlElement.removeEventListener("mouseleave",t.getProperty("mouseleave"))}onEnterObject(t){t.htmlElement.addEventListener("mouseenter",t.getProperty("mouseenter"))}onLeaveObject(t){t.htmlElement.removeEventListener("mouseenter",t.getProperty("mouseenter")),t.htmlElement.removeEventListener("mouseleave",t.getProperty("mouseleave"))}safariNavigationCleanup(t){t.getProperty("is-mouse-over")&&this.onMouseLeave(t)}onElementRemovedFromDOM(t){t.getProperty("is-mouse-over")&&this.onMouseLeave(t)}onObjectDisconnected(t){t.getProperty("is-mouse-over")&&this.onMouseLeave(t)}onDOMRebuild(){this.enabled&&this.collectCursorPortals()}onDOMMutate(t,e){this.enabled&&((this.shouldRefreshPortals(t)||this.shouldRefreshPortals(e))&&this.collectCursorPortals(),e.length>0&&this.handleRemovedNodes(e))}collectCursorPortals(){this.cursorPortals.clear(),document.querySelectorAll(di).forEach(e=>{if(!(e instanceof HTMLElement))return;let r=this.resolvePortalId(e),i=this.resolvePortalLerp(e),n=e.matches(Vi)?e:e.querySelector(Vi),s=this.data.cursor.targetX,o=this.data.cursor.targetY,a={id:r,element:e,content:n,prev:{x:s,y:o,stepX:0,stepY:0},hoverCount:0,showTimer:null,lerp:i},d=this.cursorPortals.get(r);d?d.push(a):this.cursorPortals.set(r,[a])})}resolvePortalId(t){let e=[t.getAttribute("data-string-cursor"),t.getAttribute("string-cursor"),t.getAttribute("data-string-cursor-id"),t.getAttribute("string-cursor-id")];for(let r of e)if(r&&r.trim().length>0)return r.trim();return At}resolvePortalLerp(t){let e=t.getAttribute("data-string-cursor-lerp")??t.getAttribute("string-cursor-lerp")??this.settings["cursor-lerp"];if(!e)return null;let r=parseFloat(e);if(!Number.isFinite(r))return null;let i=Math.min(1,Math.max(.01,r));return this.tools.adaptiveLerp.process({value:i,inMin:.1,inMax:1,outMin:.05,outMax:.65})}shouldRefreshPortals(t){for(let e of Array.from(t))if(e instanceof Element&&(e.matches(di)||e.querySelector(di)))return!0;return!1}withPortalsForObject(t,e){this.getPortalsForObject(t).forEach(i=>e(i))}getPortalsForObject(t){if(this.cursorPortals.size===0)return[];let e=this.extractPortalIds(t),r=[];if(e.forEach(i=>{if(i==="*"){this.cursorPortals.forEach(o=>{o.forEach(a=>r.push(a))});return}let n=i.length>0?i:At,s=this.cursorPortals.get(n);s&&s.forEach(o=>r.push(o))}),r.length===0){let i=this.cursorPortals.get(At)??this.cursorPortals.values().next().value;i&&i.length>0&&i.forEach(n=>r.push(n))}return r}extractPortalIds(t){if(!t)return[At];let e=t.getProperty("cursor-target");return typeof e!="string"||e.trim().length===0?[At]:e.split(/[,|]/).map(r=>r.trim()).filter(Boolean)}incrementPortalHover(t){t.hoverCount++,t.element.classList.remove("-show"),this.restartPortalShowTimer(t)}decrementPortalHover(t){t.hoverCount=Math.max(0,t.hoverCount-1),t.hoverCount===0&&(this.clearPortalShowTimer(t),t.element.classList.remove("-show"))}restartPortalShowTimer(t){if(this.clearPortalShowTimer(t),!t.element.isConnected){t.showTimer=null;return}t.element.classList.add("-show"),t.showTimer=null}clearPortalShowTimer(t){t.showTimer&&(clearTimeout(t.showTimer),t.showTimer=null)}updatePortalPosition(t,e,r,i){if(!t.element.isConnected)return;let n=t.prev,s=Number.isFinite(n.x)?n.x:e,o=Number.isFinite(n.y)?n.y:r,a=t.lerp??.1,d=this.getFrameAdjustedLerp(a,i),c=(e-s)*d,u=(r-o)*d,p=i>1e-4?i:1/60,g=c/(p*60),m=u/(p*60);if(Math.abs(c)<$&&Math.abs(u)<$)return;let h=s+c,f=o+u;this.writePortalVars(t.element,{"--x":X(h,2),"--y":X(f,2),"--x-lerp":X(g,3),"--y-lerp":X(m,3)}),n.x=h,n.y=f,n.stepX=c,n.stepY=u}handleRemovedNodes(t){this.hoveredObjects.size!==0&&Array.from(this.hoveredObjects).forEach(e=>{e.htmlElement.isConnected||this.onElementRemovedFromDOM(e)})}cleanupHoverTargets(){this.hoveredObjects.size!==0&&Array.from(this.hoveredObjects).forEach(t=>this.safariNavigationCleanup(t))}bindGlobalLifecycleListeners(){this.globalListenersBound||(window.addEventListener("beforeunload",this.boundBeforeUnload),window.addEventListener("pagehide",this.boundPageHide),document.addEventListener("visibilitychange",this.boundVisibilityChange),this.globalListenersBound=!0)}unbindGlobalLifecycleListeners(){this.globalListenersBound&&(window.removeEventListener("beforeunload",this.boundBeforeUnload),window.removeEventListener("pagehide",this.boundPageHide),document.removeEventListener("visibilitychange",this.boundVisibilityChange),this.globalListenersBound=!1)}setMouseCoordinates(t,e,r,i,n){if(t.getProperty("cursor-target-style-disable"))return!1;let s=es(t),o=t.getProperty("cursor-float")??2,a=Math.pow(10,o),d=Math.abs(e)<$&&Number.isFinite(s.prevX)&&Math.abs(s.prevX)<$?s.prevX:Math.round(e*a)/a,c=Math.abs(r)<$&&Number.isFinite(s.prevY)&&Math.abs(s.prevY)<$?s.prevY:Math.round(r*a)/a;if(Number.isFinite(s.prevX)&&Math.abs(d-s.prevX)<=$&&Number.isFinite(s.prevY)&&Math.abs(c-s.prevY)<=$)return!1;s.prevX=d,s.prevY=c;let u=t.getProperty("__cursor-vars"),p={"--x":X(d,o),"--y":X(c,o)};if(u&&u.size>0){let m=Number.isFinite(i)?i:t.getProperty("mouse-pixel-x"),h=Number.isFinite(n)?n:t.getProperty("mouse-pixel-y"),f=t.getProperty("__prev-x-px"),b=t.getProperty("__prev-y-px"),y=Number.isFinite(f)?m-f:0,v=Number.isFinite(b)?h-b:0;t.setProperty("__prev-x-px",m),t.setProperty("__prev-y-px",h);let S=y===0&&v===0?0:Math.atan2(v,y),E=S*180/Math.PI;u.has("xpx")&&(p["--x-px"]=X(m,2)),u.has("ypx")&&(p["--y-px"]=X(h,2)),u.has("dx")&&(p["--dx"]=X(y,3)),u.has("dy")&&(p["--dy"]=X(v,3)),u.has("angle")&&(p["--angle"]=X(S,4)),u.has("angle-deg")&&(p["--angle-deg"]=X(E,2))}let g=()=>{this.applyToElementAndConnects(t,m=>{L.setVars(m,p)})};return L.isOpen?g():L.run(g),!0}writePortalVars(t,e){if(L.isOpen){L.setVars(t,e);return}L.run(()=>{L.setVars(t,e)})}parseCursorVars(t){return t?new Set(t.split(/[|,]/).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0)):new Set}getFrameAdjustedLerp(t,e){let r=Math.min(.99,Math.max(.001,t));if(!Number.isFinite(e)||e<=0)return r;let n=Math.max(e,ci)*60,s=1-Math.pow(1-r,n);return Math.min(.999,Math.max(1e-4,s))}getObjectDimensions(t){let e=t.getProperty("cached-width"),r=t.getProperty("cached-height");if(typeof e=="number"&&typeof r=="number"&&e>0&&r>0){let g=e/2,m=r/2;return{width:e,height:r,halfWidth:g,halfHeight:m}}let i=t.htmlElement,n=i.offsetWidth||i.clientWidth||i.scrollWidth||1,s=i.offsetHeight||i.clientHeight||i.scrollHeight||1,o=t.getProperty("half-width"),a=t.getProperty("half-height"),d=typeof o=="number"&&Number.isFinite(o)?o:n/2,c=typeof a=="number"&&Number.isFinite(a)?a:s/2,u=d>0?d*2:n,p=c>0?c*2:s;return t.setProperty("cached-width",u),t.setProperty("cached-height",p),{width:u,height:p,halfWidth:d,halfHeight:c}}calculateOffset(t,e,r){switch(t){case"start":return e/r;case"end":return(e-r)/r;case"center":default:return(e-r/2)/(r/2)}}reverseOffset(t,e,r){switch(t){case"start":return e*r;case"end":return e*r+r;case"center":default:return e*(r/2)+r/2}}removeObject(t){if(!this.enabled)return super.removeObject(t);let e=this.objectMapOnPage.get(t);e&&this.centers.detach(e),super.removeObject(t)}destroy(){this.unbindGlobalLifecycleListeners(),this.hoveredObjects.clear(),super.destroy()}};var Ve=class extends x{originObservers=new WeakMap;constructor(t){super(t),this.htmlKey="impulse",this.cssProperties=[{name:"--push-x",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--push-y",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--push-rotation",syntax:"<number>",initialValue:"0",inherits:!0}],this.attributesToMap.push({key:"position-strength",type:"number",fallback:this.settings["position-strength"]},{key:"position-tension",type:"number",fallback:this.settings["position-tension"]},{key:"position-friction",type:"number",fallback:this.settings["position-friction"]},{key:"position-max-velocity",type:"number",fallback:this.settings["position-max-velocity"]},{key:"position-update-threshold",type:"number",fallback:this.settings["position-update-threshold"]},{key:"rotation-strength",type:"number",fallback:this.settings["rotation-strength"]},{key:"rotation-tension",type:"number",fallback:this.settings["rotation-tension"]},{key:"rotation-friction",type:"number",fallback:this.settings["rotation-friction"]},{key:"rotation-max-angular-velocity",type:"number",fallback:this.settings["rotation-max-angular-velocity"]},{key:"rotation-max-angle",type:"number",fallback:this.settings["rotation-max-angle"]},{key:"rotation-update-threshold",type:"number",fallback:this.settings["rotation-update-threshold"]},{key:"max-offset",type:"number",fallback:this.settings["max-offset"]},{key:"sleep-epsilon",type:"number",fallback:this.settings["sleep-epsilon"]},{key:"continuous-push",type:"boolean",fallback:this.settings["continuous-push"]},{key:"rotation-origin",type:"string",fallback:this.settings["rotation-origin"]??"center center"})}onObjectConnected(t){super.onObjectConnected(t),t.setProperty("offset-x",0),t.setProperty("offset-y",0),t.setProperty("velocity-x",0),t.setProperty("velocity-y",0),t.setProperty("angle-deg",0),t.setProperty("ang-vel-deg",0),t.setProperty("__prev-css-x",0),t.setProperty("__prev-css-y",0),t.setProperty("__prev-css-rot",0),t.setProperty("__push-latch",!1),t.setProperty("__rotate-latch",!1),this.cacheRotationOrigin(t),this.observeRotationOrigin(t),this.hover.track(t),this.centers.attach(t)}onObjectDisconnected(t){this.hover.untrack(t),this.centers.detach(t);let e=this.originObservers.get(t);e&&(e.disconnect(),this.originObservers.delete(t))}onMouseMove(t){if(!t)return;let e=this.data.cursor.velocityX,r=this.data.cursor.velocityY;if(e===0&&r===0)return;let i=this.data.cursor.targetX,n=this.data.cursor.targetY;for(let s of this.objects){let o=s.htmlElement.getBoundingClientRect();if(i>=o.left&&i<=o.right&&n>=o.top&&n<=o.bottom){{let u=o.width||1,p=Math.max(0,Math.min(1,(this.data.cursor.targetX-o.left)/u));this.events.emit(this.getObjectEventName(s,"object:impulse","side"),{value:p})}let d=s.getProperty("position-strength")||0;if(d!==0){let u=s.getProperty("continuous-push")??!0,p=s.getProperty("__push-latch")===!0;if(u||!p){let g=s.getProperty("velocity-x")||0,m=s.getProperty("velocity-y")||0;g+=e*d,m+=r*d,s.setProperty("velocity-x",g),s.setProperty("velocity-y",m),u||s.setProperty("__push-latch",!0)}}let c=s.getProperty("rotation-strength")??.75;if(c!==0){let u=s.getProperty("continuous-push")??!0,p=s.getProperty("__rotate-latch")===!0;if(u||!p){let{centerX:g,centerY:m}=this.getRotationOriginFromRect(s,o),h=i-g,f=n-m,b=h*r-f*e,y=s.getProperty("ang-vel-deg")||0;y+=b*c*.02,s.setProperty("ang-vel-deg",y),u||s.setProperty("__rotate-latch",!0)}}}}}cacheRotationOrigin(t){let e=t.getProperty("rotation-origin")??"center center",{x:r,y:i}=this.tools.originParser.toNormalized({value:e});t.setProperty("__rotation-origin-x",r),t.setProperty("__rotation-origin-y",i)}observeRotationOrigin(t){let e="string-rotation-origin",r="data-string-rotation-origin",i=new MutationObserver(n=>{for(let s of n)if(s.type==="attributes"&&(s.attributeName===e||s.attributeName===r)){let o=t.htmlElement.getAttribute(e)??t.htmlElement.getAttribute(r);o!==null&&t.setProperty("rotation-origin",o),this.cacheRotationOrigin(t);break}});i.observe(t.htmlElement,{attributes:!0,attributeFilter:[e,r]}),this.originObservers.set(t,i)}getRotationOriginFromRect(t,e){let r=t.getProperty("__rotation-origin-x")??.5,i=t.getProperty("__rotation-origin-y")??.5;return{centerX:e.left+e.width*r,centerY:e.top+e.height*i}}onFrame(t){let e=this.data.cursor.targetX,r=this.data.cursor.targetY;for(let i of this.objects){let n=i.htmlElement.getBoundingClientRect(),s=e>=n.left&&e<=n.right&&r>=n.top&&r<=n.bottom;!s&&i.getProperty("__push-latch")===!0&&i.setProperty("__push-latch",!1),!s&&i.getProperty("__rotate-latch")===!0&&i.setProperty("__rotate-latch",!1)}for(let i=0;i<this.objects.length;i++){let n=this.objects[i],s=n.getProperty("offset-x")||0,o=n.getProperty("offset-y")||0,a=n.getProperty("velocity-x")||0,d=n.getProperty("velocity-y")||0,c=n.getProperty("position-tension")??.05,u=n.getProperty("position-friction")??.15,p=n.getProperty("position-max-velocity")??120,g=n.getProperty("max-offset")??220;a-=c*s,d-=c*o;let m=1-u;a*=m,d*=m,a>p?a=p:a<-p&&(a=-p),d>p?d=p:d<-p&&(d=-p),s+=a,o+=d,s>g?s=g:s<-g&&(s=-g),o>g?o=g:o<-g&&(o=-g);let h=n.getProperty("angle-deg")||0,f=n.getProperty("ang-vel-deg")||0,b=n.getProperty("rotation-tension")??.06,y=n.getProperty("rotation-friction")??.18,v=n.getProperty("rotation-max-angular-velocity")??6,S=n.getProperty("rotation-max-angle")??18;f-=b*h,f*=1-y,f>v?f=v:f<-v&&(f=-v),h+=f,h>S?(h=S,f*=.35):h<-S&&(h=-S,f*=.35);let E=n.getProperty("sleep-epsilon")??.01,M=a*a+d*d<E*E&&s*s+o*o<E*E,C=Math.abs(f)<E&&Math.abs(h)<E;M?(a||d||s||o)&&(n.setProperty("offset-x",0),n.setProperty("offset-y",0),n.setProperty("velocity-x",0),n.setProperty("velocity-y",0),s=o=a=d=0):(n.setProperty("offset-x",s),n.setProperty("offset-y",o),n.setProperty("velocity-x",a),n.setProperty("velocity-y",d)),C?(h||f)&&(n.setProperty("angle-deg",0),n.setProperty("ang-vel-deg",0),h=f=0):(n.setProperty("angle-deg",h),n.setProperty("ang-vel-deg",f));let A=n.getProperty("position-update-threshold")??.1,I=n.getProperty("rotation-update-threshold")??.15,H=n.getProperty("__prev-css-x")||0,w=n.getProperty("__prev-css-y")||0,_=n.getProperty("__prev-css-rot")||0,k=Math.round(s*10)/10,O=Math.round(o*10)/10,T=Math.round(h*10)/10,P=Math.abs(k-H)>A||Math.abs(O-w)>A,R=Math.abs(T-_)>I;(P||R)&&(n.setProperty("__next-css-x",k),n.setProperty("__next-css-y",O),n.setProperty("__next-css-rot",T)),n.setProperty("__needs-position-update",P),n.setProperty("__needs-rotation-update",R)}}onMutate(){for(let t=0;t<this.objects.length;t++){let e=this.objects[t],r=e.getProperty("__needs-position-update")===!0,i=e.getProperty("__needs-rotation-update")===!0;if(!r&&!i)continue;let n=e.getProperty("__next-css-x")||0,s=e.getProperty("__next-css-y")||0,o=e.getProperty("__next-css-rot")||0;this.applyToElementAndConnects(e,a=>{r&&(L.setVar(a,"--push-x",n),L.setVar(a,"--push-y",s)),i&&L.setVar(a,"--push-rotation",o)}),r&&(e.setProperty("__prev-css-x",n),e.setProperty("__prev-css-y",s),this.events.emit(this.getObjectEventName(e,"object:impulse","move"),{x:n,y:s})),i&&(e.setProperty("__prev-css-rot",o),this.events.emit(this.getObjectEventName(e,"object:impulse","rotate"),{rotation:o})),e.setProperty("__needs-position-update",!1),e.setProperty("__needs-rotation-update",!1)}}};var gt=new WeakMap,ui=60,Wi=(l,t)=>t>0?l>=t?l%t:l<0?(l%t+t)%t:l:0,rs=l=>Number.isFinite(l)?Math.max(0,Math.abs(l)):ui,We=class extends x{onFontsReadyBound;constructor(t){super(t),this.htmlKey="marquee",this.cssProperties=[{name:"--marquee-progress",syntax:"<number>",initialValue:"0",inherits:!1}],this.permissions.mobile.rebuild.height=!1,this.permissions.mobile.rebuild.width=!1,this.permissions.mobile.rebuild.scrollHeight=!1,this.attributesToMap=[...this.attributesToMap,{key:"marquee-direction",type:{type:"enum",values:["left","right"]},fallback:this.settings["marquee-direction"]??"left"},{key:"marquee-speed",type:"number",fallback:this.settings["marquee-speed"]??ui},{key:"marquee-gap",type:"dimension",fallback:this.settings["marquee-gap"]??0},{key:"marquee-fill",type:"boolean",fallback:this.settings["marquee-fill"]??!1},{key:"marquee-pause-on-hover",type:"boolean",fallback:this.settings["marquee-pause-on-hover"]??!1},{key:"marquee-progress",type:"boolean",fallback:this.settings["marquee-progress"]??!1},{key:"marquee-part-class",type:"string",fallback:this.settings["marquee-part-class"]??""}],this.onFontsReadyBound=this.onFontsReady.bind(this)}onInit(){"fonts"in document&&document.fonts&&(document.fonts.ready.then(this.onFontsReadyBound),document.fonts.addEventListener?.("loadingdone",this.onFontsReadyBound))}onUnsubscribe(){"fonts"in document&&document.fonts&&document.fonts.removeEventListener?.("loadingdone",this.onFontsReadyBound)}onObjectConnected(t){super.onObjectConnected(t);let e=gt.get(t);e||(e=this.createState(t.htmlElement),gt.set(t,e),this.mountStructure(e)),this.syncConfig(t,e),this.refresh(e)}onObjectDisconnected(t){let e=gt.get(t);e&&(e.host.removeEventListener("mouseenter",this.onMouseEnter),e.host.removeEventListener("mouseleave",this.onMouseLeave))}onResizeWidth(){for(let t=0;t<this.objectsOnPage.length;t++){let e=gt.get(this.objectsOnPage[t]);e&&(this.syncConfig(this.objectsOnPage[t],e),this.refresh(e))}}onFrame(t){let e=Math.max(.004166666666666667,Math.min(.1,(t.time.delta||16.6667)/1e3));L.run(()=>{for(let r=0;r<this.objectsOnPage.length;r++){let i=gt.get(this.objectsOnPage[r]);if(!i||!(i.cycleWidth>0))continue;!(i.pauseOnHover&&i.hovering)&&i.speed>0&&(i.position=Wi(i.position+i.speed*e,i.cycleWidth));let n=i.direction==="right"?i.position-i.cycleWidth:-i.position;n!==i.lastAppliedTranslate&&(i.lastAppliedTranslate=n,L.setProp(i.track,"transform",`translate3d(${n}px, 0, 0)`),this.updatePartProgress(i,n))}})}createState(t){let e=document.createElement("div"),r=document.createElement("span");return e.setAttribute("data-string-marquee-track",""),r.setAttribute("data-string-marquee-part",""),t.addEventListener("mouseenter",this.onMouseEnter),t.addEventListener("mouseleave",this.onMouseLeave),{host:t,track:e,part:r,parts:[r],clones:[],direction:"left",speed:ui,gap:0,fill:!1,pauseOnHover:!1,progressEnabled:!1,hovering:!1,position:0,hostWidth:0,partWidth:0,cycleWidth:0,lastAppliedTranslate:Number.NaN,partProgressApplied:[Number.NaN],partClass:""}}mountStructure(t){let{host:e,track:r,part:i}=t;for(;e.firstChild;)i.appendChild(e.firstChild);r.appendChild(i),e.appendChild(r),L.run(()=>{L.setProps(e,{overflow:"hidden"}),L.setProps(r,{display:"flex",flexWrap:"nowrap",width:"max-content",willChange:"transform"}),L.setProps(i,{flex:"0 0 auto"})})}syncConfig(t,e){e.direction=t.getProperty("marquee-direction")??"left",e.speed=rs(t.getProperty("marquee-speed")),e.gap=Math.max(0,t.getProperty("marquee-gap")??0),e.fill=t.getProperty("marquee-fill")===!0,e.pauseOnHover=t.getProperty("marquee-pause-on-hover")===!0,e.progressEnabled=t.getProperty("marquee-progress")===!0,e.partClass=t.getProperty("marquee-part-class")??""}refresh(t){this.syncPartClass(t),this.syncCopies(t),t.hostWidth=t.host.getBoundingClientRect().width,t.partWidth=t.part.getBoundingClientRect().width,t.cycleWidth=t.partWidth>0?t.partWidth+t.gap:0,t.position=Wi(t.position,t.cycleWidth),t.lastAppliedTranslate=Number.NaN;for(let e=0;e<t.partProgressApplied.length;e++)t.partProgressApplied[e]=Number.NaN;L.run(()=>{if(L.setProp(t.track,"columnGap",`${t.gap}px`),L.setProp(t.track,"transform","translate3d(0, 0, 0)"),!t.progressEnabled)for(let e=0;e<t.parts.length;e++)L.setVar(t.parts[e],"--marquee-progress",0)})}syncCopies(t){for(let o=0;o<t.clones.length;o++)t.clones[o].remove();t.clones.length=0;let e=t.host.getBoundingClientRect().width,r=t.part.getBoundingClientRect().width;if(!(e>0)||!(r>0))return;let i=r+t.gap,n=t.fill?Math.max(2,Math.ceil(e*2/i)+1):2,s=document.createDocumentFragment();for(let o=1;o<n;o++){let a=t.part.cloneNode(!0);a.removeAttribute("data-string-marquee-part"),a.setAttribute("aria-hidden","true"),s.appendChild(a),t.clones.push(a)}t.track.appendChild(s),t.parts=[t.part,...t.clones],t.partProgressApplied=new Array(t.parts.length).fill(Number.NaN)}syncPartClass(t){t.part.className=t.partClass}updatePartProgress(t,e){if(!t.progressEnabled||!(t.hostWidth>0)||!(t.partWidth>0))return;let r=t.hostWidth+t.partWidth;if(r>0)for(let i=0;i<t.parts.length;i++){let s=(e+i*t.cycleWidth+t.partWidth)/r,o=s<=0?0:s>=1?1:s,a=t.direction==="right"?o:1-o;t.partProgressApplied[i]!==a&&(t.partProgressApplied[i]=a,L.setVar(t.parts[i],"--marquee-progress",a))}}onFontsReady(){for(let t=0;t<this.objectsOnPage.length;t++){let e=gt.get(this.objectsOnPage[t]);e&&this.refresh(e)}}onMouseEnter=t=>{let e=t.currentTarget;if(e)for(let r=0;r<this.objectsOnPage.length;r++){let i=gt.get(this.objectsOnPage[r]);if(i?.host===e){i.hovering=!0;return}}};onMouseLeave=t=>{let e=t.currentTarget;if(e)for(let r=0;r<this.objectsOnPage.length;r++){let i=gt.get(this.objectsOnPage[r]);if(i?.host===e){i.hovering=!1;return}}}};var pi=class{measureQueue=[];mutateQueue=[];scheduled=!1;measure(t){this.measureQueue.push(t),this.schedule()}mutate(t){this.mutateQueue.push(t),this.schedule()}schedule(){this.scheduled||(this.scheduled=!0)}flush(){if(!this.scheduled)return;let t=this.measureQueue;this.measureQueue=[];for(let r=0;r<t.length;r++)try{t[r]()}catch(i){console.error("Error in frameDOM measure task:",i)}let e=this.mutateQueue;this.mutateQueue=[];for(let r=0;r<e.length;r++)try{e[r]()}catch(i){console.error("Error in frameDOM mutate task:",i)}this.scheduled=!1}},U=new pi;var is=20,rt={MANUAL_COLS_KEY:"masonry-manual-cols",MANUAL_GAP_KEY:"masonry-manual-gap",DEFAULT_DURATION:600,DEFAULT_EASING:"cubic-bezier(0.25, 1, 0.5, 1)"};function Ni(l){if(!l)return rt.DEFAULT_DURATION;let t=parseFloat(l);return isNaN(t)?rt.DEFAULT_DURATION:t}function Ne(l,t){let e=[...l].sort((i,n)=>n.breakpoint-i.breakpoint),r=e.find(i=>t>=i.breakpoint);return r?r.value:e[e.length-1]?.value}var ze=class extends x{states=new WeakMap;constructor(t){super(t),this.htmlKey="masonry",this.attributesToMap.push({key:"masonry-cols",type:"breakpoint-dimension",fallback:"2|640:3|1024:4"},{key:"masonry-gap",type:"breakpoint-dimension",fallback:"16|640:24|1024:32"},{key:"masonry-mode",type:"string",fallback:"auto"})}parseEasing(t){return this.tools.easingFunction.process({easing:t||rt.DEFAULT_EASING})}onObjectConnected(t){super.onObjectConnected(t);let e=t.htmlElement;L.begin(),L.setProps(e,{position:"relative",boxSizing:"border-box"}),L.commit();let r=this.createState(t,e);this.states.set(t,r),this.attachImgLoaders(t,r,e),this.scheduleLayout(t,!1,"init");let i=t.id;this.events.on(`masonry:update:${i}`,n=>{n.mode&&t.setProperty("masonry-mode",n.mode),n.cols!==void 0&&t.setProperty(rt.MANUAL_COLS_KEY,Number(n.cols)),n.gap!==void 0&&t.setProperty(rt.MANUAL_GAP_KEY,Number(n.gap)),this.scheduleLayout(t,!0,"external-event")})}onFrame(t){let e=t.time.now;this.objectsOnPage.forEach(r=>{let i=this.states.get(r);if(!i||!i.isAnimating)return;let n=0;L.run(()=>{if(i.isAnimatingHeight){let s=e-i.heightStartTime,o=Math.min(1,s/i.heightDuration),a=i.heightEase(o),d=i.startHeight+(i.targetHeight-i.startHeight)*a;L.setProps(r.htmlElement,{height:`${d}px`}),o<1?n++:i.isAnimatingHeight=!1}i.items.forEach((s,o)=>{if(!s.isMoving)return;let a=e-s.startTime,d=a*s.invPosDur,c=d>1?1:d,u=s.posEase(c);s.cx=s.sx+s.dx*u,s.cy=s.sy+s.dy*u;let p=a*s.invSizeDur,g=p>1?1:p,m=s.sizeEase(g);s.cw=s.sw+s.dw*m,L.setProps(o,{transform:`translate3d(${s.cx}px, ${s.cy}px, 0)`,...Math.abs(s.dw)>.05?{width:`${s.cw}px`}:{},willChange:"transform, width"}),c<1||g<1?n++:(s.isMoving=!1,L.setProps(o,{transform:`translate3d(${s.tx}px, ${s.ty}px, 0)`,width:`${s.tw}px`,willChange:"auto"}),s.cx=s.tx,s.cy=s.ty,s.cw=s.tw)})}),n===0&&this.handleAnimationEnd(r,i,e)})}onResize(){this.data.system.suppressMasonryResize||this.objectsOnPage.forEach(t=>{this.states.has(t)&&this.scheduleLayout(t,!0,"window-resize")})}cleanupObject(t){let e=this.states.get(t);e&&(e.ro.disconnect(),e.mo.disconnect(),e.resizeDebounceId&&clearTimeout(e.resizeDebounceId),this.states.delete(t))}createState(t,e){let r=e.getBoundingClientRect(),i=o=>{if(!o.length)return;let a=o[0].contentRect,d=this.states.get(t);if(!d||Math.abs(a.width-d.lastObservedWidth)<=.5&&Math.abs(a.height-d.lastObservedHeight)<=.5)return;d.lastObservedWidth=a.width,d.lastObservedHeight=a.height;let c=getComputedStyle(e),u=parseFloat(c.paddingLeft)||0,p=parseFloat(c.paddingRight)||0,g=a.width-u-p;if(g<=0)return;let{columns:m,gap:h}=this.getGridSettings(t),f=(g-h*(m-1))/m;m===d.lastLayoutColumns&&h===d.lastLayoutGap&&Math.abs(f-d.lastLayoutColumnWidth)<=.5||(d.resizeDebounceId&&window.clearTimeout(d.resizeDebounceId),d.resizeDebounceId=window.setTimeout(()=>{d.isResizing=!0,this.scheduleLayout(t,!0,"resize-observer"),d.isResizing=!1},is))},n=o=>{let a=this.states.get(t);if(!a)return;let d=!1;for(let c of o)c.removedNodes.length&&c.removedNodes.forEach(u=>{if(u.nodeType===1){let p=u;this.cleanupImgListeners(a,p),a.items.delete(p),d=!0}}),c.addedNodes.length&&c.addedNodes.forEach(u=>{u.nodeType===1&&(this.attachImgLoaders(t,a,u),d=!0)});d&&this.scheduleLayout(t,!0,"mutation-observer")},s={ro:new ResizeObserver(i),mo:new MutationObserver(n),isResizing:!1,lastObservedWidth:r.width,lastObservedHeight:r.height,lastLayoutColumns:0,lastLayoutGap:0,lastLayoutColumnWidth:-1,lastChildrenHash:0,lastHeightsHash:0,childIds:new WeakMap,nextChildId:1,imgUnsubs:new WeakMap,layoutScheduled:!1,items:new Map,startHeight:e.offsetHeight,targetHeight:e.offsetHeight,heightStartTime:0,heightDuration:rt.DEFAULT_DURATION,heightEase:this.parseEasing(null),isAnimatingHeight:!1,isAnimating:!1,pendingHeight:void 0,pendingHeightAnimate:!1,expectedEndTime:0};return s.ro.observe(e),s.mo.observe(e,{childList:!0}),s}handleAnimationEnd(t,e,r){if(e.pendingHeight!==void 0){let i=e.pendingHeight,n=e.pendingHeightAnimate;if(e.pendingHeight=void 0,e.pendingHeightAnimate=!1,n){e.startHeight=t.htmlElement.offsetHeight,e.targetHeight=i,e.heightStartTime=r,e.heightDuration=rt.DEFAULT_DURATION,e.heightEase=this.parseEasing(null),e.isAnimatingHeight=!0,e.isAnimating=!0;return}L.run(()=>{L.setProps(t.htmlElement,{height:`${i}px`})})}e.isAnimating&&this.events.emit("masonry:shuffle:end",{object:t}),e.isAnimating=!1,this.objectManager.refreshLayoutForRoot(t.htmlElement),e.endTimerId&&(window.clearTimeout(e.endTimerId),e.endTimerId=void 0),requestAnimationFrame(()=>{this.events.emit("resize",!0)})}scheduleLayout(t,e,r){let i=this.states.get(t);!i||i.layoutScheduled||(i.layoutScheduled=!0,U.measure(()=>{i.layoutScheduled=!1,this.performSyncLayout(t,i,e,r)}))}performSyncLayout(t,e,r,i){let n=t.htmlElement,s=Array.from(n.children);if(s.length===0)return;let o=n.getBoundingClientRect(),a=getComputedStyle(n),d=parseFloat(a.paddingLeft)||0,c=parseFloat(a.paddingRight)||0,u=parseFloat(a.paddingTop)||0,p=o.width-d-c;if(p<=0)return;let{columns:g,gap:m}=this.getGridSettings(t),h=(p-m*(g-1))/g,b=(t.getProperty("masonry-mode")||"auto")==="auto"&&r&&!e.isResizing&&i!=="window-resize"&&i!=="resize-observer",y=g===e.lastLayoutColumns&&m===e.lastLayoutGap&&Math.abs(h-e.lastLayoutColumnWidth)<=.5,v=0;s.forEach(k=>{let O=e.childIds.get(k);O||(O=e.nextChildId++,e.childIds.set(k,O)),v=v*31+O>>>0}),e.lastLayoutColumns=g,e.lastLayoutGap=m,e.lastLayoutColumnWidth=h,e.lastChildrenHash=v;let S=new Map;r&&s.forEach(k=>{let O=e.items.get(k);O&&S.set(k,O.cw)}),L.begin(),s.forEach(k=>{L.setProps(k,{position:"absolute",top:"0",left:"0",width:`${h}px`})}),L.commit();let E=s.map(k=>k.offsetHeight),M=0;E.forEach(k=>M=M*31+Math.round(k*2)>>>0),e.lastHeightsHash=M,r&&S.size>0&&L.run(()=>{S.forEach((k,O)=>{L.setProps(O,{width:`${k}px`})})});let C=new Array(g).fill(0),A=performance.now(),I=!1,H=0;s.forEach((k,O)=>{let T=E[O],P=0,R=C[0];for(let Y=1;Y<g;Y++)C[Y]<R&&(R=C[Y],P=Y);let B=P*(h+m)+d,W=R+u,N=h;C[P]=R+T+m;let z=Ni(k.getAttribute("string-masonry-position-time")),nt=Ni(k.getAttribute("string-masonry-size-time")),yt=z>0?1/z:1e3,st=nt>0?1/nt:1e3,dt=this.parseEasing(k.getAttribute("string-masonry-position-easing")),xt=this.parseEasing(k.getAttribute("string-masonry-size-easing")),D=e.items.get(k);if(D)Math.abs(D.tx-B)+Math.abs(D.ty-W)+Math.abs(D.tw-N)>.5&&(D.sx=D.cx,D.sy=D.cy,D.sw=D.cw,D.tx=B,D.ty=W,D.tw=N,D.dx=D.tx-D.sx,D.dy=D.ty-D.sy,D.dw=D.tw-D.sw,D.posEase=dt,D.invPosDur=yt,D.sizeEase=xt,D.invSizeDur=st,D.startTime=A,D.isMoving=!0,I=!0,H=Math.max(H,z,nt));else{let Y=B,ct=r?W+30:W;D={sx:Y,sy:ct,sw:N,tx:B,ty:W,tw:N,dx:0,dy:0,dw:0,cx:Y,cy:ct,cw:N,startTime:A,posEase:dt,invPosDur:yt,sizeEase:xt,invSizeDur:st,isMoving:r},e.items.set(k,D),r?(D.dx=D.tx-D.sx,D.dy=D.ty-D.sy,D.dw=D.tw-D.sw,I=!0,H=Math.max(H,z,nt)):L.run(()=>{L.setProps(k,{transform:`translate3d(${B}px, ${W}px, 0)`,width:`${N}px`,willChange:"auto"})})}});let w=Math.max(...C);if(Math.abs(e.targetHeight-w)>1)if(r){let k=n.getBoundingClientRect(),O=this.data.viewport.windowHeight;var _=!1;if(k.bottom>=-100&&k.bottom<=O+100){let T=k.top+w-O;if(Math.abs(T)>1&&w<n.offsetHeight){let P=k.top+this.data.scroll.current+w-O;this.events.emit("scrollTo",P),_=!0}}w>=e.targetHeight?(b?(e.startHeight=n.offsetHeight,e.heightStartTime=A,e.heightDuration=rt.DEFAULT_DURATION,e.heightEase=this.parseEasing(null),e.isAnimatingHeight=!0):L.run(()=>{L.setProps(t.htmlElement,{height:`${w}px`}),requestAnimationFrame(()=>{this.events.emit("resize",!0)})}),e.targetHeight=w,e.pendingHeight=void 0):(e.pendingHeight=w,e.pendingHeightAnimate=b,e.targetHeight=w,_||L.run(()=>{L.setProps(t.htmlElement,{height:`${w}px`}),requestAnimationFrame(()=>{this.events.emit("resize",!0)})})),I=!0}else e.targetHeight=w,e.pendingHeight=void 0,L.run(()=>{L.setProps(t.htmlElement,{height:`${w}px`})});I&&(e.isAnimating||this.events.emit("masonry:shuffle:start",{object:t}),e.isAnimating=!0,H>0&&(e.expectedEndTime=A+H+32,e.endTimerId&&window.clearTimeout(e.endTimerId),e.endTimerId=window.setTimeout(()=>{e.isAnimating&&(e.pendingHeight!==void 0||e.isAnimatingHeight||(this.events.emit("masonry:shuffle:end",{object:t}),e.isAnimating=!1,e.endTimerId=void 0))},H+50)))}getGridSettings(t){let e=this.data.viewport.windowWidth;if((t.getProperty("masonry-mode")||"auto")==="manual"){let s=t.getProperty(rt.MANUAL_COLS_KEY),o=t.getProperty(rt.MANUAL_GAP_KEY),a=t.getProperty("masonry-cols")||[],d=t.getProperty("masonry-gap")||[];return{columns:Math.max(1,Math.round(s??Ne(a,e)??2)),gap:Math.max(0,o??Ne(d,e)??16)}}let i=t.getProperty("masonry-cols")||[{breakpoint:0,value:2}],n=t.getProperty("masonry-gap")||[{breakpoint:0,value:16}];return{columns:Math.max(1,Math.round(Ne(i,e)??2)),gap:Math.max(0,Ne(n,e)??16)}}attachImgLoaders(t,e,r){(r.tagName==="IMG"?[r]:Array.from(r.querySelectorAll("img"))).forEach(n=>{let s=n;if(s.complete||e.imgUnsubs.has(s))return;let o=()=>{this.scheduleLayout(t,!0,"img-load"),this.cleanupImgListeners(e,s)};s.addEventListener("load",o),s.addEventListener("error",o),e.imgUnsubs.set(s,()=>{s.removeEventListener("load",o),s.removeEventListener("error",o)})})}cleanupImgListeners(t,e){let r=i=>{let n=t.imgUnsubs.get(i);n&&(n(),t.imgUnsubs.delete(i))};e.tagName==="IMG"?r(e):e.querySelectorAll("img").forEach(i=>r(i))}};var Ge=class extends x{constructor(t){super(t),this.htmlKey="magnetic",this._type=2,this.cssProperties=[{name:"--magnetic-x",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--magnetic-y",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--magnetic-target-x",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--magnetic-target-y",syntax:"<number>",initialValue:"0",inherits:!0}],this.permissions.mobile.rebuild.height=!1,this.permissions.mobile.rebuild.width=!1,this.permissions.mobile.rebuild.scrollHeight=!1,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("magnetic-active",!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("magnetic-lerp",.1),e.setProperty("event-magnetic-name",this.getObjectEventName(e,"magnetic:move")),e.setProperty("__next-magnetic-x",0),e.setProperty("__next-magnetic-y",0),e.setProperty("__needs-magnetic-update",!1)}onMouseMove(t){for(let e=0;e<this.objects.length;e++){let r=this.objects[e],n=r.htmlElement.getBoundingClientRect(),s=n.left+n.width/2,o=n.top+n.height/2,a=t.clientX-s,d=t.clientY-o,c=Math.sqrt(a**2+d**2),u=r.getProperty("radius")??0,p=r.getProperty("strength")??0,g=this.tools.magneticPull.process({distance:c,radius:u,strength:p});r.setProperty("magnetic-target-x",a*g),r.setProperty("magnetic-target-y",d*g),g>0&&r.setProperty("magnetic-active",!0)}}onFrame(t){for(let e=0;e<this.objects.length;e++){let r=this.objects[e];if(r.getProperty("magnetic-active")===!0){let i=r.getProperty("magnetic-x")??0,n=r.getProperty("magnetic-y")??0,s=r.getProperty("magnetic-lerp")??.1,o=r.getProperty("magnetic-target-x")??0,a=r.getProperty("magnetic-target-y")??0,d=this.tools.lerp.process({from:i,to:o,progress:s}),c=this.tools.lerp.process({from:n,to:a,progress:s});d>-.01&&d<.01&&(d=0,r.setProperty("magnetic-x",o)),c>-.01&&c<.01&&(c=0,r.setProperty("magnetic-y",a)),i+=d,n+=c,r.setProperty("magnetic-x",i),r.setProperty("magnetic-y",n);let u=r.getProperty("event-magnetic-name");u&&this.events.emit(u,{x:i,y:n}),r.setProperty("__next-magnetic-x",i),r.setProperty("__next-magnetic-y",n),r.setProperty("__needs-magnetic-update",!0),o===i&&a===n&&r.setProperty("magnetic-active",!1)}}}onMutate(){for(let t=0;t<this.objects.length;t++){let e=this.objects[t];if(!(e.getProperty("__needs-magnetic-update")===!0))continue;let i=e.getProperty("__next-magnetic-x")??e.getProperty("magnetic-x")??0,n=e.getProperty("__next-magnetic-y")??e.getProperty("magnetic-y")??0;this.applyToElementAndConnects(e,s=>{L.setVar(s,"--magnetic-x",i),L.setVar(s,"--magnetic-y",n)}),e.setProperty("__needs-magnetic-update",!1)}}};var kt=class extends x{nearOnly=!0;useAllObjects=!1;maxDistanceMultiplier=1;updateThreshold=.1;enabled=!0;constructor(t){super(t),_e()&&(this.enabled=!1)}onObjectConnected(t){this.enabled&&(super.onObjectConnected(t),this.centers.attach(t),this.hover.track(t))}removeObject(t){if(!this.enabled)return super.removeObject(t);let e=this.objectMapOnPage.get(t);e&&(this.centers.detach(e),this.hover.untrack(e)),super.removeObject(t)}onScroll(){this.enabled&&(this.centers.invalidateAll(),this.scheduleCursorUpdate())}onMouseMoveMeasure(t){this.enabled&&(super.onMouseMoveMeasure(t),this.refreshPointerState())}onScrollMeasure(t){this.enabled&&(super.onScrollMeasure(t),this.refreshPointerState())}getCursorTargets(t=!1){if(!this.enabled)return[];let e=this.hover.activeObjects();return this.nearOnly&&e.length?e:this.useAllObjects?this.objectsOnPage:this.objects.length>0?this.objects:t?this.objectsOnPage:this.objects}refreshPointerState(t,e=!1){if(!this.enabled)return;let r=this.data.cursor.targetX,i=this.data.cursor.targetY,n=t?[t]:this.getCursorTargets(e),s=!this.nearOnly&&this.maxDistanceMultiplier>0?Math.pow(this.data.viewport.windowWidth*this.maxDistanceMultiplier,2):null;for(let o of n){let{cx:a,cy:d}=this.centers.getCenter(o),c=r-a,u=i-d,p=c*c+u*u;if(this.nearOnly){if(p>this.data.viewport.windowWidth*this.data.viewport.windowWidth&&!this.hover.isActive(o))continue}else if(s!==null&&p>s)continue;o.setProperty("dx",c),o.setProperty("dy",u),o.setProperty("dist",Math.sqrt(p))}}scrollUpdateScheduled=!1;scheduleCursorUpdate(){!this.enabled||this.scrollUpdateScheduled||(this.scrollUpdateScheduled=!0,U.measure(()=>{this.refreshPointerState(),U.mutate(()=>{this.scrollUpdateScheduled=!1,L.run(()=>{this.onCursorScrollUpdate()})})}))}onCursorScrollUpdate(){}};var gi=Math.PI*2,ns=180/Math.PI,Gi=l=>l<0?0:l>1?1:l,ss=(l,t)=>{let e=(t-l)%gi;return e>Math.PI&&(e-=gi),e<-Math.PI&&(e+=gi),l+e},os={computeStep(l,t,e,r,i,n,s,o,a,d,c,u,p,g,m,h,f){let b=a;(h===1||e>r)&&(b=Math.atan2(t,l));let y=i>0?Math.min(e,i):e,v=s,S=o;if(g===1)v=b,S=y;else{let A=ss(s,b),I=Gi(n);v+=(A-v)*I,S+=(y-S)*I}let E=v*ns-90,M=m===1||Number.isNaN(d)||Math.abs(E-d)>u,C=m===1||Number.isNaN(c)||Math.abs(S-c)>p;f.angle=v,f.dist=S,f.tAngle=b,f.tDist=y,f.degRaw=E,f.cssDeg=Math.round(E*10)/10,f.cssDist=Math.round(S*10)/10,f.angleChanged=M?1:0,f.distChanged=C?1:0}},as={bypassDeadzone:!0},ls={forceImmediate:!0,forceEmit:!0,bypassDeadzone:!0},zi=new WeakMap,ds=l=>{let t=zi.get(l);return t||(t={angle:0,dist:0,tAngle:0,tDist:0,prevDeg:NaN,prevDist:NaN},zi.set(l,t)),t},$e=class extends kt{stepResult={angle:0,dist:0,tAngle:0,tDist:0,degRaw:0,cssDeg:0,cssDist:0,angleChanged:0,distChanged:0};constructor(t){super(t),this.htmlKey="spotlight",this.cssProperties=[{name:"--spotlight-angle",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--spotlight-distance",syntax:"<number>",initialValue:"0",inherits:!0}],this.nearOnly=!1,this.useAllObjects=!1,this.maxDistanceMultiplier=1,this.attributesToMap.push({key:"lerp",type:"number",fallback:this.settings.lerp,transform:e=>Gi(this.tools.adaptiveLerp.process({value:e,inMin:.1,inMax:1,outMin:.05,outMax:.65}))},{key:"angle-threshold",type:"number",fallback:.2},{key:"distance-threshold",type:"number",fallback:.5},{key:"deadzone",type:"number",fallback:4},{key:"dist-max",type:"number",fallback:0})}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i),e.setProperty("spotlight-angle-rad",0),e.setProperty("spotlight-distance",0),e.setProperty("spotlight-angle-rad-target",0),e.setProperty("spotlight-distance-target",0),U.measure(()=>{this.refreshPointerState(e,!0),U.mutate(()=>{L.run(()=>{this.updateSpotlightState(e,ls)})})})}onMutate(t){if(this.enabled){super.onMutate(t);let e=this.getCursorTargets(!1),r=e.length>0?e:this.getCursorTargets(!0);for(let i=0;i<r.length;i++){let n=r[i];this.updateSpotlightState(n)}}}onCursorScrollUpdate(){let t=this.getCursorTargets(!1),e=t.length>0?t:this.getCursorTargets(!0);for(let r=0;r<e.length;r++){let i=e[r];this.updateSpotlightState(i,as)}}updateSpotlightState(t,e={}){let r=t.getProperty("dx"),i=t.getProperty("dy"),n=t.getProperty("dist");if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(n))return;let s=ds(t);os.computeStep(r,i,n,t.getProperty("deadzone")??4,t.getProperty("dist-max")??0,t.getProperty("lerp")??.15,s.angle,s.dist,s.tAngle,s.prevDeg,s.prevDist,t.getProperty("angle-threshold")??.2,t.getProperty("distance-threshold")??.5,e.forceImmediate===!0?1:0,e.forceEmit===!0?1:0,e.bypassDeadzone===!0?1:0,this.stepResult),s.angle=this.stepResult.angle,s.dist=this.stepResult.dist,s.tAngle=this.stepResult.tAngle,s.tDist=this.stepResult.tDist,t.setProperty("spotlight-distance-target",s.tDist),t.setProperty("spotlight-angle-rad-target",s.tAngle),t.setProperty("spotlight-angle-rad",s.angle),t.setProperty("spotlight-distance",s.dist),(this.stepResult.angleChanged===1||this.stepResult.distChanged===1)&&(this.writeSpotlightVars(t,this.stepResult.cssDeg,this.stepResult.cssDist),s.prevDeg=this.stepResult.degRaw,s.prevDist=s.dist,this.events.emit(this.getObjectEventName(t,"spotlight:update"),{distance:this.stepResult.cssDist,angleDeg:this.stepResult.cssDeg}))}writeSpotlightVars(t,e,r){let i=()=>{this.applyToElementAndConnects(t,n=>{L.setVar(n,"--spotlight-angle",e),L.setVar(n,"--spotlight-distance",r)})};if(L.isOpen){i();return}L.run(i)}};var $i="-aspect-ready";function cs(l){if(!l)return!1;let t=l.toLowerCase();return!!(t.endsWith(".svg")||t.startsWith("data:image/svg"))}function Ui(l){let t=new DataView(l);return l.byteLength<28?{width:0,height:0}:t.getUint32(0)!==2303741511||t.getUint32(4)!==218765834?{width:0,height:0}:t.getUint32(8)!==13||t.getUint32(12)!==1229472850?{width:0,height:0}:{width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}function ji(l){let t=new DataView(l);if(t.getUint16(0)!==65496)return{width:0,height:0};let e=2;for(;e+9<l.byteLength;){let r=t.getUint16(e);if(e+=2,r===65498||r===65497)break;let i=t.getUint16(e);if(i<2||e+i>l.byteLength)break;if(r>=65472&&r<=65475||r>=65477&&r<=65479||r>=65481&&r<=65483||r>=65485&&r<=65487)return{height:t.getUint16(e+3),width:t.getUint16(e+5)};e+=i}return{width:0,height:0}}function Yi(l){let t=new DataView(l);if(l.byteLength<16)return{width:0,height:0};if(t.getUint32(0,!0)!==1179011410||t.getUint32(8,!0)!==1346520407)return{width:0,height:0};let e=12;for(;e+8<=l.byteLength;){let r=t.getUint32(e,!1),i=t.getUint32(e+4,!0),n=e+8;if(r===1448097880){let s=(t.getUint16(n+4,!0)|t.getUint8(n+6)<<16)+1,o=(t.getUint16(n+7,!0)|t.getUint8(n+9)<<16)+1;return{width:s,height:o}}if(r===1448097824&&n+10<=l.byteLength&&t.getUint8(n+3)===157&&t.getUint8(n+4)===1&&t.getUint8(n+5)===42){let s=t.getUint16(n+6,!0)&16383,o=t.getUint16(n+8,!0)&16383;return{width:s,height:o}}if(r===1448097868&&n+5<=l.byteLength&&t.getUint8(n)===47){let s=t.getUint8(n+1),o=t.getUint8(n+2),a=t.getUint8(n+3),d=t.getUint8(n+4),c=1+((o&63)<<8|s),u=1+((d&15)<<10|a<<2|(o&192)>>6);return{width:c,height:u}}e=n+i+(i&1)}return{width:0,height:0}}function qi(l,t){let e=(t||"").toLowerCase();if(e.includes("png"))return Ui(l);if(e.includes("jpeg")||e.includes("jpg"))return ji(l);if(e.includes("webp"))return Yi(l);let r=Ui(l);return r.width||(r=ji(l),r.width)||(r=Yi(l),r.width)?r:{width:0,height:0}}async function us(l,t,e){let r=await fetch(l,{mode:"cors",credentials:t?.credentials??"omit",referrerPolicy:t?.referrerPolicy,signal:t?.signal,cache:"default"});if(!r.ok||!r.body)throw new Error(`HTTP ${r.status}`);let i=r.headers.get("content-type"),n=r.body.getReader(),s=1048576,o=4096,a=new Uint8Array(s),d=0,c=0,u=[],p=null,g=!1;for(;;){let{done:f,value:b}=await n.read();if(f)break;if(!b)continue;let y=b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength);if(u.push(y),!p&&d<s){let v=Math.min(b.byteLength,s-d);if(v>0&&(a.set(b.subarray(0,v),d),d+=v),d-c>=o){let S=d===a.byteLength?a:a.slice(0,d),E=qi(S.buffer,i);E.width&&E.height&&(p=E,!g&&e&&(e(p),g=!0)),c=d}}}if(!p){let f=await new Response(new Blob(u)).arrayBuffer(),b=qi(f,i);b.width&&b.height&&(p=b,!g&&e&&(e(p),g=!0))}let m=new Blob(u,{type:i||"application/octet-stream"}),h=URL.createObjectURL(m);return{dims:p,blobUrl:h,contentType:i}}var Ue=class extends x{isStartLoaded=!1;loadingCount=0;imageStates=new WeakMap;constructor(t){super(t),this.htmlKey="lazy"}onInit(){document.querySelectorAll("img[string-lazy], img[data-string-lazy]").forEach(e=>this.ensureState(e)),this.isStartLoaded=!0}onObjectConnected(t){let e=t.htmlElement;if(!(e instanceof HTMLImageElement))return;e.getAttribute("src")||e.setAttribute("src","data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1' height='1' viewBox='0 0 1 1'%3E%3C/svg%3E");let r=this.ensureState(e);!r.aspectReady&&!r.aspectLoading&&this.prepareAspectRatio(e);let i=s=>{this.handleInView(e,r,!!s?.inView)};r.unsubscribe&&r.unsubscribe();let n=this.getObjectEventName(t,"object:inview");this.events.on(n,i),r.unsubscribe=()=>this.events.off(n,i),this.isStartLoaded&&(t.getProperty("is-inview")??!1)&&this.handleInView(e,r,!0)}onObjectDisconnected(t){let e=t.htmlElement;if(!(e instanceof HTMLImageElement))return;let r=this.imageStates.get(e);r&&(r.pendingActivation=!1,r.controller&&r.controller.abort(),r.blobUrl&&URL.revokeObjectURL(r.blobUrl),r.unsubscribe&&(r.unsubscribe(),r.unsubscribe=void 0))}ensureState(t){let e=this.imageStates.get(t);if(!e){let r=this.readSource(t);return e={src:r,aspectReady:!1,contentReady:!1,aspectLoading:!1,contentLoading:!1,pendingActivation:!1,rangeAttempted:!1,fetching:!1},this.imageStates.set(t,e),t.classList.contains("lazyLoad")||t.classList.add("lazyLoad"),t.dataset&&!t.dataset.stringLazySrc&&r&&(t.dataset.stringLazySrc=r),e}return e.src||(e.src=this.readSource(t)),e}readSource(t){let e=this.tools.domAttribute.process({element:t,key:this.htmlKey,fallback:""});return typeof e=="string"?e:e==null?"":String(e)}handleInView(t,e,r){e.pendingActivation=r,r&&(e.aspectReady?this.maybeActivateImage(t,e):e.aspectLoading||this.prepareAspectRatio(t))}async prepareAspectRatio(t){let e=this.ensureState(t);if(!e.src||e.aspectLoading||e.aspectReady)return;if(cs(e.src)){e.aspectReady=!0,e.allowSrcFallback=!0,this.maybeActivateImage(t,e);return}e.aspectLoading=!0,e.fetching=!0;let r=t.getAttribute("crossorigin"),i=t.getAttribute("referrerpolicy"),n=new AbortController;e.controller=n;try{let{blobUrl:s}=await us(e.src,{credentials:r==="use-credentials"?"include":"omit",referrerPolicy:i||void 0,signal:n.signal},o=>{o.width>0&&o.height>0&&!e.aspectReady&&(t.style.aspectRatio=`${o.width} / ${o.height}`,t.classList.add($i),e.width=o.width,e.height=o.height,e.aspectReady=!0)});e.blobUrl=s,!e.aspectReady&&e.width&&e.height&&(t.style.aspectRatio=`${e.width} / ${e.height}`,t.classList.add($i),e.aspectReady=!0)}catch{e.allowSrcFallback=!0,e.aspectReady=!0}finally{e.fetching=!1,e.aspectLoading=!1,this.maybeActivateImage(t,e)}}maybeActivateImage(t,e){!e.pendingActivation||e.contentReady||e.contentLoading||!e.aspectReady||!e.src||e.fetching&&!e.blobUrl||(e.blobUrl||e.allowSrcFallback)&&this.activateImage(t,e)}activateImage(t,e){e.contentLoading=!0,this.loadingCount++;let r=s=>{e.contentLoading&&(e.contentLoading=!1,e.pendingActivation=!1,this.loadingCount=Math.max(0,this.loadingCount-1),s&&(e.contentReady=!0,t.classList.add("-loaded")),this.loadingCount===0&&this.events.emit("image:load:all",null))},i=()=>r(!0),n=()=>r(!1);t.addEventListener("load",i,{once:!0}),t.addEventListener("error",n,{once:!0}),t.decoding="async",t.loading=t.loading||"lazy",e.blobUrl?(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.src=e.blobUrl):t.src=e.src,t.complete&&t.naturalWidth>0&&t.naturalHeight>0&&(t.removeEventListener("load",i),t.removeEventListener("error",n),r(!0))}};var je=class extends x{loadingTimeout=0;constructor(t){super(t),this._type=2,this.loadingTimeout=this.settings.timeout}onInit(){setTimeout(()=>{document.documentElement.classList.add("-loaded")},this.loadingTimeout)}};var Ye=class extends x{constructor(t){super(t),this.htmlKey=""}canConnect(t){return t.keys[0]==null||t.getProperty("inview-fallback")===!0}};var Ot=class{min=void 0;max=void 0;enable=!0;constructor(t){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}},qe=class extends x{queries={0:new Ot({max:359}),1:new Ot({min:360,max:1023}),2:new Ot({min:1024,max:1365}),3:new Ot({min:1366})};isMobileMedia=!1;isTabletMedia=!1;isLaptopMedia=!1;isDesktopMedia=!1;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)};constructor(t){super(t),this._type=2}onConnect(){}onInit(){if(this.settings!=null&&this.settings.settings!=null){let t=this.settings.settings;t.mobile?(this.queries[0].enable=!0,this.queries[0].setRange(t.mobile.min==null?null:t.mobile.min,t.mobile.max??null),this.matchMedias[0]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[0].enable=!1,t.tablet?(this.queries[1].enable=!0,this.queries[1].setRange(t.tablet.min==null?null:t.tablet.min,t.tablet.max??null),this.matchMedias[1]=window.matchMedia(this.queries[1].mediaQuery)):this.queries[1].enable=!1,t.laptop?(this.queries[2].enable=!0,this.queries[2].setRange(t.laptop.min==null?null:t.laptop.min,t.laptop.max??null),this.matchMedias[2]=window.matchMedia(this.queries[2].mediaQuery)):this.queries[2].enable=!1,t.desktop?(this.queries[3].enable=!0,this.queries[3].setRange(t.desktop.min==null?null:t.desktop.min,t.desktop.max??null),this.matchMedias[3]=window.matchMedia(this.queries[3].mediaQuery)):this.queries[3].enable=!1}this.updateElements()}onResize(){this.updateElements()}updateElements(){let t=this.matchMedias[0].matches&&this.queries[0].enable,e=this.matchMedias[1].matches&&this.queries[1].enable,r=this.matchMedias[2].matches&&this.queries[2].enable,i=this.matchMedias[3].matches&&this.queries[3].enable;this.isMobileMedia!=t&&this.events.emit("screen:mobile",t),this.isTabletMedia!=e&&this.events.emit("screen:tablet",e),this.isLaptopMedia!=r&&this.events.emit("screen:laptop",r),this.isDesktopMedia!=i&&this.events.emit("screen:desktop",i),this.isMobileMedia=t,this.isTabletMedia=e,this.isLaptopMedia=r,this.isDesktopMedia=i,document.querySelectorAll("[string-mobile], [string-tablet], [string-laptop], [string-desktop]").forEach(s=>{let o=!1;s.hasAttribute("string-mobile")&&t&&(o=!0),s.hasAttribute("string-tablet")&&e&&(o=!0),s.hasAttribute("string-laptop")&&r&&(o=!0),s.hasAttribute("string-desktop")&&i&&(o=!0),o?s.style.display=null:s.style.display="none"})}};var Xe=class extends x{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,n=this.tools.originParser.process({value:r}),s=this.tools.originParser.process({value:i});return{x:n,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 ps=.05,gs=.01,Xi=1,hs=-1,ms=1,Ke=class extends x{defaultModeScope=["smooth"];previousLerp=0;displacement=0;acceleration=0;velocityMultiplier=.00125;isInitialScroll=!0;baseVelocityMultiplier=.00125;reducedVelocityMultiplier=this.baseVelocityMultiplier/20;negativeVelocityMultiplier=-1e-4;maxDisplacementValue=0;constructor(t){super(t),this.htmlKey="glide",this.cssProperties=[{name:"--glide",syntax:"<number>",initialValue:"0",inherits:!0}],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}]}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i),e.setProperty("glide-value",e.getProperty("glide")??0),e.setProperty("event-glide-name",this.getObjectEventName(e,"object:glide")),e.setProperty("__next-glide",0),e.setProperty("__next-glide-transform","translate3d(0, 0px, 0)"),e.setProperty("__needs-glide-var-update",!1),e.setProperty("__needs-glide-transform-update",!1)}setupItem=t=>{let e=t.getProperty("glide-value")??0,r=-this.data.scroll.displacement*this.maxDisplacementValue*e,i=t.getProperty("event-glide-name");i&&this.events.emit(i,r);let n=`translate3d(0, ${r}px, 0)`;t.setProperty("__next-glide-transform",n),t.setProperty("__needs-glide-transform-update",!0)};updateTransforms(){for(let t=0;t<this.objects.length;t++)this.setupItem(this.objects[t])}resetObjectStyles(t){for(let e=0;e<t.length;e++){let r=t[e];r.setProperty("__next-glide-transform","translate3d(0, 0px, 0)"),r.setProperty("__needs-glide-transform-update",!0),r.setProperty("__next-glide",0),r.setProperty("__needs-glide-var-update",!0)}}calcExpanderFactor(t){let e=t?this.data.scroll.lerped<this.previousLerp:this.data.scroll.lerped>this.previousLerp;this.velocityMultiplier=e?this.isInitialScroll?this.baseVelocityMultiplier:this.reducedVelocityMultiplier:this.negativeVelocityMultiplier,e||(this.isInitialScroll=!1)}onStart(){this.maxDisplacementValue=this.data.viewport.windowHeight*.1}onResize(){this.maxDisplacementValue=this.data.viewport.windowHeight*.1}resetState(){this.displacement=0,this.acceleration=0,this.isInitialScroll=!0,this.velocityMultiplier=this.baseVelocityMultiplier}onScrollStart(){this.resetState()}onScrollStop(){this.resetState(),this.previousLerp=0,this.data.scroll.displacement=0,this.resetObjectStyles(this.objects),this.flushPendingGlideStyles()}onFrame(t){this.calcExpanderFactor(this.data.scroll.isScrollingDown===!1),this.acceleration=Math.min(Xi,this.acceleration+ps),this.displacement=Math.max(gs,Math.min(Xi,this.displacement+this.velocityMultiplier)),this.data.scroll.displacement=Math.min(ms,Math.max(hs,this.data.scroll.lerped*this.displacement*this.acceleration));let e=this.data.scroll.displacement;for(let r=0;r<this.objects.length;r++){let i=this.objects[r];i.setProperty("__next-glide",e),i.setProperty("__needs-glide-var-update",!0)}this.previousLerp=this.data.scroll.lerped,this.updateTransforms()}onObjectModeDeactivated(t){super.onObjectModeDeactivated(t),this.resetObjectStyles([t]),L.run(()=>{this.applyPendingGlideStylesForObject(t)})}onMutate(){this.applyPendingGlideStyles()}applyPendingGlideStylesForObject(t){let e=t.getProperty("__next-glide")??0,r=t.getProperty("__next-glide-transform")??"translate3d(0, 0px, 0)";this.applyVarToElement(t,"--glide",e),this.applyVarToConnects(t,"--glide",e),this.applyPropToElement(t,"transform",r),t.setProperty("__needs-glide-var-update",!1),t.setProperty("__needs-glide-transform-update",!1)}applyPendingGlideStyles(){for(let t=0;t<this.objects.length;t++){let e=this.objects[t],r=e.getProperty("__needs-glide-var-update")===!0,i=e.getProperty("__needs-glide-transform-update")===!0;if(!(!r&&!i)){if(r){let n=e.getProperty("__next-glide")??this.data.scroll.displacement;this.applyVarToElement(e,"--glide",n),this.applyVarToConnects(e,"--glide",n),e.setProperty("__needs-glide-var-update",!1)}if(i){let n=e.getProperty("__next-glide-transform")??"translate3d(0, 0px, 0)";this.applyPropToElement(e,"transform",n),e.setProperty("__needs-glide-transform-update",!1)}}}}flushPendingGlideStyles(){if(L.isOpen){this.applyPendingGlideStyles();return}L.run(()=>{this.applyPendingGlideStyles()})}};var Ze=class extends x{hasInitializedCSS=!1;defaultModeScope=["smooth"];constructor(t){super(t),this.htmlKey="lerp",this.cssProperties=[{name:"--lerp",syntax:"<number>",initialValue:"0",inherits:!0}],this.attributesToMap=[]}onObjectConnected(t){super.onObjectConnected(t),t.setProperty("lerp-value",0),t.setProperty("lerp-applied",0),t.setProperty("event-lerp-name",this.getObjectEventName(t,"object:lerp"))}onResize(){super.onResize(),!this.hasInitializedCSS&&this.objectsOnPage.length>0&&(this.hasInitializedCSS=!0,L.run(()=>{for(let t=0;t<this.objectsOnPage.length;t++)this.updateObjectLerp(this.objectsOnPage[t],!0)}))}onScrollStop(){for(let t=0;t<this.objects.length;t++)this.recomputeLerp(this.objects[t],0)}onFrame(t){let e=t.scroll.lerped;for(let r=0;r<this.objects.length;r++)this.recomputeLerp(this.objects[r],e)}recomputeLerp(t,e){(t.getProperty("lerp-value")??0)!==e&&(t.setProperty("lerp-value",e),this.updateObjectLerp(t))}onMutate(){L.run(()=>{let t=this.objects.length;for(let e=0;e<t;e++)this.updateObjectLerp(this.objects[e])})}updateObjectLerp(t,e=!1){let r=t.getProperty("lerp-value")??0,i=t.getProperty("lerp-applied");if(!e&&i===r)return;t.setProperty("lerp-applied",r);let n=r?.toString()??"0",s=t.getProperty("event-lerp-name");s&&this.events.emit(s,r),L.run(()=>{this.applyVarToElement(t,"--lerp",n),this.applyVarToConnects(t,"--lerp",n)})}onObjectDisconnected(t){super.onObjectDisconnected(t);let e=i=>{i.style.removeProperty("--lerp")};e(t.htmlElement);let r=t.mirrorObjects;for(let i=0;i<r.length;i++)e(r[i].htmlElement)}};var Lt="__string-dev-progress-override",Ki={computeRawProgress(l,t,e){if(e===0)return 0;let r=(l-t)/e;return r<=0?0:r>=1?1:r},computeRawProgressBatch(l,t,e,r,i){for(let n=0;n<i;n++){let s=e[n];if(s===0){r[n]=0;continue}let o=(l-t[n])/s;o<=0?r[n]=0:o>=1?r[n]=1:r[n]=o}}},Dt=class extends x{updateScheduled=!1;batchStarts=new Float64Array(0);batchDiffs=new Float64Array(0);batchOut=new Float64Array(0);constructor(t){super(t),this.htmlKey="progress",this.cssProperties=[{name:"--progress",syntax:"<number>",initialValue:"0",inherits:!0},{name:"--progress-slice",syntax:"<number>",initialValue:"0",inherits:!0}],this.attributesToMap=[...this.attributesToMap,{key:"easing",type:"easing",fallback:this.settings.easing},{key:"precision",type:"number",fallback:this.settings.precision??-1}]}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i)}sanitizeRawProgress(t){if(!Number.isFinite(t)||t<=0)return 0;if(t>=1)return 1;let e=1e-4;return t>1-e?t=1:t<e&&(t=0),t}resolveRawProgress(t,e,r,i){let n=t.getProperty(Lt);return n!=null?this.sanitizeRawProgress(n):Ki.computeRawProgress(e,r,i)}applyRawProgress(t,e){let r=this.sanitizeRawProgress(e),i=t.getProperty("easing"),n=typeof i=="function"?i(r):r,s=t.getProperty("precision")??-1,o=s>=0?Math.round(n*10**s)/10**s:n;t.getProperty("progress-value")!==o&&(t.setProperty("progress-raw",r),t.setProperty("progress-value",o))}recomputeProgress(t){let e=t.getProperty("start-position")??t.getProperty("progress-start-position")??0,r=t.getProperty("difference-position")??t.getProperty("progress-difference-position")??0;t.setProperty("progress-start-position",e),t.setProperty("progress-difference-position",r);let i=this.resolveRawProgress(t,this.data.scroll.transformedCurrent,e,r);this.applyRawProgress(t,i)}ensureBatchCapacity(t){this.batchStarts.length>=t||(this.batchStarts=new Float64Array(t),this.batchDiffs=new Float64Array(t),this.batchOut=new Float64Array(t))}calculatePositions(t,e){super.calculatePositions(t,e),t.setProperty("progress-start-position",t.getProperty("start-position")??t.getProperty("progress-start-position")??0),t.setProperty("progress-difference-position",t.getProperty("difference-position")??t.getProperty("progress-difference-position")??0),this.recomputeProgress(t)}onScroll(t){super.onScroll(t)}onObjectConnected(t){super.onObjectConnected(t)}onScrollMeasure(t){let e=this.objects.length;if(e!==0){this.ensureBatchCapacity(e);for(let r=0;r<e;r++){let i=this.objects[r],n=i.getProperty("start-position")??i.getProperty("progress-start-position")??0,s=i.getProperty("difference-position")??i.getProperty("progress-difference-position")??0;i.setProperty("progress-start-position",n),i.setProperty("progress-difference-position",s),this.batchStarts[r]=n,this.batchDiffs[r]=s}Ki.computeRawProgressBatch(this.data.scroll.transformedCurrent,this.batchStarts,this.batchDiffs,this.batchOut,e);for(let r=0;r<e;r++){let i=this.objects[r],n=i.getProperty(Lt),s=n!=null?this.sanitizeRawProgress(n):this.batchOut[r];this.applyRawProgress(i,s)}}}onMutate(){L.run(()=>{let t=this.objects.length;for(let e=0;e<t;e++)this.updateObjectProgress(this.objects[e])})}updateObjectProgress(t){let e=t.getProperty("progress-value")??0;if(t.getProperty("progress-applied")===e)return;let i=t.getProperty("key"),n=t.getProperty("precision")??-1;t.setProperty("progress-applied",e);let s=t.getProperty("progress-raw")??e,o=t.getProperty("easing"),a=t.getProperty("event-progress-name")??t.getScopedEventName("object:progress");t.setProperty("event-progress-name",a),a&&this.events.emit(a,e),this.emitSignal(t,"progress",e),i&&this.applyVarToElement(t,i,e);for(let d=0;d<t.mirrorObjects.length;d++){let c=t.mirrorObjects[d],u=c.applyProgress(s,typeof o=="function"?o:void 0),p=n>=0?Math.round(u*10**n)/10**n:u;c.setProperty("progress",p),i&&this.tools.styleTxn.setVar(c.htmlElement,i,p)}}onObjectDisconnected(t){super.onObjectDisconnected(t);let e=t.getProperty("key");if(!e)return;let r=n=>{n.style.removeProperty(e)};r(t.htmlElement);let i=t.mirrorObjects;for(let n=0;n<i.length;n++)r(i[n].htmlElement)}};var Qe=class extends Dt{defaultModeScope=["smooth"];updateScheduledTransform=!1;calculateParallaxForObject;constructor(t){super(t),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"]}],this.calculateParallaxForObject=this.calculateParallax}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i);let n=e.getProperty("parallax-bias")??0,s=Math.abs(e.getProperty("parallax")??.2);e.setProperty("parallax-sign",Math.sign(e.getProperty("parallax"))),e.setProperty("parallax",s),e.setProperty("parallax-position-start",-.5+.5*n),e.setProperty("parallax-position-end",.5+.5*(1-n));let o=this.data.viewport.windowHeight;e.setProperty("offset-top",s*o),e.setProperty("offset-bottom",s*o)}calculatePositions(t,e){super.calculatePositions(t,e),t.setProperty("parallax-transform-value",this.calculateParallaxForObject(t))}onScroll(t){super.onScroll(t)}onScrollMeasure(t){super.onScrollMeasure(t);for(let e=0;e<this.objects.length;e++){let r=this.objects[e];r.setProperty("parallax-transform-value",this.calculateParallaxForObject(r))}}onMutate(){L.run(()=>{for(let t=0;t<this.objects.length;t++){let e=this.objects[t],r=e.getProperty("progress-value")??0;e.getProperty("parallax-progress-applied")!==r&&(e.setProperty("parallax-transform-value",this.calculateParallaxForObject(e)),e.setProperty("parallax-progress-applied",r));let n=e.getProperty("parallax-transform-value");n&&(this.applyPropToElement(e,"transform",n.transform),this.applyPropToConnects(e,"transform",n.transform))}})}calculateParallax=t=>{let e=t.getProperty("progress-value")??0,r=t.getProperty("parallax")??0,i=t.getProperty("parallax-position-start")??0,n=t.getProperty("parallax-position-end")??1,s=t.getProperty("parallax-sign")??1,o=this.data.viewport.windowHeight/this.data.viewport.transformScale,a=s*r*(o*i+e*o*n);return this.events.emit(this.getObjectEventName(t,"object:parallax"),a),{transform:`translate3d(0, ${a}px, 0)`}}};var Je=class{scrollbar;thumb;isDragging=!1;onScrollTo;startY=0;startScrollPosition=0;data;constructor(t,e,r,i){this.data=t,this.scrollbar=e,this.thumb=r,this.onScrollTo=i}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,this.onScrollTo(r),this.updateThumb()}};var tr=class{scrollbar;thumb;isDragging=!1;onScrollTo;startCoordinate=0;startScrollPosition=0;data;constructor(t,e,r,i){this.data=t,this.scrollbar=e,this.thumb=r,this.onScrollTo=i}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,n=Math.max(0,Math.min(r,i));this.data.scroll.current=n,this.data.scroll.target=n,this.onScrollTo(n),this.updateThumb()}};var er=class extends x{scrollbar;thumb;scrollTimeout;isDragging=!1;scrollMode="smooth";mouseUpEventBind;mouseDownEventBind;mouseMoveEventBind;scrollbarState;scrollbarStateHorizontal;scrollbarStateVertical;requestScrollTo;constructor(t){super(t),this.mouseUpEventBind=this.mouseUpEvent.bind(this),this.mouseDownEventBind=this.mouseDownEvent.bind(this),this.mouseMoveEventBind=this.mouseMoveEvent.bind(this),this.requestScrollTo=e=>{this.events.emit("scrollTo",{position:e,immediate:!0})}}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(t){this.updateThumb(),this.showScrollbar(),this.hideScrollbar()}onResize(){this.scrollbarState.onResize()}onRebuild(){this.scrollbarState.onResize()}addCustomStyles(){let t=document.createElement("style");t.textContent=`
|
|
2
2
|
::-webkit-scrollbar {
|
|
3
3
|
display: none;
|
|
4
4
|
width: 0;
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
-ms-overflow-style: none; /* IE and Edge */
|
|
17
17
|
scrollbar-width: none; /* Firefox */
|
|
18
18
|
}
|
|
19
|
-
`,document.head.appendChild(t)}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 Je(this.data,this.scrollbar,this.thumb,this.requestScrollTo),this.scrollbarStateVertical=new tr(this.data,this.scrollbar,this.thumb,this.requestScrollTo),this.scrollbarState=this.scrollbarStateVertical}updateThumb(){this.scrollbarState.updateThumb()}mouseDownEvent(t){this.isDragging=!0,this.scrollbarState.mouseDownEvent(t),document.body.style.userSelect="none",this.scrollbar.classList.add("-touch")}mouseMoveEvent(t){this.isDragging&&this.scrollbarState.mouseMoveEvent(t)}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 Et={BEFORE_ELEMENT:"-before-element",AFTER_ELEMENT:"-after-element"};function fs(d){if(!d||!Array.isArray(d.chars)||d.chars.length===0)return[];let t=d.chars[0].splitClass??[];if(t.length===0)return[];for(let e of d.chars){let r=e.splitClass??[];if(r.length!==t.length)return[];for(let i=0;i<r.length;i++)if(r[i]!==t[i])return[]}return t}function mi(d){return d.chars[0]?.token?.meta?.wrappers??[]}function vs(d,t,e){if(e.trimInlineGaps!==!0||!t)return!1;let r=mi(d),i=mi(t);if(r.length===0||i.length===0)return!1;if(r.length!==i.length)return!0;for(let n=0;n<r.length;n++)if(r[n].id!==i[n].id)return!0;return!1}function Zi(d,t,e){let r=document.createDocumentFragment(),i=K(t,"line")||K(t,"charLine")||K(t,"wordLine"),n=0,s=K(t,"char")||K(t,"charLine")||K(t,"charWord"),o=0;d.forEach(p=>o+=p.words.length);let a=0;d.forEach(p=>p.words.forEach(g=>a+=g.chars.length));let l=d.length,c=o,u=new Map;return d.forEach((p,g)=>{let m=g===d.length-1,h=r,f="";i&&(h=document.createElement("span"),h.setAttribute("aria-hidden","true"),h.classList.add("-s-line"),p.isBeforeElement&&h.classList.add(Et.BEFORE_ELEMENT),p.isAfterElement&&h.classList.add(Et.AFTER_ELEMENT),h.style.setProperty("--line-index",String(p.lineIndex)),h.style.setProperty("--word-total",String(p.words.length)),p.fitFontSize!==void 0&&h.style.setProperty("--fit-font-size",String(p.fitFontSize)),hi(h,p.calculatedValues,t));let b=[],y=h;p.words.forEach((v,S)=>{let E=S===p.words.length-1,M=mi(v),C=0;for(;C<b.length&&C<M.length&&b[C].info.id===M[C].id;)C++;for(;b.length>C;)b.pop();y=b.length>0?b[b.length-1].element:h;for(let T=C;T<M.length;T++){let P=M[T],R=document.createElement(P.tag);for(let[B,W]of P.attributes)R.setAttribute(B,W);y.appendChild(R),b.push({info:P,element:R}),y=R}if(v.chars.length===1&&v.chars[0].token.type==="element"){let T=v.chars[0].token.node.cloneNode(!0);y.appendChild(T);return}let I=v.chars.map(T=>T.char).join("");I&&(f+=f.length===0||v.noSpaceBefore?I:` ${I}`);let H=K(t,"word")||K(t,"charWord")||K(t,"wordLine"),w=H?document.createElement("span"):y,_=fs(v);if(H&&(w.setAttribute("aria-hidden","true"),w.classList.add("-s-word"),v.isBeforeElement&&w.classList.add(Et.BEFORE_ELEMENT),v.isAfterElement&&w.classList.add(Et.AFTER_ELEMENT),w.style.setProperty("--word-index",String(v.wordIndexGlobal)),w.style.setProperty("--char-total",String(v.chars.length)),w.setAttribute("data-split-content",I),hi(w,v.calculatedValues,t),_.length&&w.classList.add(..._)),s)v.chars.forEach((T,P)=>{if(T.char===" "||T.char===" ")return;let R=document.createElement("span");R.setAttribute("aria-hidden","true");let B=R;B.classList.add("-s-char"),T.isBeforeElement&&B.classList.add(Et.BEFORE_ELEMENT),T.isAfterElement&&B.classList.add(Et.AFTER_ELEMENT),B.textContent=T.char,B.setAttribute("data-split-content",T.char),B.style.setProperty("--char-index",String(n++));let W=v.chars[P+1];if(W){let z=e.getKerning(T.char,W.char);Math.abs(z)>.01&&(B.style.setProperty("--kerning",`${z.toFixed(2)}px`),B.style.marginRight="var(--kerning)")}hi(B,T.calculatedValues,t);let N=T.splitClass??[];N.length&&!_.length&&B.classList.add(...N),w.appendChild(R)});else{let T=document.createTextNode(I);w.appendChild(T)}H&&y.appendChild(w);let k=p.words[S+1],O=k?.noSpaceBefore||vs(v,k,t);i?E?m||h.appendChild(document.createElement("br")):O||w.appendChild(document.createTextNode("\xA0")):!E&&!O&&w.appendChild(document.createTextNode("\xA0"))}),i&&(h.setAttribute("data-split-content",f),r.appendChild(h))}),i&&u.set("--line-global-total",String(l)),s&&u.set("--char-global-total",String(a)),(K(t,"word")||K(t,"charWord")||K(t,"wordLine"))&&u.set("--word-global-total",String(c)),{fragment:r,extraProps:u}}function hi(d,t,e){if(t)for(let r of t){if(!bs(r.type,r.align,e))continue;let i=ys(r.type,r.align);d.style.setProperty(i,String(r.value))}}function bs(d,t,e){let r=e[d]??[];return Array.isArray(r)&&r.some(i=>t.startsWith("random")?i.align.startsWith("random"):i.align===t)}function ys(d,t){let e=t.startsWith("random")?"random":t;return`--${d}-${e}`}function K(d,t){return Array.isArray(d[t])&&d[t].length>0}var Ss=new Set(["img","video","audio","canvas","iframe","object","svg","input","textarea","select","button","area","base","col","embed","hr","link","meta","param","source","track","wbr","picture","table"]);function Ls(d){let t=[];for(let e=0;e<d.attributes.length;e++){let r=d.attributes[e];t.push([r.name,r.value])}return t}var It=0;function Qi(d){It=0;let t=[],e=(i,n)=>{n&&Object.keys(n).length&&(i.meta={...i.meta||{},...n}),t.push(i)},r=(i,n)=>{if(i.nodeType===Node.ELEMENT_NODE){let s=i,o=s.tagName.toLowerCase();if(o==="split-class"){let a=(s.getAttribute("class")??"").split(/\s+/).filter(Boolean),l={...n||{},splitClass:[...n?.splitClass??[],...a]};s.childNodes.forEach(c=>r(c,l));return}if(o==="br"){e({type:"br",id:`br_${It++}`,node:s,tagName:"br"},n);return}if(!Ss.has(o)&&s.childNodes.length>0){let a={id:`wrapper_${It++}`,tag:o,attributes:Ls(s)},l=n?.wrappers??[],c={...n||{},wrappers:[...l,a]};s.childNodes.forEach(u=>r(u,c));return}e({type:"element",id:`el_${It++}`,node:s,tagName:o},n);return}if(i.nodeType===Node.TEXT_NODE){let s=i.nodeValue??"",o=`text_${It++}`;s.trim()?e({type:"text",id:o,node:i,content:s},n):e({type:"space",id:o,node:i,content:s},n);return}e({type:"other",id:`node_${It++}`,node:i},n)};return d.forEach(i=>r(i)),t}var rr=class{ctx;font="";cache={kerning:new Map,charWidth:new Map};constructor(t){let e=document.createElement("canvas");this.ctx=e.getContext("2d"),this.setFontFromElement(t)}setFontFromElement(t){let e=window.getComputedStyle(t),r=`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${e.fontSize}/${e.lineHeight} ${e.fontFamily}`;r!==this.font&&(this.font=r,this.ctx.font=this.font,this.cache.kerning.clear(),this.cache.charWidth.clear())}getCharWidth(t){if(this.cache.charWidth.has(t))return this.cache.charWidth.get(t);let e=this.ctx.measureText(t).width;return this.cache.charWidth.set(t,e),e}getKerning(t,e){let r=`${t}${e}`,i=`${this.font}|${r}`;if(this.cache.kerning.has(i))return this.cache.kerning.get(i);let n=this.ctx.measureText(r).width,s=this.getCharWidth(t)+this.getCharWidth(e),o=n-s;return this.cache.kerning.set(i,o),o}measureWord(t){let e=0;for(let r=0;r<t.length;r++){let i=t[r];if(e+=this.getCharWidth(i),r>0){let n=t[r-1];e+=this.getKerning(n,i)}}return e}};function Es(d,t){let e=t.contentWidth,r=d.cloneNode(!0);r.removeAttribute("string"),r.removeAttribute("data-string"),r.removeAttribute("string-split"),r.removeAttribute("data-string-split"),r.removeAttribute("string-id"),r.removeAttribute("data-string-id"),r.removeAttribute("string-inited"),r.classList.remove("-splitted","-inview","-restored"),r.innerHTML=d.getAttribute("string-split-original-html")??d.innerHTML,r.style.setProperty("position","absolute","important"),r.style.setProperty("visibility","hidden","important"),r.style.setProperty("pointer-events","none","important"),r.style.setProperty("left","0","important"),r.style.setProperty("top","0","important"),r.style.setProperty("display","block","important"),r.style.setProperty("width",`${e}px`,"important"),r.style.setProperty("min-width",`${e}px`,"important"),r.style.setProperty("max-width",`${e}px`,"important"),r.style.setProperty("padding","0","important"),r.style.setProperty("border","0","important"),r.style.setProperty("margin","0","important"),r.style.setProperty("transform","none","important"),r.style.setProperty("scale","1","important"),(d.parentElement??document.body).appendChild(r);let n=new Map,s=document.createTreeWalker(d,NodeFilter.SHOW_ALL),o=document.createTreeWalker(r,NodeFilter.SHOW_ALL),a=s.currentNode,l=o.currentNode;for(n.set(a,l);(a=s.nextNode())&&(l=o.nextNode());)n.set(a,l);return{resolveNode(c){return n.get(c)??c},cleanup(){r.remove()}}}var ir=class{id="flex";supports(t,e){return e.display==="flex"||e.display==="inline-flex"}createSource(t,e){return Es(t,e)}};function Ms(){return{resolveNode(d){return d},cleanup(){}}}var nr=class{id="inline-flow";supports(t,e){return e.display!=="flex"&&e.display!=="inline-flex"}createSource(t,e){return Ms()}};var fi=[new ir,new nr];function ws(d){let t=window.getComputedStyle(d),e=d.getBoundingClientRect(),r=parseFloat(t.borderLeftWidth)||0,i=parseFloat(t.borderRightWidth)||0,n=parseFloat(t.paddingLeft)||0,s=parseFloat(t.paddingRight)||0;return Math.max(0,e.width-r-i-n-s)}function xs(d){let t=d.parentElement;for(;t;){let e=window.getComputedStyle(t),r=e.display;if(!(r==="inline"||r==="inline-block"||r==="ruby")){let n=t.getBoundingClientRect(),s=parseFloat(e.borderLeftWidth)||0,o=parseFloat(e.borderRightWidth)||0,a=parseFloat(e.paddingLeft)||0,l=parseFloat(e.paddingRight)||0;return Math.max(0,n.width-s-o-a-l)}t=t.parentElement}return 0}function Ji(d){let t=window.getComputedStyle(d),e=ws(d),r=xs(d),i=t.display==="inline"||t.display==="inline-flex"||t.display==="inline-grid",n=e;return(i&&r>e+1&&!d.style.width||n<=0)&&(n=r),{display:t.display,contentWidth:n,ownContentWidth:e,blockContainerContentWidth:r}}function tn(d,t){return fi.find(e=>e.supports(d,t))??fi[fi.length-1]}var sr=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null;function en(d,t){return t.segment!=="visual"?Cs(d):Ts(d)}function rn(d,t){return t.segment!=="visual"||!d||!sr?Array.from(d):Array.from(sr.segment(d),({segment:e})=>e)}function Cs(d){let t=[],e=/\S+/g,r;for(;(r=e.exec(d))!==null;){let i=r.index,n=i+r[0].length;t.push({text:r[0],start:i,end:n,noSpaceBefore:t.length>0&&i===t[t.length-1].end})}return t}function Ts(d){let t=Ps(d),e=[],r=null,i=()=>{r&&(e.push({text:r.text,start:r.start,end:r.end,noSpaceBefore:e.length>0&&r.start===e[e.length-1].end}),r=null)};return t.forEach(({segment:n,index:s})=>{if(/\s/u.test(n)){i();return}let o=As(n),a=s+n.length;if(o==="visual"){i(),e.push({text:n,start:s,end:a,noSpaceBefore:e.length>0&&s===e[e.length-1].end});return}if(!r||r.end!==s){i(),r={text:n,start:s,end:a};return}r.text+=n,r.end=a}),i(),e}function Ps(d){if(!sr){let t=[],e=0;return Array.from(d).forEach(r=>{t.push({segment:r,index:e}),e+=r.length}),t}return Array.from(sr.segment(d),({segment:t,index:e})=>({segment:t,index:e}))}function As(d){return/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}/u.test(d)?"visual":/[\p{Script=Latin}\p{Script=Cyrillic}\p{Script=Greek}\p{Script=Hangul}\p{Number}]/u.test(d)||/[\p{Mark}\p{Connector_Punctuation}\p{Dash_Punctuation}'’._+#&/@]/u.test(d)?"word":"visual"}function ks(d,t){return!d?.length&&!t?.length?!0:!d||!t||d.length!==t.length?!1:d.every((e,r)=>e.id===t[r].id)}function Os(d,t){return d.length!==t.length?!1:d.every((e,r)=>e===t[r])}function on(d,t,e,r){let i=document.createRange(),n=[],s=!1,o=!1,a=!1,l,c=[];try{for(let u=0;u<d.length;u++){let p=d[u];switch(p.type){case"br":{n.push({token:p,rect:new DOMRect(0,0,0,0)}),o=!0,a=!1,l=void 0,c=[],s=!1;break}case"space":o=!Ds(d,u,r);break;case"other":a=!1,o=!1;break;case"text":{let g=p.content,m=/^\s/.test(g),h=p.meta?.wrappers??[],f=p.meta?.splitClass??[],b=en(g,r),y=0;for(let v of b){let S=v.text,E=new DOMRect(0,0,0,0),M=t.resolveNode(p.node);try{i.setStart(M,v.start),i.setEnd(M,v.end),E=i.getBoundingClientRect()}catch{}let C=y===0&&!m&&!o&&a,A=y>0||ks(l,h),I=y>0||Os(c,f),H=e.measureWord(S),w=new DOMRect(E.x,E.y,H,E.height),_={...p.meta||{},joinPrev:C&&A&&I,noSpaceBefore:v.noSpaceBefore||C&&(!A||!I)};s&&y===0&&(_.isAfterElement=!0,s=!1),n.push({token:{type:"text",id:"",node:p.node,content:S,meta:_},rect:w,browserWidth:E.width}),y++}y>0&&(o=/\s$/.test(g),a=!0,l=h,c=f);break}case"element":{let g=t.resolveNode(p.node).getBoundingClientRect();n.push({token:p,rect:g,browserWidth:g.width});let m=n[n.length-2];m?.token.type==="text"&&(m.token.meta={...m.token.meta||{},isBeforeElement:!0}),s=!0,a=!1,c=[],o=!1;break}}}}finally{i.detach?.(),t.cleanup()}return n}function Ds(d,t,e){if(e.trimInlineGaps!==!0)return!1;let r=d[t];if(r?.type!=="space"||!/[\n\r\t]/.test(r.content)&&r.content.length<=1)return!1;let i=Is(d,t-1),n=Rs(d,t+1);if(!i||!n||!nn(i)||!nn(n))return!1;let s=sn(i),o=sn(n);return s.length===0||o.length===0?!1:s.join("|")!==o.join("|")}function Is(d,t){for(let e=t;e>=0;e--){let r=d[e];if(!(r.type==="space"||r.type==="other"))return r}return null}function Rs(d,t){for(let e=t;e<d.length;e++){let r=d[e];if(!(r.type==="space"||r.type==="other"))return r}return null}function nn(d){return d.type==="text"||d.type==="element"}function sn(d){return(d.meta?.wrappers??[]).map(e=>e.id)}function an(d,t,e,r){let i=Ji(t),s=tn(t,i).createSource(t,i);return on(d,s,e,r)}var ln=5;function dn(d,t,e,r){let i=[],n=null,s=0,o=0,a=0,l=0;return d.forEach(c=>{let u=c.token,p=u.meta?.isBeforeElement??!1,g=u.meta?.isAfterElement??!1;if(u.type==="br"){n=null;return}if(u.type==="text"){let m=u.content,h=u.meta?.splitClass??[],f=!!u.meta?.joinPrev,b=[],y=0,v=rn(m,r);for(let w=0;w<v.length;w++){let _=v[w],k=w>0?v[w-1]:null,O=e.getCharWidth(_),T=k?e.getKerning(k,_):0;y+=T;let P=new DOMRect(c.rect.left+y,c.rect.top,O,c.rect.height),R={char:_,rect:P,token:u,charIndexInWord:w,charIndexInLine:0,charIndexGlobal:o++};h.length&&(R.splitClass=h),b.push(R),y+=O}if(b.length>0){let w=b[b.length-1];p&&(w.isBeforeElement=!0),g&&(w.isAfterElement=!0)}let S=Math.round(c.rect.top),E=Math.round(s);if((!n||Math.abs(S-E)>ln)&&(s=S,n={words:[],rect:c.rect,lineIndex:i.length},l=0,i.push(n)),!n)return;let C=c.rect.left+(c.browserWidth??c.rect.width);if(f&&n.words.length>0){let w=n.words[n.words.length-1],_=n.words.reduce((O,T)=>O+T.chars.length,0),k=w.chars.length;b.forEach((O,T)=>{O.charIndexInLine=_+T,O.charIndexInWord=k+T}),w.chars.push(...b),w.rect=or([w.rect,c.rect]),n.rect=or(n.words.map(O=>O.rect)),l=Math.max(l,C),n.fitWidth=l-n.rect.left,n.browserWordWidthSum=(n.browserWordWidthSum??0)+(c.browserWidth??c.rect.width),p&&(w.isBeforeElement=!0),g&&(w.isAfterElement=!0);return}let A=n.words.length,I=n.words.reduce((w,_)=>w+_.chars.length,0);b.forEach((w,_)=>w.charIndexInLine=I+_);let H={chars:b,rect:c.rect,wordIndexGlobal:a++,wordIndexInLine:A,isBeforeElement:p,isAfterElement:g,noSpaceBefore:!!u.meta?.noSpaceBefore};n.words.push(H),n.rect=or(n.words.map(w=>w.rect)),l=Math.max(l,C),n.fitWidth=l-n.rect.left,n.browserWordWidthSum=(n.browserWordWidthSum??0)+(c.browserWidth??c.rect.width),p&&(n.isBeforeElement=!0),g&&(n.isAfterElement=!0);return}if(u.type==="element"){let m=c.rect,h=Math.round(m.top),f=Math.round(s);if((!n||Math.abs(h-f)>ln)&&(s=h,n={words:[],rect:m,lineIndex:i.length},l=0,i.push(n)),!n)return;let y=n.words.length,v=n.words.reduce((M,C)=>M+C.chars.length,0),E={chars:[{char:"[E]",rect:m,token:u,charIndexInWord:0,charIndexInLine:v,charIndexGlobal:o++}],rect:m,wordIndexGlobal:a++,wordIndexInLine:y,isBeforeElement:!1,isAfterElement:!1};n.words.push(E),n.rect=or(n.words.map(M=>M.rect)),l=Math.max(l,c.rect.left+(c.browserWidth??c.rect.width)),n.fitWidth=l-n.rect.left,n.browserWordWidthSum=(n.browserWordWidthSum??0)+(c.browserWidth??c.rect.width)}}),i}function or(d){if(d.length===0)return new DOMRect(0,0,0,0);let t=Math.min(...d.map(n=>n.left)),e=Math.min(...d.map(n=>n.top)),r=Math.max(...d.map(n=>n.right)),i=Math.max(...d.map(n=>n.bottom));return new DOMRect(t,e,r-t,i-e)}var ar=class extends x{lastSplitWidth=new WeakMap;constructor(t){super(t),this.htmlKey="split",this.permissions.mobile.rebuild.height=!1,this.permissions.mobile.rebuild.width=!1}onInit(){let t=()=>{this.objectsOnPage.forEach(e=>{let r=e.htmlElement;if(!r)return;let i=this.getSplitOptions(r);this.needsForcedRebuildOnFontLoad(i)&&this.lastSplitWidth.delete(r),this.onObjectConnected(e)})};document.fonts.ready.then(t),document.fonts.addEventListener("loadingdone",t)}onObjectDisconnected(t){t.htmlElement&&this.lastSplitWidth.delete(t.htmlElement)}onResizeWidth(){this.objectsOnPage.forEach(t=>{let e=t.htmlElement;if(!e)return;let r=this.getSplitOptions(e);this.needsWidthRebuild(r)&&this.onObjectConnected(t)})}onObjectConnected(t){let e=t.htmlElement;if(!e)return;let r=this.isDebugEnabled(e),i=e.classList.contains("-splitted"),n=e.getAttribute("string-split-original-html"),s=e.getAttribute("string-split-original");n===null&&s!==null&&i&&(n=s,s=this.extractTextContent(n),e.setAttribute("string-split-original-html",n),e.setAttribute("string-split-original",s)),(!i||n===null||s===null)&&(n=this.escapeAttribute(e.innerHTML),s=e.textContent??"",e.setAttribute("string-split-original-html",n),e.setAttribute("string-split-original",s)),i&&e.classList.remove("-splitted");let o=window.getComputedStyle(e),a=this.getElementContentWidth(e,o);r&&this.logConnectionStart(e,{isAlreadySplit:i,currentContentWidth:a,lastWidth:this.lastSplitWidth.get(e),originalHtml:n,originalText:s});let l=this.lastSplitWidth.get(e);if(i&&l!==void 0&&Math.abs(a-l)<1){i&&e.classList.add("-splitted");return}this.lastSplitWidth.set(e,a);try{t.htmlElement.innerHTML=n;let c=e.getAttribute("string-split")??e.getAttribute("data-string-split")??"",u=this.tools.optionsParser.process({attributeValue:c}),{fragment:p,result:g,extraProps:m}=this.split(e,u,r);t.setProperty("nodes",p.childNodes),e.setAttribute("aria-label",s),e.innerHTML="",e.appendChild(g),this.applyFlexLineBreaks(e,u),e.classList.add("-splitted"),m.forEach((f,b)=>{e.style.setProperty(b,f)}),r&&this.logRenderedState(e,u,m);let h=e.getAttribute("string-split-restore-after");h&&!isNaN(Number(h))&&setTimeout(()=>{e.innerHTML=n,e.classList.add("-restored")},Number(h))}finally{e.classList.contains("-splitted")||e.classList.add("-splitted")}}extractTextContent(t){let e=document.createElement("div");return e.innerHTML=t,e.textContent??""}getSplitOptions(t){let e=t.getAttribute("string-split")??t.getAttribute("data-string-split")??"";return this.tools.optionsParser.process({attributeValue:e})}hasLineDrivenSplit(t){return(t.line?.length??0)>0||(t.wordLine?.length??0)>0||(t.charLine?.length??0)>0}needsWidthRebuild(t){return this.hasLineDrivenSplit(t)||t.fit===!0}needsForcedRebuildOnFontLoad(t){return this.needsWidthRebuild(t)}getDebugStoreKey(t){let e=t.getAttribute("string-debug-save")??t.getAttribute("data-string-debug-save")??"";return e?e==="true"||e==="1"?this.getDebugLabel(t):e:null}writeDebugRecord(t,e,r){let i=this.getDebugStoreKey(t);if(!i)return;let n=window,s=n.__stringSplitDebug??={},o=s[i]??{label:this.getDebugLabel(t),timestamp:Date.now()};o.timestamp=Date.now(),o[e]=r,s[i]=o}isDebugEnabled(t){let e=t.getAttribute("string-debug")??t.getAttribute("data-string-debug")??"";return e?e===""||e==="true"||e==="1"||e.includes("split")||e==="all":!1}getDebugLabel(t){return t.getAttribute("string-id")??t.id??t.className??t.tagName.toLowerCase()}logConnectionStart(t,e){let r=window.getComputedStyle(t),i=this.captureBaselineSnapshot(t,r),n={text:e.originalText,html:e.originalHtml,baseline:i,flags:{isAlreadySplit:e.isAlreadySplit,display:r.display,whiteSpace:r.whiteSpace,position:r.position},widths:{currentContentWidth:e.currentContentWidth,lastWidth:e.lastWidth,rectWidth:t.getBoundingClientRect().width,clientWidth:t.clientWidth,parentContentWidth:this.getBlockContainerContentWidth(t)}};this.writeDebugRecord(t,"connect",n)}captureBaselineSnapshot(t,e){let r=t.getBoundingClientRect(),i=parseFloat(e.lineHeight);return{rectWidth:Number(r.width.toFixed(2)),rectHeight:Number(r.height.toFixed(2)),fontSize:Number(parseFloat(e.fontSize).toFixed(2)),lineHeight:Number.isFinite(i)?Number(i.toFixed(2)):e.lineHeight,estimatedLineCount:Number.isFinite(i)&&i>0?Number((r.height/i).toFixed(2)):null}}logSplitAnalysis(t,e,r,i){let n={tokens:e.map(s=>({type:s.type,text:this.getTokenDebugText(s),wrappers:s.meta?.wrappers?.map(o=>o.tag)??[]})),measured:r.map(s=>({type:s.token.type,text:this.getTokenDebugText(s.token),left:Number(s.rect.left.toFixed(2)),top:Number(s.rect.top.toFixed(2)),width:Number(s.rect.width.toFixed(2)),browserWidth:Number((s.browserWidth??s.rect.width).toFixed(2))})),layoutLines:i.map(s=>({index:s.lineIndex,text:s.words.map(o=>o.chars.map(a=>a.char).join("")).join(" "),wordCount:s.words.length,rect:{left:Number(s.rect.left.toFixed(2)),top:Number(s.rect.top.toFixed(2)),width:Number(s.rect.width.toFixed(2)),height:Number(s.rect.height.toFixed(2))},fitWidth:Number((s.fitWidth??s.rect.width).toFixed(2))}))};this.writeDebugRecord(t,"measure",n)}getTokenDebugText(t){return"content"in t?t.content:"tagName"in t?t.tagName:"#other"}logRenderedState(t,e,r){let i=window.getComputedStyle(t),n=Array.from(t.querySelectorAll(".-s-line")),s={mode:{attr:t.getAttribute("string-split")??t.getAttribute("data-string-split"),line:e.line?.length??0,wordLine:e.wordLine?.length??0,charLine:e.charLine?.length??0},root:{display:i.display,flexWrap:i.flexWrap,rectWidth:Number(t.getBoundingClientRect().width.toFixed(2)),rectHeight:Number(t.getBoundingClientRect().height.toFixed(2)),childCount:t.children.length,extraProps:Object.fromEntries(r.entries())},children:Array.from(t.children).map(o=>{let a=o,l=a.getBoundingClientRect();return{tag:a.tagName.toLowerCase(),className:a.className,text:a.textContent?.replace(/\s+/g," ").trim(),width:Number(l.width.toFixed(2)),height:Number(l.height.toFixed(2))}}),lineNodes:n.map((o,a)=>{let l=o.getBoundingClientRect(),c=window.getComputedStyle(o);return{index:a,text:o.getAttribute("data-split-content"),top:Number(l.top.toFixed(2)),left:Number(l.left.toFixed(2)),width:Number(l.width.toFixed(2)),height:Number(l.height.toFixed(2)),display:c.display,lineHeight:c.lineHeight,scale:c.scale,transform:c.transform}})};this.writeDebugRecord(t,"rendered",s)}applyFlexLineBreaks(t,e){if(!((e.line?.length??0)>0||(e.wordLine?.length??0)>0||(e.charLine?.length??0)>0))return;let i=window.getComputedStyle(t).display;if(i!=="flex"&&i!=="inline-flex")return;let n=Array.from(t.children).filter(s=>s.classList.contains("-s-line"));if(!(n.length<2))for(let s=0;s<n.length-1;s++){let o=document.createElement("span");o.setAttribute("aria-hidden","true"),o.classList.add("-s-line-break"),o.style.flexBasis="100%",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.pointerEvents="none",n[s].after(o)}}getBlockContainerContentWidth(t){let e=t.parentElement;for(;e;){let r=window.getComputedStyle(e),i=r.display;if(!(i==="inline"||i==="inline-block"||i==="ruby")){let s=e.getBoundingClientRect().width||e.clientWidth;return Math.max(0,s-(parseFloat(r.paddingLeft)||0)-(parseFloat(r.paddingRight)||0))}e=e.parentElement}return 0}getElementContentWidth(t,e=window.getComputedStyle(t)){let r=(parseFloat(e.paddingLeft)||0)+(parseFloat(e.paddingRight)||0),i=t.clientWidth||t.getBoundingClientRect().width,n=this.getBlockContainerContentWidth(t);return n>i+1&&!t.style.width&&(e.display==="inline"||e.display==="inline-flex"||e.display==="inline-grid")?Math.max(0,n-r):i>0?Math.max(0,i-r):Math.max(0,n-r)}split(t,e,r=!1){let i=new rr(t),n=document.createDocumentFragment();t.childNodes.forEach(p=>n.appendChild(p.cloneNode(!0)));let s=Qi(t.childNodes),o=an(s,t,i,e),a=dn(o,t,i,e);r&&this.logSplitAnalysis(t,s,o,a);let l=e.fit?this.getFitContext(a,t):null,c=l?this.applyFit(a,e,l):new Map;this.applyCalculatedValues(a,e);let u=Zi(a,e,i);return c.forEach((p,g)=>u.extraProps.set(g,p)),l&&this.refineFitFontSize(t,u.fragment,u.extraProps,a,e,l),{fragment:n,result:u.fragment,extraProps:u.extraProps}}getFitContext(t,e){let r=window.getComputedStyle(e),i=parseFloat(r.fontSize);if(!i)return null;let n=this.getElementContentWidth(e,r);if(n<=0)return null;let s=0;for(let l of t){let c=l.fitWidth??l.rect.width;c>s&&(s=c)}if(s<=0)return null;let o=n;if(Math.abs(n-s)<2&&e.parentElement){let l=window.getComputedStyle(e.parentElement),c=e.parentElement.clientWidth-(parseFloat(l.paddingLeft)||0)-(parseFloat(l.paddingRight)||0);c>n&&(o=c)}let a=parseFloat(r.lineHeight)||0;return{currentFontSize:i,contentWidth:o,lineHeightPx:a}}applyFit(t,e,r){let i=new Map,{currentFontSize:n,contentWidth:s}=r,o=(e.line?.length??0)>0||(e.wordLine?.length??0)>0||(e.charLine?.length??0)>0,a=(e.char?.length??0)>0||(e.charLine?.length??0)>0||(e.charWord?.length??0)>0;if(o)for(let l of t){let c=l.fitWidth??l.rect.width;c>0&&(l.fitFontSize=this.computeFitFontSize(n,s,c,a?l.browserWordWidthSum:void 0))}else{let l=t.reduce((p,g)=>(g.fitWidth??g.rect.width)>(p.fitWidth??p.rect.width)?g:p,t[0]),c=l.fitWidth??l.rect.width,u=this.computeFitFontSize(n,s,c,a?l.browserWordWidthSum:void 0);i.set("--fit-font-size",String(Math.floor(u)))}return i}refineFitFontSize(t,e,r,i,n,s){let o=(n.line?.length??0)>0||(n.wordLine?.length??0)>0||(n.charLine?.length??0)>0,a=(n.char?.length??0)>0||(n.charLine?.length??0)>0||(n.charWord?.length??0)>0,l=t.innerHTML;try{if(t.innerHTML="",t.appendChild(e.cloneNode(!0)),o){let c=Array.from(t.querySelectorAll(".-s-line")),u=Array.from(e.querySelectorAll(".-s-line"));c.forEach((p,g)=>{let m=u[g];if(!m)return;let h=parseFloat(m.style.getPropertyValue("--fit-font-size"));if(!h)return;let f=this.solveRenderedFitFontSize(p,s.currentFontSize,h,s.contentWidth,a);f&&(i[g].fitFontSize=f,m.style.setProperty("--fit-font-size",String(Math.floor(f))))})}else{let c=parseFloat(r.get("--fit-font-size")??"");if(!c)return;let u=this.solveRenderedFitFontSize(t,s.currentFontSize,c,s.contentWidth,a);if(!u)return;let p=Math.floor(u);r.set("--fit-font-size",String(p));let{lineHeightPx:g,currentFontSize:m,contentWidth:h}=s;if(g>0&&m>0){let f=g*(p/m);f>0&&(r.set("--fit-scale-y",String(window.innerHeight/f)),r.set("--fit-aspect-ratio",String(h/f)))}}}finally{t.innerHTML=l}}solveRenderedFitFontSize(t,e,r,i,n){if(!Number.isFinite(e)||!Number.isFinite(r)||e<=0||r<=0)return null;let s=this.measureScopeAtFontSize(t,n,e);if(s<=0)return null;if(Math.abs(i-s)<.01)return e;let o=Math.abs(r-e)<.01?s:this.measureScopeAtFontSize(t,n,r);if(o<=0)return e*(i/s);let a=(o-s)/(r-e);if(!Number.isFinite(a)||Math.abs(a)<1e-4)return e*(i/s);let l=e+(i-s)/a;return!Number.isFinite(l)||l<=0?null:l}measureScopeAtFontSize(t,e,r){if(e){let s=Array.from(t.querySelectorAll(".-s-char")),o=s.map(l=>l.style.fontSize);s.forEach(l=>{l.style.fontSize=`${r}px`}),t.offsetWidth;let a=this.measureCharScopeWidth(t);return s.forEach((l,c)=>{l.style.fontSize=o[c]}),a}let i=t.style.fontSize;t.style.fontSize=`${r}px`,t.offsetWidth;let n=this.measureContentWidth(t);return t.style.fontSize=i,n}measureCharScopeWidth(t){let e=0;Array.from(t.querySelectorAll(".-s-char")).forEach(o=>{let a=o.getBoundingClientRect(),l=window.getComputedStyle(o);e+=a.width+(parseFloat(l.marginLeft)||0)+(parseFloat(l.marginRight)||0)});let i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),n=i.nextNode();for(;n;){let o=n.parentElement,a=!!o?.closest(".-s-char"),l=!!o&&!o.classList.contains("-s-char")&&!o.classList.contains("-s-word")&&!o.classList.contains("-s-line")&&!o.querySelector(".-s-char, .-s-word, .-s-line");if(!a&&!l&&n.textContent?.length){let c=document.createRange();c.selectNodeContents(n),e+=c.getBoundingClientRect().width}n=i.nextNode()}return Array.from(t.querySelectorAll("*")).filter(o=>{let a=o;return!a.classList.contains("-s-char")&&!a.classList.contains("-s-word")&&!a.classList.contains("-s-line")&&!a.querySelector(".-s-char, .-s-word, .-s-line")}).forEach(o=>{e+=o.getBoundingClientRect().width}),e}measureContentWidth(t){if(!t.childNodes.length)return t.getBoundingClientRect().width;let e=document.createRange();return e.selectNodeContents(t),e.getBoundingClientRect().width}computeFitFontSize(t,e,r,i){let n=i!==void 0?r-i:0,s=r-n;return s<=0?t*(e/r):t*(e-n)/s}computeValue(t,e,r){if(t.align.startsWith("random")){let i=t.random?.min??0,n=t.random?.max??r-1;return Math.floor(Math.random()*(n-i+1))+i}switch(t.align){case"start":return e;case"end":return r-e-1;case"center":{let i=Math.floor((r-1)/2);return Math.abs(e-i)}default:return e}}applyCalculatedValues(t,e){let r=s=>s.words.reduce((o,a)=>o+a.chars.length,0),i=t.reduce((s,o)=>s+o.words.length,0),n=t.reduce((s,o)=>s+o.words.reduce((a,l)=>a+l.chars.length,0),0);t.forEach((s,o)=>{e.line&&(s.calculatedValues=e.line.map(a=>({type:"line",align:a.align,value:this.computeValue(a,o,t.length)}))),s.words.forEach(a=>{e.word&&(a.calculatedValues=e.word.map(c=>({type:"word",align:c.align,value:this.computeValue(c,a.wordIndexGlobal,i)}))),e.wordLine&&(a.calculatedValues??=[],a.calculatedValues.push(...e.wordLine.map(c=>({type:"wordLine",align:c.align,value:this.computeValue(c,a.wordIndexInLine,s.words.length)}))));let l=r(s);a.chars.forEach(c=>{let u=[];e.char&&u.push(...e.char.map(p=>({type:"char",align:p.align,value:this.computeValue(p,c.charIndexGlobal,n)}))),e.charWord&&u.push(...e.charWord.map(p=>({type:"charWord",align:p.align,value:this.computeValue(p,c.charIndexInWord,a.chars.length)}))),e.charLine&&u.push(...e.charLine.map(p=>({type:"charLine",align:p.align,value:this.computeValue(p,c.charIndexInLine,l)}))),c.calculatedValues=u})})})}escapeAttribute(t){return t.replace(/src="(https?:\/\/[^"\s]+)"/g,"src=$1")}};var lr=class extends x{canvas;context;history=[];maxPoints=0;height=0;value=0;target=0;constructor(t){super(t),this._type=2}onInit(){this.initCanvas(),this.maxPoints=this.canvas.width}onScroll(t){let e=Math.abs(t.scroll.displacement);this.value=e,this.history.push(e),this.history.length>this.maxPoints&&this.history.shift(),this.draw()}draw(){let t=this.context,e=this.canvas.width,r=this.canvas.height;t.clearRect(0,0,e,r),t.strokeStyle="red",t.lineWidth=2,t.beginPath(),this.history.forEach((i,n)=>{let s=n,o=r-i*this.height;n===0?t.moveTo(s,o):t.lineTo(s,o)}),t.stroke()}initCanvas(){let t=document.createElement("canvas"),e=window.innerWidth*.5;this.height=window.innerHeight/15-20,t.width=e,t.height=this.height,Object.assign(t.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=t,this.context=t.getContext("2d"),document.body.appendChild(t)}setTarget(t){this.target=t}clear(){this.canvas.remove(),this.history=[]}};var ht="data-fps",dr=class extends x{displayElement=null;intervalId=0;frameCount=0;fpsElements=new Set;observer=null;lastFps=-1;constructor(t){super(t),this._type=2}onInit(){this.data.system.fpsTracker&&this.createDisplayElement(),this.events.on("tracker:fps:visible",this.onVisibilityChange.bind(this)),this.scanElements(),this.observeDOM(),this.intervalId=window.setInterval(()=>{this.updateFPS(this.frameCount),this.frameCount=0},1e3)}onFrame(t){this.frameCount++}destroy(){clearInterval(this.intervalId),this.observer?.disconnect(),this.removeDisplayElement(),this.fpsElements.clear()}onVisibilityChange(t){t?this.createDisplayElement():this.removeDisplayElement()}removeDisplayElement(){this.displayElement?.remove(),this.displayElement=null}updateFPS(t){if(t===this.lastFps)return;this.lastFps=t;let e=String(t);for(let r of this.fpsElements)r.isConnected&&r.setAttribute(ht,e);this.displayElement&&this.displayElement.setAttribute(ht,e),this.events.emit("fps",t)}scanElements(){this.fpsElements.clear(),document.querySelectorAll(`[${ht}]`).forEach(t=>{t!==this.displayElement&&this.fpsElements.add(t)})}observeDOM(){this.observer=new MutationObserver(t=>{let e=!1;for(let r of t){for(let i of Array.from(r.addedNodes))if(i.nodeType===Node.ELEMENT_NODE){let n=i;n.hasAttribute(ht)&&(e=!0),n.querySelector(`[${ht}]`)&&(e=!0)}for(let i of Array.from(r.removedNodes))i.nodeType===Node.ELEMENT_NODE&&this.fpsElements.delete(i)}e&&this.scanElements()}),this.observer.observe(document.body,{childList:!0,subtree:!0})}createDisplayElement(){if(this.displayElement)return;let t=document.createElement("div");Object.assign(t.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"}),t.setAttribute(ht,"0"),document.body.appendChild(t);let e="string-fps-tracker-style";if(!document.getElementById(e)){let r=document.createElement("style");r.id=e,r.innerHTML=`
|
|
19
|
+
`,document.head.appendChild(t)}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 Je(this.data,this.scrollbar,this.thumb,this.requestScrollTo),this.scrollbarStateVertical=new tr(this.data,this.scrollbar,this.thumb,this.requestScrollTo),this.scrollbarState=this.scrollbarStateVertical}updateThumb(){this.scrollbarState.updateThumb()}mouseDownEvent(t){this.isDragging=!0,this.scrollbarState.mouseDownEvent(t),document.body.style.userSelect="none",this.scrollbar.classList.add("-touch")}mouseMoveEvent(t){this.isDragging&&this.scrollbarState.mouseMoveEvent(t)}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 Et={BEFORE_ELEMENT:"-before-element",AFTER_ELEMENT:"-after-element"};function fs(l){if(!l||!Array.isArray(l.chars)||l.chars.length===0)return[];let t=null;for(let e of l.chars){let r=e.splitClass??[];if(r.length!==0){if(t===null){t=r;continue}if(r.length!==t.length)return[];for(let i=0;i<r.length;i++)if(r[i]!==t[i])return[]}}return t??[]}function mi(l){return l.chars[0]?.token?.meta?.wrappers??[]}function vs(l,t,e){if(e.trimInlineGaps!==!0||!t)return!1;let r=mi(l),i=mi(t);if(r.length===0||i.length===0)return!1;if(r.length!==i.length)return!0;for(let n=0;n<r.length;n++)if(r[n].id!==i[n].id)return!0;return!1}function Zi(l,t,e){let r=document.createDocumentFragment(),i=K(t,"line")||K(t,"charLine")||K(t,"wordLine"),n=0,s=K(t,"char")||K(t,"charLine")||K(t,"charWord"),o=0;l.forEach(p=>o+=p.words.length);let a=0;l.forEach(p=>p.words.forEach(g=>a+=g.chars.length));let d=l.length,c=o,u=new Map;return l.forEach((p,g)=>{let m=g===l.length-1,h=r,f="";i&&(h=document.createElement("span"),h.setAttribute("aria-hidden","true"),h.classList.add("-s-line"),p.isBeforeElement&&h.classList.add(Et.BEFORE_ELEMENT),p.isAfterElement&&h.classList.add(Et.AFTER_ELEMENT),h.style.setProperty("--line-index",String(p.lineIndex)),h.style.setProperty("--word-total",String(p.words.length)),p.fitFontSize!==void 0&&h.style.setProperty("--fit-font-size",String(p.fitFontSize)),hi(h,p.calculatedValues,t));let b=[],y=h;p.words.forEach((v,S)=>{let E=S===p.words.length-1,M=mi(v),C=0;for(;C<b.length&&C<M.length&&b[C].info.id===M[C].id;)C++;for(;b.length>C;)b.pop();y=b.length>0?b[b.length-1].element:h;for(let T=C;T<M.length;T++){let P=M[T],R=document.createElement(P.tag);for(let[B,W]of P.attributes)R.setAttribute(B,W);y.appendChild(R),b.push({info:P,element:R}),y=R}if(v.chars.length===1&&v.chars[0].token.type==="element"){let T=v.chars[0].token.node.cloneNode(!0);y.appendChild(T);return}let I=v.chars.map(T=>T.char).join("");I&&(f+=f.length===0||v.noSpaceBefore?I:` ${I}`);let H=K(t,"word")||K(t,"charWord")||K(t,"wordLine"),w=H?document.createElement("span"):y,_=fs(v);if(H&&(w.setAttribute("aria-hidden","true"),w.classList.add("-s-word"),v.isBeforeElement&&w.classList.add(Et.BEFORE_ELEMENT),v.isAfterElement&&w.classList.add(Et.AFTER_ELEMENT),w.style.setProperty("--word-index",String(v.wordIndexGlobal)),w.style.setProperty("--char-total",String(v.chars.length)),w.setAttribute("data-split-content",I),hi(w,v.calculatedValues,t),_.length&&w.classList.add(..._)),s)v.chars.forEach((T,P)=>{if(T.char===" "||T.char===" ")return;let R=document.createElement("span");R.setAttribute("aria-hidden","true");let B=R;B.classList.add("-s-char"),T.isBeforeElement&&B.classList.add(Et.BEFORE_ELEMENT),T.isAfterElement&&B.classList.add(Et.AFTER_ELEMENT),B.textContent=T.char,B.setAttribute("data-split-content",T.char),B.style.setProperty("--char-index",String(n++));let W=v.chars[P+1];if(W){let z=e.getKerning(T.char,W.char);Math.abs(z)>.01&&(B.style.setProperty("--kerning",`${z.toFixed(2)}px`),B.style.marginRight="var(--kerning)")}hi(B,T.calculatedValues,t);let N=T.splitClass??[];N.length&&!_.length&&B.classList.add(...N),w.appendChild(R)});else{let T=document.createTextNode(I);w.appendChild(T)}H&&y.appendChild(w);let k=p.words[S+1],O=k?.noSpaceBefore||vs(v,k,t);i?E?m||h.appendChild(document.createElement("br")):O||w.appendChild(document.createTextNode("\xA0")):!E&&!O&&w.appendChild(document.createTextNode("\xA0"))}),i&&(h.setAttribute("data-split-content",f),r.appendChild(h))}),i&&u.set("--line-global-total",String(d)),s&&u.set("--char-global-total",String(a)),(K(t,"word")||K(t,"charWord")||K(t,"wordLine"))&&u.set("--word-global-total",String(c)),{fragment:r,extraProps:u}}function hi(l,t,e){if(t)for(let r of t){if(!bs(r.type,r.align,e))continue;let i=ys(r.type,r.align);l.style.setProperty(i,String(r.value))}}function bs(l,t,e){let r=e[l]??[];return Array.isArray(r)&&r.some(i=>t.startsWith("random")?i.align.startsWith("random"):i.align===t)}function ys(l,t){let e=t.startsWith("random")?"random":t;return`--${l}-${e}`}function K(l,t){return Array.isArray(l[t])&&l[t].length>0}var Ss=new Set(["img","video","audio","canvas","iframe","object","svg","input","textarea","select","button","area","base","col","embed","hr","link","meta","param","source","track","wbr","picture","table"]);function Ls(l){let t=[];for(let e=0;e<l.attributes.length;e++){let r=l.attributes[e];t.push([r.name,r.value])}return t}var It=0;function Qi(l){It=0;let t=[],e=(i,n)=>{n&&Object.keys(n).length&&(i.meta={...i.meta||{},...n}),t.push(i)},r=(i,n)=>{if(i.nodeType===Node.ELEMENT_NODE){let s=i,o=s.tagName.toLowerCase();if(o==="split-class"){let a=(s.getAttribute("class")??"").split(/\s+/).filter(Boolean),d={...n||{},splitClass:[...n?.splitClass??[],...a]};s.childNodes.forEach(c=>r(c,d));return}if(o==="br"){e({type:"br",id:`br_${It++}`,node:s,tagName:"br"},n);return}if(!Ss.has(o)&&s.childNodes.length>0){let a={id:`wrapper_${It++}`,tag:o,attributes:Ls(s)},d=n?.wrappers??[],c={...n||{},wrappers:[...d,a]};s.childNodes.forEach(u=>r(u,c));return}e({type:"element",id:`el_${It++}`,node:s,tagName:o},n);return}if(i.nodeType===Node.TEXT_NODE){let s=i.nodeValue??"",o=`text_${It++}`;s.trim()?e({type:"text",id:o,node:i,content:s},n):e({type:"space",id:o,node:i,content:s},n);return}e({type:"other",id:`node_${It++}`,node:i},n)};return l.forEach(i=>r(i)),t}var rr=class{ctx;font="";cache={kerning:new Map,charWidth:new Map};constructor(t){let e=document.createElement("canvas");this.ctx=e.getContext("2d"),this.setFontFromElement(t)}setFontFromElement(t){let e=window.getComputedStyle(t),r=`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${e.fontSize}/${e.lineHeight} ${e.fontFamily}`;r!==this.font&&(this.font=r,this.ctx.font=this.font,this.cache.kerning.clear(),this.cache.charWidth.clear())}getCharWidth(t){if(this.cache.charWidth.has(t))return this.cache.charWidth.get(t);let e=this.ctx.measureText(t).width;return this.cache.charWidth.set(t,e),e}getKerning(t,e){let r=`${t}${e}`,i=`${this.font}|${r}`;if(this.cache.kerning.has(i))return this.cache.kerning.get(i);let n=this.ctx.measureText(r).width,s=this.getCharWidth(t)+this.getCharWidth(e),o=n-s;return this.cache.kerning.set(i,o),o}measureWord(t){let e=0;for(let r=0;r<t.length;r++){let i=t[r];if(e+=this.getCharWidth(i),r>0){let n=t[r-1];e+=this.getKerning(n,i)}}return e}};function Es(l,t){let e=t.contentWidth,r=l.cloneNode(!0);r.removeAttribute("string"),r.removeAttribute("data-string"),r.removeAttribute("string-split"),r.removeAttribute("data-string-split"),r.removeAttribute("string-id"),r.removeAttribute("data-string-id"),r.removeAttribute("string-inited"),r.classList.remove("-splitted","-inview","-restored"),r.innerHTML=l.getAttribute("string-split-original-html")??l.innerHTML,r.style.setProperty("position","absolute","important"),r.style.setProperty("visibility","hidden","important"),r.style.setProperty("pointer-events","none","important"),r.style.setProperty("left","0","important"),r.style.setProperty("top","0","important"),r.style.setProperty("display","block","important"),r.style.setProperty("width",`${e}px`,"important"),r.style.setProperty("min-width",`${e}px`,"important"),r.style.setProperty("max-width",`${e}px`,"important"),r.style.setProperty("padding","0","important"),r.style.setProperty("border","0","important"),r.style.setProperty("margin","0","important"),r.style.setProperty("transform","none","important"),r.style.setProperty("scale","1","important"),(l.parentElement??document.body).appendChild(r);let n=new Map,s=document.createTreeWalker(l,NodeFilter.SHOW_ALL),o=document.createTreeWalker(r,NodeFilter.SHOW_ALL),a=s.currentNode,d=o.currentNode;for(n.set(a,d);(a=s.nextNode())&&(d=o.nextNode());)n.set(a,d);return{resolveNode(c){return n.get(c)??c},cleanup(){r.remove()}}}var ir=class{id="flex";supports(t,e){return e.display==="flex"||e.display==="inline-flex"}createSource(t,e){return Es(t,e)}};function Ms(){return{resolveNode(l){return l},cleanup(){}}}var nr=class{id="inline-flow";supports(t,e){return e.display!=="flex"&&e.display!=="inline-flex"}createSource(t,e){return Ms()}};var fi=[new ir,new nr];function ws(l){let t=window.getComputedStyle(l),e=l.getBoundingClientRect(),r=parseFloat(t.borderLeftWidth)||0,i=parseFloat(t.borderRightWidth)||0,n=parseFloat(t.paddingLeft)||0,s=parseFloat(t.paddingRight)||0;return Math.max(0,e.width-r-i-n-s)}function xs(l){let t=l.parentElement;for(;t;){let e=window.getComputedStyle(t),r=e.display;if(!(r==="inline"||r==="inline-block"||r==="ruby")){let n=t.getBoundingClientRect(),s=parseFloat(e.borderLeftWidth)||0,o=parseFloat(e.borderRightWidth)||0,a=parseFloat(e.paddingLeft)||0,d=parseFloat(e.paddingRight)||0;return Math.max(0,n.width-s-o-a-d)}t=t.parentElement}return 0}function Ji(l){let t=window.getComputedStyle(l),e=ws(l),r=xs(l),i=t.display==="inline"||t.display==="inline-flex"||t.display==="inline-grid",n=e;return(i&&r>e+1&&!l.style.width||n<=0)&&(n=r),{display:t.display,contentWidth:n,ownContentWidth:e,blockContainerContentWidth:r}}function tn(l,t){return fi.find(e=>e.supports(l,t))??fi[fi.length-1]}var sr=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null;function en(l,t){return t.segment!=="visual"?Cs(l):Ps(l)}function rn(l,t){return t.segment!=="visual"||!l||!sr?Array.from(l):Array.from(sr.segment(l),({segment:e})=>e)}function Cs(l){let t=[],e=/\S+/g,r;for(;(r=e.exec(l))!==null;)Ts(r[0],r.index,t);return t}function Ts(l,t,e){let r=0;for(let i=1;i<l.length-1;i++){let n=l[i];if(n==="-"||n==="\u2010"){let s=l.slice(r,i+1),o=t+r;e.push({text:s,start:o,end:o+s.length,noSpaceBefore:e.length>0&&o===e[e.length-1].end}),r=i+1}}if(r<l.length){let i=l.slice(r),n=t+r;e.push({text:i,start:n,end:n+i.length,noSpaceBefore:e.length>0&&n===e[e.length-1].end})}}function Ps(l){let t=As(l),e=[],r=null,i=()=>{r&&(e.push({text:r.text,start:r.start,end:r.end,noSpaceBefore:e.length>0&&r.start===e[e.length-1].end}),r=null)};return t.forEach(({segment:n,index:s})=>{if(/\s/u.test(n)){i();return}let o=Os(n),a=s+n.length;if(o==="visual"){if(ks(n)){if(r){r.text+=n,r.end=a;return}if(e.length>0&&s===e[e.length-1].end){e[e.length-1].text+=n,e[e.length-1].end=a;return}}i(),e.push({text:n,start:s,end:a,noSpaceBefore:e.length>0&&s===e[e.length-1].end});return}let d=r!==null&&(r.text.endsWith("-")||r.text.endsWith("\u2010"));if(!r||r.end!==s||d){i(),r={text:n,start:s,end:a};return}r.text+=n,r.end=a}),i(),e}function As(l){if(!sr){let t=[],e=0;return Array.from(l).forEach(r=>{t.push({segment:r,index:e}),e+=r.length}),t}return Array.from(sr.segment(l),({segment:t,index:e})=>({segment:t,index:e}))}function ks(l){return/[\)\]\})」』〕〉》›»"']/u.test(l)}function Os(l){return/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}/u.test(l)?"visual":/[\p{Script=Latin}\p{Script=Cyrillic}\p{Script=Greek}\p{Script=Hangul}\p{Number}]/u.test(l)||/[\p{Mark}\p{Connector_Punctuation}\p{Dash_Punctuation}'’._+#&/@]/u.test(l)?"word":"visual"}function Ds(l,t){return!l?.length&&!t?.length?!0:!l||!t||l.length!==t.length?!1:l.every((e,r)=>e.id===t[r].id)}function Is(l,t){return l.length!==t.length?!1:l.every((e,r)=>e===t[r])}function on(l,t,e,r){let i=document.createRange(),n=[],s=!1,o=!1,a=!1,d,c=[];try{for(let u=0;u<l.length;u++){let p=l[u];switch(p.type){case"br":{n.push({token:p,rect:new DOMRect(0,0,0,0)}),o=!0,a=!1,d=void 0,c=[],s=!1;break}case"space":o=!Rs(l,u,r);break;case"other":a=!1,o=!1;break;case"text":{let g=p.content,m=/^\s/.test(g),h=p.meta?.wrappers??[],f=p.meta?.splitClass??[],b=en(g,r),y=0;for(let v of b){let S=v.text,E=new DOMRect(0,0,0,0),M=t.resolveNode(p.node);try{i.setStart(M,v.start),i.setEnd(M,v.end),E=i.getBoundingClientRect()}catch{}let C=y===0&&!m&&!o&&a,A=y>0||Ds(d,h),I=y===0&&!Is(c,f),H=e.measureWord(S),w=new DOMRect(E.x,E.y,H,E.height),_={...p.meta||{},joinPrev:C&&A&&!I,noSpaceBefore:v.noSpaceBefore||C&&(!A||I)};s&&y===0&&(_.isAfterElement=!0,s=!1),n.push({token:{type:"text",id:"",node:p.node,content:S,meta:_},rect:w,browserWidth:E.width}),y++}y>0&&(o=/\s$/.test(g),a=!0,d=h,c=f);break}case"element":{let g=t.resolveNode(p.node).getBoundingClientRect();n.push({token:p,rect:g,browserWidth:g.width});let m=n[n.length-2];m?.token.type==="text"&&(m.token.meta={...m.token.meta||{},isBeforeElement:!0}),s=!0,a=!1,c=[],o=!1;break}}}}finally{i.detach?.(),t.cleanup()}return n}function Rs(l,t,e){if(e.trimInlineGaps!==!0)return!1;let r=l[t];if(r?.type!=="space"||!/[\n\r\t]/.test(r.content)&&r.content.length<=1)return!1;let i=Hs(l,t-1),n=Bs(l,t+1);if(!i||!n||!nn(i)||!nn(n))return!1;let s=sn(i),o=sn(n);return s.length===0||o.length===0?!1:s.join("|")!==o.join("|")}function Hs(l,t){for(let e=t;e>=0;e--){let r=l[e];if(!(r.type==="space"||r.type==="other"))return r}return null}function Bs(l,t){for(let e=t;e<l.length;e++){let r=l[e];if(!(r.type==="space"||r.type==="other"))return r}return null}function nn(l){return l.type==="text"||l.type==="element"}function sn(l){return(l.meta?.wrappers??[]).map(e=>e.id)}function an(l,t,e,r){let i=Ji(t),s=tn(t,i).createSource(t,i);return on(l,s,e,r)}var ln=5;function dn(l,t,e,r){let i=[],n=null,s=0,o=0,a=0,d=0;return l.forEach(c=>{let u=c.token,p=u.meta?.isBeforeElement??!1,g=u.meta?.isAfterElement??!1;if(u.type==="br"){n=null;return}if(u.type==="text"){let m=u.content,h=u.meta?.splitClass??[],f=!!u.meta?.joinPrev,b=[],y=0,v=rn(m,r);for(let w=0;w<v.length;w++){let _=v[w],k=w>0?v[w-1]:null,O=e.getCharWidth(_),T=k?e.getKerning(k,_):0;y+=T;let P=new DOMRect(c.rect.left+y,c.rect.top,O,c.rect.height),R={char:_,rect:P,token:u,charIndexInWord:w,charIndexInLine:0,charIndexGlobal:o++};h.length&&(R.splitClass=h),b.push(R),y+=O}if(b.length>0){let w=b[b.length-1];p&&(w.isBeforeElement=!0),g&&(w.isAfterElement=!0)}let S=Math.round(c.rect.top),E=Math.round(s);if((!n||Math.abs(S-E)>ln)&&(s=S,n={words:[],rect:c.rect,lineIndex:i.length},d=0,i.push(n)),!n)return;let C=c.rect.left+(c.browserWidth??c.rect.width);if(f&&n.words.length>0){let w=n.words[n.words.length-1],_=n.words.reduce((O,T)=>O+T.chars.length,0),k=w.chars.length;b.forEach((O,T)=>{O.charIndexInLine=_+T,O.charIndexInWord=k+T}),w.chars.push(...b),w.rect=or([w.rect,c.rect]),n.rect=or(n.words.map(O=>O.rect)),d=Math.max(d,C),n.fitWidth=d-n.rect.left,n.browserWordWidthSum=(n.browserWordWidthSum??0)+(c.browserWidth??c.rect.width),p&&(w.isBeforeElement=!0),g&&(w.isAfterElement=!0);return}let A=n.words.length,I=n.words.reduce((w,_)=>w+_.chars.length,0);b.forEach((w,_)=>w.charIndexInLine=I+_);let H={chars:b,rect:c.rect,wordIndexGlobal:a++,wordIndexInLine:A,isBeforeElement:p,isAfterElement:g,noSpaceBefore:!!u.meta?.noSpaceBefore};n.words.push(H),n.rect=or(n.words.map(w=>w.rect)),d=Math.max(d,C),n.fitWidth=d-n.rect.left,n.browserWordWidthSum=(n.browserWordWidthSum??0)+(c.browserWidth??c.rect.width),p&&(n.isBeforeElement=!0),g&&(n.isAfterElement=!0);return}if(u.type==="element"){let m=c.rect,h=Math.round(m.top),f=Math.round(s);if((!n||Math.abs(h-f)>ln)&&(s=h,n={words:[],rect:m,lineIndex:i.length},d=0,i.push(n)),!n)return;let y=n.words.length,v=n.words.reduce((M,C)=>M+C.chars.length,0),E={chars:[{char:"[E]",rect:m,token:u,charIndexInWord:0,charIndexInLine:v,charIndexGlobal:o++}],rect:m,wordIndexGlobal:a++,wordIndexInLine:y,isBeforeElement:!1,isAfterElement:!1};n.words.push(E),n.rect=or(n.words.map(M=>M.rect)),d=Math.max(d,c.rect.left+(c.browserWidth??c.rect.width)),n.fitWidth=d-n.rect.left,n.browserWordWidthSum=(n.browserWordWidthSum??0)+(c.browserWidth??c.rect.width)}}),i}function or(l){if(l.length===0)return new DOMRect(0,0,0,0);let t=Math.min(...l.map(n=>n.left)),e=Math.min(...l.map(n=>n.top)),r=Math.max(...l.map(n=>n.right)),i=Math.max(...l.map(n=>n.bottom));return new DOMRect(t,e,r-t,i-e)}var ar=class extends x{lastSplitWidth=new WeakMap;constructor(t){super(t),this.htmlKey="split",this.permissions.mobile.rebuild.height=!1,this.permissions.mobile.rebuild.width=!1}onInit(){let t=()=>{this.objectsOnPage.forEach(e=>{let r=e.htmlElement;if(!r)return;let i=this.getSplitOptions(r);this.needsForcedRebuildOnFontLoad(i)&&this.lastSplitWidth.delete(r),this.onObjectConnected(e)})};document.fonts.ready.then(t),document.fonts.addEventListener("loadingdone",t)}onObjectDisconnected(t){t.htmlElement&&this.lastSplitWidth.delete(t.htmlElement)}onResizeWidth(){this.objectsOnPage.forEach(t=>{let e=t.htmlElement;if(!e)return;let r=this.getSplitOptions(e);this.needsWidthRebuild(r)&&this.onObjectConnected(t)})}onObjectConnected(t){let e=t.htmlElement;if(!e)return;let r=this.isDebugEnabled(e),i=e.classList.contains("-splitted"),n=e.getAttribute("string-split-original-html"),s=e.getAttribute("string-split-original");n===null&&s!==null&&i&&(n=s,s=this.extractTextContent(n),e.setAttribute("string-split-original-html",n),e.setAttribute("string-split-original",s)),(!i||n===null||s===null)&&(n=this.escapeAttribute(e.innerHTML),s=e.textContent??"",e.setAttribute("string-split-original-html",n),e.setAttribute("string-split-original",s)),i&&e.classList.remove("-splitted");let o=window.getComputedStyle(e),a=this.getElementContentWidth(e,o);r&&this.logConnectionStart(e,{isAlreadySplit:i,currentContentWidth:a,lastWidth:this.lastSplitWidth.get(e),originalHtml:n,originalText:s});let d=this.lastSplitWidth.get(e);if(i&&d!==void 0&&Math.abs(a-d)<1){i&&e.classList.add("-splitted");return}this.lastSplitWidth.set(e,a);try{t.htmlElement.innerHTML=n;let c=e.getAttribute("string-split")??e.getAttribute("data-string-split")??"",u=this.tools.optionsParser.process({attributeValue:c}),{fragment:p,result:g,extraProps:m}=this.split(e,u,r);t.setProperty("nodes",p.childNodes),e.setAttribute("aria-label",s),e.innerHTML="",e.appendChild(g),this.applyFlexLineBreaks(e,u),e.classList.add("-splitted"),m.forEach((f,b)=>{e.style.setProperty(b,f)}),r&&this.logRenderedState(e,u,m);let h=e.getAttribute("string-split-restore-after");h&&!isNaN(Number(h))&&setTimeout(()=>{e.innerHTML=n,e.classList.add("-restored")},Number(h))}finally{e.classList.contains("-splitted")||e.classList.add("-splitted")}}extractTextContent(t){let e=document.createElement("div");return e.innerHTML=t,e.textContent??""}getSplitOptions(t){let e=t.getAttribute("string-split")??t.getAttribute("data-string-split")??"";return this.tools.optionsParser.process({attributeValue:e})}hasLineDrivenSplit(t){return(t.line?.length??0)>0||(t.wordLine?.length??0)>0||(t.charLine?.length??0)>0}needsWidthRebuild(t){return this.hasLineDrivenSplit(t)||t.fit===!0}needsForcedRebuildOnFontLoad(t){return this.needsWidthRebuild(t)}getDebugStoreKey(t){let e=t.getAttribute("string-debug-save")??t.getAttribute("data-string-debug-save")??"";return e?e==="true"||e==="1"?this.getDebugLabel(t):e:null}writeDebugRecord(t,e,r){let i=this.getDebugStoreKey(t);if(!i)return;let n=window,s=n.__stringSplitDebug??={},o=s[i]??{label:this.getDebugLabel(t),timestamp:Date.now()};o.timestamp=Date.now(),o[e]=r,s[i]=o}isDebugEnabled(t){let e=t.getAttribute("string-debug")??t.getAttribute("data-string-debug")??"";return e?e===""||e==="true"||e==="1"||e.includes("split")||e==="all":!1}getDebugLabel(t){return t.getAttribute("string-id")??t.id??t.className??t.tagName.toLowerCase()}logConnectionStart(t,e){let r=window.getComputedStyle(t),i=this.captureBaselineSnapshot(t,r),n={text:e.originalText,html:e.originalHtml,baseline:i,flags:{isAlreadySplit:e.isAlreadySplit,display:r.display,whiteSpace:r.whiteSpace,position:r.position},widths:{currentContentWidth:e.currentContentWidth,lastWidth:e.lastWidth,rectWidth:t.getBoundingClientRect().width,clientWidth:t.clientWidth,parentContentWidth:this.getBlockContainerContentWidth(t)}};this.writeDebugRecord(t,"connect",n)}captureBaselineSnapshot(t,e){let r=t.getBoundingClientRect(),i=parseFloat(e.lineHeight);return{rectWidth:Number(r.width.toFixed(2)),rectHeight:Number(r.height.toFixed(2)),fontSize:Number(parseFloat(e.fontSize).toFixed(2)),lineHeight:Number.isFinite(i)?Number(i.toFixed(2)):e.lineHeight,estimatedLineCount:Number.isFinite(i)&&i>0?Number((r.height/i).toFixed(2)):null}}logSplitAnalysis(t,e,r,i){let n={tokens:e.map(s=>({type:s.type,text:this.getTokenDebugText(s),wrappers:s.meta?.wrappers?.map(o=>o.tag)??[]})),measured:r.map(s=>({type:s.token.type,text:this.getTokenDebugText(s.token),left:Number(s.rect.left.toFixed(2)),top:Number(s.rect.top.toFixed(2)),width:Number(s.rect.width.toFixed(2)),browserWidth:Number((s.browserWidth??s.rect.width).toFixed(2))})),layoutLines:i.map(s=>({index:s.lineIndex,text:s.words.map(o=>o.chars.map(a=>a.char).join("")).join(" "),wordCount:s.words.length,rect:{left:Number(s.rect.left.toFixed(2)),top:Number(s.rect.top.toFixed(2)),width:Number(s.rect.width.toFixed(2)),height:Number(s.rect.height.toFixed(2))},fitWidth:Number((s.fitWidth??s.rect.width).toFixed(2))}))};this.writeDebugRecord(t,"measure",n)}getTokenDebugText(t){return"content"in t?t.content:"tagName"in t?t.tagName:"#other"}logRenderedState(t,e,r){let i=window.getComputedStyle(t),n=Array.from(t.querySelectorAll(".-s-line")),s={mode:{attr:t.getAttribute("string-split")??t.getAttribute("data-string-split"),line:e.line?.length??0,wordLine:e.wordLine?.length??0,charLine:e.charLine?.length??0},root:{display:i.display,flexWrap:i.flexWrap,rectWidth:Number(t.getBoundingClientRect().width.toFixed(2)),rectHeight:Number(t.getBoundingClientRect().height.toFixed(2)),childCount:t.children.length,extraProps:Object.fromEntries(r.entries())},children:Array.from(t.children).map(o=>{let a=o,d=a.getBoundingClientRect();return{tag:a.tagName.toLowerCase(),className:a.className,text:a.textContent?.replace(/\s+/g," ").trim(),width:Number(d.width.toFixed(2)),height:Number(d.height.toFixed(2))}}),lineNodes:n.map((o,a)=>{let d=o.getBoundingClientRect(),c=window.getComputedStyle(o);return{index:a,text:o.getAttribute("data-split-content"),top:Number(d.top.toFixed(2)),left:Number(d.left.toFixed(2)),width:Number(d.width.toFixed(2)),height:Number(d.height.toFixed(2)),display:c.display,lineHeight:c.lineHeight,scale:c.scale,transform:c.transform}})};this.writeDebugRecord(t,"rendered",s)}applyFlexLineBreaks(t,e){if(!((e.line?.length??0)>0||(e.wordLine?.length??0)>0||(e.charLine?.length??0)>0))return;let i=window.getComputedStyle(t).display;if(i!=="flex"&&i!=="inline-flex")return;let n=Array.from(t.children).filter(s=>s.classList.contains("-s-line"));if(!(n.length<2))for(let s=0;s<n.length-1;s++){let o=document.createElement("span");o.setAttribute("aria-hidden","true"),o.classList.add("-s-line-break"),o.style.flexBasis="100%",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.pointerEvents="none",n[s].after(o)}}getBlockContainerContentWidth(t){let e=t.parentElement;for(;e;){let r=window.getComputedStyle(e),i=r.display;if(!(i==="inline"||i==="inline-block"||i==="ruby")){let s=e.getBoundingClientRect().width||e.clientWidth;return Math.max(0,s-(parseFloat(r.paddingLeft)||0)-(parseFloat(r.paddingRight)||0))}e=e.parentElement}return 0}getElementContentWidth(t,e=window.getComputedStyle(t)){let r=(parseFloat(e.paddingLeft)||0)+(parseFloat(e.paddingRight)||0),i=t.clientWidth||t.getBoundingClientRect().width,n=this.getBlockContainerContentWidth(t);return n>i+1&&!t.style.width&&(e.display==="inline"||e.display==="inline-flex"||e.display==="inline-grid")?Math.max(0,n-r):i>0?Math.max(0,i-r):Math.max(0,n-r)}split(t,e,r=!1){let i=new rr(t),n=document.createDocumentFragment();t.childNodes.forEach(p=>n.appendChild(p.cloneNode(!0)));let s=Qi(t.childNodes),o=an(s,t,i,e),a=dn(o,t,i,e);r&&this.logSplitAnalysis(t,s,o,a);let d=e.fit?this.getFitContext(a,t):null,c=d?this.applyFit(a,e,d):new Map;this.applyCalculatedValues(a,e);let u=Zi(a,e,i);return c.forEach((p,g)=>u.extraProps.set(g,p)),d&&this.refineFitFontSize(t,u.fragment,u.extraProps,a,e,d),{fragment:n,result:u.fragment,extraProps:u.extraProps}}getFitContext(t,e){let r=window.getComputedStyle(e),i=parseFloat(r.fontSize);if(!i)return null;let n=this.getElementContentWidth(e,r);if(n<=0)return null;let s=0;for(let d of t){let c=d.fitWidth??d.rect.width;c>s&&(s=c)}if(s<=0)return null;let o=n;if(Math.abs(n-s)<2&&e.parentElement){let d=window.getComputedStyle(e.parentElement),c=e.parentElement.clientWidth-(parseFloat(d.paddingLeft)||0)-(parseFloat(d.paddingRight)||0);c>n&&(o=c)}let a=parseFloat(r.lineHeight)||0;return{currentFontSize:i,contentWidth:o,lineHeightPx:a}}applyFit(t,e,r){let i=new Map,{currentFontSize:n,contentWidth:s}=r,o=(e.line?.length??0)>0||(e.wordLine?.length??0)>0||(e.charLine?.length??0)>0,a=(e.char?.length??0)>0||(e.charLine?.length??0)>0||(e.charWord?.length??0)>0;if(o)for(let d of t){let c=d.fitWidth??d.rect.width;c>0&&(d.fitFontSize=this.computeFitFontSize(n,s,c,a?d.browserWordWidthSum:void 0))}else{let d=t.reduce((p,g)=>(g.fitWidth??g.rect.width)>(p.fitWidth??p.rect.width)?g:p,t[0]),c=d.fitWidth??d.rect.width,u=this.computeFitFontSize(n,s,c,a?d.browserWordWidthSum:void 0);i.set("--fit-font-size",String(Math.floor(u)))}return i}refineFitFontSize(t,e,r,i,n,s){let o=(n.line?.length??0)>0||(n.wordLine?.length??0)>0||(n.charLine?.length??0)>0,a=(n.char?.length??0)>0||(n.charLine?.length??0)>0||(n.charWord?.length??0)>0,d=t.innerHTML;try{if(t.innerHTML="",t.appendChild(e.cloneNode(!0)),o){let c=Array.from(t.querySelectorAll(".-s-line")),u=Array.from(e.querySelectorAll(".-s-line"));c.forEach((p,g)=>{let m=u[g];if(!m)return;let h=parseFloat(m.style.getPropertyValue("--fit-font-size"));if(!h)return;let f=this.solveRenderedFitFontSize(p,s.currentFontSize,h,s.contentWidth,a);f&&(i[g].fitFontSize=f,m.style.setProperty("--fit-font-size",String(Math.floor(f))))})}else{let c=parseFloat(r.get("--fit-font-size")??"");if(!c)return;let u=this.solveRenderedFitFontSize(t,s.currentFontSize,c,s.contentWidth,a);if(!u)return;let p=Math.floor(u);r.set("--fit-font-size",String(p));let{lineHeightPx:g,currentFontSize:m,contentWidth:h}=s;if(g>0&&m>0){let f=g*(p/m);f>0&&(r.set("--fit-scale-y",String(window.innerHeight/f)),r.set("--fit-aspect-ratio",String(h/f)))}}}finally{t.innerHTML=d}}solveRenderedFitFontSize(t,e,r,i,n){if(!Number.isFinite(e)||!Number.isFinite(r)||e<=0||r<=0)return null;let s=this.measureScopeAtFontSize(t,n,e);if(s<=0)return null;if(Math.abs(i-s)<.01)return e;let o=Math.abs(r-e)<.01?s:this.measureScopeAtFontSize(t,n,r);if(o<=0)return e*(i/s);let a=(o-s)/(r-e);if(!Number.isFinite(a)||Math.abs(a)<1e-4)return e*(i/s);let d=e+(i-s)/a;return!Number.isFinite(d)||d<=0?null:d}measureScopeAtFontSize(t,e,r){if(e){let s=Array.from(t.querySelectorAll(".-s-char")),o=s.map(d=>d.style.fontSize);s.forEach(d=>{d.style.fontSize=`${r}px`}),t.offsetWidth;let a=this.measureCharScopeWidth(t);return s.forEach((d,c)=>{d.style.fontSize=o[c]}),a}let i=t.style.fontSize;t.style.fontSize=`${r}px`,t.offsetWidth;let n=this.measureContentWidth(t);return t.style.fontSize=i,n}measureCharScopeWidth(t){let e=0;Array.from(t.querySelectorAll(".-s-char")).forEach(o=>{let a=o.getBoundingClientRect(),d=window.getComputedStyle(o);e+=a.width+(parseFloat(d.marginLeft)||0)+(parseFloat(d.marginRight)||0)});let i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),n=i.nextNode();for(;n;){let o=n.parentElement,a=!!o?.closest(".-s-char"),d=!!o&&!o.classList.contains("-s-char")&&!o.classList.contains("-s-word")&&!o.classList.contains("-s-line")&&!o.querySelector(".-s-char, .-s-word, .-s-line");if(!a&&!d&&n.textContent?.length){let c=document.createRange();c.selectNodeContents(n),e+=c.getBoundingClientRect().width}n=i.nextNode()}return Array.from(t.querySelectorAll("*")).filter(o=>{let a=o;return!a.classList.contains("-s-char")&&!a.classList.contains("-s-word")&&!a.classList.contains("-s-line")&&!a.querySelector(".-s-char, .-s-word, .-s-line")}).forEach(o=>{e+=o.getBoundingClientRect().width}),e}measureContentWidth(t){if(!t.childNodes.length)return t.getBoundingClientRect().width;let e=document.createRange();return e.selectNodeContents(t),e.getBoundingClientRect().width}computeFitFontSize(t,e,r,i){let n=i!==void 0?r-i:0,s=r-n;return s<=0?t*(e/r):t*(e-n)/s}computeValue(t,e,r){if(t.align.startsWith("random")){let i=t.random?.min??0,n=t.random?.max??r-1;return Math.floor(Math.random()*(n-i+1))+i}switch(t.align){case"start":return e;case"end":return r-e-1;case"center":{let i=Math.floor((r-1)/2);return Math.abs(e-i)}default:return e}}applyCalculatedValues(t,e){let r=s=>s.words.reduce((o,a)=>o+a.chars.length,0),i=t.reduce((s,o)=>s+o.words.length,0),n=t.reduce((s,o)=>s+o.words.reduce((a,d)=>a+d.chars.length,0),0);t.forEach((s,o)=>{e.line&&(s.calculatedValues=e.line.map(a=>({type:"line",align:a.align,value:this.computeValue(a,o,t.length)}))),s.words.forEach(a=>{e.word&&(a.calculatedValues=e.word.map(c=>({type:"word",align:c.align,value:this.computeValue(c,a.wordIndexGlobal,i)}))),e.wordLine&&(a.calculatedValues??=[],a.calculatedValues.push(...e.wordLine.map(c=>({type:"wordLine",align:c.align,value:this.computeValue(c,a.wordIndexInLine,s.words.length)}))));let d=r(s);a.chars.forEach(c=>{let u=[];e.char&&u.push(...e.char.map(p=>({type:"char",align:p.align,value:this.computeValue(p,c.charIndexGlobal,n)}))),e.charWord&&u.push(...e.charWord.map(p=>({type:"charWord",align:p.align,value:this.computeValue(p,c.charIndexInWord,a.chars.length)}))),e.charLine&&u.push(...e.charLine.map(p=>({type:"charLine",align:p.align,value:this.computeValue(p,c.charIndexInLine,d)}))),c.calculatedValues=u})})})}escapeAttribute(t){return t.replace(/src="(https?:\/\/[^"\s]+)"/g,"src=$1")}};var lr=class extends x{canvas;context;history=[];maxPoints=0;height=0;value=0;target=0;constructor(t){super(t),this._type=2}onInit(){this.initCanvas(),this.maxPoints=this.canvas.width}onScroll(t){let e=Math.abs(t.scroll.displacement);this.value=e,this.history.push(e),this.history.length>this.maxPoints&&this.history.shift(),this.draw()}draw(){let t=this.context,e=this.canvas.width,r=this.canvas.height;t.clearRect(0,0,e,r),t.strokeStyle="red",t.lineWidth=2,t.beginPath(),this.history.forEach((i,n)=>{let s=n,o=r-i*this.height;n===0?t.moveTo(s,o):t.lineTo(s,o)}),t.stroke()}initCanvas(){let t=document.createElement("canvas"),e=window.innerWidth*.5;this.height=window.innerHeight/15-20,t.width=e,t.height=this.height,Object.assign(t.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=t,this.context=t.getContext("2d"),document.body.appendChild(t)}setTarget(t){this.target=t}clear(){this.canvas.remove(),this.history=[]}};var ht="data-fps",dr=class extends x{displayElement=null;intervalId=0;frameCount=0;fpsElements=new Set;observer=null;lastFps=-1;constructor(t){super(t),this._type=2}onInit(){this.data.system.fpsTracker&&this.createDisplayElement(),this.events.on("tracker:fps:visible",this.onVisibilityChange.bind(this)),this.scanElements(),this.observeDOM(),this.intervalId=window.setInterval(()=>{this.updateFPS(this.frameCount),this.frameCount=0},1e3)}onFrame(t){this.frameCount++}destroy(){clearInterval(this.intervalId),this.observer?.disconnect(),this.removeDisplayElement(),this.fpsElements.clear()}onVisibilityChange(t){t?this.createDisplayElement():this.removeDisplayElement()}removeDisplayElement(){this.displayElement?.remove(),this.displayElement=null}updateFPS(t){if(t===this.lastFps)return;this.lastFps=t;let e=String(t);for(let r of this.fpsElements)r.isConnected&&r.setAttribute(ht,e);this.displayElement&&this.displayElement.setAttribute(ht,e),this.events.emit("fps",t)}scanElements(){this.fpsElements.clear(),document.querySelectorAll(`[${ht}]`).forEach(t=>{t!==this.displayElement&&this.fpsElements.add(t)})}observeDOM(){this.observer=new MutationObserver(t=>{let e=!1;for(let r of t){for(let i of Array.from(r.addedNodes))if(i.nodeType===Node.ELEMENT_NODE){let n=i;n.hasAttribute(ht)&&(e=!0),n.querySelector(`[${ht}]`)&&(e=!0)}for(let i of Array.from(r.removedNodes))i.nodeType===Node.ELEMENT_NODE&&this.fpsElements.delete(i)}e&&this.scanElements()}),this.observer.observe(document.body,{childList:!0,subtree:!0})}createDisplayElement(){if(this.displayElement)return;let t=document.createElement("div");Object.assign(t.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"}),t.setAttribute(ht,"0"),document.body.appendChild(t);let e="string-fps-tracker-style";if(!document.getElementById(e)){let r=document.createElement("style");r.id=e,r.innerHTML=`
|
|
20
20
|
[${ht}]::before {
|
|
21
21
|
content: 'FPS: ' attr(${ht});
|
|
22
22
|
}
|
|
23
|
-
`,document.head.appendChild(r)}this.displayElement=t}};var cr=class extends x{canvas;context;history=[];maxPoints=0;canvasHeight=0;currentValue=0;targetValue=0;constructor(t){super(t),this._type=2}onInit(){this.initCanvas(),this.maxPoints=this.canvas.width}onScroll(t){let e=Math.abs(t.scroll.displacement);this.currentValue=e,this.history.push(e),this.history.length>this.maxPoints&&this.history.shift(),this.draw()}draw(){let t=this.context,e=this.canvas.width,r=this.canvas.height;t.clearRect(0,0,e,r),t.strokeStyle="#007bff",t.lineWidth=2,t.beginPath(),this.history.forEach((i,n)=>{let s=n,o=r-i/2;n===0?t.moveTo(s,o):t.lineTo(s,o)}),t.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(t){this.targetValue=t}clear(){this.canvas.remove(),this.history=[]}};var mt="data-val",ft="data-val-pct",vt="data-dir",ur=class extends x{displayElement=null;valElements=new Set;valPctElements=new Set;dirElements=new Set;observer=null;lastVal=-1;lastValPct=-1;lastDir="";previousCurrent=0;idleTimeout=null;constructor(t){super(t),this._type=2}onInit(){this.data.system.positionTracker&&this.createDisplayElement(),this.events.on("tracker:position:visible",this.onVisibilityChange.bind(this)),this.scanElements(),this.observeDOM()}onScroll(t){let e=t.scroll.current,r=t.scroll.target,i=t.viewport.contentHeight,n=t.viewport.windowHeight,s=Math.round(e),o=Math.max(1,i-n),a=Math.round(e/o*100),
|
|
23
|
+
`,document.head.appendChild(r)}this.displayElement=t}};var cr=class extends x{canvas;context;history=[];maxPoints=0;canvasHeight=0;currentValue=0;targetValue=0;constructor(t){super(t),this._type=2}onInit(){this.initCanvas(),this.maxPoints=this.canvas.width}onScroll(t){let e=Math.abs(t.scroll.displacement);this.currentValue=e,this.history.push(e),this.history.length>this.maxPoints&&this.history.shift(),this.draw()}draw(){let t=this.context,e=this.canvas.width,r=this.canvas.height;t.clearRect(0,0,e,r),t.strokeStyle="#007bff",t.lineWidth=2,t.beginPath(),this.history.forEach((i,n)=>{let s=n,o=r-i/2;n===0?t.moveTo(s,o):t.lineTo(s,o)}),t.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(t){this.targetValue=t}clear(){this.canvas.remove(),this.history=[]}};var mt="data-val",ft="data-val-pct",vt="data-dir",ur=class extends x{displayElement=null;valElements=new Set;valPctElements=new Set;dirElements=new Set;observer=null;lastVal=-1;lastValPct=-1;lastDir="";previousCurrent=0;idleTimeout=null;constructor(t){super(t),this._type=2}onInit(){this.data.system.positionTracker&&this.createDisplayElement(),this.events.on("tracker:position:visible",this.onVisibilityChange.bind(this)),this.scanElements(),this.observeDOM()}onScroll(t){let e=t.scroll.current,r=t.scroll.target,i=t.viewport.contentHeight,n=t.viewport.windowHeight,s=Math.round(e),o=Math.max(1,i-n),a=Math.round(e/o*100),d;if(e!==r?d=e<r?"\u2193":"\u2191":e!==this.previousCurrent?d=e>this.previousCurrent?"\u2193":"\u2191":d=this.lastDir||"\u2022",this.previousCurrent=e,this.idleTimeout&&clearTimeout(this.idleTimeout),d!=="\u2022"&&(this.idleTimeout=setTimeout(()=>{this.setDirection("\u2022")},150)),s!==this.lastVal){this.lastVal=s;let c=String(s);for(let u of this.valElements)u.isConnected&&u.setAttribute(mt,c);this.displayElement&&this.displayElement.setAttribute(mt,c)}if(a!==this.lastValPct){this.lastValPct=a;let c=String(a);for(let u of this.valPctElements)u.isConnected&&u.setAttribute(ft,c);this.displayElement&&this.displayElement.setAttribute(ft,c)}this.setDirection(d),this.events.emit("scroll-position",{val:s,valPct:a,direction:d})}setDirection(t){if(t!==this.lastDir){this.lastDir=t;for(let e of this.dirElements)e.isConnected&&e.setAttribute(vt,t);this.displayElement&&this.displayElement.setAttribute(vt,t)}}destroy(){this.idleTimeout&&clearTimeout(this.idleTimeout),this.observer?.disconnect(),this.removeDisplayElement(),this.valElements.clear(),this.valPctElements.clear(),this.dirElements.clear()}onVisibilityChange(t){t?this.createDisplayElement():this.removeDisplayElement()}removeDisplayElement(){this.displayElement?.remove(),this.displayElement=null}scanElements(){this.valElements.clear(),this.valPctElements.clear(),this.dirElements.clear(),document.querySelectorAll(`[${mt}]`).forEach(t=>{t!==this.displayElement&&this.valElements.add(t)}),document.querySelectorAll(`[${ft}]`).forEach(t=>{t!==this.displayElement&&this.valPctElements.add(t)}),document.querySelectorAll(`[${vt}]`).forEach(t=>{t!==this.displayElement&&this.dirElements.add(t)})}observeDOM(){this.observer=new MutationObserver(t=>{let e=!1;for(let r of t){for(let i of Array.from(r.addedNodes))if(i.nodeType===Node.ELEMENT_NODE){let n=i;this.hasTrackingAttr(n)&&(e=!0),n.querySelector(`[${mt}],[${ft}],[${vt}]`)&&(e=!0)}for(let i of Array.from(r.removedNodes))if(i.nodeType===Node.ELEMENT_NODE){let n=i;this.valElements.delete(n),this.valPctElements.delete(n),this.dirElements.delete(n)}}e&&this.scanElements()}),this.observer.observe(document.body,{childList:!0,subtree:!0})}hasTrackingAttr(t){return t.hasAttribute(mt)||t.hasAttribute(ft)||t.hasAttribute(vt)}createDisplayElement(){if(this.displayElement)return;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(vt,"\u2022"),t.setAttribute(mt,"0"),t.setAttribute(ft,"0"),document.body.appendChild(t);let e="string-position-tracker-style";if(!document.getElementById(e)){let r=document.createElement("style");r.id=e,r.innerHTML=`
|
|
24
24
|
[${vt}][${mt}][${ft}]::before {
|
|
25
25
|
content: attr(${vt}) ' | ' attr(${mt}) 'px (' attr(${ft}) '%)';
|
|
26
26
|
}
|
|
27
|
-
`,document.head.appendChild(r)}this.displayElement=t}};function vi(d,t){let e=null;return function(...r){let i=this;e&&clearTimeout(e),e=setTimeout(()=>{d.apply(i,r),e=null},t)}}var pr=class{fps=0;isAnimationStarted=!1;fpsInterval=0;then=0;requestAnimationId=0;onVisibilityChangeBind;onFrameCallback=t=>{};animate=()=>{};constructor(){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 gr=class extends x{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 bi=(i=>(i.ACTIVE="-active",i.ENTERING="-entering",i.LEAVING="-leaving",i.DISABLED="-disabled",i))(bi||{}),cn={PROGRESS:"--sequence-progress",DIRECTION:"--sequence-direction"};var hr=class d extends x{activeStep=new Map;leavingStep=new Map;transitions=new Map;elementIndex=new Map;triggerElements=new Map;globalSettings=new Map;stateRegistered=new Set;lastEnteredStep=new Map;defaultDuration;initialized=!1;static ALL_STATES=Object.values(bi);constructor(t){super(t),this.htmlKey="sequence",this.defaultDuration=this.settings["sequence-duration"]??600,this.attributesToMap=[...this.attributesToMap,{key:"sequence",type:"string",fallback:""},{key:"sequence-trigger",type:"string",fallback:""},{key:"entering-easing",type:"string",fallback:""},{key:"leaving-easing",type:"string",fallback:""},{key:"entering-duration",type:"string",fallback:""},{key:"leaving-duration",type:"string",fallback:""},{key:"sequence-duration",type:"string",fallback:""},{key:"active-step",type:"string",fallback:""}]}onInit(){super.onInit(),this.events.on("sequence",this.onSequenceEvent.bind(this)),this.scanStandaloneTriggers()}scanStandaloneTriggers(){let t=document.querySelectorAll("[string-sequence-trigger]:not([string-inited])");for(let e of Array.from(t)){let r=e.getAttribute("string-sequence-trigger"),i=r?this.parseTriggerKey(r):null;i&&(this.triggerElements.set(e,i),e.addEventListener("click",this.onTriggerClick))}}parseGlobalSettingsFromObject(t){let e=i=>t.getProperty(i),r=e("sequence-duration");this.tryParseGlobalSetting(r,"enteringDuration"),this.tryParseGlobalSetting(r,"leavingDuration"),this.tryParseGlobalSetting(e("entering-duration"),"enteringDuration"),this.tryParseGlobalSetting(e("leaving-duration"),"leavingDuration"),this.tryParseGlobalSetting(e("entering-easing"),"enteringEasing"),this.tryParseGlobalSetting(e("leaving-easing"),"leavingEasing"),this.tryParseGlobalSetting(e("active-step"),"activeStep")}tryParseGlobalSetting(t,e){if(!t)return;let r=t.match(/^(.+)\[(.+)\]$/);if(!r)return;let[,i,n]=r,s=this.globalSettings.get(i)??{};this.globalSettings.set(i,s),s[e]=e==="enteringEasing"||e==="leavingEasing"?n:parseFloat(n),this.applyGlobalSettingsToExistingObjects(i)}applyGlobalSettingsToExistingObjects(t){let e=this.globalSettings.get(t);if(e){for(let[r,i]of this.elementIndex)if(this.parseSequenceKey(r)?.slider===t){e.enteringDuration!==void 0&&(i.enteringDuration=e.enteringDuration),e.leavingDuration!==void 0&&(i.leavingDuration=e.leavingDuration);for(let s of i.objects)this.resolveEasings(s,r)}}}initializeSliders(){let t=new Set;for(let e of this.elementIndex.keys()){let r=this.parseSequenceKey(e);r&&t.add(r.slider)}for(let e of t){if(this.activeStep.has(e))continue;let i=this.globalSettings.get(e)?.activeStep??0;this.elementIndex.has(`${e}[${i}]`)||(i=0),this.switchInstant(e,i,1)}}tryApplyPendingActiveStep(t){if(this.activeStep.has(t))return;let e=this.globalSettings.get(t)?.activeStep;e!==void 0&&this.elementIndex.has(`${t}[${e}]`)&&this.switchInstant(t,e,1)}canConnect(t){return t.keys.includes("sequence")||t.keys.includes("sequence-trigger")}onObjectConnected(t){super.onObjectConnected(t),this.parseGlobalSettingsFromObject(t);let e=t.getProperty("sequence"),r=t.getProperty("sequence-trigger");if(!e&&r){let i=this.parseTriggerKey(r);i&&typeof i.step=="number"&&(e=`${i.slider}[${i.step}]`,t.setProperty("sequence",e))}if(e){let i=this.parseSequenceKey(e);if(i){this.ensureStateEventRegistered(i.slider);let n=this.elementIndex.get(e);if(!n){let{enteringDuration:o,leavingDuration:a}=this.resolveDurations(t,e);n={objects:[],enteringDuration:o,leavingDuration:a},this.elementIndex.set(e,n)}n.objects.push(t),this.resolveEasings(t,e);let s=this.activeStep.get(i.slider);this.setState(t,s===i.step?"-active":"-disabled",s===i.step?1:0,1),this.tryApplyPendingActiveStep(i.slider)}}if(r){let i=this.parseTriggerKey(r);i&&(this.triggerElements.set(t.htmlElement,i),t.htmlElement.addEventListener("click",this.onTriggerClick))}}ensureStateEventRegistered(t){this.stateRegistered.has(t)||(this.stateRegistered.add(t),this.events.registerStateEvent?.(`sequence:active:${t}`))}parseTriggerKey(t){let e=t.match(/^(.+)\[(next|prev|\d+)(\|loop)?\]$/);if(!e)return null;let r=e[2]==="next"||e[2]==="prev"?e[2]:parseInt(e[2],10);return{slider:e[1],step:r,loop:e[3]==="|loop"}}getMaxStep(t){let e=-1;for(let r of this.elementIndex.keys()){let i=this.parseSequenceKey(r);i?.slider===t&&i.step>e&&(e=i.step)}return e}resolveDuration(t,e,r,i){let n=t.getProperty(i),s=t.getProperty("sequence-duration"),o=this.globalSettings.get(e)?.[r];if(n&&!n.includes("[")){let a=parseFloat(n);if(!isNaN(a))return a}if(s&&!s.includes("[")){let a=parseFloat(s);if(!isNaN(a))return a}return o??this.defaultDuration}resolveDurations(t,e){let r=this.parseSequenceKey(e)?.slider??"";return{enteringDuration:this.resolveDuration(t,r,"enteringDuration","entering-duration"),leavingDuration:this.resolveDuration(t,r,"leavingDuration","leaving-duration")}}resolveEasing(t,e,r,i){let n=t.getProperty(i);(!n||typeof n=="string"&&n.includes("["))&&(n=this.globalSettings.get(e)?.[r]??this.settings.easing??"ease-out"),typeof n=="string"&&t.setProperty(i,this.tools.easingFunction.process({easing:n}))}resolveEasings(t,e){let r=this.parseSequenceKey(e)?.slider;r&&(this.resolveEasing(t,r,"enteringEasing","entering-easing"),this.resolveEasing(t,r,"leavingEasing","leaving-easing"))}onObjectDisconnected(t){super.onObjectDisconnected(t);let e=t.getProperty("sequence");if(e){let r=this.elementIndex.get(e);if(r){let i=r.objects.indexOf(t);i!==-1&&r.objects.splice(i,1),r.objects.length||this.elementIndex.delete(e)}}this.triggerElements.has(t.htmlElement)&&(t.htmlElement.removeEventListener("click",this.onTriggerClick),this.triggerElements.delete(t.htmlElement))}parseSequenceKey(t){let e=t.match(/^(.+)\[(\d+)\]$/);return e?{slider:e[1],step:parseInt(e[2],10)}:null}onTriggerClick=t=>{let e=this.triggerElements.get(t.currentTarget);if(!e)return;let r=this.activeStep.get(e.slider)??0,i=this.getMaxStep(e.slider),n,s;if(e.step==="next"){if(n=r+1,s=1,!this.elementIndex.has(`${e.slider}[${n}]`))if(e.loop&&i>=0)n=0;else return}else if(e.step==="prev"){if(n=r-1,s=-1,n<0)if(e.loop&&i>=0)n=i;else return;if(!this.elementIndex.has(`${e.slider}[${n}]`))return}else{if(n=e.step,r===n)return;s=n>r?1:-1}this.startTransition(e.slider,n,s)};onSequenceEvent(t){let{slider:e,step:r,transitionProgress:i,direction:n=1,duration:s,instant:o}=t;this.activeStep.get(e)===r&&i===void 0||(i!==void 0?this.handleScrub(e,r,i,n):o?this.switchInstant(e,r,n):this.startTransition(e,r,n,s))}startTransition(t,e,r,i){let n=this.activeStep.get(t),s=this.leavingStep.get(t);this.ensureStateEventRegistered(t),s!==void 0&&s!==n&&this.setStepState(t,s,"-disabled",0,r);let o=this.elementIndex.get(`${t}[${e}]`),a=n!==void 0?this.elementIndex.get(`${t}[${n}]`):null;n!==void 0&&this.leavingStep.set(t,n),this.activeStep.set(t,e),this.emitActiveState(t,e);let l={fromStep:n??e,toStep:e,direction:r,startTime:this.data.time.now,enteringDuration:i??o?.enteringDuration??this.defaultDuration,leavingDuration:i??a?.leavingDuration??this.defaultDuration};this.transitions.set(t,l),this.emitTransitionStart(t,l)}handleScrub(t,e,r,i){this.transitions.delete(t);let n=this.activeStep.get(t);if(n!==e){let o=this.leavingStep.get(t);o!==void 0&&this.setStepState(t,o,"-disabled",0,i),n!==void 0&&this.leavingStep.set(t,n),this.activeStep.set(t,e),this.emitActiveState(t,e)}let s=this.leavingStep.get(t)??n??e;this.applyProgress(t,s,e,r,r,i)}switchInstant(t,e,r){this.transitions.delete(t);let i=this.activeStep.get(t),n=this.leavingStep.get(t);n!==void 0&&this.setStepState(t,n,"-disabled",0,r),i!==void 0&&i!==e&&this.setStepState(t,i,"-disabled",0,r),this.activeStep.set(t,e),this.leavingStep.delete(t),this.setStepState(t,e,"-active",1,r),this.emitActiveState(t,e),n!==void 0&&n!==e?this.emitStepLeave(t,n,r,!0):i!==void 0&&i!==e&&this.emitStepLeave(t,i,r,!0),this.emitStepEnter(t,e,r,!0);let s={fromStep:i??e,toStep:e,direction:r,startTime:this.data.time.now,enteringDuration:0,leavingDuration:0};this.emitTransitionStart(t,s),this.emitTransitionEnd(t,e,i??e,r,!0)}applyProgress(t,e,r,i,n,s){let o=this.activeStep.get(t),a=this.leavingStep.get(t);this.setStepState(t,o,i>=1?"-active":"-entering",i,s),a!==void 0&&a!==o&&(n>=1?(this.setStepState(t,a,"-disabled",0,s),this.leavingStep.delete(t),this.emitStepLeave(t,a,s,!1)):this.setStepState(t,a,"-leaving",n,s)),this.emitTransitionProgress(t,e,r,i,n,s),i>=1&&this.emitStepEnter(t,o,s,!1)}setStepState(t,e,r,i,n){let s=this.elementIndex.get(`${t}[${e}]`);if(s)for(let o of s.objects)this.setState(o,r,i,n)}setState(t,e,r,i){let n=t.htmlElement,s=t.getProperty("_state"),o=t.getProperty("_direction"),a=t.getProperty(e==="-leaving"?"leaving-easing":"entering-easing"),l=typeof a=="function"?a(r):r;s!==e&&(n.classList.remove(...d.ALL_STATES),n.classList.add(e),t.setProperty("_state",e)),o!==i&&(t.setProperty("_direction",i),L.run(()=>L.setVars(n,{[cn.DIRECTION]:i.toString()})))}onFrame(t){super.onFrame(t),this.initialized||(this.initialized=!0,this.initializeSliders());for(let[e,r]of this.transitions){let i=t.time.now-r.startTime,n=Math.min(1,i/r.enteringDuration),s=Math.min(1,i/r.leavingDuration);this.applyProgress(e,r.fromStep,r.toStep,n,s,r.direction),n>=1&&s>=1&&(this.emitTransitionEnd(e,r.toStep,r.fromStep,r.direction,!1),this.transitions.delete(e))}}emitTransitionStart(t,e){let r={slider:t,from:e.fromStep,to:e.toStep,direction:e.direction,enteringDuration:e.enteringDuration,leavingDuration:e.leavingDuration,startedAt:e.startTime};this.events.emit("sequence:transition:start",r),this.events.emit(`sequence:transition:start:${t}`,r)}emitTransitionProgress(t,e,r,i,n,s){let o={slider:t,from:e,to:r,entering:i,leaving:n,direction:s};this.events.emit("sequence:transition:progress",o),this.events.emit(`sequence:transition:progress:${t}`,o)}emitTransitionEnd(t,e,r,i,n){let s={slider:t,from:r,to:e,direction:i,instant:n};this.events.emit("sequence:transition:end",s),this.events.emit(`sequence:transition:end:${t}`,s)}emitStepEnter(t,e,r,i){if(!i&&this.lastEnteredStep.get(t)===e)return;this.lastEnteredStep.set(t,e);let n={slider:t,step:e,direction:r,instant:i};this.events.emit("sequence:step:enter",n),this.events.emit(`sequence:step:enter:${t}`,n)}emitStepLeave(t,e,r,i){if(e==null)return;let n={slider:t,step:e,direction:r,instant:i};this.events.emit("sequence:step:leave",n),this.events.emit(`sequence:step:leave:${t}`,n)}emitActiveState(t,e){let r={slider:t,step:e};this.events.emit("sequence:active",r),this.events.emit(`sequence:active:${t}`,r)}};var mr=class d extends x{constructor(t){super(t),this.htmlKey="form"}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i);let n=e.getProperty("form-events")??[];n.forEach(c=>{c.eventElement.removeEventListener(c.eventType,c.eventCallback)}),n.length=0,e.setProperty("form-events",n),super.onObjectConnected(e);let s=e.htmlElement,o=[],a={};this.getInteractiveFields(s).forEach((c,u)=>this.registerField(c,s,o,a,n,u));let l=c=>{c.preventDefault();let u=!0,p={},g=new Set;for(let m of o){let h=m.field;if(!h.isConnected||!this.shouldValidateField(h))continue;if(this.isRadioField(h)){if(g.has(m.key))continue;g.add(m.key)}let{key:f,rules:b,needsContext:y}=m,v=this.getFieldValue(h);p[f]=v,a[f]=v;let{valid:S,errors:E}=this.tools.validation.process({rules:b,value:v,context:this.buildContext(y,f,a)});this.applyValidationState(s,h,f,S,E,"submit"),S||(u=!1)}if(u)this.events.emit(`form:submit:${e.id}`,p);else{let m=new Set,h=o.find(f=>{let b=f.field;if(!b.isConnected||!this.shouldValidateField(b))return!1;if(this.isRadioField(b)){if(m.has(f.key))return!1;m.add(f.key)}let{key:y,rules:v,needsContext:S}=f,E=this.getFieldValue(b);a[y]=E;let{valid:M}=this.tools.validation.process({rules:v,value:E,context:this.buildContext(S,y,a)});return!M});h?.field&&typeof h.field.focus=="function"&&h.field.focus(),this.events.emit(`form:invalid:${e.id}`)}};s.addEventListener("submit",l),n.push({eventElement:s,eventType:"submit",eventCallback:l}),e.setProperty("form-field-entries",o),e.setProperty("form-field-values",a)}onObjectConnected(t){}onDOMMutate(t,e){this.objects.length!==0&&(t.length>0&&this.handleMutationAdditions(t),e.length>0&&this.handleMutationRemovals(e))}applyValidationState(t,e,r,i,n,s){let o=t.querySelector(`[string-input="error[${r}]"]`),a=t.querySelector(`[string-input="group[${r}]"]`);o&&(o.innerHTML="",n.forEach(c=>{let u=document.createElement("span");u.textContent=c,o.appendChild(u)})),s==="live"?(e.classList.toggle("-invalid",!i),e.classList.remove("-error")):(e.classList.remove("-invalid"),e.classList.toggle("-error",!i)),e.classList.toggle("-valid",i),a&&(s==="live"?(a.classList.toggle("-invalid",!i),a.classList.remove("-error")):(a.classList.remove("-invalid"),a.classList.toggle("-error",!i)),a.classList.toggle("-valid",i));let l=i?"valid":s==="live"?"invalid":"error";this.events.emit(`form:field:${l}:${r}`,{key:r,field:e,errors:n,phase:s,valid:i})}getInteractiveFields(t){return Array.from(t.querySelectorAll("[string-input]")).filter(e=>!this.isServiceFieldAttribute(e.getAttribute("string-input")||"")).filter(e=>this.isFormFieldElement(e)).map(e=>e)}getFieldRules(t){let e=this.tools.domAttribute.process({element:t,key:"input"})??"";return this.tools.ruleParser.process({value:e})}registerField(t,e,r,i,n,s){if(!this.isFormFieldElement(t)||t.closest("form")!==e||r.some(h=>h.field===t))return;let o=this.registerFieldIndex(t,s??r.length),a=this.getInputKey(t,o),l=this.getFieldRules(t),c=this.supportsBeforeInputValidation(l),u=this.requiresContext(l),p=this.getInputEventType(t),g={field:t,key:a,rules:l,supportsRealtime:c,needsContext:u,inputEventType:p,inputHandler:()=>{}},m=h=>{let f=h.currentTarget||h.target;if(!f||!f.isConnected||!this.shouldValidateField(f))return;let b=this.getFieldValue(f);i[g.key]=b;let y=this.buildContext(g.needsContext,g.key,i),{valid:v,errors:S}=this.tools.validation.process({rules:g.rules,value:b,context:y});this.applyValidationState(e,f,g.key,v,S,"live")};if(g.inputHandler=m,t.addEventListener(p,m),n.push({eventElement:t,eventType:p,eventCallback:m}),c&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){let h=f=>{let b=f;if(b.isComposing||b.inputType?.startsWith("insertComposition"))return;let y=f.currentTarget||f.target;if(!y||!(y instanceof HTMLInputElement||y instanceof HTMLTextAreaElement)||!y.isConnected)return;let v=y.selectionStart??0,S=y.selectionEnd??0,E=y.value;switch(b.inputType){case"deleteContentBackward":E=v===S&&v>0?y.value.slice(0,v-1)+y.value.slice(S):y.value.slice(0,v)+y.value.slice(S);break;case"deleteContentForward":E=v===S&&v<y.value.length?y.value.slice(0,v)+y.value.slice(v+1):y.value.slice(0,v)+y.value.slice(S);break;case"insertFromPaste":case"insertFromDrop":case"insertReplacementText":E=y.value.slice(0,v)+(b.data||"")+y.value.slice(S);break;default:typeof b.data=="string"&&(E=y.value.slice(0,v)+b.data+y.value.slice(S))}let{errors:M}=this.tools.validation.process({rules:g.rules,value:E,type:"beforeinput",context:this.buildContext(g.needsContext,g.key,i,{applied:!0,value:E})});M.length>0&&f.cancelable&&f.preventDefault()};g.beforeInputHandler=h,t.addEventListener("beforeinput",h),n.push({eventElement:t,eventType:"beforeinput",eventCallback:h})}t.classList.add("-inited"),r.push(g),i[a]=this.getFieldValue(t)}unregisterField(t,e,r,i){let n=e.findIndex(o=>o.field===t);if(n===-1)return;let s=e[n];s.inputHandler&&t.removeEventListener(s.inputEventType,s.inputHandler),s.beforeInputHandler&&t.removeEventListener("beforeinput",s.beforeInputHandler),delete r[s.key],e.splice(n,1);for(let o=i.length-1;o>=0;o--){let a=i[o];a.eventElement===t&&(a.eventCallback===s.inputHandler||s.beforeInputHandler&&a.eventCallback===s.beforeInputHandler)&&i.splice(o,1)}t.classList.remove("-inited")}collectInteractiveFieldsFromNode(t){let e=[];return t instanceof Element?(t.hasAttribute("string-input")&&e.push(t),e.push(...Array.from(t.querySelectorAll("[string-input]")))):t instanceof DocumentFragment&&e.push(...Array.from(t.querySelectorAll("[string-input]"))),e.filter(r=>!this.isServiceFieldAttribute(r.getAttribute("string-input")||"")).filter(r=>this.isFormFieldElement(r))}isRadioField(t){return t instanceof HTMLInputElement&&t.type==="radio"}handleMutationAdditions(t){t.forEach(e=>{this.collectInteractiveFieldsFromNode(e).forEach(i=>{let n=this.getFormStateByContainment(i);n&&this.registerField(i,n.form,n.entries,n.values,n.events)})})}handleMutationRemovals(t){t.forEach(e=>{this.collectInteractiveFieldsFromNode(e).forEach(i=>{let n=this.getFormStateByReference(i);n&&this.unregisterField(i,n.entries,n.values,n.events)})})}getFormStateByContainment(t){let e=this.objects.find(r=>r.htmlElement instanceof HTMLFormElement&&r.htmlElement.contains(t));return e?this.buildFormState(e):null}getFormStateByReference(t){for(let e of this.objects){let r=e.getProperty("form-field-entries");if(r&&r.some(i=>i.field===t))return this.buildFormState(e,r)}return null}buildFormState(t,e){let r=t.htmlElement;if(!(r instanceof HTMLFormElement))return null;let i=e??t.getProperty("form-field-entries"),n=t.getProperty("form-field-values"),s=t.getProperty("form-events");return!i||!n||!s?null:{object:t,form:r,entries:i,values:n,events:s}}registerFieldIndex(t,e){let r=t.getAttribute("data-string-form-index");return r!==null?Number(r):(t.setAttribute("data-string-form-index",String(e)),e)}getFieldIndex(t,e){let r=t.getAttribute("data-string-form-index");if(r!==null){let i=Number(r);return Number.isNaN(i)?e:i}return this.registerFieldIndex(t,e)}shouldValidateField(t){return!(t.disabled||t instanceof HTMLInputElement&&t.type==="hidden")}supportsBeforeInputValidation(t){return t.some(e=>d.beforeInputRuleKeys.has(e.key))}requiresContext(t){return t.some(e=>d.crossFieldRuleKeys.has(e.key))}buildContext(t,e,r,i){if(!t)return{fieldKey:e};let n=!!i?.applied,s=n?{...r,[e]:i.value}:r;return{fieldKey:e,values:s,getValue:o=>n&&o===e?i.value:s[o]}}static beforeInputRuleKeys=new Set(["number","integer","email","phone","letters","lettersSpaces","lettersNumbers","alpha","alpha_num","alpha_dash","digits","url","pattern"]);static crossFieldRuleKeys=new Set(["same","different","after","before"]);static serviceAttributePrefixes=["error","group"];getInputKey(t,e){return this.tools.domAttribute.process({element:t,key:"id"})||t.getAttribute("name")||t.getAttribute("id")||`input-${e}`}getFieldValue(t){if(t instanceof HTMLInputElement){if(t.type==="checkbox"){if(t.name){let e=t.form||t.closest("form"),r=e?Array.from(e.querySelectorAll(`input[type="checkbox"][name="${t.name}"]:checked`)):[t];return r.length>1?r.map(i=>i.value):r.length===1?r[0].value:""}return t.checked}if(t.type==="radio"){if(t.name){let r=(t.form||t.closest("form"))?.querySelector(`input[type="radio"][name="${t.name}"]:checked`);return r?r.value:""}return t.checked?t.value:""}return t.type==="file"&&t.files&&t.files.length>0?t.multiple?Array.from(t.files):t.files[0]:t.value}return t instanceof HTMLSelectElement?t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value:t instanceof HTMLTextAreaElement?t.value:""}isServiceFieldAttribute(t){return d.serviceAttributePrefixes.some(e=>t.startsWith(`${e}[`))}isFormFieldElement(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement}getInputEventType(t){return t instanceof HTMLSelectElement||t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio")?"change":"input"}};var fr=class{map=new WeakMap;all=new Set;attach(t){if(this.map.has(t))return;let e=t.htmlElement,r={cx:0,cy:0,valid:!1,el:e};r.ro=new ResizeObserver(()=>{r.valid=!1}),r.ro.observe(e),this.map.set(t,r),this.all.add(t)}detach(t){let e=this.map.get(t);e&&(e.ro?.disconnect(),this.map.delete(t),this.all.delete(t))}invalidate(t){this.all.forEach(e=>{if(e.id===t){let r=this.map.get(e);r&&(r.valid=!1)}})}invalidateAll(){this.all.forEach(t=>{let e=this.map.get(t);e&&(e.valid=!1)})}getCenter(t){let e=this.map.get(t);if(!e||!e.el)return{cx:0,cy:0};if(!e.valid){let r=e.el.getBoundingClientRect();e.cx=r.left+r.width/2,e.cy=r.top+r.height/2,e.valid=!0}return{cx:e.cx,cy:e.cy}}};var vr=class{active=new Set;subs=new WeakMap;track(t){if(this.subs.has(t))return;let e=t.htmlElement,r=()=>this.active.add(t),i=()=>this.active.delete(t);e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",i),this.subs.set(t,{enter:r,leave:i})}untrack(t){let e=this.subs.get(t);if(!e)return;let r=t.htmlElement;e.enter&&r.removeEventListener("pointerenter",e.enter),e.leave&&r.removeEventListener("pointerleave",e.leave),this.active.delete(t),this.subs.delete(t)}isActive(t){return this.active.has(t)}activeObjects(){return Array.from(this.active)}};var br=class{constructor(t){this.emit=t}values=new Map;publish(t,e,r){let i=this.getKey(t,e);this.values.set(i,r),this.emit(this.getEventName(t,e),r)}subscribe(t,e,r,i){r.on(this.getEventName(t,e),i)}unsubscribe(t,e,r,i){r.off(this.getEventName(t,e),i)}get(t,e){return this.values.get(this.getKey(t,e))}getEventName(t,e){return`signal:${t}:${e}`}getKey(t,e){return`${t}.${e}`}};var un=[{id:"icon-20_logo",viewBox:"0 0 20 20",content:'<path fill="currentColor" id="Combined-Shape" d="M9.443,4.529L13.911,10.273L19.885,15.217L18.865,16.45L12.823,11.45L12.702,11.324L8.181,5.511C7.834,5.066 7.161,5.065 6.814,5.51L1.297,12.564L0.036,11.578L5.553,4.524C6.543,3.259 8.458,3.261 9.443,4.529ZM14.407,2.737L16.907,6.07L16.427,6.43L13.927,3.097L14.407,2.737ZM16.907,1.487L19.407,4.82L18.927,5.18L16.427,1.847L16.907,1.487Z"/>'},{id:"icon-20_layout",viewBox:"0 0 20 20",content:'<path fill="currentColor" d="M8.4,1.25L11.6,1.25C14.024,1.25 15.231,1.296 16.156,1.768C17.05,2.223 17.777,2.95 18.232,3.844C18.704,4.769 18.75,5.976 18.75,8.4L18.75,11.6C18.75,14.024 18.704,15.231 18.232,16.156C17.777,17.05 17.05,17.777 16.156,18.232C15.231,18.704 14.024,18.75 11.6,18.75L8.4,18.75C5.976,18.75 4.769,18.704 3.844,18.232C2.95,17.777 2.223,17.05 1.768,16.156C1.296,15.231 1.25,14.024 1.25,11.6L1.25,8.4C1.25,5.976 1.296,4.769 1.768,3.844C2.223,2.95 2.95,2.223 3.844,1.768C4.769,1.296 5.976,1.25 8.4,1.25ZM8.4,2.75C6.343,2.75 5.31,2.704 4.525,3.104C3.913,3.416 3.416,3.913 3.104,4.525C2.704,5.31 2.75,6.343 2.75,8.4L2.75,11.6C2.75,13.657 2.704,14.69 3.104,15.475C3.416,16.087 3.913,16.584 4.525,16.896C5.31,17.296 6.343,17.25 8.4,17.25L11.6,17.25C13.657,17.25 14.69,17.296 15.475,16.896C16.087,16.584 16.584,16.087 16.896,15.475C17.296,14.69 17.25,13.657 17.25,11.6L17.25,8.4C17.25,6.343 17.296,5.31 16.896,4.525C16.584,3.913 16.087,3.416 15.475,3.104C14.69,2.704 13.657,2.75 11.6,2.75L8.4,2.75ZM6.5,8.5L5.5,8.5L5.5,7.5L6.5,7.5L6.5,8.5ZM14.5,10.5L13.5,10.5L13.5,9.5L14.5,9.5L14.5,10.5ZM14.5,6.5L13.5,6.5L13.5,5.5L14.5,5.5L14.5,6.5ZM14.5,8.5L13.5,8.5L13.5,7.5L14.5,7.5L14.5,8.5ZM6.5,10.5L5.5,10.5L5.5,9.5L6.5,9.5L6.5,10.5ZM6.5,4.5L5.5,4.5L5.5,3.5L6.5,3.5L6.5,4.5ZM6.5,6.5L5.5,6.5L5.5,5.5L6.5,5.5L6.5,6.5ZM6.5,14.5L5.5,14.5L5.5,13.5L6.5,13.5L6.5,14.5ZM6.5,12.5L5.5,12.5L5.5,11.5L6.5,11.5L6.5,12.5ZM14.5,16.5L13.5,16.5L13.5,15.5L14.5,15.5L14.5,16.5ZM6.5,16.5L5.5,16.5L5.5,15.5L6.5,15.5L6.5,16.5ZM14.5,4.5L13.5,4.5L13.5,3.5L14.5,3.5L14.5,4.5ZM14.5,12.5L13.5,12.5L13.5,11.5L14.5,11.5L14.5,12.5ZM14.5,14.5L13.5,14.5L13.5,13.5L14.5,13.5L14.5,14.5ZM10.5,14.5L9.5,14.5L9.5,13.5L10.5,13.5L10.5,14.5ZM10.5,6.5L9.5,6.5L9.5,5.5L10.5,5.5L10.5,6.5ZM10.5,16.5L9.5,16.5L9.5,15.5L10.5,15.5L10.5,16.5ZM10.5,4.5L9.5,4.5L9.5,3.5L10.5,3.5L10.5,4.5ZM10.5,8.5L9.5,8.5L9.5,7.5L10.5,7.5L10.5,8.5ZM10.5,10.5L9.5,10.5L9.5,9.5L10.5,9.5L10.5,10.5ZM10.5,12.5L9.5,12.5L9.5,11.5L10.5,11.5L10.5,12.5ZM6.5,20L5.5,20L5.5,19.5L6.5,19.5L6.5,20ZM6.5,0.5L5.5,0.5L5.5,0L6.5,0L6.5,0.5ZM14.5,20L13.5,20L13.5,19.5L14.5,19.5L14.5,20ZM14.5,0.5L13.5,0.5L13.5,0L14.5,0L14.5,0.5ZM10.5,20L9.5,20L9.5,19.5L10.5,19.5L10.5,20ZM10.5,0.5L9.5,0.5L9.5,0L10.5,0L10.5,0.5Z"/>'},{id:"icon-20_intersection",viewBox:"0 0 20 20",content:'<path fill="currentColor" d="M12.702,1.659C13.408,2.018 13.982,2.592 14.341,3.298C14.577,3.76 14.589,4.044 14.75,4.341C14.958,4.726 15.274,5.042 15.659,5.25C15.956,5.41 16.24,5.423 16.702,5.659C17.408,6.018 17.982,6.592 18.341,7.298C18.704,8.009 18.75,8.936 18.75,10.8L18.75,13.2C18.75,15.064 18.704,15.991 18.341,16.702C17.982,17.408 17.408,17.982 16.702,18.341C15.991,18.704 15.064,18.75 13.2,18.75L10.8,18.75C8.936,18.75 8.009,18.704 7.298,18.341C6.592,17.982 6.018,17.408 5.659,16.702C5.423,16.24 5.411,15.956 5.25,15.659C5.042,15.274 4.726,14.958 4.341,14.75C4.044,14.589 3.76,14.577 3.298,14.341C2.592,13.982 2.018,13.408 1.659,12.702C1.296,11.991 1.25,11.064 1.25,9.2L1.25,6.8C1.25,4.936 1.296,4.009 1.659,3.298C2.018,2.592 2.592,2.018 3.298,1.659C4.009,1.296 4.936,1.25 6.8,1.25L9.2,1.25C11.064,1.25 11.991,1.296 12.702,1.659ZM13.715,5.502C13.61,5.36 13.515,5.211 13.431,5.055C13.265,4.748 13.248,4.456 13.005,3.979C12.789,3.555 12.445,3.211 12.021,2.995C11.45,2.704 10.697,2.75 9.2,2.75L6.8,2.75C5.303,2.75 4.55,2.704 3.979,2.995C3.555,3.211 3.211,3.555 2.995,3.979C2.704,4.55 2.75,5.303 2.75,6.8L2.75,9.2C2.75,10.697 2.704,11.45 2.995,12.021C3.211,12.445 3.555,12.789 3.979,13.005C4.456,13.248 4.748,13.265 5.055,13.431C5.275,13.55 5.481,13.69 5.672,13.848C5.562,13.658 5.5,13.438 5.5,13.203L5.5,10.8C5.5,8.997 5.531,8.1 5.881,7.411C6.217,6.752 6.752,6.217 7.411,5.881C8.1,5.531 8.997,5.5 10.8,5.5L13.2,5.5L13.626,5.5C13.658,5.5 13.687,5.501 13.715,5.502ZM6.152,14.328C6.31,14.519 6.45,14.725 6.569,14.945C6.735,15.252 6.752,15.544 6.995,16.021C7.211,16.445 7.555,16.789 7.979,17.005C8.55,17.296 9.303,17.25 10.8,17.25L13.2,17.25C14.697,17.25 15.45,17.296 16.021,17.005C16.445,16.789 16.789,16.445 17.005,16.021C17.296,15.45 17.25,14.697 17.25,13.2L17.25,10.8C17.25,9.303 17.296,8.55 17.005,7.979C16.789,7.555 16.445,7.211 16.021,6.995C15.544,6.752 15.252,6.735 14.945,6.569C14.789,6.485 14.641,6.39 14.5,6.286L14.5,6.8L14.5,9.2C14.5,11.003 14.469,11.9 14.119,12.589C13.783,13.248 13.248,13.783 12.589,14.119C11.9,14.469 11.003,14.5 9.2,14.5L6.797,14.5C6.562,14.5 6.342,14.438 6.152,14.328ZM13.5,6.5L13.2,6.5L10.8,6.5C9.242,6.5 8.46,6.469 7.865,6.772C7.395,7.012 7.012,7.395 6.772,7.865C6.469,8.46 6.5,9.242 6.5,10.8L6.5,13.203C6.5,13.367 6.633,13.5 6.797,13.5L9.2,13.5C10.758,13.5 11.54,13.531 12.135,13.228C12.605,12.988 12.988,12.605 13.228,12.135C13.531,11.54 13.5,10.758 13.5,9.2L13.5,6.8L13.5,6.5ZM10,8C11.104,8 12,8.896 12,10C12,11.104 11.104,12 10,12C8.896,12 8,11.104 8,10C8,8.896 8.896,8 10,8Z"/>'},{id:"icon-20_progress",viewBox:"0 0 20 20",content:'<path fill="currentColor" d="M11.6,2.5L11.6,1.5L12.402,1.501L12.398,2.501L11.6,2.5ZM11.6,2.5L11.4,2.5L11.4,1.5L11.598,1.5L11.6,2.5ZM2.5,11.378L2.501,12.376L1.501,12.379L1.5,11.378L2.5,11.378ZM6.105,18.243C4.791,18.574 3.416,18.75 2,18.75L2,17.25C2.393,17.25 2.783,17.235 3.169,17.206L3.683,16.624C3.879,16.796 4.094,16.948 4.326,17.074C10.886,16.07 16.07,10.886 17.074,4.326C16.951,4.1 16.804,3.89 16.636,3.698L17.203,3.203C17.234,2.806 17.25,2.405 17.25,2L18.75,2C18.75,3.424 18.572,4.807 18.238,6.128L18.469,6.116C18.484,6.421 18.492,6.758 18.496,7.136L17.946,7.141C16.296,12.264 12.245,16.31 7.119,17.953L7.113,18.496C6.735,18.492 6.398,18.484 6.093,18.468L6.105,18.243ZM9.4,1.5L9.4,2.5L8.363,2.5L8.363,1.5L9.4,1.5ZM2.5,9.378L1.5,9.378L1.5,8.378L2.5,8.378L2.5,9.378ZM14.348,2.568L14.448,1.573C14.864,1.615 15.216,1.681 15.53,1.781L15.227,2.734C14.972,2.653 14.685,2.602 14.348,2.568ZM17.5,9.141L18.5,9.141L18.5,10.141L17.5,10.141L17.5,9.141ZM17.5,12.14L18.5,12.141C18.499,12.509 18.497,12.843 18.492,13.149L17.492,13.132C17.498,12.831 17.499,12.502 17.5,12.14ZM17.326,15.012L18.298,15.246C18.227,15.539 18.133,15.8 18.01,16.043C17.964,16.133 17.915,16.221 17.864,16.307L17.005,15.794C17.045,15.727 17.083,15.659 17.119,15.589C17.208,15.413 17.275,15.224 17.326,15.012ZM15.777,17.015L16.285,17.877C16.206,17.923 16.125,17.968 16.043,18.01C15.794,18.137 15.525,18.233 15.221,18.304L14.993,17.33C15.213,17.279 15.408,17.211 15.589,17.119C15.653,17.086 15.716,17.051 15.777,17.015ZM13.11,17.493L13.127,18.493C12.821,18.498 12.486,18.499 12.119,18.5L12.118,17.5C12.48,17.499 12.809,17.498 13.11,17.493ZM10.119,17.5L10.119,18.5L9.119,18.5L9.119,17.5L10.119,17.5ZM2.728,15.209L1.773,15.506C1.676,15.192 1.611,14.84 1.57,14.425L2.565,14.327C2.599,14.665 2.649,14.953 2.728,15.209ZM2.52,6.396L1.521,6.36C1.535,5.966 1.56,5.622 1.6,5.316L2.591,5.447C2.555,5.725 2.533,6.038 2.52,6.396ZM3.232,3.858L2.441,3.246C2.671,2.949 2.937,2.682 3.233,2.451L3.848,3.24C3.618,3.419 3.411,3.627 3.232,3.858ZM5.433,2.593L5.3,1.602C5.606,1.561 5.95,1.536 6.345,1.521L6.382,2.52C6.024,2.534 5.711,2.556 5.433,2.593Z"/>'},{id:"icon-20_ruler",viewBox:"0 0 20 20",content:'<path fill="currentColor" d="M6,17.75C4.915,17.75 4.376,17.718 3.948,17.541C3.343,17.29 2.847,16.832 2.55,16.248C2.296,15.75 2.25,15.104 2.25,13.8L2.25,6.2C2.25,4.896 2.296,4.25 2.55,3.752C2.813,3.234 3.234,2.813 3.752,2.55C4.25,2.296 4.896,2.25 6.2,2.25L13.8,2.25C15.104,2.25 15.75,2.296 16.248,2.55C16.832,2.847 17.29,3.343 17.541,3.948C17.718,4.376 17.75,4.915 17.75,6L17.75,6.4C17.75,7.144 17.704,7.51 17.559,7.794C17.391,8.124 17.124,8.391 16.794,8.559C16.51,8.704 16.144,8.75 15.4,8.75L10,8.75L10,7.25L12.5,7.25L12.5,6L13.5,6L13.5,7.25L15.4,7.25C15.61,7.25 15.777,7.25 15.916,7.244C16.002,7.24 16.064,7.248 16.113,7.223C16.161,7.199 16.199,7.161 16.223,7.113C16.248,7.064 16.244,6.916 16.244,6.916C16.244,6.916 16.25,5.61 16.25,5.4C16.25,5.4 16.243,4.735 16.155,4.522C16.041,4.247 15.833,4.021 15.567,3.886C15.21,3.704 14.737,3.75 13.8,3.75L6.2,3.75C5.263,3.75 4.79,3.704 4.433,3.886C4.197,4.006 4.006,4.197 3.886,4.433C3.704,4.79 3.75,5.263 3.75,6.2L3.75,13.8C3.75,14.737 3.704,15.21 3.886,15.567C4.021,15.833 4.247,16.041 4.522,16.155C4.829,16.282 5.221,16.25 6,16.25L6,17.75ZM6,17.75L6.006,16.25L6.399,16.25C6.609,16.25 6.777,16.25 6.916,16.244C7.002,16.24 7.064,16.248 7.113,16.223C7.161,16.199 7.199,16.161 7.223,16.113C7.248,16.064 7.24,16.002 7.244,15.916C7.25,15.777 7.25,15.61 7.25,15.4L7.25,13.5L6,13.5L6,12.5L7.25,12.5L7.25,8.5L6,8.5L6,7.5L7.25,7.5L7.25,6L8.75,6L8.75,15.4C8.75,16.144 8.704,16.51 8.559,16.794C8.391,17.124 8.124,17.391 7.794,17.559C7.51,17.704 7.144,17.75 6.4,17.75L6,17.75Z"/>'},{id:"icon-16_noplus",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M2.38,0.675L7.499,6.647L7.5,1L8.5,1L8.5,7.5L15,7.5L15,8.5L9.085,8.498L14.38,14.675L13.62,15.325L1.62,1.325L2.38,0.675ZM7.5,10.119L8.5,11.286L8.5,15L7.5,15L7.5,10.119ZM5.254,7.499L6.111,8.499L1,8.5L1,7.5L5.254,7.499Z" />'},{id:"icon-16_nooffset",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M12.067,11.976L14.38,14.675L13.62,15.325L1.62,1.325L2.38,0.675L5.23,4L10.8,4C11.92,4 12.48,4 12.908,4.218C13.284,4.41 13.59,4.716 13.782,5.092C14,5.52 14,6.08 14,7.2L14,8.8C14,9.92 14,10.48 13.782,10.908C13.59,11.284 13.284,11.59 12.908,11.782C12.684,11.896 12.424,11.95 12.067,11.976ZM2.681,4.497L9.111,11.999L5.2,12C4.08,12 3.52,12 3.092,11.782C2.716,11.59 2.41,11.284 2.218,10.908C2,10.48 2,9.92 2,8.8L2,7.2C2,6.08 2,5.52 2.218,5.092C2.334,4.865 2.491,4.663 2.681,4.497ZM12.646,0.646L13.354,1.354L11,3.707L8.646,1.354L9.354,0.646L11,2.293L12.646,0.646ZM7.354,14.646L6.646,15.354L5,13.707L3.354,15.354L2.646,14.646L5,12.293L7.354,14.646Z"/>'},{id:"icon-16_settings",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.208,1.177C8.363,1.209 8.524,1.303 8.846,1.489L13.216,4.011C13.538,4.197 13.699,4.291 13.805,4.408C13.899,4.512 13.97,4.635 14.013,4.768C14.062,4.919 14.062,5.105 14.062,5.477L14.062,10.523C14.062,10.895 14.062,11.081 14.013,11.232C13.97,11.365 13.899,11.488 13.805,11.592C13.699,11.709 13.538,11.803 13.216,11.989L8.846,14.511C8.524,14.697 8.363,14.791 8.208,14.823C8.071,14.853 7.929,14.853 7.792,14.823C7.637,14.791 7.476,14.697 7.154,14.511L2.784,11.989C2.462,11.803 2.301,11.709 2.195,11.592C2.101,11.488 2.03,11.365 1.987,11.232C1.938,11.081 1.938,10.895 1.938,10.523L1.938,5.477C1.938,5.105 1.938,4.919 1.987,4.768C2.03,4.635 2.101,4.512 2.195,4.408C2.301,4.291 2.462,4.197 2.784,4.011L7.154,1.489C7.476,1.303 7.637,1.209 7.792,1.177C7.929,1.147 8.071,1.147 8.208,1.177ZM8,5C6.343,5 5,6.343 5,8C5,9.657 6.343,11 8,11C9.657,11 11,9.657 11,8C11,6.343 9.657,5 8,5Z"/>'},{id:"icon-16_options",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M9,7L9,9L7,9L7,7L9,7ZM9,3L9,5L7,5L7,3L9,3ZM9,11L9,13L7,13L7,11L9,11Z"/>'},{id:"icon-16_grab",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M10,4L12,4L12,6L10,6L10,4ZM10,10L12,10L12,12L10,12L10,10ZM7,4L9,4L9,6L7,6L7,4ZM7,10L9,10L9,12L7,12L7,10ZM7,13L9,13L9,15L7,15L7,13ZM4,4L6,4L6,6L4,6L4,4ZM7,1L9,1L9,3L7,3L7,1ZM4,10L6,10L6,12L4,12L4,10Z"/>'},{id:"icon-16_eye",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8,3C10.692,3 13.2,4.46 15.526,7.381C15.815,7.744 15.815,8.256 15.526,8.619C13.2,11.54 10.692,13 8,13C5.308,13 2.8,11.54 0.474,8.619C0.185,8.256 0.185,7.744 0.474,7.381C2.8,4.46 5.308,3 8,3ZM8,5C6.343,5 5,6.343 5,8C5,9.657 6.343,11 8,11C9.657,11 11,9.657 11,8C11,6.343 9.657,5 8,5Z"/>'},{id:"icon-16_offset",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M5.2,4L10.8,4C11.92,4 12.48,4 12.908,4.218C13.284,4.41 13.59,4.716 13.782,5.092C14,5.52 14,6.08 14,7.2L14,8.8C14,9.92 14,10.48 13.782,10.908C13.59,11.284 13.284,11.59 12.908,11.782C12.48,12 11.92,12 10.8,12L5.2,12C4.08,12 3.52,12 3.092,11.782C2.716,11.59 2.41,11.284 2.218,10.908C2,10.48 2,9.92 2,8.8L2,7.2C2,6.08 2,5.52 2.218,5.092C2.41,4.716 2.716,4.41 3.092,4.218C3.52,4 4.08,4 5.2,4ZM12.646,0.646L13.354,1.354L11,3.707L8.646,1.354L9.354,0.646L11,2.293L12.646,0.646ZM7.354,14.646L6.646,15.354L5,13.707L3.354,15.354L2.646,14.646L5,12.293L7.354,14.646Z"/>'},{id:"icon-16_play-l",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M11.293,3.281C11.769,2.923 12.007,2.745 12.266,2.75C12.491,2.755 12.702,2.86 12.841,3.038C13,3.241 13,3.539 13,4.134L13,11.866C13,12.461 13,12.759 12.841,12.962C12.702,13.14 12.491,13.245 12.266,13.25C12.007,13.255 11.769,13.077 11.293,12.719L6.225,8.919C5.827,8.621 5.629,8.471 5.551,8.272C5.483,8.097 5.483,7.903 5.551,7.728C5.629,7.529 5.827,7.379 6.225,7.081L11.293,3.281ZM2.8,3L4.2,3C4.48,3 4.62,3 4.727,3.054C4.821,3.102 4.898,3.179 4.946,3.273C5,3.38 5,3.52 5,3.8L5,12.2C5,12.48 5,12.62 4.946,12.727C4.898,12.821 4.821,12.898 4.727,12.946C4.62,13 4.48,13 4.2,13L2.8,13C2.52,13 2.38,13 2.273,12.946C2.179,12.898 2.102,12.821 2.054,12.727C2,12.62 2,12.48 2,12.2L2,3.8C2,3.52 2,3.38 2.054,3.273C2.102,3.179 2.179,3.102 2.273,3.054C2.38,3 2.52,3 2.8,3Z"/>'},{id:"icon-16_play-r",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M4.707,3.281L9.775,7.081C10.173,7.379 10.371,7.529 10.449,7.728C10.517,7.903 10.517,8.097 10.449,8.272C10.371,8.471 10.173,8.621 9.775,8.919L4.707,12.719C4.231,13.077 3.993,13.255 3.734,13.25C3.509,13.245 3.298,13.14 3.159,12.962C3,12.759 3,12.461 3,11.866L3,4.134C3,3.539 3,3.241 3.159,3.038C3.298,2.86 3.509,2.755 3.734,2.75C3.993,2.745 4.231,2.923 4.707,3.281ZM11.8,3L13.2,3C13.48,3 13.62,3 13.727,3.054C13.821,3.102 13.898,3.179 13.946,3.273C14,3.38 14,3.52 14,3.8L14,12.2C14,12.48 14,12.62 13.946,12.727C13.898,12.821 13.821,12.898 13.727,12.946C13.62,13 13.48,13 13.2,13L11.8,13C11.52,13 11.38,13 11.273,12.946C11.179,12.898 11.102,12.821 11.054,12.727C11,12.62 11,12.48 11,12.2L11,3.8C11,3.52 11,3.38 11.054,3.273C11.102,3.179 11.179,3.102 11.273,3.054C11.38,3 11.52,3 11.8,3Z"/>'},{id:"icon-16_plus",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M7.5,8.5L1,8.5L1,7.5L7.5,7.5L7.5,1L8.5,1L8.5,7.5L15,7.5L15,8.5L8.5,8.5L8.5,15L7.5,15L7.5,8.5Z"/>'},{id:"icon-16_minus",viewBox:"0 0 16 16",content:'<rect x="3" y="7.5" width="10" height="1"/>'},{id:"icon-16_close",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M7.293,8L1.646,2.354L2.354,1.646L8,7.293L13.646,1.646L14.354,2.354L8.707,8L14.354,13.646L13.646,14.354L8,8.707L2.354,14.354L1.646,13.646L7.293,8Z"/>'},{id:"icon-16_layout-columns",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M7,3L9,3L9,13L7,13L7,3ZM3,3L5,3L5,13L3,13L3,3ZM11,3L13,3L13,13L11,13L11,3Z"/>'},{id:"icon-16_layout-rows",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M13,3L13,5L3,5L3,3L13,3ZM13,7L13,9L3,9L3,7L13,7ZM13,11L13,13L3,13L3,11L13,11Z"/>'},{id:"icon-16_layout-center",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M12.673,11.362C12.385,11.926 11.926,12.385 11.362,12.673C10.76,12.98 9.983,12.999 8.501,13L8.5,8.5L13,8.501C12.999,9.983 12.98,10.76 12.673,11.362ZM3,8.501L7.5,8.5L7.5,13C6.017,12.999 5.24,12.98 4.638,12.673C4.074,12.385 3.615,11.926 3.327,11.362C3.02,10.76 3.001,9.983 3,8.501ZM11.362,3.327C11.926,3.615 12.385,4.074 12.673,4.638C12.98,5.24 12.999,6.017 13,7.5L8.5,7.5L8.501,3C9.983,3.001 10.76,3.02 11.362,3.327ZM7.5,3L7.5,7.5L3,7.5C3.001,6.017 3.02,5.24 3.327,4.638C3.615,4.074 4.074,3.615 4.638,3.327C5.24,3.02 6.017,3.001 7.5,3Z"/>'},{id:"icon-16_layout-golden",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.488,3L8.5,3L8.501,13C8.404,13 8.304,13 8.2,13L7.8,13C6.12,13 5.28,13 4.638,12.673C4.074,12.385 3.615,11.926 3.327,11.362C3,10.72 3,9.88 3,8.2L3,7.8C3,6.12 3,5.28 3.327,4.638C3.615,4.074 4.074,3.615 4.638,3.327C5.28,3 6.12,3 7.8,3L8.2,3L8.488,3ZM12.673,11.362C12.385,11.926 11.926,12.385 11.362,12.673C10.913,12.902 10.366,12.971 9.501,12.991L9.5,9.5L12.991,9.501C12.971,10.366 12.902,10.913 12.673,11.362ZM11.362,3.327C11.926,3.615 12.385,4.074 12.673,4.638C13,5.28 13,6.12 13,7.8L13,8.2C13,8.304 13,8.404 13,8.501L9.5,8.5L9.501,3.009C10.366,3.029 10.913,3.098 11.362,3.327Z"/>'},{id:"icon-16_layout-thirds",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M6.5,10.5L9.5,10.5L9.501,12.991C9.131,13 8.703,13 8.2,13L7.8,13C7.297,13 6.869,13 6.5,12.991L6.5,10.5ZM3.077,10.502L5.5,10.5L5.499,12.923C5.159,12.876 4.884,12.798 4.638,12.673C4.074,12.385 3.615,11.926 3.327,11.362C3.202,11.116 3.125,10.841 3.077,10.502ZM12.673,11.362C12.385,11.926 11.926,12.385 11.362,12.673C11.116,12.798 10.841,12.875 10.502,12.923L10.5,10.5L12.923,10.502C12.875,10.841 12.798,11.116 12.673,11.362ZM13,7.8L13,8.2C13,8.703 13,9.131 12.991,9.501L10.5,9.5L10.5,6.5L12.991,6.5C13,6.869 13,7.297 13,7.8ZM3.009,6.5L5.5,6.5L5.5,9.5L3.009,9.501C3,9.131 3,8.703 3,8.2L3,7.8C3,7.297 3,6.869 3.009,6.5ZM6.5,6.5L9.5,6.5L9.5,9.5L6.5,9.5L6.5,6.5ZM11.362,3.327C11.926,3.615 12.385,4.074 12.673,4.638C12.798,4.884 12.876,5.159 12.923,5.499L10.5,5.5L10.502,3.077C10.841,3.125 11.116,3.202 11.362,3.327ZM5.499,3.077L5.5,5.5L3.077,5.499C3.124,5.159 3.202,4.884 3.327,4.638C3.615,4.074 4.074,3.615 4.638,3.327C4.884,3.202 5.159,3.124 5.499,3.077ZM9.501,3.009L9.5,5.5L6.5,5.5L6.5,3.009C6.869,3 7.297,3 7.8,3L8.2,3C8.703,3 9.131,3 9.501,3.009Z"/>'},{id:"icon-16_layout-dots",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M11,3L13,3L13,5L11,5L11,3ZM11,7L13,7L13,9L11,9L11,7ZM11,11L13,11L13,13L11,13L11,11ZM7,3L9,3L9,5L7,5L7,3ZM7,7L9,7L9,9L7,9L7,7ZM7,11L9,11L9,13L7,13L7,11ZM3,3L5,3L5,5L3,5L3,3ZM3,7L5,7L5,9L3,9L3,7ZM3,11L5,11L5,13L3,13L3,11Z"/>'},{id:"icon-16_export",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.5,5C9.983,5.001 10.76,5.02 11.362,5.327C12.12,5.713 12.678,6.402 12.898,7.224C13,7.605 13,8.07 13,9C13,9.93 13,10.395 12.898,10.776C12.678,11.598 12.12,12.287 11.362,12.673C10.72,13 9.88,13 8.2,13L7.8,13C6.12,13 5.28,13 4.638,12.673C3.88,12.287 3.322,11.598 3.102,10.776C3,10.395 3,9.93 3,9C3,8.07 3,7.605 3.102,7.224C3.322,6.402 3.88,5.713 4.638,5.327C5.24,5.02 6.017,5.001 7.5,5L7.5,10L8.5,10L8.5,5ZM7.5,5L7.5,3.207L6.354,4.354L5.646,3.646L8,1.293L10.354,3.646L9.646,4.354L8.5,3.207L8.5,5L7.5,5Z"/>'},{id:"icon-16_import",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.5,5C9.983,5.001 10.76,5.02 11.362,5.327C12.12,5.713 12.678,6.402 12.898,7.224C13,7.605 13,8.07 13,9C13,9.93 13,10.395 12.898,10.776C12.678,11.598 12.12,12.287 11.362,12.673C10.72,13 9.88,13 8.2,13L7.8,13C6.12,13 5.28,13 4.638,12.673C3.88,12.287 3.322,11.598 3.102,10.776C3,10.395 3,9.93 3,9C3,8.07 3,7.605 3.102,7.224C3.322,6.402 3.88,5.713 4.638,5.327C5.24,5.02 6.017,5.001 7.5,5L7.5,8.793L6.354,7.646L5.646,8.354L8,10.707L10.354,8.354L9.646,7.646L8.5,8.793L8.5,5ZM7.5,5L7.5,2L8.5,2L8.5,5L7.5,5Z"/>'},{id:"icon-16_break",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M10.475,11.182L11.182,10.475L14.01,13.303L13.303,14.01L10.475,11.182ZM11.437,9.197L11.634,8.217L15.169,8.924L14.973,9.905L11.437,9.197ZM8.217,11.634L9.197,11.437L9.905,14.973L8.924,15.169L8.217,11.634ZM5.525,4.818L4.818,5.525L1.99,2.697L2.697,1.99L5.525,4.818ZM7.783,4.366L6.803,4.563L6.095,1.027L7.076,0.831L7.783,4.366ZM4.563,6.803L4.366,7.783L0.831,7.076L1.027,6.095L4.563,6.803Z"/>'},{id:"icon-16_offset-marker-down",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.5,3L7.5,3L7.5,10.793L5.354,8.646L4.646,9.354L8,12.707L11.354,9.354L10.646,8.646L8.5,10.793L8.5,3Z"/>'},{id:"icon-16_offset-marker-up",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M7.5,13L8.5,13L8.5,5.207L10.646,7.354L11.354,6.646L8,3.293L4.646,6.646L5.354,7.354L7.5,5.207L7.5,13Z"/>'},{id:"icon-12_chevrone-up",viewBox:"0 0 12 12",content:'<path fill="currentColor" d="M3.277,7.416L2.723,6.584L6,4.399L9.277,6.584L8.723,7.416L6,5.601L3.277,7.416Z"/>'},{id:"icon-12_chevrone-down",viewBox:"0 0 12 12",content:'<path fill="currentColor" d="M8.723,4.584L9.277,5.416L6,7.601L2.723,5.416L3.277,4.584L6,6.399L8.723,4.584Z"/>'},{id:"icon-12_arrow-up",viewBox:"0 0 12 12",content:'<path fill="currentColor" d="M5.5,3.934L3.277,5.416L2.723,4.584L6,2.399L9.277,4.584L8.723,5.416L6.5,3.934L6.5,10L5.5,10L5.5,3.934Z"/>'},{id:"icon-12_arrow-down",viewBox:"0 0 12 12",content:'<path fill="currentColor" d="M6.5,8.066L8.723,6.584L9.277,7.416L6,9.601L2.723,7.416L3.277,6.584L5.5,8.066L5.5,2L6.5,2L6.5,8.066Z"/>'}];var se=class d{static instance=null;spriteRoot=null;constructor(){for(let t of un)this.register(t)}static getInstance(){return this.instance||(this.instance=new d),this.instance}register(t){let e=this.ensureSprite();if(e.querySelector(`#${t.id}`))return;let r=document.createElementNS("http://www.w3.org/2000/svg","symbol");r.id=t.id,r.setAttribute("viewBox",t.viewBox),r.innerHTML=t.content,e.appendChild(r)}resolve(t,e,...r){let i=`icon-${t}_${e}`,n=r.map(s=>` data-stdg-icon-${s}`).join("");return`<svg data-stdg-icon-${t}${n}><use href="#${i}"></use></svg>`}ensureSprite(){if(this.spriteRoot)return this.spriteRoot;let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("data-string-devtools-icon-sprite",""),t.setAttribute("aria-hidden","true"),t.style.cssText="display:none;position:absolute;width:0;height:0;overflow:hidden",(document.body??document.documentElement).prepend(t),this.spriteRoot=t,t}};function V(d,t,...e){return se.getInstance().resolve(d,t,...e)}function Rt(d){let t=document.createElement("div");return t.setAttribute("data-stdg",""),t.setAttribute("data-stdg-badge",""),d&&t.setAttribute("data-target-id",d),t.setAttribute("data-visible","false"),t.setAttribute("data-string-devtools-theme",""),t}function oe(d){let t=document.createElement("div");if(t.setAttribute("data-stdg",""),t.setAttribute("data-stdg-panel",""),t.setAttribute("data-open","false"),d)for(let[e,r]of Object.entries(d))t.setAttribute(e,r);return t.addEventListener("pointerdown",e=>e.stopPropagation()),t}function ae(){let d=document.createElement("div");return d.setAttribute("data-stdg-panel-header",""),d}function le(d){let t=document.createElement("div");if(t.setAttribute("data-stdg-panel-content",""),d)for(let[e,r]of Object.entries(d))t.setAttribute(e,r);return t}function tt(d){let{icon:t,size:e=16,label:r,modifiers:i=[],attrs:n}=d,s=document.createElement("button");s.type="button",s.setAttribute("data-stdg-button",""),s.setAttribute(`data-stdg-button-icon-${e}`,"");for(let o of i)s.setAttribute(`data-stdg-button-${o}`,"");if(s.setAttribute("aria-label",r),s.setAttribute("title",r),s.innerHTML=V(e,t),n)for(let[o,a]of Object.entries(n))s.setAttribute(o,a);return s}function yi(d,t){let e=document.createElement("button");if(e.type="button",e.setAttribute("data-stdg-button",""),e.setAttribute("data-string-grid-list-delete",""),e.setAttribute("aria-label",d),e.setAttribute("title",d),e.innerHTML=V(16,"minus"),t)for(let[r,i]of Object.entries(t))e.setAttribute(r,i);return e}function Ht(d){let{icon:t,size:e=16,label:r,withLabel:i=!1,attrs:n}=d,s=document.createElement("button");if(s.type="button",s.setAttribute("data-stdg-button",""),s.setAttribute("data-stdg-button-toggle",""),s.setAttribute("data-stdg-panel-button",""),s.setAttribute(`data-stdg-panel-button-icon-${e}`,""),s.setAttribute("aria-label",r),s.setAttribute("title",r),s.innerHTML=i?`${V(e,t)}<span>${r}</span>`:V(e,t),n)for(let[o,a]of Object.entries(n))s.setAttribute(o,a);return s}var pn=`
|
|
27
|
+
`,document.head.appendChild(r)}this.displayElement=t}};function vi(l,t){let e=null;return function(...r){let i=this;e&&clearTimeout(e),e=setTimeout(()=>{l.apply(i,r),e=null},t)}}var pr=class{fps=0;isAnimationStarted=!1;fpsInterval=0;then=0;requestAnimationId=0;onVisibilityChangeBind;onFrameCallback=t=>{};animate=()=>{};constructor(){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 gr=class extends x{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 bi=(i=>(i.ACTIVE="-active",i.ENTERING="-entering",i.LEAVING="-leaving",i.DISABLED="-disabled",i))(bi||{}),cn={PROGRESS:"--sequence-progress",DIRECTION:"--sequence-direction"};var hr=class l extends x{activeStep=new Map;leavingStep=new Map;transitions=new Map;elementIndex=new Map;triggerElements=new Map;globalSettings=new Map;stateRegistered=new Set;lastEnteredStep=new Map;defaultDuration;initialized=!1;static ALL_STATES=Object.values(bi);constructor(t){super(t),this.htmlKey="sequence",this.defaultDuration=this.settings["sequence-duration"]??600,this.attributesToMap=[...this.attributesToMap,{key:"sequence",type:"string",fallback:""},{key:"sequence-trigger",type:"string",fallback:""},{key:"entering-easing",type:"string",fallback:""},{key:"leaving-easing",type:"string",fallback:""},{key:"entering-duration",type:"string",fallback:""},{key:"leaving-duration",type:"string",fallback:""},{key:"sequence-duration",type:"string",fallback:""},{key:"active-step",type:"string",fallback:""}]}onInit(){super.onInit(),this.events.on("sequence",this.onSequenceEvent.bind(this)),this.scanStandaloneTriggers()}scanStandaloneTriggers(){let t=document.querySelectorAll("[string-sequence-trigger]:not([string-inited])");for(let e of Array.from(t)){let r=e.getAttribute("string-sequence-trigger"),i=r?this.parseTriggerKey(r):null;i&&(this.triggerElements.set(e,i),e.addEventListener("click",this.onTriggerClick))}}parseGlobalSettingsFromObject(t){let e=i=>t.getProperty(i),r=e("sequence-duration");this.tryParseGlobalSetting(r,"enteringDuration"),this.tryParseGlobalSetting(r,"leavingDuration"),this.tryParseGlobalSetting(e("entering-duration"),"enteringDuration"),this.tryParseGlobalSetting(e("leaving-duration"),"leavingDuration"),this.tryParseGlobalSetting(e("entering-easing"),"enteringEasing"),this.tryParseGlobalSetting(e("leaving-easing"),"leavingEasing"),this.tryParseGlobalSetting(e("active-step"),"activeStep")}tryParseGlobalSetting(t,e){if(!t)return;let r=t.match(/^(.+)\[(.+)\]$/);if(!r)return;let[,i,n]=r,s=this.globalSettings.get(i)??{};this.globalSettings.set(i,s),s[e]=e==="enteringEasing"||e==="leavingEasing"?n:parseFloat(n),this.applyGlobalSettingsToExistingObjects(i)}applyGlobalSettingsToExistingObjects(t){let e=this.globalSettings.get(t);if(e){for(let[r,i]of this.elementIndex)if(this.parseSequenceKey(r)?.slider===t){e.enteringDuration!==void 0&&(i.enteringDuration=e.enteringDuration),e.leavingDuration!==void 0&&(i.leavingDuration=e.leavingDuration);for(let s of i.objects)this.resolveEasings(s,r)}}}initializeSliders(){let t=new Set;for(let e of this.elementIndex.keys()){let r=this.parseSequenceKey(e);r&&t.add(r.slider)}for(let e of t){if(this.activeStep.has(e))continue;let i=this.globalSettings.get(e)?.activeStep??0;this.elementIndex.has(`${e}[${i}]`)||(i=0),this.switchInstant(e,i,1)}}tryApplyPendingActiveStep(t){if(this.activeStep.has(t))return;let e=this.globalSettings.get(t)?.activeStep;e!==void 0&&this.elementIndex.has(`${t}[${e}]`)&&this.switchInstant(t,e,1)}canConnect(t){return t.keys.includes("sequence")||t.keys.includes("sequence-trigger")}onObjectConnected(t){super.onObjectConnected(t),this.parseGlobalSettingsFromObject(t);let e=t.getProperty("sequence"),r=t.getProperty("sequence-trigger");if(!e&&r){let i=this.parseTriggerKey(r);i&&typeof i.step=="number"&&(e=`${i.slider}[${i.step}]`,t.setProperty("sequence",e))}if(e){let i=this.parseSequenceKey(e);if(i){this.ensureStateEventRegistered(i.slider);let n=this.elementIndex.get(e);if(!n){let{enteringDuration:o,leavingDuration:a}=this.resolveDurations(t,e);n={objects:[],enteringDuration:o,leavingDuration:a},this.elementIndex.set(e,n)}n.objects.push(t),this.resolveEasings(t,e);let s=this.activeStep.get(i.slider);this.setState(t,s===i.step?"-active":"-disabled",s===i.step?1:0,1),this.tryApplyPendingActiveStep(i.slider)}}if(r){let i=this.parseTriggerKey(r);i&&(this.triggerElements.set(t.htmlElement,i),t.htmlElement.addEventListener("click",this.onTriggerClick))}}ensureStateEventRegistered(t){this.stateRegistered.has(t)||(this.stateRegistered.add(t),this.events.registerStateEvent?.(`sequence:active:${t}`))}parseTriggerKey(t){let e=t.match(/^(.+)\[(next|prev|\d+)(\|loop)?\]$/);if(!e)return null;let r=e[2]==="next"||e[2]==="prev"?e[2]:parseInt(e[2],10);return{slider:e[1],step:r,loop:e[3]==="|loop"}}getMaxStep(t){let e=-1;for(let r of this.elementIndex.keys()){let i=this.parseSequenceKey(r);i?.slider===t&&i.step>e&&(e=i.step)}return e}resolveDuration(t,e,r,i){let n=t.getProperty(i),s=t.getProperty("sequence-duration"),o=this.globalSettings.get(e)?.[r];if(n&&!n.includes("[")){let a=parseFloat(n);if(!isNaN(a))return a}if(s&&!s.includes("[")){let a=parseFloat(s);if(!isNaN(a))return a}return o??this.defaultDuration}resolveDurations(t,e){let r=this.parseSequenceKey(e)?.slider??"";return{enteringDuration:this.resolveDuration(t,r,"enteringDuration","entering-duration"),leavingDuration:this.resolveDuration(t,r,"leavingDuration","leaving-duration")}}resolveEasing(t,e,r,i){let n=t.getProperty(i);(!n||typeof n=="string"&&n.includes("["))&&(n=this.globalSettings.get(e)?.[r]??this.settings.easing??"ease-out"),typeof n=="string"&&t.setProperty(i,this.tools.easingFunction.process({easing:n}))}resolveEasings(t,e){let r=this.parseSequenceKey(e)?.slider;r&&(this.resolveEasing(t,r,"enteringEasing","entering-easing"),this.resolveEasing(t,r,"leavingEasing","leaving-easing"))}onObjectDisconnected(t){super.onObjectDisconnected(t);let e=t.getProperty("sequence");if(e){let r=this.elementIndex.get(e);if(r){let i=r.objects.indexOf(t);i!==-1&&r.objects.splice(i,1),r.objects.length||this.elementIndex.delete(e)}}this.triggerElements.has(t.htmlElement)&&(t.htmlElement.removeEventListener("click",this.onTriggerClick),this.triggerElements.delete(t.htmlElement))}parseSequenceKey(t){let e=t.match(/^(.+)\[(\d+)\]$/);return e?{slider:e[1],step:parseInt(e[2],10)}:null}onTriggerClick=t=>{let e=this.triggerElements.get(t.currentTarget);if(!e)return;let r=this.activeStep.get(e.slider)??0,i=this.getMaxStep(e.slider),n,s;if(e.step==="next"){if(n=r+1,s=1,!this.elementIndex.has(`${e.slider}[${n}]`))if(e.loop&&i>=0)n=0;else return}else if(e.step==="prev"){if(n=r-1,s=-1,n<0)if(e.loop&&i>=0)n=i;else return;if(!this.elementIndex.has(`${e.slider}[${n}]`))return}else{if(n=e.step,r===n)return;s=n>r?1:-1}this.startTransition(e.slider,n,s)};onSequenceEvent(t){let{slider:e,step:r,transitionProgress:i,direction:n=1,duration:s,instant:o}=t;this.activeStep.get(e)===r&&i===void 0||(i!==void 0?this.handleScrub(e,r,i,n):o?this.switchInstant(e,r,n):this.startTransition(e,r,n,s))}startTransition(t,e,r,i){let n=this.activeStep.get(t),s=this.leavingStep.get(t);this.ensureStateEventRegistered(t),s!==void 0&&s!==n&&this.setStepState(t,s,"-disabled",0,r);let o=this.elementIndex.get(`${t}[${e}]`),a=n!==void 0?this.elementIndex.get(`${t}[${n}]`):null;n!==void 0&&this.leavingStep.set(t,n),this.activeStep.set(t,e),this.emitActiveState(t,e);let d={fromStep:n??e,toStep:e,direction:r,startTime:this.data.time.now,enteringDuration:i??o?.enteringDuration??this.defaultDuration,leavingDuration:i??a?.leavingDuration??this.defaultDuration};this.transitions.set(t,d),this.emitTransitionStart(t,d)}handleScrub(t,e,r,i){this.transitions.delete(t);let n=this.activeStep.get(t);if(n!==e){let o=this.leavingStep.get(t);o!==void 0&&this.setStepState(t,o,"-disabled",0,i),n!==void 0&&this.leavingStep.set(t,n),this.activeStep.set(t,e),this.emitActiveState(t,e)}let s=this.leavingStep.get(t)??n??e;this.applyProgress(t,s,e,r,r,i)}switchInstant(t,e,r){this.transitions.delete(t);let i=this.activeStep.get(t),n=this.leavingStep.get(t);n!==void 0&&this.setStepState(t,n,"-disabled",0,r),i!==void 0&&i!==e&&this.setStepState(t,i,"-disabled",0,r),this.activeStep.set(t,e),this.leavingStep.delete(t),this.setStepState(t,e,"-active",1,r),this.emitActiveState(t,e),n!==void 0&&n!==e?this.emitStepLeave(t,n,r,!0):i!==void 0&&i!==e&&this.emitStepLeave(t,i,r,!0),this.emitStepEnter(t,e,r,!0);let s={fromStep:i??e,toStep:e,direction:r,startTime:this.data.time.now,enteringDuration:0,leavingDuration:0};this.emitTransitionStart(t,s),this.emitTransitionEnd(t,e,i??e,r,!0)}applyProgress(t,e,r,i,n,s){let o=this.activeStep.get(t),a=this.leavingStep.get(t);this.setStepState(t,o,i>=1?"-active":"-entering",i,s),a!==void 0&&a!==o&&(n>=1?(this.setStepState(t,a,"-disabled",0,s),this.leavingStep.delete(t),this.emitStepLeave(t,a,s,!1)):this.setStepState(t,a,"-leaving",n,s)),this.emitTransitionProgress(t,e,r,i,n,s),i>=1&&this.emitStepEnter(t,o,s,!1)}setStepState(t,e,r,i,n){let s=this.elementIndex.get(`${t}[${e}]`);if(s)for(let o of s.objects)this.setState(o,r,i,n)}setState(t,e,r,i){let n=t.htmlElement,s=t.getProperty("_state"),o=t.getProperty("_direction"),a=t.getProperty(e==="-leaving"?"leaving-easing":"entering-easing"),d=typeof a=="function"?a(r):r;s!==e&&(n.classList.remove(...l.ALL_STATES),n.classList.add(e),t.setProperty("_state",e)),o!==i&&(t.setProperty("_direction",i),L.run(()=>L.setVars(n,{[cn.DIRECTION]:i.toString()})))}onFrame(t){super.onFrame(t),this.initialized||(this.initialized=!0,this.initializeSliders());for(let[e,r]of this.transitions){let i=t.time.now-r.startTime,n=Math.min(1,i/r.enteringDuration),s=Math.min(1,i/r.leavingDuration);this.applyProgress(e,r.fromStep,r.toStep,n,s,r.direction),n>=1&&s>=1&&(this.emitTransitionEnd(e,r.toStep,r.fromStep,r.direction,!1),this.transitions.delete(e))}}emitTransitionStart(t,e){let r={slider:t,from:e.fromStep,to:e.toStep,direction:e.direction,enteringDuration:e.enteringDuration,leavingDuration:e.leavingDuration,startedAt:e.startTime};this.events.emit("sequence:transition:start",r),this.events.emit(`sequence:transition:start:${t}`,r)}emitTransitionProgress(t,e,r,i,n,s){let o={slider:t,from:e,to:r,entering:i,leaving:n,direction:s};this.events.emit("sequence:transition:progress",o),this.events.emit(`sequence:transition:progress:${t}`,o)}emitTransitionEnd(t,e,r,i,n){let s={slider:t,from:r,to:e,direction:i,instant:n};this.events.emit("sequence:transition:end",s),this.events.emit(`sequence:transition:end:${t}`,s)}emitStepEnter(t,e,r,i){if(!i&&this.lastEnteredStep.get(t)===e)return;this.lastEnteredStep.set(t,e);let n={slider:t,step:e,direction:r,instant:i};this.events.emit("sequence:step:enter",n),this.events.emit(`sequence:step:enter:${t}`,n)}emitStepLeave(t,e,r,i){if(e==null)return;let n={slider:t,step:e,direction:r,instant:i};this.events.emit("sequence:step:leave",n),this.events.emit(`sequence:step:leave:${t}`,n)}emitActiveState(t,e){let r={slider:t,step:e};this.events.emit("sequence:active",r),this.events.emit(`sequence:active:${t}`,r)}};var mr=class l extends x{constructor(t){super(t),this.htmlKey="form"}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i);let n=e.getProperty("form-events")??[];n.forEach(c=>{c.eventElement.removeEventListener(c.eventType,c.eventCallback)}),n.length=0,e.setProperty("form-events",n),super.onObjectConnected(e);let s=e.htmlElement,o=[],a={};this.getInteractiveFields(s).forEach((c,u)=>this.registerField(c,s,o,a,n,u));let d=c=>{c.preventDefault();let u=!0,p={},g=new Set;for(let m of o){let h=m.field;if(!h.isConnected||!this.shouldValidateField(h))continue;if(this.isRadioField(h)){if(g.has(m.key))continue;g.add(m.key)}let{key:f,rules:b,needsContext:y}=m,v=this.getFieldValue(h);p[f]=v,a[f]=v;let{valid:S,errors:E}=this.tools.validation.process({rules:b,value:v,context:this.buildContext(y,f,a)});this.applyValidationState(s,h,f,S,E,"submit"),S||(u=!1)}if(u)this.events.emit(`form:submit:${e.id}`,p);else{let m=new Set,h=o.find(f=>{let b=f.field;if(!b.isConnected||!this.shouldValidateField(b))return!1;if(this.isRadioField(b)){if(m.has(f.key))return!1;m.add(f.key)}let{key:y,rules:v,needsContext:S}=f,E=this.getFieldValue(b);a[y]=E;let{valid:M}=this.tools.validation.process({rules:v,value:E,context:this.buildContext(S,y,a)});return!M});h?.field&&typeof h.field.focus=="function"&&h.field.focus(),this.events.emit(`form:invalid:${e.id}`)}};s.addEventListener("submit",d),n.push({eventElement:s,eventType:"submit",eventCallback:d}),e.setProperty("form-field-entries",o),e.setProperty("form-field-values",a)}onObjectConnected(t){}onDOMMutate(t,e){this.objects.length!==0&&(t.length>0&&this.handleMutationAdditions(t),e.length>0&&this.handleMutationRemovals(e))}applyValidationState(t,e,r,i,n,s){let o=t.querySelector(`[string-input="error[${r}]"]`),a=t.querySelector(`[string-input="group[${r}]"]`);o&&(o.innerHTML="",n.forEach(c=>{let u=document.createElement("span");u.textContent=c,o.appendChild(u)})),s==="live"?(e.classList.toggle("-invalid",!i),e.classList.remove("-error")):(e.classList.remove("-invalid"),e.classList.toggle("-error",!i)),e.classList.toggle("-valid",i),a&&(s==="live"?(a.classList.toggle("-invalid",!i),a.classList.remove("-error")):(a.classList.remove("-invalid"),a.classList.toggle("-error",!i)),a.classList.toggle("-valid",i));let d=i?"valid":s==="live"?"invalid":"error";this.events.emit(`form:field:${d}:${r}`,{key:r,field:e,errors:n,phase:s,valid:i})}getInteractiveFields(t){return Array.from(t.querySelectorAll("[string-input]")).filter(e=>!this.isServiceFieldAttribute(e.getAttribute("string-input")||"")).filter(e=>this.isFormFieldElement(e)).map(e=>e)}getFieldRules(t){let e=this.tools.domAttribute.process({element:t,key:"input"})??"";return this.tools.ruleParser.process({value:e})}registerField(t,e,r,i,n,s){if(!this.isFormFieldElement(t)||t.closest("form")!==e||r.some(h=>h.field===t))return;let o=this.registerFieldIndex(t,s??r.length),a=this.getInputKey(t,o),d=this.getFieldRules(t),c=this.supportsBeforeInputValidation(d),u=this.requiresContext(d),p=this.getInputEventType(t),g={field:t,key:a,rules:d,supportsRealtime:c,needsContext:u,inputEventType:p,inputHandler:()=>{}},m=h=>{let f=h.currentTarget||h.target;if(!f||!f.isConnected||!this.shouldValidateField(f))return;let b=this.getFieldValue(f);i[g.key]=b;let y=this.buildContext(g.needsContext,g.key,i),{valid:v,errors:S}=this.tools.validation.process({rules:g.rules,value:b,context:y});this.applyValidationState(e,f,g.key,v,S,"live")};if(g.inputHandler=m,t.addEventListener(p,m),n.push({eventElement:t,eventType:p,eventCallback:m}),c&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){let h=f=>{let b=f;if(b.isComposing||b.inputType?.startsWith("insertComposition"))return;let y=f.currentTarget||f.target;if(!y||!(y instanceof HTMLInputElement||y instanceof HTMLTextAreaElement)||!y.isConnected)return;let v=y.selectionStart??0,S=y.selectionEnd??0,E=y.value;switch(b.inputType){case"deleteContentBackward":E=v===S&&v>0?y.value.slice(0,v-1)+y.value.slice(S):y.value.slice(0,v)+y.value.slice(S);break;case"deleteContentForward":E=v===S&&v<y.value.length?y.value.slice(0,v)+y.value.slice(v+1):y.value.slice(0,v)+y.value.slice(S);break;case"insertFromPaste":case"insertFromDrop":case"insertReplacementText":E=y.value.slice(0,v)+(b.data||"")+y.value.slice(S);break;default:typeof b.data=="string"&&(E=y.value.slice(0,v)+b.data+y.value.slice(S))}let{errors:M}=this.tools.validation.process({rules:g.rules,value:E,type:"beforeinput",context:this.buildContext(g.needsContext,g.key,i,{applied:!0,value:E})});M.length>0&&f.cancelable&&f.preventDefault()};g.beforeInputHandler=h,t.addEventListener("beforeinput",h),n.push({eventElement:t,eventType:"beforeinput",eventCallback:h})}t.classList.add("-inited"),r.push(g),i[a]=this.getFieldValue(t)}unregisterField(t,e,r,i){let n=e.findIndex(o=>o.field===t);if(n===-1)return;let s=e[n];s.inputHandler&&t.removeEventListener(s.inputEventType,s.inputHandler),s.beforeInputHandler&&t.removeEventListener("beforeinput",s.beforeInputHandler),delete r[s.key],e.splice(n,1);for(let o=i.length-1;o>=0;o--){let a=i[o];a.eventElement===t&&(a.eventCallback===s.inputHandler||s.beforeInputHandler&&a.eventCallback===s.beforeInputHandler)&&i.splice(o,1)}t.classList.remove("-inited")}collectInteractiveFieldsFromNode(t){let e=[];return t instanceof Element?(t.hasAttribute("string-input")&&e.push(t),e.push(...Array.from(t.querySelectorAll("[string-input]")))):t instanceof DocumentFragment&&e.push(...Array.from(t.querySelectorAll("[string-input]"))),e.filter(r=>!this.isServiceFieldAttribute(r.getAttribute("string-input")||"")).filter(r=>this.isFormFieldElement(r))}isRadioField(t){return t instanceof HTMLInputElement&&t.type==="radio"}handleMutationAdditions(t){t.forEach(e=>{this.collectInteractiveFieldsFromNode(e).forEach(i=>{let n=this.getFormStateByContainment(i);n&&this.registerField(i,n.form,n.entries,n.values,n.events)})})}handleMutationRemovals(t){t.forEach(e=>{this.collectInteractiveFieldsFromNode(e).forEach(i=>{let n=this.getFormStateByReference(i);n&&this.unregisterField(i,n.entries,n.values,n.events)})})}getFormStateByContainment(t){let e=this.objects.find(r=>r.htmlElement instanceof HTMLFormElement&&r.htmlElement.contains(t));return e?this.buildFormState(e):null}getFormStateByReference(t){for(let e of this.objects){let r=e.getProperty("form-field-entries");if(r&&r.some(i=>i.field===t))return this.buildFormState(e,r)}return null}buildFormState(t,e){let r=t.htmlElement;if(!(r instanceof HTMLFormElement))return null;let i=e??t.getProperty("form-field-entries"),n=t.getProperty("form-field-values"),s=t.getProperty("form-events");return!i||!n||!s?null:{object:t,form:r,entries:i,values:n,events:s}}registerFieldIndex(t,e){let r=t.getAttribute("data-string-form-index");return r!==null?Number(r):(t.setAttribute("data-string-form-index",String(e)),e)}getFieldIndex(t,e){let r=t.getAttribute("data-string-form-index");if(r!==null){let i=Number(r);return Number.isNaN(i)?e:i}return this.registerFieldIndex(t,e)}shouldValidateField(t){return!(t.disabled||t instanceof HTMLInputElement&&t.type==="hidden")}supportsBeforeInputValidation(t){return t.some(e=>l.beforeInputRuleKeys.has(e.key))}requiresContext(t){return t.some(e=>l.crossFieldRuleKeys.has(e.key))}buildContext(t,e,r,i){if(!t)return{fieldKey:e};let n=!!i?.applied,s=n?{...r,[e]:i.value}:r;return{fieldKey:e,values:s,getValue:o=>n&&o===e?i.value:s[o]}}static beforeInputRuleKeys=new Set(["number","integer","email","phone","letters","lettersSpaces","lettersNumbers","alpha","alpha_num","alpha_dash","digits","url","pattern"]);static crossFieldRuleKeys=new Set(["same","different","after","before"]);static serviceAttributePrefixes=["error","group"];getInputKey(t,e){return this.tools.domAttribute.process({element:t,key:"id"})||t.getAttribute("name")||t.getAttribute("id")||`input-${e}`}getFieldValue(t){if(t instanceof HTMLInputElement){if(t.type==="checkbox"){if(t.name){let e=t.form||t.closest("form"),r=e?Array.from(e.querySelectorAll(`input[type="checkbox"][name="${t.name}"]:checked`)):[t];return r.length>1?r.map(i=>i.value):r.length===1?r[0].value:""}return t.checked}if(t.type==="radio"){if(t.name){let r=(t.form||t.closest("form"))?.querySelector(`input[type="radio"][name="${t.name}"]:checked`);return r?r.value:""}return t.checked?t.value:""}return t.type==="file"&&t.files&&t.files.length>0?t.multiple?Array.from(t.files):t.files[0]:t.value}return t instanceof HTMLSelectElement?t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value:t instanceof HTMLTextAreaElement?t.value:""}isServiceFieldAttribute(t){return l.serviceAttributePrefixes.some(e=>t.startsWith(`${e}[`))}isFormFieldElement(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement}getInputEventType(t){return t instanceof HTMLSelectElement||t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio")?"change":"input"}};var fr=class{map=new WeakMap;all=new Set;attach(t){if(this.map.has(t))return;let e=t.htmlElement,r={cx:0,cy:0,valid:!1,el:e};r.ro=new ResizeObserver(()=>{r.valid=!1}),r.ro.observe(e),this.map.set(t,r),this.all.add(t)}detach(t){let e=this.map.get(t);e&&(e.ro?.disconnect(),this.map.delete(t),this.all.delete(t))}invalidate(t){this.all.forEach(e=>{if(e.id===t){let r=this.map.get(e);r&&(r.valid=!1)}})}invalidateAll(){this.all.forEach(t=>{let e=this.map.get(t);e&&(e.valid=!1)})}getCenter(t){let e=this.map.get(t);if(!e||!e.el)return{cx:0,cy:0};if(!e.valid){let r=e.el.getBoundingClientRect();e.cx=r.left+r.width/2,e.cy=r.top+r.height/2,e.valid=!0}return{cx:e.cx,cy:e.cy}}};var vr=class{active=new Set;subs=new WeakMap;track(t){if(this.subs.has(t))return;let e=t.htmlElement,r=()=>this.active.add(t),i=()=>this.active.delete(t);e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",i),this.subs.set(t,{enter:r,leave:i})}untrack(t){let e=this.subs.get(t);if(!e)return;let r=t.htmlElement;e.enter&&r.removeEventListener("pointerenter",e.enter),e.leave&&r.removeEventListener("pointerleave",e.leave),this.active.delete(t),this.subs.delete(t)}isActive(t){return this.active.has(t)}activeObjects(){return Array.from(this.active)}};var br=class{constructor(t){this.emit=t}values=new Map;publish(t,e,r){let i=this.getKey(t,e);this.values.set(i,r),this.emit(this.getEventName(t,e),r)}subscribe(t,e,r,i){r.on(this.getEventName(t,e),i)}unsubscribe(t,e,r,i){r.off(this.getEventName(t,e),i)}get(t,e){return this.values.get(this.getKey(t,e))}getEventName(t,e){return`signal:${t}:${e}`}getKey(t,e){return`${t}.${e}`}};var un=[{id:"icon-20_logo",viewBox:"0 0 20 20",content:'<path fill="currentColor" id="Combined-Shape" d="M9.443,4.529L13.911,10.273L19.885,15.217L18.865,16.45L12.823,11.45L12.702,11.324L8.181,5.511C7.834,5.066 7.161,5.065 6.814,5.51L1.297,12.564L0.036,11.578L5.553,4.524C6.543,3.259 8.458,3.261 9.443,4.529ZM14.407,2.737L16.907,6.07L16.427,6.43L13.927,3.097L14.407,2.737ZM16.907,1.487L19.407,4.82L18.927,5.18L16.427,1.847L16.907,1.487Z"/>'},{id:"icon-20_layout",viewBox:"0 0 20 20",content:'<path fill="currentColor" d="M8.4,1.25L11.6,1.25C14.024,1.25 15.231,1.296 16.156,1.768C17.05,2.223 17.777,2.95 18.232,3.844C18.704,4.769 18.75,5.976 18.75,8.4L18.75,11.6C18.75,14.024 18.704,15.231 18.232,16.156C17.777,17.05 17.05,17.777 16.156,18.232C15.231,18.704 14.024,18.75 11.6,18.75L8.4,18.75C5.976,18.75 4.769,18.704 3.844,18.232C2.95,17.777 2.223,17.05 1.768,16.156C1.296,15.231 1.25,14.024 1.25,11.6L1.25,8.4C1.25,5.976 1.296,4.769 1.768,3.844C2.223,2.95 2.95,2.223 3.844,1.768C4.769,1.296 5.976,1.25 8.4,1.25ZM8.4,2.75C6.343,2.75 5.31,2.704 4.525,3.104C3.913,3.416 3.416,3.913 3.104,4.525C2.704,5.31 2.75,6.343 2.75,8.4L2.75,11.6C2.75,13.657 2.704,14.69 3.104,15.475C3.416,16.087 3.913,16.584 4.525,16.896C5.31,17.296 6.343,17.25 8.4,17.25L11.6,17.25C13.657,17.25 14.69,17.296 15.475,16.896C16.087,16.584 16.584,16.087 16.896,15.475C17.296,14.69 17.25,13.657 17.25,11.6L17.25,8.4C17.25,6.343 17.296,5.31 16.896,4.525C16.584,3.913 16.087,3.416 15.475,3.104C14.69,2.704 13.657,2.75 11.6,2.75L8.4,2.75ZM6.5,8.5L5.5,8.5L5.5,7.5L6.5,7.5L6.5,8.5ZM14.5,10.5L13.5,10.5L13.5,9.5L14.5,9.5L14.5,10.5ZM14.5,6.5L13.5,6.5L13.5,5.5L14.5,5.5L14.5,6.5ZM14.5,8.5L13.5,8.5L13.5,7.5L14.5,7.5L14.5,8.5ZM6.5,10.5L5.5,10.5L5.5,9.5L6.5,9.5L6.5,10.5ZM6.5,4.5L5.5,4.5L5.5,3.5L6.5,3.5L6.5,4.5ZM6.5,6.5L5.5,6.5L5.5,5.5L6.5,5.5L6.5,6.5ZM6.5,14.5L5.5,14.5L5.5,13.5L6.5,13.5L6.5,14.5ZM6.5,12.5L5.5,12.5L5.5,11.5L6.5,11.5L6.5,12.5ZM14.5,16.5L13.5,16.5L13.5,15.5L14.5,15.5L14.5,16.5ZM6.5,16.5L5.5,16.5L5.5,15.5L6.5,15.5L6.5,16.5ZM14.5,4.5L13.5,4.5L13.5,3.5L14.5,3.5L14.5,4.5ZM14.5,12.5L13.5,12.5L13.5,11.5L14.5,11.5L14.5,12.5ZM14.5,14.5L13.5,14.5L13.5,13.5L14.5,13.5L14.5,14.5ZM10.5,14.5L9.5,14.5L9.5,13.5L10.5,13.5L10.5,14.5ZM10.5,6.5L9.5,6.5L9.5,5.5L10.5,5.5L10.5,6.5ZM10.5,16.5L9.5,16.5L9.5,15.5L10.5,15.5L10.5,16.5ZM10.5,4.5L9.5,4.5L9.5,3.5L10.5,3.5L10.5,4.5ZM10.5,8.5L9.5,8.5L9.5,7.5L10.5,7.5L10.5,8.5ZM10.5,10.5L9.5,10.5L9.5,9.5L10.5,9.5L10.5,10.5ZM10.5,12.5L9.5,12.5L9.5,11.5L10.5,11.5L10.5,12.5ZM6.5,20L5.5,20L5.5,19.5L6.5,19.5L6.5,20ZM6.5,0.5L5.5,0.5L5.5,0L6.5,0L6.5,0.5ZM14.5,20L13.5,20L13.5,19.5L14.5,19.5L14.5,20ZM14.5,0.5L13.5,0.5L13.5,0L14.5,0L14.5,0.5ZM10.5,20L9.5,20L9.5,19.5L10.5,19.5L10.5,20ZM10.5,0.5L9.5,0.5L9.5,0L10.5,0L10.5,0.5Z"/>'},{id:"icon-20_intersection",viewBox:"0 0 20 20",content:'<path fill="currentColor" d="M12.702,1.659C13.408,2.018 13.982,2.592 14.341,3.298C14.577,3.76 14.589,4.044 14.75,4.341C14.958,4.726 15.274,5.042 15.659,5.25C15.956,5.41 16.24,5.423 16.702,5.659C17.408,6.018 17.982,6.592 18.341,7.298C18.704,8.009 18.75,8.936 18.75,10.8L18.75,13.2C18.75,15.064 18.704,15.991 18.341,16.702C17.982,17.408 17.408,17.982 16.702,18.341C15.991,18.704 15.064,18.75 13.2,18.75L10.8,18.75C8.936,18.75 8.009,18.704 7.298,18.341C6.592,17.982 6.018,17.408 5.659,16.702C5.423,16.24 5.411,15.956 5.25,15.659C5.042,15.274 4.726,14.958 4.341,14.75C4.044,14.589 3.76,14.577 3.298,14.341C2.592,13.982 2.018,13.408 1.659,12.702C1.296,11.991 1.25,11.064 1.25,9.2L1.25,6.8C1.25,4.936 1.296,4.009 1.659,3.298C2.018,2.592 2.592,2.018 3.298,1.659C4.009,1.296 4.936,1.25 6.8,1.25L9.2,1.25C11.064,1.25 11.991,1.296 12.702,1.659ZM13.715,5.502C13.61,5.36 13.515,5.211 13.431,5.055C13.265,4.748 13.248,4.456 13.005,3.979C12.789,3.555 12.445,3.211 12.021,2.995C11.45,2.704 10.697,2.75 9.2,2.75L6.8,2.75C5.303,2.75 4.55,2.704 3.979,2.995C3.555,3.211 3.211,3.555 2.995,3.979C2.704,4.55 2.75,5.303 2.75,6.8L2.75,9.2C2.75,10.697 2.704,11.45 2.995,12.021C3.211,12.445 3.555,12.789 3.979,13.005C4.456,13.248 4.748,13.265 5.055,13.431C5.275,13.55 5.481,13.69 5.672,13.848C5.562,13.658 5.5,13.438 5.5,13.203L5.5,10.8C5.5,8.997 5.531,8.1 5.881,7.411C6.217,6.752 6.752,6.217 7.411,5.881C8.1,5.531 8.997,5.5 10.8,5.5L13.2,5.5L13.626,5.5C13.658,5.5 13.687,5.501 13.715,5.502ZM6.152,14.328C6.31,14.519 6.45,14.725 6.569,14.945C6.735,15.252 6.752,15.544 6.995,16.021C7.211,16.445 7.555,16.789 7.979,17.005C8.55,17.296 9.303,17.25 10.8,17.25L13.2,17.25C14.697,17.25 15.45,17.296 16.021,17.005C16.445,16.789 16.789,16.445 17.005,16.021C17.296,15.45 17.25,14.697 17.25,13.2L17.25,10.8C17.25,9.303 17.296,8.55 17.005,7.979C16.789,7.555 16.445,7.211 16.021,6.995C15.544,6.752 15.252,6.735 14.945,6.569C14.789,6.485 14.641,6.39 14.5,6.286L14.5,6.8L14.5,9.2C14.5,11.003 14.469,11.9 14.119,12.589C13.783,13.248 13.248,13.783 12.589,14.119C11.9,14.469 11.003,14.5 9.2,14.5L6.797,14.5C6.562,14.5 6.342,14.438 6.152,14.328ZM13.5,6.5L13.2,6.5L10.8,6.5C9.242,6.5 8.46,6.469 7.865,6.772C7.395,7.012 7.012,7.395 6.772,7.865C6.469,8.46 6.5,9.242 6.5,10.8L6.5,13.203C6.5,13.367 6.633,13.5 6.797,13.5L9.2,13.5C10.758,13.5 11.54,13.531 12.135,13.228C12.605,12.988 12.988,12.605 13.228,12.135C13.531,11.54 13.5,10.758 13.5,9.2L13.5,6.8L13.5,6.5ZM10,8C11.104,8 12,8.896 12,10C12,11.104 11.104,12 10,12C8.896,12 8,11.104 8,10C8,8.896 8.896,8 10,8Z"/>'},{id:"icon-20_progress",viewBox:"0 0 20 20",content:'<path fill="currentColor" d="M11.6,2.5L11.6,1.5L12.402,1.501L12.398,2.501L11.6,2.5ZM11.6,2.5L11.4,2.5L11.4,1.5L11.598,1.5L11.6,2.5ZM2.5,11.378L2.501,12.376L1.501,12.379L1.5,11.378L2.5,11.378ZM6.105,18.243C4.791,18.574 3.416,18.75 2,18.75L2,17.25C2.393,17.25 2.783,17.235 3.169,17.206L3.683,16.624C3.879,16.796 4.094,16.948 4.326,17.074C10.886,16.07 16.07,10.886 17.074,4.326C16.951,4.1 16.804,3.89 16.636,3.698L17.203,3.203C17.234,2.806 17.25,2.405 17.25,2L18.75,2C18.75,3.424 18.572,4.807 18.238,6.128L18.469,6.116C18.484,6.421 18.492,6.758 18.496,7.136L17.946,7.141C16.296,12.264 12.245,16.31 7.119,17.953L7.113,18.496C6.735,18.492 6.398,18.484 6.093,18.468L6.105,18.243ZM9.4,1.5L9.4,2.5L8.363,2.5L8.363,1.5L9.4,1.5ZM2.5,9.378L1.5,9.378L1.5,8.378L2.5,8.378L2.5,9.378ZM14.348,2.568L14.448,1.573C14.864,1.615 15.216,1.681 15.53,1.781L15.227,2.734C14.972,2.653 14.685,2.602 14.348,2.568ZM17.5,9.141L18.5,9.141L18.5,10.141L17.5,10.141L17.5,9.141ZM17.5,12.14L18.5,12.141C18.499,12.509 18.497,12.843 18.492,13.149L17.492,13.132C17.498,12.831 17.499,12.502 17.5,12.14ZM17.326,15.012L18.298,15.246C18.227,15.539 18.133,15.8 18.01,16.043C17.964,16.133 17.915,16.221 17.864,16.307L17.005,15.794C17.045,15.727 17.083,15.659 17.119,15.589C17.208,15.413 17.275,15.224 17.326,15.012ZM15.777,17.015L16.285,17.877C16.206,17.923 16.125,17.968 16.043,18.01C15.794,18.137 15.525,18.233 15.221,18.304L14.993,17.33C15.213,17.279 15.408,17.211 15.589,17.119C15.653,17.086 15.716,17.051 15.777,17.015ZM13.11,17.493L13.127,18.493C12.821,18.498 12.486,18.499 12.119,18.5L12.118,17.5C12.48,17.499 12.809,17.498 13.11,17.493ZM10.119,17.5L10.119,18.5L9.119,18.5L9.119,17.5L10.119,17.5ZM2.728,15.209L1.773,15.506C1.676,15.192 1.611,14.84 1.57,14.425L2.565,14.327C2.599,14.665 2.649,14.953 2.728,15.209ZM2.52,6.396L1.521,6.36C1.535,5.966 1.56,5.622 1.6,5.316L2.591,5.447C2.555,5.725 2.533,6.038 2.52,6.396ZM3.232,3.858L2.441,3.246C2.671,2.949 2.937,2.682 3.233,2.451L3.848,3.24C3.618,3.419 3.411,3.627 3.232,3.858ZM5.433,2.593L5.3,1.602C5.606,1.561 5.95,1.536 6.345,1.521L6.382,2.52C6.024,2.534 5.711,2.556 5.433,2.593Z"/>'},{id:"icon-20_ruler",viewBox:"0 0 20 20",content:'<path fill="currentColor" d="M6,17.75C4.915,17.75 4.376,17.718 3.948,17.541C3.343,17.29 2.847,16.832 2.55,16.248C2.296,15.75 2.25,15.104 2.25,13.8L2.25,6.2C2.25,4.896 2.296,4.25 2.55,3.752C2.813,3.234 3.234,2.813 3.752,2.55C4.25,2.296 4.896,2.25 6.2,2.25L13.8,2.25C15.104,2.25 15.75,2.296 16.248,2.55C16.832,2.847 17.29,3.343 17.541,3.948C17.718,4.376 17.75,4.915 17.75,6L17.75,6.4C17.75,7.144 17.704,7.51 17.559,7.794C17.391,8.124 17.124,8.391 16.794,8.559C16.51,8.704 16.144,8.75 15.4,8.75L10,8.75L10,7.25L12.5,7.25L12.5,6L13.5,6L13.5,7.25L15.4,7.25C15.61,7.25 15.777,7.25 15.916,7.244C16.002,7.24 16.064,7.248 16.113,7.223C16.161,7.199 16.199,7.161 16.223,7.113C16.248,7.064 16.244,6.916 16.244,6.916C16.244,6.916 16.25,5.61 16.25,5.4C16.25,5.4 16.243,4.735 16.155,4.522C16.041,4.247 15.833,4.021 15.567,3.886C15.21,3.704 14.737,3.75 13.8,3.75L6.2,3.75C5.263,3.75 4.79,3.704 4.433,3.886C4.197,4.006 4.006,4.197 3.886,4.433C3.704,4.79 3.75,5.263 3.75,6.2L3.75,13.8C3.75,14.737 3.704,15.21 3.886,15.567C4.021,15.833 4.247,16.041 4.522,16.155C4.829,16.282 5.221,16.25 6,16.25L6,17.75ZM6,17.75L6.006,16.25L6.399,16.25C6.609,16.25 6.777,16.25 6.916,16.244C7.002,16.24 7.064,16.248 7.113,16.223C7.161,16.199 7.199,16.161 7.223,16.113C7.248,16.064 7.24,16.002 7.244,15.916C7.25,15.777 7.25,15.61 7.25,15.4L7.25,13.5L6,13.5L6,12.5L7.25,12.5L7.25,8.5L6,8.5L6,7.5L7.25,7.5L7.25,6L8.75,6L8.75,15.4C8.75,16.144 8.704,16.51 8.559,16.794C8.391,17.124 8.124,17.391 7.794,17.559C7.51,17.704 7.144,17.75 6.4,17.75L6,17.75Z"/>'},{id:"icon-16_noplus",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M2.38,0.675L7.499,6.647L7.5,1L8.5,1L8.5,7.5L15,7.5L15,8.5L9.085,8.498L14.38,14.675L13.62,15.325L1.62,1.325L2.38,0.675ZM7.5,10.119L8.5,11.286L8.5,15L7.5,15L7.5,10.119ZM5.254,7.499L6.111,8.499L1,8.5L1,7.5L5.254,7.499Z" />'},{id:"icon-16_nooffset",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M12.067,11.976L14.38,14.675L13.62,15.325L1.62,1.325L2.38,0.675L5.23,4L10.8,4C11.92,4 12.48,4 12.908,4.218C13.284,4.41 13.59,4.716 13.782,5.092C14,5.52 14,6.08 14,7.2L14,8.8C14,9.92 14,10.48 13.782,10.908C13.59,11.284 13.284,11.59 12.908,11.782C12.684,11.896 12.424,11.95 12.067,11.976ZM2.681,4.497L9.111,11.999L5.2,12C4.08,12 3.52,12 3.092,11.782C2.716,11.59 2.41,11.284 2.218,10.908C2,10.48 2,9.92 2,8.8L2,7.2C2,6.08 2,5.52 2.218,5.092C2.334,4.865 2.491,4.663 2.681,4.497ZM12.646,0.646L13.354,1.354L11,3.707L8.646,1.354L9.354,0.646L11,2.293L12.646,0.646ZM7.354,14.646L6.646,15.354L5,13.707L3.354,15.354L2.646,14.646L5,12.293L7.354,14.646Z"/>'},{id:"icon-16_settings",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.208,1.177C8.363,1.209 8.524,1.303 8.846,1.489L13.216,4.011C13.538,4.197 13.699,4.291 13.805,4.408C13.899,4.512 13.97,4.635 14.013,4.768C14.062,4.919 14.062,5.105 14.062,5.477L14.062,10.523C14.062,10.895 14.062,11.081 14.013,11.232C13.97,11.365 13.899,11.488 13.805,11.592C13.699,11.709 13.538,11.803 13.216,11.989L8.846,14.511C8.524,14.697 8.363,14.791 8.208,14.823C8.071,14.853 7.929,14.853 7.792,14.823C7.637,14.791 7.476,14.697 7.154,14.511L2.784,11.989C2.462,11.803 2.301,11.709 2.195,11.592C2.101,11.488 2.03,11.365 1.987,11.232C1.938,11.081 1.938,10.895 1.938,10.523L1.938,5.477C1.938,5.105 1.938,4.919 1.987,4.768C2.03,4.635 2.101,4.512 2.195,4.408C2.301,4.291 2.462,4.197 2.784,4.011L7.154,1.489C7.476,1.303 7.637,1.209 7.792,1.177C7.929,1.147 8.071,1.147 8.208,1.177ZM8,5C6.343,5 5,6.343 5,8C5,9.657 6.343,11 8,11C9.657,11 11,9.657 11,8C11,6.343 9.657,5 8,5Z"/>'},{id:"icon-16_options",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M9,7L9,9L7,9L7,7L9,7ZM9,3L9,5L7,5L7,3L9,3ZM9,11L9,13L7,13L7,11L9,11Z"/>'},{id:"icon-16_grab",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M10,4L12,4L12,6L10,6L10,4ZM10,10L12,10L12,12L10,12L10,10ZM7,4L9,4L9,6L7,6L7,4ZM7,10L9,10L9,12L7,12L7,10ZM7,13L9,13L9,15L7,15L7,13ZM4,4L6,4L6,6L4,6L4,4ZM7,1L9,1L9,3L7,3L7,1ZM4,10L6,10L6,12L4,12L4,10Z"/>'},{id:"icon-16_eye",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8,3C10.692,3 13.2,4.46 15.526,7.381C15.815,7.744 15.815,8.256 15.526,8.619C13.2,11.54 10.692,13 8,13C5.308,13 2.8,11.54 0.474,8.619C0.185,8.256 0.185,7.744 0.474,7.381C2.8,4.46 5.308,3 8,3ZM8,5C6.343,5 5,6.343 5,8C5,9.657 6.343,11 8,11C9.657,11 11,9.657 11,8C11,6.343 9.657,5 8,5Z"/>'},{id:"icon-16_offset",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M5.2,4L10.8,4C11.92,4 12.48,4 12.908,4.218C13.284,4.41 13.59,4.716 13.782,5.092C14,5.52 14,6.08 14,7.2L14,8.8C14,9.92 14,10.48 13.782,10.908C13.59,11.284 13.284,11.59 12.908,11.782C12.48,12 11.92,12 10.8,12L5.2,12C4.08,12 3.52,12 3.092,11.782C2.716,11.59 2.41,11.284 2.218,10.908C2,10.48 2,9.92 2,8.8L2,7.2C2,6.08 2,5.52 2.218,5.092C2.41,4.716 2.716,4.41 3.092,4.218C3.52,4 4.08,4 5.2,4ZM12.646,0.646L13.354,1.354L11,3.707L8.646,1.354L9.354,0.646L11,2.293L12.646,0.646ZM7.354,14.646L6.646,15.354L5,13.707L3.354,15.354L2.646,14.646L5,12.293L7.354,14.646Z"/>'},{id:"icon-16_play-l",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M11.293,3.281C11.769,2.923 12.007,2.745 12.266,2.75C12.491,2.755 12.702,2.86 12.841,3.038C13,3.241 13,3.539 13,4.134L13,11.866C13,12.461 13,12.759 12.841,12.962C12.702,13.14 12.491,13.245 12.266,13.25C12.007,13.255 11.769,13.077 11.293,12.719L6.225,8.919C5.827,8.621 5.629,8.471 5.551,8.272C5.483,8.097 5.483,7.903 5.551,7.728C5.629,7.529 5.827,7.379 6.225,7.081L11.293,3.281ZM2.8,3L4.2,3C4.48,3 4.62,3 4.727,3.054C4.821,3.102 4.898,3.179 4.946,3.273C5,3.38 5,3.52 5,3.8L5,12.2C5,12.48 5,12.62 4.946,12.727C4.898,12.821 4.821,12.898 4.727,12.946C4.62,13 4.48,13 4.2,13L2.8,13C2.52,13 2.38,13 2.273,12.946C2.179,12.898 2.102,12.821 2.054,12.727C2,12.62 2,12.48 2,12.2L2,3.8C2,3.52 2,3.38 2.054,3.273C2.102,3.179 2.179,3.102 2.273,3.054C2.38,3 2.52,3 2.8,3Z"/>'},{id:"icon-16_play-r",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M4.707,3.281L9.775,7.081C10.173,7.379 10.371,7.529 10.449,7.728C10.517,7.903 10.517,8.097 10.449,8.272C10.371,8.471 10.173,8.621 9.775,8.919L4.707,12.719C4.231,13.077 3.993,13.255 3.734,13.25C3.509,13.245 3.298,13.14 3.159,12.962C3,12.759 3,12.461 3,11.866L3,4.134C3,3.539 3,3.241 3.159,3.038C3.298,2.86 3.509,2.755 3.734,2.75C3.993,2.745 4.231,2.923 4.707,3.281ZM11.8,3L13.2,3C13.48,3 13.62,3 13.727,3.054C13.821,3.102 13.898,3.179 13.946,3.273C14,3.38 14,3.52 14,3.8L14,12.2C14,12.48 14,12.62 13.946,12.727C13.898,12.821 13.821,12.898 13.727,12.946C13.62,13 13.48,13 13.2,13L11.8,13C11.52,13 11.38,13 11.273,12.946C11.179,12.898 11.102,12.821 11.054,12.727C11,12.62 11,12.48 11,12.2L11,3.8C11,3.52 11,3.38 11.054,3.273C11.102,3.179 11.179,3.102 11.273,3.054C11.38,3 11.52,3 11.8,3Z"/>'},{id:"icon-16_plus",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M7.5,8.5L1,8.5L1,7.5L7.5,7.5L7.5,1L8.5,1L8.5,7.5L15,7.5L15,8.5L8.5,8.5L8.5,15L7.5,15L7.5,8.5Z"/>'},{id:"icon-16_minus",viewBox:"0 0 16 16",content:'<rect x="3" y="7.5" width="10" height="1"/>'},{id:"icon-16_close",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M7.293,8L1.646,2.354L2.354,1.646L8,7.293L13.646,1.646L14.354,2.354L8.707,8L14.354,13.646L13.646,14.354L8,8.707L2.354,14.354L1.646,13.646L7.293,8Z"/>'},{id:"icon-16_layout-columns",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M7,3L9,3L9,13L7,13L7,3ZM3,3L5,3L5,13L3,13L3,3ZM11,3L13,3L13,13L11,13L11,3Z"/>'},{id:"icon-16_layout-rows",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M13,3L13,5L3,5L3,3L13,3ZM13,7L13,9L3,9L3,7L13,7ZM13,11L13,13L3,13L3,11L13,11Z"/>'},{id:"icon-16_layout-center",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M12.673,11.362C12.385,11.926 11.926,12.385 11.362,12.673C10.76,12.98 9.983,12.999 8.501,13L8.5,8.5L13,8.501C12.999,9.983 12.98,10.76 12.673,11.362ZM3,8.501L7.5,8.5L7.5,13C6.017,12.999 5.24,12.98 4.638,12.673C4.074,12.385 3.615,11.926 3.327,11.362C3.02,10.76 3.001,9.983 3,8.501ZM11.362,3.327C11.926,3.615 12.385,4.074 12.673,4.638C12.98,5.24 12.999,6.017 13,7.5L8.5,7.5L8.501,3C9.983,3.001 10.76,3.02 11.362,3.327ZM7.5,3L7.5,7.5L3,7.5C3.001,6.017 3.02,5.24 3.327,4.638C3.615,4.074 4.074,3.615 4.638,3.327C5.24,3.02 6.017,3.001 7.5,3Z"/>'},{id:"icon-16_layout-golden",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.488,3L8.5,3L8.501,13C8.404,13 8.304,13 8.2,13L7.8,13C6.12,13 5.28,13 4.638,12.673C4.074,12.385 3.615,11.926 3.327,11.362C3,10.72 3,9.88 3,8.2L3,7.8C3,6.12 3,5.28 3.327,4.638C3.615,4.074 4.074,3.615 4.638,3.327C5.28,3 6.12,3 7.8,3L8.2,3L8.488,3ZM12.673,11.362C12.385,11.926 11.926,12.385 11.362,12.673C10.913,12.902 10.366,12.971 9.501,12.991L9.5,9.5L12.991,9.501C12.971,10.366 12.902,10.913 12.673,11.362ZM11.362,3.327C11.926,3.615 12.385,4.074 12.673,4.638C13,5.28 13,6.12 13,7.8L13,8.2C13,8.304 13,8.404 13,8.501L9.5,8.5L9.501,3.009C10.366,3.029 10.913,3.098 11.362,3.327Z"/>'},{id:"icon-16_layout-thirds",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M6.5,10.5L9.5,10.5L9.501,12.991C9.131,13 8.703,13 8.2,13L7.8,13C7.297,13 6.869,13 6.5,12.991L6.5,10.5ZM3.077,10.502L5.5,10.5L5.499,12.923C5.159,12.876 4.884,12.798 4.638,12.673C4.074,12.385 3.615,11.926 3.327,11.362C3.202,11.116 3.125,10.841 3.077,10.502ZM12.673,11.362C12.385,11.926 11.926,12.385 11.362,12.673C11.116,12.798 10.841,12.875 10.502,12.923L10.5,10.5L12.923,10.502C12.875,10.841 12.798,11.116 12.673,11.362ZM13,7.8L13,8.2C13,8.703 13,9.131 12.991,9.501L10.5,9.5L10.5,6.5L12.991,6.5C13,6.869 13,7.297 13,7.8ZM3.009,6.5L5.5,6.5L5.5,9.5L3.009,9.501C3,9.131 3,8.703 3,8.2L3,7.8C3,7.297 3,6.869 3.009,6.5ZM6.5,6.5L9.5,6.5L9.5,9.5L6.5,9.5L6.5,6.5ZM11.362,3.327C11.926,3.615 12.385,4.074 12.673,4.638C12.798,4.884 12.876,5.159 12.923,5.499L10.5,5.5L10.502,3.077C10.841,3.125 11.116,3.202 11.362,3.327ZM5.499,3.077L5.5,5.5L3.077,5.499C3.124,5.159 3.202,4.884 3.327,4.638C3.615,4.074 4.074,3.615 4.638,3.327C4.884,3.202 5.159,3.124 5.499,3.077ZM9.501,3.009L9.5,5.5L6.5,5.5L6.5,3.009C6.869,3 7.297,3 7.8,3L8.2,3C8.703,3 9.131,3 9.501,3.009Z"/>'},{id:"icon-16_layout-dots",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M11,3L13,3L13,5L11,5L11,3ZM11,7L13,7L13,9L11,9L11,7ZM11,11L13,11L13,13L11,13L11,11ZM7,3L9,3L9,5L7,5L7,3ZM7,7L9,7L9,9L7,9L7,7ZM7,11L9,11L9,13L7,13L7,11ZM3,3L5,3L5,5L3,5L3,3ZM3,7L5,7L5,9L3,9L3,7ZM3,11L5,11L5,13L3,13L3,11Z"/>'},{id:"icon-16_export",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.5,5C9.983,5.001 10.76,5.02 11.362,5.327C12.12,5.713 12.678,6.402 12.898,7.224C13,7.605 13,8.07 13,9C13,9.93 13,10.395 12.898,10.776C12.678,11.598 12.12,12.287 11.362,12.673C10.72,13 9.88,13 8.2,13L7.8,13C6.12,13 5.28,13 4.638,12.673C3.88,12.287 3.322,11.598 3.102,10.776C3,10.395 3,9.93 3,9C3,8.07 3,7.605 3.102,7.224C3.322,6.402 3.88,5.713 4.638,5.327C5.24,5.02 6.017,5.001 7.5,5L7.5,10L8.5,10L8.5,5ZM7.5,5L7.5,3.207L6.354,4.354L5.646,3.646L8,1.293L10.354,3.646L9.646,4.354L8.5,3.207L8.5,5L7.5,5Z"/>'},{id:"icon-16_import",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.5,5C9.983,5.001 10.76,5.02 11.362,5.327C12.12,5.713 12.678,6.402 12.898,7.224C13,7.605 13,8.07 13,9C13,9.93 13,10.395 12.898,10.776C12.678,11.598 12.12,12.287 11.362,12.673C10.72,13 9.88,13 8.2,13L7.8,13C6.12,13 5.28,13 4.638,12.673C3.88,12.287 3.322,11.598 3.102,10.776C3,10.395 3,9.93 3,9C3,8.07 3,7.605 3.102,7.224C3.322,6.402 3.88,5.713 4.638,5.327C5.24,5.02 6.017,5.001 7.5,5L7.5,8.793L6.354,7.646L5.646,8.354L8,10.707L10.354,8.354L9.646,7.646L8.5,8.793L8.5,5ZM7.5,5L7.5,2L8.5,2L8.5,5L7.5,5Z"/>'},{id:"icon-16_break",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M10.475,11.182L11.182,10.475L14.01,13.303L13.303,14.01L10.475,11.182ZM11.437,9.197L11.634,8.217L15.169,8.924L14.973,9.905L11.437,9.197ZM8.217,11.634L9.197,11.437L9.905,14.973L8.924,15.169L8.217,11.634ZM5.525,4.818L4.818,5.525L1.99,2.697L2.697,1.99L5.525,4.818ZM7.783,4.366L6.803,4.563L6.095,1.027L7.076,0.831L7.783,4.366ZM4.563,6.803L4.366,7.783L0.831,7.076L1.027,6.095L4.563,6.803Z"/>'},{id:"icon-16_offset-marker-down",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M8.5,3L7.5,3L7.5,10.793L5.354,8.646L4.646,9.354L8,12.707L11.354,9.354L10.646,8.646L8.5,10.793L8.5,3Z"/>'},{id:"icon-16_offset-marker-up",viewBox:"0 0 16 16",content:'<path fill="currentColor" d="M7.5,13L8.5,13L8.5,5.207L10.646,7.354L11.354,6.646L8,3.293L4.646,6.646L5.354,7.354L7.5,5.207L7.5,13Z"/>'},{id:"icon-12_chevrone-up",viewBox:"0 0 12 12",content:'<path fill="currentColor" d="M3.277,7.416L2.723,6.584L6,4.399L9.277,6.584L8.723,7.416L6,5.601L3.277,7.416Z"/>'},{id:"icon-12_chevrone-down",viewBox:"0 0 12 12",content:'<path fill="currentColor" d="M8.723,4.584L9.277,5.416L6,7.601L2.723,5.416L3.277,4.584L6,6.399L8.723,4.584Z"/>'},{id:"icon-12_arrow-up",viewBox:"0 0 12 12",content:'<path fill="currentColor" d="M5.5,3.934L3.277,5.416L2.723,4.584L6,2.399L9.277,4.584L8.723,5.416L6.5,3.934L6.5,10L5.5,10L5.5,3.934Z"/>'},{id:"icon-12_arrow-down",viewBox:"0 0 12 12",content:'<path fill="currentColor" d="M6.5,8.066L8.723,6.584L9.277,7.416L6,9.601L2.723,7.416L3.277,6.584L5.5,8.066L5.5,2L6.5,2L6.5,8.066Z"/>'}];var se=class l{static instance=null;spriteRoot=null;constructor(){for(let t of un)this.register(t)}static getInstance(){return this.instance||(this.instance=new l),this.instance}register(t){let e=this.ensureSprite();if(e.querySelector(`#${t.id}`))return;let r=document.createElementNS("http://www.w3.org/2000/svg","symbol");r.id=t.id,r.setAttribute("viewBox",t.viewBox),r.innerHTML=t.content,e.appendChild(r)}resolve(t,e,...r){let i=`icon-${t}_${e}`,n=r.map(s=>` data-stdg-icon-${s}`).join("");return`<svg data-stdg-icon-${t}${n}><use href="#${i}"></use></svg>`}ensureSprite(){if(this.spriteRoot)return this.spriteRoot;let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("data-string-devtools-icon-sprite",""),t.setAttribute("aria-hidden","true"),t.style.cssText="display:none;position:absolute;width:0;height:0;overflow:hidden",(document.body??document.documentElement).prepend(t),this.spriteRoot=t,t}};function V(l,t,...e){return se.getInstance().resolve(l,t,...e)}function Rt(l){let t=document.createElement("div");return t.setAttribute("data-stdg",""),t.setAttribute("data-stdg-badge",""),l&&t.setAttribute("data-target-id",l),t.setAttribute("data-visible","false"),t.setAttribute("data-string-devtools-theme",""),t}function oe(l){let t=document.createElement("div");if(t.setAttribute("data-stdg",""),t.setAttribute("data-stdg-panel",""),t.setAttribute("data-open","false"),l)for(let[e,r]of Object.entries(l))t.setAttribute(e,r);return t.addEventListener("pointerdown",e=>e.stopPropagation()),t}function ae(){let l=document.createElement("div");return l.setAttribute("data-stdg-panel-header",""),l}function le(l){let t=document.createElement("div");if(t.setAttribute("data-stdg-panel-content",""),l)for(let[e,r]of Object.entries(l))t.setAttribute(e,r);return t}function tt(l){let{icon:t,size:e=16,label:r,modifiers:i=[],attrs:n}=l,s=document.createElement("button");s.type="button",s.setAttribute("data-stdg-button",""),s.setAttribute(`data-stdg-button-icon-${e}`,"");for(let o of i)s.setAttribute(`data-stdg-button-${o}`,"");if(s.setAttribute("aria-label",r),s.setAttribute("title",r),s.innerHTML=V(e,t),n)for(let[o,a]of Object.entries(n))s.setAttribute(o,a);return s}function yi(l,t){let e=document.createElement("button");if(e.type="button",e.setAttribute("data-stdg-button",""),e.setAttribute("data-string-grid-list-delete",""),e.setAttribute("aria-label",l),e.setAttribute("title",l),e.innerHTML=V(16,"minus"),t)for(let[r,i]of Object.entries(t))e.setAttribute(r,i);return e}function Ht(l){let{icon:t,size:e=16,label:r,withLabel:i=!1,attrs:n}=l,s=document.createElement("button");if(s.type="button",s.setAttribute("data-stdg-button",""),s.setAttribute("data-stdg-button-toggle",""),s.setAttribute("data-stdg-panel-button",""),s.setAttribute(`data-stdg-panel-button-icon-${e}`,""),s.setAttribute("aria-label",r),s.setAttribute("title",r),s.innerHTML=i?`${V(e,t)}<span>${r}</span>`:V(e,t),n)for(let[o,a]of Object.entries(n))s.setAttribute(o,a);return s}var pn=`
|
|
28
28
|
|
|
29
29
|
[data-string-devtools-overlay-badge][data-module-enabled="false"] {
|
|
30
30
|
display: none;
|
|
@@ -1271,16 +1271,16 @@ border: none;
|
|
|
1271
1271
|
color: var(--string-dg-color-black);
|
|
1272
1272
|
}
|
|
1273
1273
|
|
|
1274
|
-
`;var
|
|
1274
|
+
`;var _s={"--string-dev-panel-bg":"#ffffff","--string-dev-panel-border":"1px solid #e0e0e0","--string-dev-panel-radius":"16px","--string-dev-panel-shadow":"0 16px 24px rgba(0, 0, 0, 0.1)","--string-dev-panel-backdrop":"blur(12px)","--string-dev-panel-padding":"4px","--string-dev-panel-font-family":'-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',"--string-dev-panel-font-size":"12px","--string-dev-panel-text":"#111111","--string-dev-panel-muted":"rgba(17, 17, 17, 0.6)","--string-dev-panel-subtle":"rgba(17, 17, 17, 0.72)","--string-dev-panel-divider":"rgba(17, 17, 17, 0.08)","--string-dev-header-font-size":"10px","--string-dev-header-font-weight":"500","--string-dev-header-letter-spacing":"0","--string-dev-header-padding":"8px 8px 8px","--string-dev-header-margin-bottom":"4px","--string-dev-accent":"#FF4F36","--string-dev-accent-soft":"rgba(255, 79, 54, 0.12)","--string-dev-accent-soft-hover":"rgba(255, 79, 54, 0.18)","--string-dev-focus-color":"rgba(255, 79, 54, 0.68)","--string-dev-focus-shadow":"0 0 0 2px rgba(255, 79, 54, 0.18)","--string-dev-field-bg":"rgba(221, 221, 221, 0.4)","--string-dev-field-border":"rgba(255, 255, 255, 0.96)","--string-dev-field-radius":"8px","--string-dev-input-height":"32px","--string-dev-button-height":"32px","--string-dev-chip-size":"24px","--string-dev-icon-button-size":"20px","--string-dev-icon-button-radius":"8px","--string-dev-chip-active-bg":"rgba(221, 221, 221, 0.54)","--string-dev-chip-muted":"rgba(17, 17, 17, 0.22)","--string-dev-chip-resolved":"rgba(17, 17, 17, 0.78)","--string-dev-icon-button-hover-bg":"rgba(17, 17, 17, 0.08)"};function Fs(l,t){return l.trim().split(`
|
|
1275
1275
|
`).map(e=>`${t}${e}`).join(`
|
|
1276
|
-
`)}function yr(
|
|
1277
|
-
`):
|
|
1276
|
+
`)}function yr(l,t={}){let e=Array.isArray(l)?l.join(`,
|
|
1277
|
+
`):l,r={..._s,...t},i=Object.entries(r).map(([n,s])=>`${n}: ${s};`).join(`
|
|
1278
1278
|
`);return`${e} {
|
|
1279
|
-
${
|
|
1280
|
-
}`}function Bt(){if(typeof document>"u")return null;let d="string-devtools-shared-styles",t=document.getElementById(d);if(t instanceof HTMLStyleElement)return t;let e=document.createElement("style");return e.id=d,e.textContent=pn,document.head.appendChild(e),e}function _s(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Fs(){return _s()?window.matchMedia("(pointer: coarse)").matches||window.matchMedia("(any-pointer: coarse)").matches:!1}function ot(d=typeof window<"u"?window.innerWidth:1024){let t=Fs(),e=d<=1024||t;return{coarsePointer:t,compact:e}}var Si="";function Vs(d){let t=(d??"").trim();return t?encodeURIComponent(t):""}function Li(d){Si=Vs(d)}function it(d){return Si?`${d}::${Si}`:d}var Ws="string-devtools:dock",Ns=600,gn=12,zs="[data-stdg-dock]",Gs="[data-stdg-dock-sub-badges]";function hn(d){if(!d)return"";let t=[];return d.ctrlKey&&t.push("Ctrl"),d.altKey&&t.push("Alt"),d.shiftKey&&t.push("Shift"),d.metaKey&&t.push("Meta"),t.push(d.key.length===1?d.key.toUpperCase():d.key),t.join("+")}var Sr=class{root;mainButton;itemsWrap;toolsWrap;fpsSeparator;fpsElement;entries=new Map;collapsed=!1;suppressPersist=!1;preferences;onKeydownBind;onResizeBind;constructor(){Bt(),this.cleanupExistingDockArtifacts(),this.preferences=this.loadPreferences(),this.onResizeBind=()=>{window.requestAnimationFrame(()=>this.handleViewportChange())},this.onKeydownBind=e=>{let r=e.target;r&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r.isContentEditable)||e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.code==="KeyS"&&(e.preventDefault(),this.setCollapsed(!this.collapsed))},window.addEventListener("keydown",this.onKeydownBind),window.addEventListener("resize",this.onResizeBind),this.root=document.createElement("div"),this.root.setAttribute("data-stdg",""),this.root.setAttribute("data-stdg-dock",""),this.root.setAttribute("data-collapsed",this.preferences.collapsed?"true":"false"),this.mainButton=this.createMainButton(),this.itemsWrap=document.createElement("div"),this.itemsWrap.setAttribute("data-stdg-dock-list",""),this.toolsWrap=document.createElement("div"),this.toolsWrap.setAttribute("data-stdg-dock-tools",""),this.fpsSeparator=this.createSeparator(),this.fpsSeparator.setAttribute("data-stdg-dock-fps-separator",""),this.fpsElement=document.createElement("div"),this.fpsElement.setAttribute("data-string-defguides-doc-fps",""),this.fpsElement.title="Current FPS";let t=document.createElement("span");t.textContent="0",this.fpsElement.appendChild(t),this.root.appendChild(this.mainButton),this.itemsWrap.appendChild(this.toolsWrap),this.itemsWrap.appendChild(this.fpsSeparator),this.itemsWrap.appendChild(this.fpsElement),this.root.appendChild(this.itemsWrap),(document.body??document.documentElement).appendChild(this.root),this.setCollapsed(this.preferences.collapsed,!1)}add(t){if(this.entries.has(t.id))return;this.applyStoredActiveState(t);let e=document.createElement("button");e.type="button",e.setAttribute("data-stdg",""),e.setAttribute("data-stdg-button",""),e.setAttribute("data-stdg-button-icon-20",""),e.setAttribute("data-devguides-id",t.id);let r=hn(t.hotkey),i=r?`${t.label} (${r})`:t.label;e.setAttribute("aria-label",i),e.innerHTML=V(20,t.icon),e.title=i,e.addEventListener("click",()=>{let c=!t.getState().active;if(t.setActive(c),!t.subscribe){let u=t.getState();this.renderButton(e,t.label,t.hotkey,u),this.persistActiveState(t.id,u.active)}});let n=document.createElement("div");n.setAttribute("data-stdg",""),n.setAttribute("data-stdg-dock-slot",""),n.setAttribute("data-devguides-slot",t.id),n.appendChild(e);let s=null;t.subBadges&&t.subBadges.length>0&&(n.setAttribute("data-has-sub-badges",""),s=this.createSubBadgeGroup(t));let o=[];s&&o.push(...this.attachSubBadges(n,s));let a=t.subscribe?t.subscribe(c=>{this.renderButton(e,t.label,t.hotkey,c),this.syncSubBadgeState(n,s,c.active),this.persistActiveState(t.id,c.active)}):null;this.entries.set(t.id,{definition:t,button:e,slot:n,subBadges:s,unsubscribe:a,cleanup:o}),this.toolsWrap.appendChild(n),this.sortButtons();let l=t.getState();this.renderButton(e,t.label,t.hotkey,l),this.syncSubBadgeState(n,s,l.active),this.persistActiveState(t.id,l.active)}attachSubBadges(t,e){let r=[];(document.body??document.documentElement).appendChild(e);let i=!1,n=null,s=null,o=0,a=0,l=!1,c=P=>{i!==P&&(i=P,e.setAttribute("data-open",P?"true":"false"),P&&this.positionSubBadges(t,e))},u=()=>ot(window.innerWidth).compact,p=()=>{n!==null&&(window.clearTimeout(n),n=null),s=null},g=()=>{p(),l&&window.setTimeout(()=>{l=!1},0)},m=()=>{window.setTimeout(()=>{t.matches(":hover")||e.matches(":hover")||c(!1)},60)},h=()=>{u()||c(!0)};t.addEventListener("pointerenter",h),r.push(()=>t.removeEventListener("pointerenter",h));let f=()=>{u()||m()};t.addEventListener("pointerleave",f),r.push(()=>t.removeEventListener("pointerleave",f));let b=()=>{u()||c(!0)};e.addEventListener("pointerenter",b),r.push(()=>e.removeEventListener("pointerenter",b));let y=()=>{u()||m()};e.addEventListener("pointerleave",y),r.push(()=>e.removeEventListener("pointerleave",y));let v=()=>c(!1);e.addEventListener("string-devtools-sub-badge-action",v),r.push(()=>e.removeEventListener("string-devtools-sub-badge-action",v));let S=P=>{u()&&(P.target instanceof HTMLElement&&P.target.closest("[data-stdg-dock-sub-badge]")||(p(),s=P.pointerId,o=P.clientX,a=P.clientY,n=window.setTimeout(()=>{n=null,l=!0,c(!0)},Ns)))};t.addEventListener("pointerdown",S),r.push(()=>t.removeEventListener("pointerdown",S));let E=P=>{if(!u()||n===null||P.pointerId!==s)return;let R=Math.abs(P.clientX-o),B=Math.abs(P.clientY-a);(R>gn||B>gn)&&p()};t.addEventListener("pointermove",E),r.push(()=>t.removeEventListener("pointermove",E)),t.addEventListener("pointerup",g),r.push(()=>t.removeEventListener("pointerup",g)),t.addEventListener("pointercancel",g),r.push(()=>t.removeEventListener("pointercancel",g));let M=()=>{u()&&p()};t.addEventListener("pointerleave",M),r.push(()=>t.removeEventListener("pointerleave",M));let C=P=>{!u()||!l||P.preventDefault()};t.addEventListener("contextmenu",C),r.push(()=>t.removeEventListener("contextmenu",C));let A=P=>{u()&&P.preventDefault()};t.addEventListener("selectstart",A),r.push(()=>t.removeEventListener("selectstart",A));let I=P=>{!u()||!l||(l=!1,P.preventDefault(),P.stopImmediatePropagation())};t.addEventListener("click",I,!0),r.push(()=>t.removeEventListener("click",I,!0)),e.addEventListener("pointerdown",g),r.push(()=>e.removeEventListener("pointerdown",g)),e.addEventListener("pointercancel",g),r.push(()=>e.removeEventListener("pointercancel",g));let H=P=>{u()&&P.preventDefault()};e.addEventListener("contextmenu",H),r.push(()=>e.removeEventListener("contextmenu",H));let w=P=>{u()&&P.preventDefault()};e.addEventListener("selectstart",w),r.push(()=>e.removeEventListener("selectstart",w));let _=()=>{l=!1};e.addEventListener("click",_),r.push(()=>e.removeEventListener("click",_));let k=P=>{if(!i)return;let R=P.target;R instanceof Node&&(t.contains(R)||e.contains(R)||c(!1))};document.addEventListener("pointerdown",k),r.push(()=>document.removeEventListener("pointerdown",k));let O=new MutationObserver(()=>{e.querySelector('[data-active="true"]')||m()});O.observe(e,{subtree:!0,attributes:!0,attributeFilter:["data-active"]}),r.push(()=>O.disconnect());let T=()=>{i&&this.positionSubBadges(t,e)};return window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),r.push(()=>window.removeEventListener("resize",T)),r.push(()=>window.removeEventListener("scroll",T,!0)),e.setAttribute("data-open","false"),r.push(()=>e.remove()),r}positionSubBadges(t,e){let r=t.getBoundingClientRect();ot(window.innerWidth).compact?(e.style.left=`${Math.round(r.right+8)}px`,e.style.top=`${Math.round(r.top+r.height/2)}px`,e.style.bottom=""):(e.style.left=`${Math.round(r.left+r.width/2)}px`,e.style.top="",e.style.bottom=`${Math.round(window.innerHeight-r.top+8)}px`)}createSubBadgeGroup(t){let e=document.createElement("div");e.setAttribute("data-stdg",""),e.setAttribute("data-stdg-dock-sub-badges",""),e.setAttribute("data-parent-active","false");for(let r of t.subBadges??[]){let i={"data-stdg":"","data-stdg-dock-sub-badge":"","data-sub-badge-id":r.id,"data-active":"false","data-parent-active":"false"};if(r.selectorAttribute&&(i[r.selectorAttribute]=""),r.attributes)for(let[s,o]of Object.entries(r.attributes))o==null||o===!1||(i[s]=o===!0?"":String(o));let n=tt({icon:r.icon,size:16,label:r.label,modifiers:["toggle"],attrs:i});n.addEventListener("pointerdown",s=>{s.stopPropagation()}),n.addEventListener("click",s=>{s.stopPropagation(),t.getState().active||t.setActive(!0),r.onClick(n),n.setAttribute("data-active","false"),n.dispatchEvent(new CustomEvent("string-devtools-sub-badge-action",{bubbles:!0}))}),e.appendChild(n)}return e}remove(t){let e=this.entries.get(t);if(e){e.unsubscribe?.();for(let r of e.cleanup)r();e.slot.remove(),this.entries.delete(t)}}destroy(){window.removeEventListener("keydown",this.onKeydownBind),window.removeEventListener("resize",this.onResizeBind);for(let t of this.entries.values()){t.unsubscribe?.();for(let e of t.cleanup)e();t.slot.remove()}this.entries.clear(),this.root.remove()}cleanupExistingDockArtifacts(){document.querySelectorAll(zs).forEach(t=>t.remove()),document.querySelectorAll(Gs).forEach(t=>t.remove())}setFPS(t){let e=this.fpsElement.querySelector("span");e&&(e.textContent=String(Math.max(0,Math.round(t))))}sortButtons(){let t=Array.from(this.entries.values()).sort((r,i)=>{let n=r.definition.order??0,s=i.definition.order??0;return n!==s?n-s:r.definition.label.localeCompare(i.definition.label)});this.toolsWrap.innerHTML="",this.toolsWrap.appendChild(this.createSeparator());let e;for(let r of t){let i=r.definition.group;e!==void 0&&i!==e&&this.toolsWrap.appendChild(this.createSeparator()),e=i,this.toolsWrap.appendChild(r.slot)}this.fpsSeparator.style.display=t.length>0?"block":"none",this.syncCollapsedLayout()}createSeparator(){let t=document.createElement("span");return t.setAttribute("data-stdg-horizontal-line",""),t}createMainButton(){let t=document.createElement("button");return t.type="button",t.setAttribute("data-stdg",""),t.setAttribute("data-stdg-button",""),t.setAttribute("data-stdg-button-hover",""),t.setAttribute("data-stdg-button-icon-20",""),t.setAttribute("data-collapsed",this.preferences.collapsed?"true":"false"),t.setAttribute("aria-label","Toggle Dev Guides"),t.innerHTML=`
|
|
1279
|
+
${Fs(i," ")}
|
|
1280
|
+
}`}function Bt(){if(typeof document>"u")return null;let l="string-devtools-shared-styles",t=document.getElementById(l);if(t instanceof HTMLStyleElement)return t;let e=document.createElement("style");return e.id=l,e.textContent=pn,document.head.appendChild(e),e}function Vs(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Ws(){return Vs()?window.matchMedia("(pointer: coarse)").matches||window.matchMedia("(any-pointer: coarse)").matches:!1}function ot(l=typeof window<"u"?window.innerWidth:1024){let t=Ws(),e=l<=1024||t;return{coarsePointer:t,compact:e}}var Si="";function Ns(l){let t=(l??"").trim();return t?encodeURIComponent(t):""}function Li(l){Si=Ns(l)}function it(l){return Si?`${l}::${Si}`:l}var zs="string-devtools:dock",Gs=600,gn=12,$s="[data-stdg-dock]",Us="[data-stdg-dock-sub-badges]";function hn(l){if(!l)return"";let t=[];return l.ctrlKey&&t.push("Ctrl"),l.altKey&&t.push("Alt"),l.shiftKey&&t.push("Shift"),l.metaKey&&t.push("Meta"),t.push(l.key.length===1?l.key.toUpperCase():l.key),t.join("+")}var Sr=class{root;mainButton;itemsWrap;toolsWrap;fpsSeparator;fpsElement;entries=new Map;collapsed=!1;suppressPersist=!1;preferences;onKeydownBind;onResizeBind;constructor(){Bt(),this.cleanupExistingDockArtifacts(),this.preferences=this.loadPreferences(),this.onResizeBind=()=>{window.requestAnimationFrame(()=>this.handleViewportChange())},this.onKeydownBind=e=>{let r=e.target;r&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r.isContentEditable)||e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.code==="KeyS"&&(e.preventDefault(),this.setCollapsed(!this.collapsed))},window.addEventListener("keydown",this.onKeydownBind),window.addEventListener("resize",this.onResizeBind),this.root=document.createElement("div"),this.root.setAttribute("data-stdg",""),this.root.setAttribute("data-stdg-dock",""),this.root.setAttribute("data-collapsed",this.preferences.collapsed?"true":"false"),this.mainButton=this.createMainButton(),this.itemsWrap=document.createElement("div"),this.itemsWrap.setAttribute("data-stdg-dock-list",""),this.toolsWrap=document.createElement("div"),this.toolsWrap.setAttribute("data-stdg-dock-tools",""),this.fpsSeparator=this.createSeparator(),this.fpsSeparator.setAttribute("data-stdg-dock-fps-separator",""),this.fpsElement=document.createElement("div"),this.fpsElement.setAttribute("data-string-defguides-doc-fps",""),this.fpsElement.title="Current FPS";let t=document.createElement("span");t.textContent="0",this.fpsElement.appendChild(t),this.root.appendChild(this.mainButton),this.itemsWrap.appendChild(this.toolsWrap),this.itemsWrap.appendChild(this.fpsSeparator),this.itemsWrap.appendChild(this.fpsElement),this.root.appendChild(this.itemsWrap),(document.body??document.documentElement).appendChild(this.root),this.setCollapsed(this.preferences.collapsed,!1)}add(t){if(this.entries.has(t.id))return;this.applyStoredActiveState(t);let e=document.createElement("button");e.type="button",e.setAttribute("data-stdg",""),e.setAttribute("data-stdg-button",""),e.setAttribute("data-stdg-button-icon-20",""),e.setAttribute("data-devguides-id",t.id);let r=hn(t.hotkey),i=r?`${t.label} (${r})`:t.label;e.setAttribute("aria-label",i),e.innerHTML=V(20,t.icon),e.title=i,e.addEventListener("click",()=>{let c=!t.getState().active;if(t.setActive(c),!t.subscribe){let u=t.getState();this.renderButton(e,t.label,t.hotkey,u),this.persistActiveState(t.id,u.active)}});let n=document.createElement("div");n.setAttribute("data-stdg",""),n.setAttribute("data-stdg-dock-slot",""),n.setAttribute("data-devguides-slot",t.id),n.appendChild(e);let s=null;t.subBadges&&t.subBadges.length>0&&(n.setAttribute("data-has-sub-badges",""),s=this.createSubBadgeGroup(t));let o=[];s&&o.push(...this.attachSubBadges(n,s));let a=t.subscribe?t.subscribe(c=>{this.renderButton(e,t.label,t.hotkey,c),this.syncSubBadgeState(n,s,c.active),this.persistActiveState(t.id,c.active)}):null;this.entries.set(t.id,{definition:t,button:e,slot:n,subBadges:s,unsubscribe:a,cleanup:o}),this.toolsWrap.appendChild(n),this.sortButtons();let d=t.getState();this.renderButton(e,t.label,t.hotkey,d),this.syncSubBadgeState(n,s,d.active),this.persistActiveState(t.id,d.active)}attachSubBadges(t,e){let r=[];(document.body??document.documentElement).appendChild(e);let i=!1,n=null,s=null,o=0,a=0,d=!1,c=P=>{i!==P&&(i=P,e.setAttribute("data-open",P?"true":"false"),P&&this.positionSubBadges(t,e))},u=()=>ot(window.innerWidth).compact,p=()=>{n!==null&&(window.clearTimeout(n),n=null),s=null},g=()=>{p(),d&&window.setTimeout(()=>{d=!1},0)},m=()=>{window.setTimeout(()=>{t.matches(":hover")||e.matches(":hover")||c(!1)},60)},h=()=>{u()||c(!0)};t.addEventListener("pointerenter",h),r.push(()=>t.removeEventListener("pointerenter",h));let f=()=>{u()||m()};t.addEventListener("pointerleave",f),r.push(()=>t.removeEventListener("pointerleave",f));let b=()=>{u()||c(!0)};e.addEventListener("pointerenter",b),r.push(()=>e.removeEventListener("pointerenter",b));let y=()=>{u()||m()};e.addEventListener("pointerleave",y),r.push(()=>e.removeEventListener("pointerleave",y));let v=()=>c(!1);e.addEventListener("string-devtools-sub-badge-action",v),r.push(()=>e.removeEventListener("string-devtools-sub-badge-action",v));let S=P=>{u()&&(P.target instanceof HTMLElement&&P.target.closest("[data-stdg-dock-sub-badge]")||(p(),s=P.pointerId,o=P.clientX,a=P.clientY,n=window.setTimeout(()=>{n=null,d=!0,c(!0)},Gs)))};t.addEventListener("pointerdown",S),r.push(()=>t.removeEventListener("pointerdown",S));let E=P=>{if(!u()||n===null||P.pointerId!==s)return;let R=Math.abs(P.clientX-o),B=Math.abs(P.clientY-a);(R>gn||B>gn)&&p()};t.addEventListener("pointermove",E),r.push(()=>t.removeEventListener("pointermove",E)),t.addEventListener("pointerup",g),r.push(()=>t.removeEventListener("pointerup",g)),t.addEventListener("pointercancel",g),r.push(()=>t.removeEventListener("pointercancel",g));let M=()=>{u()&&p()};t.addEventListener("pointerleave",M),r.push(()=>t.removeEventListener("pointerleave",M));let C=P=>{!u()||!d||P.preventDefault()};t.addEventListener("contextmenu",C),r.push(()=>t.removeEventListener("contextmenu",C));let A=P=>{u()&&P.preventDefault()};t.addEventListener("selectstart",A),r.push(()=>t.removeEventListener("selectstart",A));let I=P=>{!u()||!d||(d=!1,P.preventDefault(),P.stopImmediatePropagation())};t.addEventListener("click",I,!0),r.push(()=>t.removeEventListener("click",I,!0)),e.addEventListener("pointerdown",g),r.push(()=>e.removeEventListener("pointerdown",g)),e.addEventListener("pointercancel",g),r.push(()=>e.removeEventListener("pointercancel",g));let H=P=>{u()&&P.preventDefault()};e.addEventListener("contextmenu",H),r.push(()=>e.removeEventListener("contextmenu",H));let w=P=>{u()&&P.preventDefault()};e.addEventListener("selectstart",w),r.push(()=>e.removeEventListener("selectstart",w));let _=()=>{d=!1};e.addEventListener("click",_),r.push(()=>e.removeEventListener("click",_));let k=P=>{if(!i)return;let R=P.target;R instanceof Node&&(t.contains(R)||e.contains(R)||c(!1))};document.addEventListener("pointerdown",k),r.push(()=>document.removeEventListener("pointerdown",k));let O=new MutationObserver(()=>{e.querySelector('[data-active="true"]')||m()});O.observe(e,{subtree:!0,attributes:!0,attributeFilter:["data-active"]}),r.push(()=>O.disconnect());let T=()=>{i&&this.positionSubBadges(t,e)};return window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),r.push(()=>window.removeEventListener("resize",T)),r.push(()=>window.removeEventListener("scroll",T,!0)),e.setAttribute("data-open","false"),r.push(()=>e.remove()),r}positionSubBadges(t,e){let r=t.getBoundingClientRect();ot(window.innerWidth).compact?(e.style.left=`${Math.round(r.right+8)}px`,e.style.top=`${Math.round(r.top+r.height/2)}px`,e.style.bottom=""):(e.style.left=`${Math.round(r.left+r.width/2)}px`,e.style.top="",e.style.bottom=`${Math.round(window.innerHeight-r.top+8)}px`)}createSubBadgeGroup(t){let e=document.createElement("div");e.setAttribute("data-stdg",""),e.setAttribute("data-stdg-dock-sub-badges",""),e.setAttribute("data-parent-active","false");for(let r of t.subBadges??[]){let i={"data-stdg":"","data-stdg-dock-sub-badge":"","data-sub-badge-id":r.id,"data-active":"false","data-parent-active":"false"};if(r.selectorAttribute&&(i[r.selectorAttribute]=""),r.attributes)for(let[s,o]of Object.entries(r.attributes))o==null||o===!1||(i[s]=o===!0?"":String(o));let n=tt({icon:r.icon,size:16,label:r.label,modifiers:["toggle"],attrs:i});n.addEventListener("pointerdown",s=>{s.stopPropagation()}),n.addEventListener("click",s=>{s.stopPropagation(),t.getState().active||t.setActive(!0),r.onClick(n),n.setAttribute("data-active","false"),n.dispatchEvent(new CustomEvent("string-devtools-sub-badge-action",{bubbles:!0}))}),e.appendChild(n)}return e}remove(t){let e=this.entries.get(t);if(e){e.unsubscribe?.();for(let r of e.cleanup)r();e.slot.remove(),this.entries.delete(t)}}destroy(){window.removeEventListener("keydown",this.onKeydownBind),window.removeEventListener("resize",this.onResizeBind);for(let t of this.entries.values()){t.unsubscribe?.();for(let e of t.cleanup)e();t.slot.remove()}this.entries.clear(),this.root.remove()}cleanupExistingDockArtifacts(){document.querySelectorAll($s).forEach(t=>t.remove()),document.querySelectorAll(Us).forEach(t=>t.remove())}setFPS(t){let e=this.fpsElement.querySelector("span");e&&(e.textContent=String(Math.max(0,Math.round(t))))}sortButtons(){let t=Array.from(this.entries.values()).sort((r,i)=>{let n=r.definition.order??0,s=i.definition.order??0;return n!==s?n-s:r.definition.label.localeCompare(i.definition.label)});this.toolsWrap.innerHTML="",this.toolsWrap.appendChild(this.createSeparator());let e;for(let r of t){let i=r.definition.group;e!==void 0&&i!==e&&this.toolsWrap.appendChild(this.createSeparator()),e=i,this.toolsWrap.appendChild(r.slot)}this.fpsSeparator.style.display=t.length>0?"block":"none",this.syncCollapsedLayout()}createSeparator(){let t=document.createElement("span");return t.setAttribute("data-stdg-horizontal-line",""),t}createMainButton(){let t=document.createElement("button");return t.type="button",t.setAttribute("data-stdg",""),t.setAttribute("data-stdg-button",""),t.setAttribute("data-stdg-button-hover",""),t.setAttribute("data-stdg-button-icon-20",""),t.setAttribute("data-collapsed",this.preferences.collapsed?"true":"false"),t.setAttribute("aria-label","Toggle Dev Guides"),t.innerHTML=`
|
|
1281
1281
|
${V(20,"logo")}
|
|
1282
1282
|
${V(12,"chevrone-up")}
|
|
1283
|
-
`,t.addEventListener("click",()=>{this.setCollapsed(!this.collapsed)}),t}setCollapsed(t,e=!0){if(this.collapsed=t,this.root.setAttribute("data-collapsed",t?"true":"false"),this.mainButton.setAttribute("data-collapsed",t?"true":"false"),this.mainButton.setAttribute("aria-label",t?"Expand developer tools":"Collapse developer tools"),t){this.suppressPersist=!0;for(let r of this.entries.values())r.definition.getState().active&&r.definition.setActive(!1);this.suppressPersist=!1}else{this.suppressPersist=!0;for(let r of this.entries.values())this.preferences.active[r.definition.id]===!0&&r.definition.setActive(!0);this.suppressPersist=!1}e&&(this.preferences.collapsed=t,this.savePreferences()),this.syncCollapsedLayout()}syncCollapsedLayout(){let t=ot(window.innerWidth).compact,e=t?this.toolsWrap.scrollHeight:this.toolsWrap.scrollWidth;this.toolsWrap.style.maxHeight=t?this.collapsed?"0px":`${e}px`:"",this.toolsWrap.style.maxWidth=t?"":this.collapsed?"0px":`${e}px`,this.toolsWrap.style.opacity=this.collapsed?"0":"1",this.toolsWrap.style.pointerEvents=this.collapsed?"none":"auto"}handleViewportChange(){this.syncCollapsedLayout();for(let t of this.entries.values())t.subBadges&&t.subBadges.getAttribute("data-open")==="true"&&this.positionSubBadges(t.slot,t.subBadges)}renderButton(t,e,r,i){let n=hn(r),s=n?`${e} (${n})`:e;t.setAttribute("data-active",i.active?"true":"false"),t.setAttribute("aria-label",`${s}: ${i.active?"On":"Off"}`),t.title=`${s}: ${i.active?"On":"Off"}`}syncSubBadgeState(t,e,r){let i=r?"true":"false";if(t.setAttribute("data-active",i),!!e){e.setAttribute("data-parent-active",i);for(let n of e.querySelectorAll("[data-stdg-dock-sub-badge]"))n.setAttribute("data-parent-active",i),n.setAttribute("aria-disabled",r?"false":"true")}}applyStoredActiveState(t){let e=this.preferences.active[t.id];if(typeof e!="boolean")return;let r=this.collapsed?!1:e;r!==t.getState().active&&t.setActive(r)}persistActiveState(t,e){this.suppressPersist||this.collapsed||(this.preferences.active[t]=e,this.savePreferences())}loadPreferences(){try{let t=localStorage.getItem(this.dockStorageKey);if(!t)return{collapsed:!1,active:{}};let e=JSON.parse(t);return{collapsed:e.collapsed===!0,active:e.active&&typeof e.active=="object"?e.active:{}}}catch{return{collapsed:!1,active:{}}}}savePreferences(){try{localStorage.setItem(this.dockStorageKey,JSON.stringify(this.preferences))}catch{}}get dockStorageKey(){return it(Ws)}};var Lr=class{definitions=new Map;dock=null;register(t){!t||this.definitions.has(t.id)||(this.definitions.set(t.id,t),this.dock||(this.dock=new Sr),this.dock.add(t))}setFPS(t){this.dock?.setFPS(t)}destroy(){this.definitions.clear(),this.dock?.destroy(),this.dock=null}};var Er=class extends x{constructor(t){super(t),this.htmlKey="scroller"}onObjectConnected(t){let e=t.getProperty("scroller-inited");if(e==null||e==""){t.setProperty("scroller-inited","inited");let r=i=>{this.events.emit("wheel",i)};t.setProperty("scroller-wheel-event",r),t.htmlElement.addEventListener("wheel",r)}}onObjectDisconnected(t){t.setProperty("scroller-inited",""),t.htmlElement.removeEventListener("wheel",t.getProperty("scroller-wheel-event"))}};var Mr=class extends x{states=new WeakMap;constructor(t){super(t),this.htmlKey="scroll-container",this.attributesToMap.push({key:"lerp",type:"number",fallback:.1})}onObjectConnected(t){super.onObjectConnected(t);let e=t.htmlElement;getComputedStyle(e).overflowY==="visible"&&(e.style.overflowY="auto");let r={current:e.scrollTop,target:e.scrollTop,maxScroll:e.scrollHeight-e.clientHeight,velocity:0,lerp:t.getProperty("lerp")||.1,isDragging:!1,isActive:!1};this.states.set(e,r),e.addEventListener("wheel",i=>this.handleWheel(i,e,r),{passive:!1}),e.addEventListener("scroll",i=>this.onNativeScroll(i,e,r),{passive:!0}),this.measure(e,r)}onObjectDisconnected(t){this.states.delete(t.htmlElement)}onFrame(t){for(let e of this.objectsOnPage){let r=e.htmlElement,i=this.states.get(r);i&&i.isActive&&!i.isDragging&&this.updateScroll(r,i)}}onResize(){for(let t of this.objectsOnPage){let e=t.htmlElement,r=this.states.get(e);r&&this.measure(e,r)}}measure(t,e){e.maxScroll=t.scrollHeight-t.clientHeight}handleWheel(t,e,r){let i=t.deltaY,n=i<0,s=i>0,o=r.target<=.1,a=r.target>=r.maxScroll-.1;n&&o||s&&a||(t.preventDefault(),t.stopPropagation(),r.target+=i,r.target=Math.max(0,Math.min(r.target,r.maxScroll)),r.isActive=!0,r.isDragging=!1)}onWheel(t){}onNativeScroll(t,e,r){r.isActive||(r.current=e.scrollTop,r.target=e.scrollTop)}updateScroll(t,e){let r=e.target-e.current;Math.abs(r)<.1?(e.current=e.target,e.isActive=!1):e.current+=r*e.lerp,t.scrollTop=e.current}};function mn(d){let t=d.match(/([^[]+)\[([\d.]+)-([\d.]+)\]/);return t?{id:t[1],start:parseFloat(t[2]),end:parseFloat(t[3])}:null}function $s(d,t,e,r,i){return r+(i-r)*(d-t)/(e-t)}var wr=class extends x{constructor(t){super(t),this.htmlKey="progress-part",this.attributesToMap=[...this.attributesToMap,{key:"part-of",type:"string",fallback:""},{key:"easing",type:"easing",fallback:this.settings.easing}]}onObjectConnected(t){let e=t.getProperty("part-of"),r=mn(e);if(r){t.setProperty("part-of-id",r.id),t.setProperty("start",r.start),t.setProperty("end",r.end);let i=n=>{if(r){let s=$s(n,r?.start,r?.end,0,1),o=Math.max(0,Math.min(1,s)),a=t.getProperty("easing"),l=typeof a=="function"?a(o):o;t.htmlElement.style.setProperty("--progress-slice",l.toString()),this.emitSignal(t,"progress-slice",l),this.events.emit(this.getObjectEventName(t,"object:progress-slice"),l)}};t.setProperty("progress-event",i),this.events.on(`object:progress:${r.id}`,i)}}onObjectDisconnected(t){let e=t.getProperty("part-of-id");e&&this.events.off(`object:progress:${e}`,t.getProperty("progress-event"))}};var Us=/^([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\s*(>=|<=|==|!=|>|<)\s*(-?(?:\d+\.?\d*|\d*\.?\d+))$/,js=/^(.*?)\s*=>\s*([a-z.]+)\((.*)\)$/;function fn(d){return d.split(";").map(t=>t.trim()).filter(Boolean).flatMap(t=>{let e=t.match(js);if(!e)return[];let[,r,i,n]=e,s=Ys(r.trim());if(!s.length)return[];let o=Xs(i.trim(),n.trim());return o?[{groups:s,effect:o,raw:t}]:[]})}function Ys(d){return d.split(/\s*\|\|\s*/).filter(Boolean).map(t=>t.split(/\s*&&\s*/).filter(Boolean).map(qs)).filter(t=>t.length>0&&t.every(Boolean))}function qs(d){let t=d.match(Us);if(!t)return null;let[,e,r,i,n]=t,s=parseFloat(n);return Number.isFinite(s)?{sourceId:e,signal:r,operator:i,threshold:s,raw:d}:null}function Xs(d,t){let e=Ks(t);switch(d){case"toggle.class":return e[0]?{type:"class-toggle",key:e[0]}:null;case"class.add":return e[0]?{type:"class-add",key:e[0]}:null;case"class.remove":return e[0]?{type:"class-remove",key:e[0]}:null;case"style.set":return e[0]&&e[1]?{type:"style-set",key:e[0],value:e[1]}:null;case"style.remove":return e[0]?{type:"style-remove",key:e[0]}:null;case"var.set":return e[0]&&e[1]?{type:"var-set",key:e[0],value:e[1]}:null;case"var.remove":return e[0]?{type:"var-remove",key:e[0]}:null;default:return null}}function Ks(d){return d.split(",").map(t=>t.trim()).filter(Boolean)}var xr=class extends x{constructor(t){super(t),this.htmlKey="signal",this.attributesToMap=[...this.attributesToMap,{key:"signal",type:"string",fallback:""}]}onObjectConnected(t){let e=t.getProperty("signal");if(!e)return;let r=fn(e);if(r.length===0)return;let i=[];t.setProperty("signal-rules",i);for(let n=0;n<r.length;n++){let s=r[n],o={rule:s,callbacks:[],previousState:null},a=()=>{this.applyRuleState(t,o)};for(let{sourceId:l,signal:c}of to(s))o.callbacks.push({sourceId:l,signal:c,callback:a}),this.signals.subscribe(l,c,this.events,a);i.push(o),this.applyRuleState(t,o)}}onObjectDisconnected(t){let e=t.getProperty("signal-rules");if(e)for(let r=0;r<e.length;r++){let i=e[r];for(let n=0;n<i.callbacks.length;n++){let s=i.callbacks[n];this.signals.unsubscribe(s.sourceId,s.signal,this.events,s.callback)}i.rule.effect.type==="class-toggle"&&this.resetEffect(t,i.rule.effect)}}applyRuleState(t,e){let r=Zs(e.rule,this.signals);e.previousState!==r&&(e.previousState=r,L.run(()=>{this.applyEffectState(t,e.rule.effect,r)}))}applyEffectState(t,e,r){e.type==="class-toggle"?r?this.applyEffect(t,e):this.resetEffect(t,e):r&&this.applyEffect(t,e)}applyEffect(t,e){this.applyToElementAndConnects(t,r=>eo(r,e))}resetEffect(t,e){this.applyToElementAndConnects(t,r=>ro(r,e))}};function Zs(d,t){for(let e=0;e<d.groups.length;e++){let r=d.groups[e],i=!0;for(let n=0;n<r.length;n++)if(!Qs(r[n],t)){i=!1;break}if(i)return!0}return!1}function Qs(d,t){let e=t.get(d.sourceId,d.signal);return typeof e!="number"||!Number.isFinite(e)?!1:Js(e,d.operator,d.threshold)}function Js(d,t,e){switch(t){case">":return d>e;case">=":return d>=e;case"<":return d<e;case"<=":return d<=e;case"==":return d===e;case"!=":return d!==e}}function to(d){let t=new Set,e=[];for(let r of d.groups)for(let{sourceId:i,signal:n}of r){let s=`${i}::${n}`;t.has(s)||(t.add(s),e.push({sourceId:i,signal:n}))}return e}function eo(d,t){switch(t.type){case"class-toggle":case"class-add":d.classList.add(t.key);return;case"class-remove":d.classList.remove(t.key);return;case"style-set":L.setProp(d,t.key,t.value);return;case"style-remove":case"var-remove":d.style.removeProperty(t.key);return;case"var-set":L.setVar(d,t.key,t.value);return}}function ro(d,t){switch(t.type){case"class-toggle":d.classList.remove(t.key);return;default:return}}var io=(d,t)=>{let e=Math.min(d,t),r=Math.max(d,t);return e+Math.random()*(r-e)},no=(d,t)=>{let e=Math.ceil(Math.min(d,t)),r=Math.floor(Math.max(d,t));return r<e?e:Math.floor(Math.random()*(r-e+1))+e},so=d=>{if(Array.isArray(d)&&d.length>=2){let t=Number(d[0]),e=Number(d[1]);if(Number.isFinite(t)&&Number.isFinite(e))return[t,e]}return typeof d=="number"&&Number.isFinite(d)?[0,d]:[0,1]},Cr=class extends x{constructor(t){super(t),this.htmlKey="random",this.attributesToMap.push({key:"random-number",type:"json",fallback:"[0,1]"}),this.attributesToMap.push({key:"random-type",type:"string",fallback:"int"})}onObjectConnected(t){let e=t.htmlElement,r=so(t.getProperty("random-number")),n=String(t.getProperty("random-type")??"float").toLowerCase()==="int"?no(r[0],r[1]):io(r[0],r[1]);L.run(()=>{L.setVars(e,{"--random":n})})}};var Tr=class{constructor(t,e){this.id=t;this.zIndex=e}screenRoot=null;world=null;screen=null;worldHost=null;hostPositionWasPatched=!1;hostPositionInlineValue=null;ensure(t){if(this.screenRoot?.isConnected)return t&&this.attachWorldToHost(t),this.screenRoot;let e=document.querySelector(`[data-string-dev-viewport-layer="${this.id}"]`);if(e)return this.screenRoot=e,this.screen=e.querySelector(`[data-string-dev-viewport-screen="${this.id}"]`),t&&this.attachWorldToHost(t),e;let r=document.createElement("div");r.setAttribute("data-string-dev-viewport-layer",this.id),r.setAttribute("data-string-devtools-theme",""),r.style.position="fixed",r.style.inset="0",r.style.zIndex=String(this.zIndex),r.style.pointerEvents="none",r.style.overflow="hidden";let i=document.createElement("div");return i.setAttribute("data-string-dev-viewport-screen",this.id),i.style.position="absolute",i.style.inset="0",i.style.pointerEvents="none",i.style.overflow="hidden",r.appendChild(i),(document.body??document.documentElement).appendChild(r),this.screenRoot=r,this.screen=i,this.attachWorldToHost(t??document.body??document.documentElement),r}getElement(){return this.screenRoot?.isConnected?this.screenRoot:null}getWorldElement(t){return this.ensure(t),this.world}getScreenElement(){return this.ensure(),this.screen}destroy(){this.restoreHostPosition(),this.screenRoot?.remove(),this.screenRoot=null,this.world?.remove(),this.world=null,this.screen=null,this.worldHost=null}attachWorldToHost(t){if(this.worldHost===t&&this.world?.isConnected)return;if(this.restoreHostPosition(),this.worldHost=t,!this.world){let r=document.createElement("div");r.setAttribute("data-string-dev-viewport-world",this.id),r.setAttribute("data-string-devtools-theme",""),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="1px",r.style.height="1px",r.style.pointerEvents="none",r.style.overflow="visible",r.style.zIndex=String(this.zIndex),this.world=r}t!==document.body&&t!==document.documentElement&&window.getComputedStyle(t).position==="static"&&(this.hostPositionWasPatched=!0,this.hostPositionInlineValue=t.style.position||null,t.style.position="relative"),t.appendChild(this.world)}restoreHostPosition(){this.world&&this.world.remove(),this.worldHost&&this.hostPositionWasPatched&&(this.hostPositionInlineValue==null||this.hostPositionInlineValue===""?this.worldHost.style.removeProperty("position"):this.worldHost.style.position=this.hostPositionInlineValue),this.hostPositionWasPatched=!1,this.hostPositionInlineValue=null}};var _t=class d{static instance=null;layers=new Map;static getInstance(){return this.instance||(this.instance=new d),this.instance}acquire(t,e){let r=this.layers.get(t);if(r){if(r.zIndex!==e)throw new Error(`Shared devtools layer "${t}" already exists with z-index ${r.zIndex}, requested ${e}.`);return r.refs+=1,r.layer}let i=new Tr(t,e);return this.layers.set(t,{layer:i,refs:1,zIndex:e}),i}release(t){let e=this.layers.get(t);e&&(e.refs-=1,!(e.refs>0)&&(e.layer.destroy(),this.layers.delete(t)))}};var Z=class extends x{static devtool=null;overlayRegistry=_t.getInstance();acquiredViewportLayers=new Map;devtoolListeners=new Set;hotkeyHandler=null;devtoolConfig=null;constructor(t){super(t),this._type=2,Bt();let e=this.constructor.devtool;e&&(this.configureDevtool(e),this.bindDevtoolHotkey(e.hotkey));let r=e?.styles,i=(typeof r=="function"?r():r)??this.getStyles();i&&this.ensureStyle(`${this.getStyleScopeId(i)}-styles`,i)}get respectSelfDisable(){return!1}get connectsConfig(){return this.constructor.devtool?.connects}canConnect(t){let e=this.connectsConfig;return e?!!(e.global===!0||t.keys.includes("dev-inspect")||e.keys?.some(r=>t.keys.includes(r))||e.attributes?.some(r=>t.htmlElement.hasAttribute(r))):super.canConnect(t)}getStyleScopeId(t){let e=this.htmlKey||this.constructor.devtool?.connects?.keys?.[0];if(e)return e;let r=0;for(let i=0;i<t.length;i+=1)r=r*31+t.charCodeAt(i)>>>0;return`string-dev-${r.toString(16)}`}getStyles(){return null}getDevtoolDefinition(){if(!this.devtoolConfig)return null;let t=this.devtoolConfig,e=this.getDevtoolSubBadges();return{id:t.id,label:t.label,icon:t.icon,order:t.order,group:t.group,hotkey:t.hotkey,subBadges:e.length>0?e:void 0,getState:()=>({active:this.getDevtoolActiveState()}),setActive:r=>{this.setDevtoolActiveState(r)},subscribe:r=>(this.devtoolListeners.add(r),r({active:this.getDevtoolActiveState()}),()=>{this.devtoolListeners.delete(r)})}}getDevtoolSubBadges(){return[]}configureDevtool(t){this.devtoolConfig=t}bindDevtoolHotkey(t){typeof window>"u"||!t||(this.hotkeyHandler=e=>{let r=e.target;r&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r.isContentEditable)||e.key.toLowerCase()!==t.key.toLowerCase()||e.shiftKey!==(t.shiftKey??!1)||e.ctrlKey!==(t.ctrlKey??!1)||e.altKey!==(t.altKey??!1)||e.metaKey!==(t.metaKey??!1)||(e.preventDefault(),this.setDevtoolActiveState(!this.getDevtoolActiveState()))},window.addEventListener("keydown",this.hotkeyHandler))}emitDevtoolState(t=this.getDevtoolActiveState()){let e={active:t};for(let r of this.devtoolListeners)r(e)}acquireViewportLayer(t,e){let r=this.acquiredViewportLayers.get(t);if(r)return r;let i=this.overlayRegistry.acquire(t,e);return this.acquiredViewportLayers.set(t,i),i}releaseViewportLayer(t){this.acquiredViewportLayers.has(t)&&(this.overlayRegistry.release(t),this.acquiredViewportLayers.delete(t))}ensureStyle(t,e){let r=document.getElementById(t);if(r instanceof HTMLStyleElement)return r;let i=document.createElement("style");return i.id=t,i.textContent=e,document.head.appendChild(i),i}getWorldHost(){return this.data.scroll.container??document.body??document.documentElement}getDevtoolActiveState(){return!1}setDevtoolActiveState(t){}destroy(){this.hotkeyHandler&&(window.removeEventListener("keydown",this.hotkeyHandler),this.hotkeyHandler=null),this.devtoolListeners.clear();for(let t of this.acquiredViewportLayers.keys())this.overlayRegistry.release(t);this.acquiredViewportLayers.clear(),super.destroy()}};var Ei=["S","M","L","XL"];var oo=[1280,1024,768,0];function vn(d,t){let e=t-1-d;return Ei[e]??"S"}var bn=0;function Pr(){return`grid-${Date.now()}-${bn++}`}function Ar(){return`layout-${Date.now()}-${bn++}`}function kr(d=2){let t=Math.max(2,Math.min(4,d)),e=[];for(let r=0;r<t;r++){let i=vn(r,t),n=r===t-1?0:oo[r]??0;e.push({id:Ar(),label:i,minWidth:n,instances:[]})}return e}function de(d){return Number.isFinite(d)?Math.max(0,Math.round(d)):0}function Ft(d){let t=d.length;for(let e=0;e<t;e++)d[e].label=vn(e,t)}var ao="string-grid:";function Mi(d){return it(ao+d)}function lo(d){if(!d||typeof d!="object")return 0;if(Array.isArray(d))return d.length;let t=d,e=Array.isArray(t.layouts)?t.layouts:[],r=0;for(let i of e){if(!i||typeof i!="object")continue;let n=i,s=Array.isArray(n.instances)?n.instances:Array.isArray(n.grids)?n.grids:[];r+=s.length}return r}var Or=class{adapterRegistry=new Map;elementStates=new Map;registerAdapter(t){this.adapterRegistry.set(t.type,t)}getAdapter(t){return this.adapterRegistry.get(t)}getAdapterRegistry(){return this.adapterRegistry}getLayouts(t){return this.getOrInitState(t).layouts}getLayoutCount(t){return this.getOrInitState(t).layouts.length}getSelectedLayoutId(t){return this.getOrInitState(t).selectedLayoutId}getPanelTitle(t){return this.getOrInitState(t).panelTitle?.trim()||"Layout"}getSelectedLayoutLabel(t){let e=this.getOrInitState(t);return this.findSelectedLayout(e)?.label??"S"}getResolvedLayoutId(t,e){let r=this.getOrInitState(t);return this.findResolvedLayout(r,e)?.id??r.layouts[r.layouts.length-1].id}getSelectedInstances(t){let e=this.getOrInitState(t);return this.findSelectedLayout(e)?.instances??[]}getResolvedInstances(t,e){let r=this.getOrInitState(t);return this.findResolvedLayout(r,e)?.instances??[]}addLayout(t){let e=this.getOrInitState(t);if(e.layouts.length>=4)return null;let r=e.layouts[0],i=r?Math.min(1920,r.minWidth+256):1280,n={id:Ar(),label:"XL",minWidth:i,instances:[]};return e.layouts.unshift(n),this.sortLayouts(e),Ft(e.layouts),this.ensureMinWidthConstraints(e),e.layouts.some(s=>s.id===e.selectedLayoutId)||(e.selectedLayoutId=e.layouts[0].id),this.save(t),n}removeLayout(t,e){let r=this.getOrInitState(t);if(r.layouts.length<=2)return!1;let i=r.layouts.findIndex(n=>n.id===e);return i===-1?!1:(r.layouts.splice(i,1),Ft(r.layouts),this.ensureMinWidthConstraints(r),r.layouts.some(n=>n.id===r.selectedLayoutId)||(r.selectedLayoutId=r.layouts[r.layouts.length-1].id),this.save(t),!0)}selectLayout(t,e,r=!0){let i=this.getOrInitState(t);i.layouts.some(n=>n.id===e)&&(i.selectedLayoutId=e,r&&this.save(t))}updateLayoutMinWidth(t,e,r,i=!0){let n=this.getOrInitState(t),s=n.layouts.find(o=>o.id===e);s&&(s.minWidth=de(r),this.sortLayouts(n),Ft(n.layouts),this.ensureMinWidthConstraints(n),i&&this.save(t))}replaceLayouts(t,e,r){let i=this.normalizeLayouts(e),n={elementId:t,layouts:i,selectedLayoutId:r};this.ensureValidSelection(n),this.elementStates.set(t,n),this.save(t)}getInstances(t){return this.getSelectedInstances(t)}addInstance(t,e){let r=this.adapterRegistry.get(e);if(!r)return null;let i=this.findSelectedLayout(this.getOrInitState(t));if(!i)return null;let n={id:Pr(),type:e,visible:!0,settings:{...r.getDefaults()}};return i.instances.push(n),this.save(t),n}removeInstance(t,e){let r=this.findSelectedLayout(this.getOrInitState(t));r&&(r.instances=r.instances.filter(i=>i.id!==e),this.save(t))}reorderInstance(t,e,r,i){let n=this.findSelectedLayout(this.getOrInitState(t));if(!n||e===r)return;let s=n.instances.findIndex(u=>u.id===e),o=n.instances.findIndex(u=>u.id===r);if(s===-1||o===-1)return;let[a]=n.instances.splice(s,1),l=n.instances.findIndex(u=>u.id===r),c=i==="before"?l:l+1;n.instances.splice(c,0,a),this.save(t)}moveInstanceToEnd(t,e){let r=this.findSelectedLayout(this.getOrInitState(t));if(!r)return;let i=r.instances.findIndex(s=>s.id===e);if(i===-1||i===r.instances.length-1)return;let[n]=r.instances.splice(i,1);r.instances.push(n),this.save(t)}toggleVisibility(t,e){let r=this.findInstance(t,e);r&&(r.visible=!r.visible,this.save(t))}renameInstance(t,e,r){let i=this.findInstance(t,e);i&&(i.name=r.trim()||void 0,this.save(t))}renamePanelTitle(t,e){let r=this.getOrInitState(t);r.panelTitle=e.trim()||"Layout",this.save(t)}updateSetting(t,e,r,i){let n=this.findInstance(t,e);n&&(n.settings[r]=i,this.save(t))}findInstance(t,e){return this.getSelectedInstances(t).find(r=>r.id===e)}save(t){let e=this.elementStates.get(t);if(e)try{let r={layouts:e.layouts,selectedLayoutId:e.selectedLayoutId,panelTitle:e.panelTitle??"Layout"},i=Mi(t);localStorage.setItem(i,JSON.stringify(r))}catch(r){console.warn("[StringDevLayout:storage] save failed",{elementId:t,storageSlot:Mi(t),error:r})}}load(t,e=[]){try{let r=[t,...e],i=[];for(let p of r){let g=Mi(p),m=localStorage.getItem(g);if(m)try{let h=JSON.parse(m);i.push({elementId:p,storageSlot:g,raw:m,parsed:h,gridCount:lo(h)})}catch(h){console.warn("[StringDevLayout:storage] candidate parse failed",{elementId:t,candidateId:p,storageSlot:g,error:h})}}let n=i[0]??null;for(let p of i)(!n||p.gridCount>n.gridCount)&&(n=p);if(!n)return;let s=n.parsed,o=n.elementId;if(Array.isArray(s)){let p=s.filter(m=>this.adapterRegistry.has(m.type));for(let m of p){let h=this.adapterRegistry.get(m.type);h&&(m.settings={...h.getDefaults(),...m.settings})}let g=kr(2);g[g.length-1].instances=p,this.elementStates.set(t,{elementId:t,layouts:g,selectedLayoutId:g[0].id,panelTitle:"Layout"}),o!==t&&this.save(t);return}let a=Array.isArray(s?.layouts)?s.layouts:null;if(!a)return;let l=this.normalizeLayouts(a);if(l.length===0)return;let c=typeof s?.selectedLayoutId=="string"?s.selectedLayoutId:l[0].id,u={elementId:t,layouts:l,selectedLayoutId:c,panelTitle:typeof s?.panelTitle=="string"&&s.panelTitle.trim().length>0?s.panelTitle.trim():"Layout"};this.ensureValidSelection(u),this.elementStates.set(t,u),o!==t&&this.save(t)}catch{}}clear(){this.elementStates.clear()}getOrInitState(t){let e=this.elementStates.get(t);if(!e){let r=kr(2);e={elementId:t,layouts:r,selectedLayoutId:r[0].id,panelTitle:"Layout"},this.elementStates.set(t,e)}return this.sortLayouts(e),this.ensureValidSelection(e),e}normalizeLayouts(t){let i=t.filter(n=>n&&typeof n=="object"&&typeof n.id=="string").map(n=>{let s=Array.isArray(n.instances)?n.instances:Array.isArray(n.grids)?n.grids:[];return{id:n.id,label:n.label??"S",minWidth:de(typeof n.minWidth=="number"?n.minWidth:0),instances:s.filter(o=>this.adapterRegistry.has(o.type)).map(o=>{let a=this.adapterRegistry.get(o.type);return a?{...o,visible:o.visible!==!1,settings:{...a.getDefaults(),...o.settings}}:o})}}).slice(0,4);for(;i.length<2;)i.push({id:Ar(),label:"S",minWidth:0,instances:[]});return this.sortLayoutsArr(i),Ft(i),this.ensureMinWidthConstraintsArr(i),i}sortLayouts(t){this.sortLayoutsArr(t.layouts)}sortLayoutsArr(t){t.sort((e,r)=>r.minWidth-e.minWidth)}ensureValidSelection(t){t.layouts.length<2&&(t.layouts=kr(2)),t.layouts.length>4&&(t.layouts=t.layouts.slice(0,4),Ft(t.layouts)),t.layouts.some(e=>e.id===t.selectedLayoutId)||(t.selectedLayoutId=t.layouts[t.layouts.length-1].id)}ensureMinWidthConstraints(t){this.ensureMinWidthConstraintsArr(t.layouts)}ensureMinWidthConstraintsArr(t){if(t.length!==0){t[t.length-1].minWidth=0;for(let e=t.length-2;e>=0;e--){let r=t[e+1].minWidth;t[e].minWidth<=r&&(t[e].minWidth=r+1)}}}findSelectedLayout(t){return t.layouts.find(e=>e.id===t.selectedLayoutId)}findResolvedLayout(t,e){for(let r of t.layouts)if(e>=r.minWidth)return r;return t.layouts[t.layouts.length-1]}};var co="http://www.w3.org/2000/svg",ue=class{svg;target;resizeObserver;enabled=!0;onResize;constructor(t,e,r){this.target=t,this.onResize=r,this.svg=document.createElementNS(co,"svg"),this.svg.setAttribute("data-string-grid-overlay",""),this.svg.style.position="absolute",this.svg.style.pointerEvents="none",this.svg.style.transformOrigin="top left",e.appendChild(this.svg),this.syncViewBox(),this.resizeObserver=new ResizeObserver(()=>{this.syncViewBox(),this.onResize?.()}),this.resizeObserver.observe(this.target)}getElement(){return this.svg}setPosition(t,e,r,i){this.svg.style.width=`${r}px`,this.svg.style.height=`${i}px`,this.svg.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(e)}px, 0)`}render(t,e){if(this.clearAll(),!this.enabled)return;let{width:r,height:i}=this.getDimensions();for(let n of[...t].reverse()){let s=e.get(n.type);if(s&&n.visible){s.render(this.svg,r,i,{...n.settings,__instanceId:n.id});let o=this.svg.querySelector(`[data-grid-id="${n.id}"]`);o&&(o.setAttribute("data-grid-type",n.type),o.setAttribute("data-grid-visible","true"))}}}setEnabled(t){this.enabled=t,this.svg.style.display=t?"":"none",t||this.clearAll()}clearAll(){let t=this.svg.querySelectorAll("[data-grid-id]");for(let e=t.length-1;e>=0;e--)t[e].remove()}clearInstance(t,e){e.clear(this.svg,t)}syncViewBox(){let{width:t,height:e}=this.getDimensions();this.svg.setAttribute("viewBox",`0 0 ${t} ${e}`)}getDimensions(){return{width:this.target.offsetWidth,height:this.target.offsetHeight}}destroy(){this.resizeObserver.disconnect(),this.svg.remove()}ensurePositioned(){getComputedStyle(this.target).position==="static"&&(this.target.style.position="relative")}};var Q=class{key;label;value;onChange;root=null;constructor(t,e,r,i){this.key=t,this.label=e,this.value=r,this.onChange=i}setDisabled(t){this.root&&this.root.setAttribute("data-disabled",t?"true":"false")}getValue(){return this.value}destroy(){this.root?.remove(),this.root=null}emit(t){this.value=t,this.onChange(this.key,t)}createLabel(){let t=document.createElement("label");return t.textContent=this.label,t.setAttribute("data-stdg-label",""),t}createRow(){let t=document.createElement("div");return t.setAttribute("data-stdg-panel-field",""),t}};var uo=320,po=60,yn=6,Dr=class extends Q{min;max;step;input=null;stepperButtons=[];constructor(t,e,r,i,n=0,s=100,o=1){super(t,e,r,i),this.min=n,this.max=s,this.step=o}build(){let t=this.createRow();return t.appendChild(this.createLabel()),t.appendChild(this.createControls()),this.root=t,t}setValue(t){this.value=t,this.input&&(this.input.value=this.formatValue(t))}setDisabled(t){super.setDisabled(t),this.input&&(this.input.disabled=t);for(let e of this.stepperButtons)e.disabled=t}createControls(){let t=document.createElement("div");t.setAttribute("data-stdg-field-input","");let e=document.createElement("div");return e.setAttribute("data-stdg-stepper",""),e.appendChild(this.createStepperButton("up",1)),e.appendChild(this.createStepperButton("down",-1)),t.appendChild(this.createInput()),t.appendChild(e),t}createInput(){let t=document.createElement("input");return t.type="text",t.inputMode="text",t.setAttribute("enterkeyhint","done"),t.autocomplete="off",t.spellcheck=!1,t.value=this.formatValue(this.value),t.setAttribute("data-stdg-input",""),t.addEventListener("focus",()=>{t.select()}),t.addEventListener("blur",()=>{this.commitValue(t.value)}),t.addEventListener("keydown",e=>{if(e.key==="Enter"){t.blur();return}if(e.key==="Escape"){t.value=this.formatValue(this.value),t.blur();return}e.key!=="ArrowUp"&&e.key!=="ArrowDown"||(e.preventDefault(),this.applyDelta(e.key==="ArrowUp"?1:-1,e))}),t.addEventListener("wheel",e=>{document.activeElement===t&&(e.preventDefault(),this.applyDelta(e.deltaY<0?1:-1,e))}),t.addEventListener("mousedown",e=>{e.button===1&&this.startMiddleDrag(e,t)}),t.addEventListener("auxclick",e=>{e.button===1&&e.preventDefault()}),this.input=t,t}createStepperButton(t,e){let r=document.createElement("button");r.type="button",r.setAttribute("data-stdg-button",""),r.setAttribute("data-stdg-button-icon-12",""),r.setAttribute("data-direction",t),r.innerHTML=V(12,t==="up"?"chevrone-up":"chevrone-down");let i=0,n=0,s=!1,o=()=>{window.clearTimeout(i),window.clearInterval(n),document.removeEventListener("pointerup",o),document.removeEventListener("pointercancel",o)};return r.addEventListener("pointerdown",a=>{a.button===0&&(i=window.setTimeout(()=>{s=!0,this.applyDelta(e),n=window.setInterval(()=>{this.applyDelta(e)},po)},uo),document.addEventListener("pointerup",o),document.addEventListener("pointercancel",o))}),r.addEventListener("click",a=>{if(s){s=!1,a.preventDefault();return}this.applyDelta(e),this.input?.focus(),this.input?.select()}),this.stepperButtons.push(r),r}startMiddleDrag(t,e){t.preventDefault();let r=t.clientX,i=0,n=document.body.style.cursor,s=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let o=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",o),document.body.style.cursor=n,document.body.style.userSelect=s},a=l=>{let c=l.clientX-r;for(r=l.clientX,i+=c;Math.abs(i)>=yn;){let u=i>0?1:-1;this.applyDelta(u,l),i-=yn*u}};e.focus(),e.select(),document.addEventListener("mousemove",a),document.addEventListener("mouseup",o)}commitValue(t){let e=parseFloat(t.replace(",","."));if(isNaN(e)){this.input&&(this.input.value=this.formatValue(this.value));return}let r=this.normalizeValue(e);this.input&&(this.input.value=this.formatValue(r)),this.emit(r)}applyDelta(t,e){let r=e?.shiftKey?10:e?.altKey?.1:1,i=this.normalizeValue(this.value+t*this.step*r);this.input&&(this.input.value=this.formatValue(i)),this.emit(i)}normalizeValue(t){let e=Math.round(t/this.step)*this.step,r=this.getPrecision(this.step);return Number(e.toFixed(r))}getPrecision(t){return String(t).split(".")[1]?.length??0}formatValue(t){let e=this.getPrecision(this.step);return e>0?t.toFixed(e):String(t)}};var go=320,ho=60,Sn=6,Ir=class d extends Q{min;max;step;displayMultiplier;displayStep;suffix;units;currentUnit;valueInput=null;unitSelect=null;stepperButtons=[];static DECIMAL_UNITS=new Set(["rem","em"]);constructor(t,e,r,i,n=0,s=100,o=1,a=1,l,c,u,p){super(t,e,r,i),this.min=n,this.max=s,this.step=o,this.displayMultiplier=a,this.displayStep=l,this.suffix=c,this.units=u,this.currentUnit=p}build(){let t=this.createRow();return t.appendChild(this.createLabel()),t.appendChild(this.createControls()),this.root=t,t}setValue(t){this.value=t,this.valueInput&&(this.valueInput.value=this.formatValue(t))}setDisabled(t){super.setDisabled(t),this.valueInput&&(this.valueInput.disabled=t),this.unitSelect&&(this.unitSelect.disabled=t);for(let e of this.stepperButtons)e.disabled=t}createControls(){let t=document.createElement("div");t.setAttribute("data-stdg-field-input","");let e=document.createElement("div");if(e.setAttribute("data-stdg-field-value",""),e.appendChild(this.createInput()),this.suffix){let i=document.createElement("span");i.setAttribute("data-stdg-field-suffix",""),i.textContent=this.suffix,e.appendChild(i)}if(t.appendChild(e),this.units&&this.units.length>0){let i=document.createElement("select");i.setAttribute("data-stdg-select","");for(let n of this.units){let s=document.createElement("option");s.value=n.value,s.textContent=n.label,i.appendChild(s)}i.value=this.currentUnit||this.units[0].value,i.addEventListener("change",()=>{this.currentUnit=i.value,this.valueInput&&(this.valueInput.value=this.formatValue(this.value)),this.onChange(this.key+"Unit",i.value)}),this.unitSelect=i,t.appendChild(i)}let r=document.createElement("div");return r.setAttribute("data-stdg-stepper",""),r.appendChild(this.createStepperButton("up",1)),r.appendChild(this.createStepperButton("down",-1)),t.appendChild(r),t}createInput(){let t=document.createElement("input");return t.type="text",t.inputMode="text",t.setAttribute("enterkeyhint","done"),t.autocomplete="off",t.spellcheck=!1,t.value=this.formatValue(this.value),t.setAttribute("data-stdg-input",""),t.addEventListener("focus",()=>{t.select()}),t.addEventListener("blur",()=>{this.commitInputValue(t)}),t.addEventListener("keydown",e=>{e.key==="Enter"?t.blur():e.key==="Escape"?(t.value=this.formatValue(this.value),t.blur()):(e.key==="ArrowUp"||e.key==="ArrowDown")&&(e.preventDefault(),this.applyDelta(e.key==="ArrowUp"?1:-1,e,t))}),t.addEventListener("wheel",e=>{document.activeElement===t&&(e.preventDefault(),this.applyDelta(e.deltaY<0?1:-1,e,t))}),t.addEventListener("mousedown",e=>{e.button===1&&this.startMiddleDrag(e,t)}),t.addEventListener("auxclick",e=>{e.button===1&&e.preventDefault()}),this.valueInput=t,t}createStepperButton(t,e){let r=document.createElement("button");r.type="button",r.setAttribute("data-stdg-button",""),r.setAttribute("data-stdg-button-icon-12",""),r.setAttribute("data-direction",t),r.innerHTML=V(12,t==="up"?"chevrone-up":"chevrone-down");let i=0,n=0,s=!1,o=()=>{window.clearTimeout(i),window.clearInterval(n),document.removeEventListener("pointerup",o),document.removeEventListener("pointercancel",o)};return r.addEventListener("pointerdown",a=>{a.button===0&&(i=window.setTimeout(()=>{s=!0,this.valueInput&&(this.applyDelta(e,void 0,this.valueInput),n=window.setInterval(()=>{this.valueInput&&this.applyDelta(e,void 0,this.valueInput)},ho))},go),document.addEventListener("pointerup",o),document.addEventListener("pointercancel",o))}),r.addEventListener("click",a=>{if(s){s=!1,a.preventDefault();return}this.valueInput&&(this.applyDelta(e,void 0,this.valueInput),this.valueInput.focus(),this.valueInput.select())}),this.stepperButtons.push(r),r}startMiddleDrag(t,e){t.preventDefault();let r=t.clientX,i=0,n=document.body.style.cursor,s=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let o=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",o),document.body.style.cursor=n,document.body.style.userSelect=s},a=l=>{let c=l.clientX-r;for(r=l.clientX,i+=c;Math.abs(i)>=Sn;){let u=i>0?1:-1;this.applyDelta(u,l,e),i-=Sn*u}};e.focus(),e.select(),document.addEventListener("mousemove",a),document.addEventListener("mouseup",o)}commitInputValue(t){let e=parseFloat(t.value.replace(",","."));if(isNaN(e)){t.value=this.formatValue(this.value);return}let r=this.normalizeDisplayValue(e);t.value=this.formatValue(r),this.emit(r)}applyDelta(t,e,r){let i=e?.shiftKey?10:e?.altKey?.1:1,n=this.modelToDisplay(this.value)+t*this.getDisplayStep()*i,s=this.normalizeDisplayValue(n);r.value=this.formatValue(s),this.emit(s)}normalizeValue(t){let e=Math.min(this.max,Math.max(this.min,t));if(d.DECIMAL_UNITS.has(this.currentUnit??""))return Number(e.toFixed(2));let r=Math.round(e/this.step)*this.step,i=this.getPrecision(this.step);return Number(r.toFixed(i))}normalizeDisplayValue(t){let e=this.modelToDisplay(this.min),r=this.modelToDisplay(this.max),i=Math.min(r,Math.max(e,t)),n=this.getDisplayPrecision();if(d.DECIMAL_UNITS.has(this.currentUnit??"")){let l=Number(i.toFixed(n));return this.normalizeValue(this.displayToModel(l))}let s=this.getDisplayStep(),o=Math.round(i/s)*s,a=Number(o.toFixed(n));return this.normalizeValue(this.displayToModel(a))}getPrecision(t){return String(t).split(".")[1]?.length??0}formatValue(t){let e=this.modelToDisplay(t),r=this.getDisplayPrecision();return r>0?e.toFixed(r):String(e)}modelToDisplay(t){let e=this.getDisplayPrecision();return Number((t*this.displayMultiplier).toFixed(e))}displayToModel(t){return t/this.displayMultiplier}getDisplayStep(){return this.displayStep??this.step*this.displayMultiplier}getDisplayPrecision(){if(d.DECIMAL_UNITS.has(this.currentUnit??""))return 2;let t=this.getDisplayStep();return t<1?Math.max(2,this.getPrecision(t)):0}};var Rr=class extends Q{colorInput=null;hexLabel=null;build(){let t=this.createRow();return t.appendChild(this.createLabel()),t.appendChild(this.createControl()),this.root=t,t}setValue(t){this.value=t,this.colorInput&&(this.colorInput.value=t),this.hexLabel&&(this.hexLabel.value=t)}setDisabled(t){super.setDisabled(t),this.colorInput&&(this.colorInput.disabled=t),this.hexLabel&&(this.hexLabel.disabled=t)}createControl(){let t=document.createElement("div");t.setAttribute("data-stdg-field-input","");let e=document.createElement("input");e.type="color",e.value=this.value,e.setAttribute("data-stdg-input",""),e.setAttribute("data-stdg-input-color","");let r=document.createElement("input");return r.type="text",r.inputMode="text",r.value=this.value,r.setAttribute("data-stdg-input",""),e.addEventListener("input",()=>{r.value=e.value,this.emit(e.value)}),r.addEventListener("change",()=>{let i=r.value.trim();e.value=i,this.emit(i)}),this.colorInput=e,this.hexLabel=r,t.appendChild(e),t.appendChild(r),t}};var Hr=class extends Q{options;select=null;stepperButtons=[];constructor(t,e,r,i,n){super(t,e,r,i),this.options=n}build(){let t=this.createRow();return t.appendChild(this.createLabel()),t.appendChild(this.createControl()),this.root=t,t}setValue(t){this.value=t,this.select&&(this.select.value=t)}setDisabled(t){super.setDisabled(t),this.select&&(this.select.disabled=t);for(let e of this.stepperButtons)e.disabled=t}createControl(){let t=document.createElement("div");t.setAttribute("data-stdg-field-input","");let e=document.createElement("select");e.setAttribute("data-stdg-select","");for(let i of this.options){let n=document.createElement("option");n.value=i.value,n.textContent=i.label,i.value===this.value&&(n.selected=!0),e.appendChild(n)}e.addEventListener("change",()=>{this.emit(e.value)}),this.select=e;let r=document.createElement("div");return r.setAttribute("data-stdg-stepper",""),r.appendChild(this.createStepperButton("up",-1)),r.appendChild(this.createStepperButton("down",1)),t.appendChild(e),t.appendChild(r),t}createStepperButton(t,e){let r=document.createElement("button");return r.type="button",r.setAttribute("data-stdg-button",""),r.setAttribute("data-stdg-button-icon-12",""),r.setAttribute("data-direction",t),r.innerHTML=V(12,t==="up"?"chevrone-up":"chevrone-down"),r.addEventListener("click",()=>{if(!this.select)return;let i=this.select.options.length;if(i===0)return;let s=((this.select.selectedIndex+e)%i+i)%i;this.select.selectedIndex=s,this.emit(this.select.value)}),this.stepperButtons.push(r),r}};var Br=class extends Q{checkbox=null;toggle=null;build(){let t=this.createRow();t.appendChild(this.createLabel());let e=document.createElement("label");e.setAttribute("data-stdg-toggle",""),e.setAttribute("data-checked",String(this.value));let r=document.createElement("input");r.type="checkbox",r.checked=this.value,r.setAttribute("data-stdg-toggle-input",""),this.checkbox=r,this.toggle=e;let i=document.createElement("span");return i.setAttribute("data-stdg-toggle-knob",""),r.addEventListener("change",()=>{let n=r.checked;this.value=n,e.setAttribute("data-checked",String(n)),this.emit(n)}),e.appendChild(r),e.appendChild(i),t.appendChild(e),this.root=t,t}setValue(t){this.value=t,this.checkbox&&(this.checkbox.checked=t),this.toggle?.setAttribute("data-checked",String(t))}setDisabled(t){super.setDisabled(t),this.checkbox&&(this.checkbox.disabled=t),this.toggle?.setAttribute("aria-disabled",t?"true":"false")}};var _r=class{fields=[];fieldEntries=[];values={};build(t,e,r){this.destroy(),this.values={...e};let i=(o,a)=>{this.values[o]=a,this.syncDisabledStates(),r(o,a)},n=document.createDocumentFragment(),s=document.createElement("div");s.setAttribute("data-stdg-panel-content",""),n.appendChild(s);for(let o of t){if(o.type==="divider"){s=document.createElement("div"),s.setAttribute("data-stdg-panel-content",""),n.appendChild(s);continue}let a=this.createField(o,e,i);a&&(this.fields.push(a),this.fieldEntries.push({descriptor:o,field:a}),s.appendChild(a.build()))}return this.syncDisabledStates(),n}updateValues(t){this.values={...this.values,...t};for(let e of this.fields){let r=e.key;r&&r in t&&e.setValue(t[r])}this.syncDisabledStates()}destroy(){for(let t of this.fields)t.destroy();this.fields=[],this.fieldEntries=[],this.values={}}createField(t,e,r){switch(t.type){case"number":return new Dr(t.key,t.label,e[t.key]??t.default,r,t.min,t.max,t.step);case"range":return new Ir(t.key,t.label,e[t.key]??t.default,r,t.min,t.max,t.step,t.displayMultiplier,t.displayStep,t.suffix,t.units,e[t.key+"Unit"]??t.defaultUnit);case"color":return new Rr(t.key,t.label,e[t.key]??t.default,r);case"select":return new Hr(t.key,t.label,e[t.key]??t.default,r,t.options);case"toggle":return new Br(t.key,t.label,e[t.key]??t.default,r);default:return null}}syncDisabledStates(){for(let t of this.fieldEntries){let e=t.descriptor.disabledWhen,r=!!e&&this.values[e.key]===e.equals;t.field.setDisabled(r)}}};var wi=12,mo=360,fo=560,pe=class{target;adapterRegistry;hudRoot;trigger;panel;layoutTitle;layoutChipTabs;layoutSettingsToggle;layoutSettingsList;layoutAddButton;layoutIOActions;listContainer;addGuideButton;headerAddButton;addPanel;addGridList;layoutPanel;detailPanel;detailContent;detailTitle=null;detailIcon=null;detailBuilder=null;instances=[];layouts=[];panelTitleValue="Layout";selectedLayoutId="";resolvedLayoutId="";selectedInstanceId=null;selectedBreakpointLayoutId=null;isOpen=!1;panelInBody=!1;isAddPanelOpen=!1;isLayoutSettingsOpen=!1;enabled=!0;onDocumentPointerDownBind;onViewportChangeBind;onAdd;onRemove;onToggle;onSettingChange;onReorder;onMoveToEnd;onSelectLayout;onUpdateLayoutMinWidth;onAddLayout;onRemoveLayout;onExport;onImport;onRenameInstance;onRenamePanelTitle;onHUDOpen;onHUDClose;onLayoutPanelOpen;onLayoutPanelClose;constructor(t,e,r,i){this.target=t,this.adapterRegistry=e,this.onAdd=r.onAdd,this.onRemove=r.onRemove,this.onToggle=r.onToggle,this.onSettingChange=r.onSettingChange,this.onReorder=r.onReorder,this.onMoveToEnd=r.onMoveToEnd,this.onSelectLayout=r.onSelectLayout,this.onUpdateLayoutMinWidth=r.onUpdateLayoutMinWidth,this.onAddLayout=r.onAddLayout,this.onRemoveLayout=r.onRemoveLayout,this.onExport=r.onExport,this.onImport=r.onImport,this.onRenameInstance=r.onRenameInstance,this.onRenamePanelTitle=r.onRenamePanelTitle,this.onHUDOpen=r.onHUDOpen,this.onHUDClose=r.onHUDClose,this.onLayoutPanelOpen=r.onLayoutPanelOpen,this.onLayoutPanelClose=r.onLayoutPanelClose,this.onDocumentPointerDownBind=this.onDocumentPointerDown.bind(this),this.onViewportChangeBind=()=>this.syncPanelPlacement(),this.hudRoot=this.createHudRoot(),this.trigger=this.createTrigger(),this.panel=this.createMainPanel(),this.addPanel=this.createAddPanel(),this.layoutPanel=this.createLayoutPanel(),this.detailPanel=this.createDetailPanel(),i?.attachTrigger!==!1&&this.hudRoot.appendChild(this.trigger),this.panel.appendChild(this.addPanel),this.panel.appendChild(this.layoutPanel),this.panel.appendChild(this.detailPanel),this.hudRoot.appendChild(this.panel),document.addEventListener("pointerdown",this.onDocumentPointerDownBind),window.addEventListener("resize",this.onViewportChangeBind),window.visualViewport?.addEventListener("resize",this.onViewportChangeBind),window.visualViewport?.addEventListener("scroll",this.onViewportChangeBind)}refresh(t,e,r,i,n){this.instances=[...t],this.layouts=[...e],this.panelTitleValue=r.trim()||"Layout",this.selectedLayoutId=i,this.resolvedLayoutId=n,this.selectedInstanceId&&!t.some(s=>s.id===this.selectedInstanceId)&&this.clearSelection(),this.selectedBreakpointLayoutId&&!this.layouts.some(s=>s.id===this.selectedBreakpointLayoutId)&&(this.selectedBreakpointLayoutId=null),this.layoutTitle.value=this.panelTitleValue,this.renderLayoutChips(),this.renderLayoutSettings(),this.renderList(),this.renderDetailPanel()}destroy(){this.detailBuilder?.destroy(),document.removeEventListener("pointerdown",this.onDocumentPointerDownBind),window.removeEventListener("resize",this.onViewportChangeBind),window.visualViewport?.removeEventListener("resize",this.onViewportChangeBind),window.visualViewport?.removeEventListener("scroll",this.onViewportChangeBind),this.panelInBody&&this.panel.remove(),this.hudRoot.remove()}getTriggerElement(){return this.trigger}getHudElement(){return this.hudRoot}setTargetId(t){this.hudRoot.setAttribute("data-target-id",t),this.trigger.setAttribute("data-target-id",t),this.panel.setAttribute("data-target-id",t),this.addPanel.setAttribute("data-target-id",t),this.layoutPanel.setAttribute("data-target-id",t),this.detailPanel.setAttribute("data-target-id",t)}setAnchorPosition(t,e,r="top-left"){this.hudRoot.setAttribute("data-visible","true");let i=r==="top-right"?" translate(-100%, 0%)":"";this.hudRoot.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(e)}px, 0)${i}`,this.syncPanelPlacement()}setAnchorVisible(t){this.hudRoot.setAttribute("data-visible",t?"true":"false")}isHUDOpen(){return this.isOpen}isLayoutSettingsPanelOpen(){return this.isLayoutSettingsOpen}setEnabled(t){this.enabled=t,t||this.hide(),this.hudRoot.style.display=t?"":"none"}isEnabled(){return this.enabled}createHudRoot(){return Rt()}createTrigger(){let t=tt({icon:"settings",label:"Open layout guides",modifiers:["toggle"],attrs:{"data-devguides-id":"layout","data-open":"false","data-state":"visible","data-active":"false","aria-expanded":"false"}});return t.addEventListener("click",e=>{e.stopPropagation(),this.toggle()}),t}createMainPanel(){let t=oe(),e=ae();this.layoutTitle=document.createElement("input"),this.layoutTitle.setAttribute("data-stdg-input",""),this.layoutTitle.setAttribute("data-stdg-panel-title",""),this.layoutTitle.type="text",this.layoutTitle.value=this.panelTitleValue,this.layoutTitle.addEventListener("blur",()=>{let n=this.layoutTitle.value.trim()||"Layout";n!==this.panelTitleValue&&(this.panelTitleValue=n,this.onRenamePanelTitle(n)),this.layoutTitle.value=n}),this.layoutTitle.addEventListener("keydown",n=>{n.stopPropagation(),n.key==="Enter"&&this.layoutTitle.blur(),n.key==="Escape"&&(this.layoutTitle.value=this.panelTitleValue.trim()||"Layout",this.layoutTitle.blur())}),this.layoutTitle.addEventListener("click",n=>{n.stopPropagation(),this.startLayoutTitleRename()}),this.layoutSettingsToggle=tt({icon:"options",label:"Layout Settings",modifiers:["toggle","left"],attrs:{"data-active":"false"}}),this.layoutSettingsToggle.addEventListener("click",n=>{n.stopPropagation(),this.isLayoutSettingsOpen?this.closeLayoutPanel():this.openLayoutPanel()});let r=tt({icon:"close",label:"Close layout guides",modifiers:["right"]});r.addEventListener("click",n=>{n.stopPropagation(),this.hide()}),this.headerAddButton=tt({icon:"plus",label:"Add Layout Guide",modifiers:["toggle","left"],attrs:{"data-active":"false"}}),this.headerAddButton.addEventListener("click",n=>{n.stopPropagation(),this.openAddPanel()}),e.appendChild(this.layoutTitle),e.appendChild(this.headerAddButton),e.appendChild(r);let i=document.createElement("div");return i.setAttribute("data-stdg-panel-responsive",""),this.layoutChipTabs=document.createElement("div"),this.layoutChipTabs.setAttribute("data-stdg-panel-list",""),i.appendChild(this.layoutSettingsToggle),i.appendChild(this.layoutChipTabs),this.listContainer=le({"data-string-grid-list":""}),this.addGuideButton=Ht({icon:"plus",label:"Add Layout Guide",withLabel:!0,attrs:{"data-active":"false"}}),this.addGuideButton.addEventListener("click",n=>{n.stopPropagation(),this.openAddPanel()}),this.listContainer.appendChild(this.addGuideButton),t.appendChild(e),t.appendChild(i),t.appendChild(this.listContainer),t}createAddPanel(){let t=oe({"data-panel":"add"}),e=ae(),r=tt({icon:"close",label:"Close panel",modifiers:["right"]});return r.addEventListener("click",i=>{i.stopPropagation(),this.closeAddPanel()}),e.appendChild(r),this.addGridList=le({"data-string-grid-add-grid-list":"","data-stdg-panel-content-50":""}),this.renderAddPanelList(),t.appendChild(e),t.appendChild(this.addGridList),t}renderAddPanelList(){if(this.addGridList.innerHTML="",this.adapterRegistry.size===0){let t=document.createElement("div");t.setAttribute("data-string-grid-add-grid-empty",""),t.textContent="No layout guides available",this.addGridList.appendChild(t);return}for(let[,t]of this.adapterRegistry){let e=Ht({icon:"",label:t.label,withLabel:!0});e.innerHTML=`${t.icon.replace("<svg","<svg data-stdg-icon-16")}<span>${t.label}</span>`,e.addEventListener("click",r=>{r.stopPropagation(),this.onAdd(t.type),this.closeAddPanel()}),this.addGridList.appendChild(e)}}createLayoutPanel(){let t=oe({"data-panel":"layout"}),e=ae();this.layoutAddButton=tt({icon:"plus",label:"Add Layout Guide",modifiers:["toggle","left"],attrs:{"data-active":"false"}}),this.layoutAddButton.addEventListener("click",o=>{o.stopPropagation(),this.onAddLayout()});let r=tt({icon:"close",label:"Close panel",modifiers:["right"]});r.addEventListener("click",o=>{o.stopPropagation(),this.closeLayoutPanel()}),e.appendChild(this.layoutAddButton),e.appendChild(r),this.layoutSettingsList=le(),this.layoutIOActions=le({"data-stdg-panel-content-50":""});let i=Ht({icon:"export",label:"Export",withLabel:!0,attrs:{"data-io":"export"}});i.addEventListener("click",o=>{o.stopPropagation(),this.onExport()});let n=Ht({icon:"import",label:"Import",withLabel:!0,attrs:{"data-io":"import"}});n.addEventListener("click",o=>{o.stopPropagation(),this.onImport()}),this.layoutIOActions.appendChild(i),this.layoutIOActions.appendChild(n);let s=document.createElement("span");return s.setAttribute("data-stdg-panel-hr",""),t.appendChild(e),t.appendChild(this.layoutSettingsList),t.appendChild(s),t.appendChild(this.layoutIOActions),t}createDetailPanel(){let t=oe({"data-panel":"detail"}),e=ae();this.detailIcon=document.createElement("span"),this.detailIcon.setAttribute("data-stdg-holder-icon-16",""),this.detailIcon.setAttribute("data-stdg-button-left",""),this.detailTitle=document.createElement("span"),this.detailTitle.addEventListener("click",i=>{i.stopPropagation(),this.startDetailRename()});let r=tt({icon:"close",label:"Close detail panel",modifiers:["right"]});return r.addEventListener("click",i=>{i.stopPropagation(),this.closeDetailPanel()}),e.appendChild(this.detailIcon),e.appendChild(this.detailTitle),e.appendChild(r),this.detailContent=document.createElement("div"),this.detailContent.setAttribute("data-string-dev-detail-body",""),t.appendChild(e),t.appendChild(this.detailContent),t}renderLayoutChips(){this.layoutChipTabs.innerHTML="";let t=e=>{this.selectedLayoutId=e,this.renderLayoutChips(),this.renderLayoutSettings()};[...this.layouts].reverse().forEach(e=>{let r=Ht({icon:"",label:`Select ${e.label} layout`});r.innerHTML=`<span>${e.label}</span>`,r.setAttribute("data-active",String(e.id===this.selectedLayoutId)),r.setAttribute("data-resolved",String(e.id===this.resolvedLayoutId)),r.setAttribute("data-mode",e.label),r.addEventListener("click",i=>{i.stopPropagation(),t(e.id),this.onSelectLayout(e.id)}),this.layoutChipTabs.appendChild(r)}),this.layoutSettingsToggle.setAttribute("data-active",String(this.isLayoutSettingsOpen))}renderLayoutSettings(){this.layoutSettingsList.innerHTML="",this.layoutAddButton.style.display=this.layouts.length>=4?"none":"";let{breakpointsRow:t,inputField:e}=this.createBreakpointWidget();this.layoutSettingsList.appendChild(t),this.layoutSettingsList.appendChild(e)}createBreakpointWidget(){let t=[...this.layouts].reverse(),e=t.length>2,r=document.createElement("div");r.setAttribute("data-stdg-panel-breakpoints","");let i=document.createElement("div");i.setAttribute("data-stdg-panel-field","");let n=`st-dg-break-${Date.now()}`,s=document.createElement("span");s.innerHTML=V(16,"break","second");let o=document.createElement("input");o.id=n,o.type="number",o.inputMode="numeric",o.step="1",o.min="1",o.setAttribute("data-stdg-input","");let a=document.createElement("label");a.htmlFor=n,a.setAttribute("data-stdg-field-input-disable",""),a.textContent="px",i.appendChild(s),i.appendChild(o),i.appendChild(a);let l=null,c=null,u=0,p=(h,f,b,y=!1)=>{c?.setAttribute("data-active","false"),l=h,c=b,u=f,this.selectedBreakpointLayoutId=h,b.setAttribute("data-active","true"),o.value=String(f),y&&(o.focus(),o.select())},g=()=>{if(!l||!o.isConnected)return;let h=Number.parseInt(o.value,10);if(Number.isFinite(h)&&h>=0){if(h===u)return;u=h,this.onUpdateLayoutMinWidth(l,h)}else o.value=String(u)};o.addEventListener("keydown",h=>{if(h.stopPropagation(),h.key==="Enter"){g();return}h.key==="Escape"&&(o.value=String(u),o.blur())}),o.addEventListener("blur",()=>requestAnimationFrame(g)),o.addEventListener("click",h=>h.stopPropagation());let m=null;if(t.forEach((h,f)=>{let b=document.createElement("div");b.setAttribute("data-stdg-panel-breakpoint-value","");let y=document.createElement("span");if(y.textContent=h.label,b.appendChild(y),e&&f>=2){let v=yi(`Remove ${h.label} layout`);v.addEventListener("pointerdown",S=>S.stopPropagation()),v.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation(),this.layouts.length>2&&this.onRemoveLayout(h.id)}),b.appendChild(v)}if(r.appendChild(b),f<t.length-1){let v=t[f+1],S=document.createElement("button");S.type="button",S.setAttribute("data-stdg-button",""),S.setAttribute("data-stdg-panel-breakpoint-marker",""),S.setAttribute("data-active","false"),S.setAttribute("aria-label",`Edit ${v.label} breakpoint`);let E=document.createElement("span");E.textContent=String(v.minWidth),S.appendChild(E),S.addEventListener("click",M=>{M.stopPropagation(),p(v.id,v.minWidth,S,!0)}),r.appendChild(S),(this.selectedBreakpointLayoutId===v.id||m===null&&this.selectedBreakpointLayoutId===null)&&(m={layoutId:v.id,value:v.minWidth,el:S})}}),m!==null){let h=m;p(h.layoutId,h.value,h.el)}return{breakpointsRow:r,inputField:i}}syncChipRowStates(){this.layoutChipTabs.querySelectorAll("[data-stdg-panel-button][data-mode]").forEach(e=>{let r=e.getAttribute("data-mode"),i=this.layouts.find(n=>n.label===r);i&&(e.setAttribute("data-active",String(i.id===this.selectedLayoutId)),e.setAttribute("data-resolved",String(i.id===this.resolvedLayoutId)))})}renderList(){for(;this.addGuideButton.nextSibling;)this.listContainer.removeChild(this.addGuideButton.nextSibling);for(let e of this.instances){let r=this.adapterRegistry.get(e.type);if(!r)continue;let i=document.createElement("div");i.setAttribute("data-stdg-panel-list-item",""),i.setAttribute("data-stdg-button",""),i.setAttribute("data-stdg-button-toggle",""),i.setAttribute("data-active",String(e.id===this.selectedInstanceId)),i.innerHTML=`${V(16,"grab","second")}${r.icon.replace("<svg","<svg data-stdg-icon-16")}<span>${e.name?.trim()||r.label}</span>`;let n=this.createToggle(e.visible,()=>this.onToggle(e.id)),s=yi(`Remove ${e.name?.trim()||"instance"}`);s.addEventListener("click",o=>{o.stopPropagation(),this.selectedInstanceId===e.id&&this.closeDetailPanel(),this.onRemove(e.id)}),i.appendChild(n),i.appendChild(s),i.addEventListener("click",()=>{this.selectedInstanceId===e.id?this.closeDetailPanel():this.selectInstance(e.id)}),i.setAttribute("draggable","true"),i.addEventListener("dragstart",o=>{o.stopPropagation(),o.dataTransfer?.setData("text/plain",e.id),i.setAttribute("data-dragging","true")}),i.addEventListener("dragend",()=>{i.removeAttribute("data-dragging"),this.listContainer.querySelectorAll("[data-drag-over]").forEach(o=>o.removeAttribute("data-drag-over"))}),i.addEventListener("dragover",o=>{o.preventDefault(),o.stopPropagation();let a=i.getBoundingClientRect(),l=o.clientY<a.top+a.height/2?"before":"after";this.listContainer.querySelectorAll("[data-drag-over]").forEach(c=>c.removeAttribute("data-drag-over")),i.setAttribute("data-drag-over",l)}),i.addEventListener("dragleave",o=>{i.contains(o.relatedTarget)||i.removeAttribute("data-drag-over")}),i.addEventListener("drop",o=>{o.preventDefault(),o.stopPropagation();let a=o.dataTransfer?.getData("text/plain");if(i.removeAttribute("data-drag-over"),!a||a===e.id)return;let l=i.getBoundingClientRect(),c=o.clientY<l.top+l.height/2?"before":"after";this.onReorder(a,e.id,c)}),this.listContainer.appendChild(i)}this.addGuideButton.setAttribute("data-empty",String(this.instances.length===0));let t=this.instances.length>0;this.addGuideButton.style.display=t?"none":"",this.headerAddButton.style.display=t?"":"none"}renderDetailPanel(){if(!this.selectedInstanceId){this.hideDetailPanelUI();return}let t=this.instances.find(i=>i.id===this.selectedInstanceId);if(!t){this.clearSelection();return}let e=this.adapterRegistry.get(t.type);if(!e){this.clearSelection();return}this.detailIcon&&(this.detailIcon.innerHTML=e.icon.replace("<svg","<svg data-stdg-icon-16 data-stdg-icon-second")),this.detailTitle&&(this.detailTitle.textContent=t.name?.trim()||e.label),this.detailBuilder?.destroy(),this.detailBuilder=new _r;let r=this.detailBuilder.build(e.getUISchema(),t.settings,(i,n)=>this.onSettingChange(t.id,i,n));for(;this.detailContent.firstChild;)this.detailContent.removeChild(this.detailContent.firstChild);this.detailContent.appendChild(r),this.detailPanel.setAttribute("data-open","true"),this.alignDetailPanel(),this.syncPanelPlacement()}createToggle(t,e){let r=document.createElement("label");r.setAttribute("data-stdg-toggle",""),r.setAttribute("data-checked",String(t));let i=document.createElement("input");i.type="checkbox",i.checked=t,i.setAttribute("data-stdg-toggle-input",""),i.addEventListener("change",s=>{s.stopPropagation(),e()});let n=document.createElement("span");return n.setAttribute("data-stdg-toggle-knob",""),r.addEventListener("click",s=>s.stopPropagation()),r.appendChild(i),r.appendChild(n),r}startDetailRename(){if(!this.selectedInstanceId||!this.detailTitle)return;let t=this.instances.find(o=>o.id===this.selectedInstanceId);if(!t)return;let e=this.adapterRegistry.get(t.type);if(!e)return;let r=t.name?.trim()||e.label,i=this.detailTitle.parentElement;if(!i)return;let n=document.createElement("input");n.setAttribute("data-stdg-input",""),n.type="text",n.value=r;let s=()=>{let o=n.value.trim();o!==r&&this.onRenameInstance(t.id,o),i.contains(n)&&i.replaceChild(this.detailTitle,n)};n.addEventListener("blur",s),n.addEventListener("keydown",o=>{o.key==="Enter"&&n.blur(),o.key==="Escape"&&(n.value=r,n.blur())}),n.addEventListener("click",o=>o.stopPropagation()),n.addEventListener("pointerdown",o=>o.stopPropagation()),i.replaceChild(n,this.detailTitle),n.focus(),n.select()}startLayoutTitleRename(){this.layoutTitle.select()}openAddPanel(){this.isAddPanelOpen=!0,this.closeLayoutPanel(),this.clearSelection(),this.renderAddPanelList(),this.addPanel.setAttribute("data-open","true"),this.syncPanelPlacement()}closeAddPanel(){this.isAddPanelOpen=!1,this.addPanel.setAttribute("data-open","false"),this.syncPanelPlacement()}openLayoutPanel(){this.isLayoutSettingsOpen=!0,this.closeAddPanel(),this.clearSelection(),this.layoutPanel.setAttribute("data-open","true"),this.renderLayoutChips(),this.alignLayoutPanel(),this.syncPanelPlacement(),this.onLayoutPanelOpen()}closeLayoutPanel(){this.isLayoutSettingsOpen=!1,this.layoutPanel.setAttribute("data-open","false"),this.renderLayoutChips(),this.syncPanelPlacement(),this.onLayoutPanelClose()}alignLayoutPanel(){if(this.isMobilePanelMode()){this.layoutPanel.style.removeProperty("top");return}if(this.hudRoot.getAttribute("data-target-id")==="__global__"){this.layoutPanel.style.removeProperty("top");return}let t=this.layoutSettingsToggle.getBoundingClientRect(),e=this.panel.getBoundingClientRect();this.layoutPanel.style.top=`${t.top-e.top}px`}selectInstance(t){this.selectedInstanceId=t,this.closeLayoutPanel(),this.closeAddPanel(),this.renderList(),this.renderDetailPanel()}closeDetailPanel(){this.clearSelection(),this.renderList()}clearSelection(){this.selectedInstanceId=null,this.hideDetailPanelUI()}hideDetailPanelUI(){let t=this.detailBuilder;this.detailBuilder=null,this.detailPanel.setAttribute("data-open","false"),this.syncPanelPlacement(),window.setTimeout(()=>{this.detailPanel.getAttribute("data-open")==="false"&&(t?.destroy(),this.detailContent.innerHTML="",this.detailPanel.style.removeProperty("top"))},220)}alignDetailPanel(){if(this.isMobilePanelMode()){this.detailPanel.style.removeProperty("top");return}if(this.hudRoot.getAttribute("data-target-id")==="__global__"){this.detailPanel.style.removeProperty("top");return}let t=this.listContainer.querySelector('[data-stdg-panel-list-item][data-active="true"]');if(!t)return;let e=t.getBoundingClientRect(),r=this.panel.getBoundingClientRect();this.detailPanel.style.top=`${e.top-r.top}px`}show(){this.isOpen=!0,this.panel.setAttribute("data-open","true"),this.trigger.setAttribute("data-active","true"),this.trigger.setAttribute("aria-expanded","true"),this.syncPanelPlacement(),this.onHUDOpen()}hide(){this.isOpen=!1,this.panel.setAttribute("data-open","false"),this.closeAddPanel(),this.closeDetailPanel(),this.closeLayoutPanel(),this.trigger.setAttribute("data-active","false"),this.trigger.setAttribute("aria-expanded","false"),this.syncPanelPlacement(),this.onHUDClose()}toggle(){this.enabled&&(this.isOpen?this.hide():this.show())}isMobilePanelMode(){return typeof window>"u"?!1:window.matchMedia("(max-width: 1024px), (pointer: coarse)").matches}syncPanelPlacement(){if(!this.isMobilePanelMode()){this.panelInBody&&(this.panel.removeAttribute("data-mobile-sheet"),this.panel.style.removeProperty("position"),this.panel.style.removeProperty("bottom"),this.hudRoot.appendChild(this.panel),this.panelInBody=!1),this.hudRoot.setAttribute("data-mobile-sheet","false"),this.panel.style.removeProperty("left"),this.panel.style.removeProperty("top"),this.panel.style.removeProperty("width"),this.panel.style.removeProperty("height"),this.panel.style.removeProperty("max-height");return}if(!this.isOpen)return;this.panelInBody||((document.body??document.documentElement).appendChild(this.panel),this.panelInBody=!0);let e=window.visualViewport,r=e?.width??window.innerWidth,i=e?.height??window.innerHeight,n=Math.max(220,r-wi*2),s=Math.max(120,i-wi*2),o=Math.min(mo,n),a=Math.min(fo,s),l=Math.round((e?.offsetLeft??0)+(r-o)/2);this.hudRoot.setAttribute("data-mobile-sheet","true"),this.panel.setAttribute("data-mobile-sheet","true"),this.panel.style.position="fixed",this.panel.style.left=`${l}px`,this.panel.style.bottom=`${wi}px`,this.panel.style.removeProperty("top"),this.panel.style.width=`${Math.round(o)}px`,this.panel.style.maxHeight=`${Math.round(a)}px`,this.panel.style.removeProperty("height"),this.addPanel.style.removeProperty("top"),this.layoutPanel.style.removeProperty("top"),this.detailPanel.style.removeProperty("top")}onDocumentPointerDown(t){if(!this.isOpen)return;let e=t.target;e instanceof Node&&(this.panel.contains(e)||this.trigger.contains(e)||this.addPanel.contains(e)||this.layoutPanel.contains(e)||this.detailPanel.contains(e)||this.hide())}};var Mt=class{static VERSION=2;static serialize(t,e){return{v:this.VERSION,source:"StringDevLayout",selectedLayout:e,layouts:t.map(r=>({id:r.id,label:r.label,minWidth:r.minWidth,grids:r.instances.map(i=>({id:i.id,type:i.type,visible:i.visible,...i.name!==void 0?{name:i.name}:{},settings:{...i.settings}}))}))}}static deserialize(t,e){if(!t||typeof t!="object")return null;let r=t,i=r.v,n=r.source;if(n!=="StringDevLayout"&&n!=="StringGrid"||i!==1&&i!==2||!Array.isArray(r.layouts))return null;let s=r.layouts.filter(l=>!!l&&typeof l=="object"&&typeof l.id=="string").map((l,c)=>({id:l.id,label:Ei.includes(l.label)?l.label:"S",minWidth:this.resolveImportedMinWidth(l.minWidth,c),instances:(Array.isArray(l.grids)?l.grids:[]).filter(u=>!!u&&typeof u=="object"&&typeof u.type=="string"&&e.has(u.type)).map(u=>{let p=u.type,g=e.get(p);return{id:typeof u.id=="string"?u.id:Pr(),type:p,visible:u.visible!==!1,...typeof u.name=="string"&&u.name?{name:u.name}:{},settings:{...g.getDefaults(),...u.settings&&typeof u.settings=="object"&&!Array.isArray(u.settings)?u.settings:{}}}})}));if(s.length===0)return null;s.sort((l,c)=>c.minWidth-l.minWidth);let o=typeof r.selectedLayout=="string"?r.selectedLayout:typeof r.activeLayout=="string"?r.activeLayout:s[0].id,a=s.some(l=>l.id===o)?o:s[0].id;return{layouts:s,selectedLayoutId:a}}static toFile(t,e){let r=JSON.stringify(e,null,2),i=new Blob([r],{type:"application/json"}),n=URL.createObjectURL(i),s=document.createElement("a");s.href=n,s.download=t,s.click(),URL.revokeObjectURL(n)}static fromFile(){return new Promise((t,e)=>{let r=document.createElement("input");r.type="file",r.accept=".json,application/json";let i=()=>r.remove();r.addEventListener("change",()=>{let n=r.files?.[0];if(!n){i(),e(new Error("No file selected"));return}let s=new FileReader;s.onload=()=>{i();try{t(JSON.parse(s.result))}catch{e(new Error("Invalid JSON"))}},s.onerror=()=>{i(),e(new Error("File read error"))},s.readAsText(n)}),r.addEventListener("cancel",()=>{i(),e(new Error("Cancelled"))}),document.body.appendChild(r),r.click()})}static resolveImportedMinWidth(t,e){return typeof t=="number"&&Number.isFinite(t)?de(t):[1280,1024,768,0][e]??Math.max(0,1280-e*256)}};var Fr="http://www.w3.org/2000/svg",G=class{clear(t,e){let r=t.querySelector(`[data-grid-id="${e}"]`);r&&r.remove()}getGroup(t,e){let r=t.querySelector(`[data-grid-id="${e}"]`);return r||(r=document.createElementNS(Fr,"g"),r.setAttribute("data-grid-id",e),t.appendChild(r)),r}createLine(t,e,r,i,n,s,o=1){let a=document.createElementNS(Fr,"line");return a.setAttribute("data-string-grid-shape","line"),a.setAttribute("x1",String(t)),a.setAttribute("y1",String(e)),a.setAttribute("x2",String(r)),a.setAttribute("y2",String(i)),a.setAttribute("stroke",n),a.setAttribute("stroke-opacity",String(s)),a.setAttribute("stroke-width",String(o)),a}createRect(t,e,r,i,n,s){let o=document.createElementNS(Fr,"rect");return o.setAttribute("data-string-grid-shape","rect"),o.setAttribute("x",String(t)),o.setAttribute("y",String(e)),o.setAttribute("width",String(r)),o.setAttribute("height",String(i)),o.setAttribute("fill",n),o.setAttribute("fill-opacity",String(s)),o}resolveUnit(t,e,r,i){let n=parseFloat(getComputedStyle(document.documentElement).fontSize)||16,s=i instanceof Element&&parseFloat(getComputedStyle(i).fontSize)||n;switch(e){case"%":return t/100*r;case"vw":return t/100*window.innerWidth;case"vh":return t/100*window.innerHeight;case"em":return t*s;case"rem":return t*n;default:return t}}createPath(t,e,r,i=1,n="none"){let s=document.createElementNS(Fr,"path");return s.setAttribute("data-string-grid-shape","path"),s.setAttribute("d",t),s.setAttribute("stroke",e),s.setAttribute("stroke-opacity",String(r)),s.setAttribute("stroke-width",String(i)),s.setAttribute("fill",n),s}};var Vr=class d extends G{type="columns";label="Columns";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7" y="3" width="2" height="10" fill="currentColor"/><rect x="3" y="3" width="2" height="10" fill="currentColor"/><rect x="11" y="3" width="2" height="10" fill="currentColor"/></svg>';static UNIT_OPTIONS=[{value:"px",label:"px"},{value:"%",label:"%"},{value:"vw",label:"vw"},{value:"vh",label:"vh"},{value:"em",label:"em"},{value:"rem",label:"rem"}];getDefaults(){return{count:12,gap:20,gapUnit:"px",margin:0,marginUnit:"px",color:"#4a90e2",opacity:.15,showLines:!1}}getUISchema(){return[{type:"number",key:"count",label:"Columns",default:12,min:1,max:48,step:1},{type:"range",key:"gap",label:"Gap",default:20,min:0,max:100,step:1,units:d.UNIT_OPTIONS,defaultUnit:"px"},{type:"range",key:"margin",label:"Margin",default:0,min:0,max:100,step:1,units:d.UNIT_OPTIONS,defaultUnit:"px"},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#4a90e2"},{type:"range",key:"opacity",label:"Opacity",default:.15,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10},{type:"toggle",key:"showLines",label:"Lines only",default:!1}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{count:s,gap:o,gapUnit:a,margin:l,marginUnit:c,color:u,opacity:p,showLines:g}=i,m=t.parentElement,h=this.resolveUnit(o,a||"px",e,m),f=this.resolveUnit(l,c||"px",e,m),b=e-f*2,y=(s-1)*h,v=(b-y)/s;if(!(v<=0))for(let S=0;S<s;S++){let E=f+S*(v+h);g?(n.appendChild(this.createLine(E,0,E,r,u,p)),n.appendChild(this.createLine(E+v,0,E+v,r,u,p))):n.appendChild(this.createRect(E,0,v,r,u,p))}}};var Wr=class d extends G{type="rows";label="Rows";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="10" height="2" fill="currentColor"/><rect x="3" y="7" width="10" height="2" fill="currentColor"/><rect x="3" y="11" width="10" height="2" fill="currentColor"/></svg>';static UNIT_OPTIONS=[{value:"px",label:"px"},{value:"%",label:"%"},{value:"vh",label:"vh"},{value:"vw",label:"vw"},{value:"em",label:"em"},{value:"rem",label:"rem"}];getDefaults(){return{mode:"count",count:8,size:24,sizeUnit:"px",gap:0,gapUnit:"px",margin:0,marginUnit:"px",color:"#e2784a",opacity:.2,style:"line"}}getUISchema(){return[{type:"select",key:"mode",label:"Mode",default:"count",options:[{value:"count",label:"By count"},{value:"size",label:"By size"}]},{type:"number",key:"count",label:"Rows",default:8,min:1,max:48,step:1,disabledWhen:{key:"mode",equals:"size"}},{type:"range",key:"size",label:"Size",default:24,min:0,max:1200,step:1,units:d.UNIT_OPTIONS,defaultUnit:"px",disabledWhen:{key:"mode",equals:"count"}},{type:"range",key:"gap",label:"Gap",default:0,min:0,max:100,step:1,units:d.UNIT_OPTIONS,defaultUnit:"px"},{type:"range",key:"margin",label:"Margin",default:0,min:0,max:100,step:1,units:d.UNIT_OPTIONS,defaultUnit:"px"},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#e2784a"},{type:"range",key:"opacity",label:"Opacity",default:.2,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10},{type:"select",key:"style",label:"Style",default:"line",options:[{value:"line",label:"Lines"},{value:"fill",label:"Fill"}]}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{mode:s,count:o,size:a,sizeUnit:l,gap:c,gapUnit:u,margin:p,marginUnit:g,color:m,opacity:h,style:f}=i,b=t.parentElement,y=this.resolveUnit(c,u||"px",r,b),v=this.resolveUnit(p,g||"px",r,b),S=r-v*2;if(!(S<=0))if(s==="count")this.renderByCount(n,e,S,v,o,y,m,h,f);else{let E=this.resolveUnit(a,l||"px",r,b);if(E<=0)return;this.renderBySize(n,e,S,v,E,y,m,h,f)}}renderByCount(t,e,r,i,n,s,o,a,l){if(l==="fill"){let c=(r-(n-1)*s)/n;if(c<=0)return;for(let u=0;u<n;u++){let p=i+u*(c+s);t.appendChild(this.createRect(0,p,e,c,o,a))}}else{if(n===1){let u=i+r/2;t.appendChild(this.createLine(0,u,e,u,o,a));return}let c=r/(n-1);for(let u=0;u<n;u++){let p=i+u*c;t.appendChild(this.createLine(0,p,e,p,o,a))}}}renderBySize(t,e,r,i,n,s,o,a,l){if(l==="fill"){let c=n+s;for(let u=0;u<r;u+=c){let p=Math.min(n,r-u);t.appendChild(this.createRect(0,i+u,e,p,o,a))}}else for(let c=0;c<=r;c+=n)t.appendChild(this.createLine(0,i+c,e,i+c,o,a))}};var Nr=class extends G{type="center";label="Center";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="10" height="10" rx="3" fill="currentColor"/><path d="M8 2V14" stroke="white"/><path d="M2 8H14" stroke="white"/></svg>';getDefaults(){return{showVertical:!0,showHorizontal:!0,color:"#50e24a",opacity:.5,dashed:!0}}getUISchema(){return[{type:"toggle",key:"showVertical",label:"Vertical",default:!0},{type:"toggle",key:"showHorizontal",label:"Horizontal",default:!0},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#50e24a"},{type:"range",key:"opacity",label:"Opacity",default:.5,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10},{type:"toggle",key:"dashed",label:"Dashed",default:!0}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{showVertical:s,showHorizontal:o,color:a,opacity:l,dashed:c}=i,u=c?"6 3":"none";if(s){let p=this.createLine(e/2,0,e/2,r,a,l);c&&p.setAttribute("stroke-dasharray",u),n.appendChild(p)}if(o){let p=this.createLine(0,r/2,e,r/2,a,l);c&&p.setAttribute("stroke-dasharray",u),n.appendChild(p)}}};var zr=class extends G{type="rule-of-thirds";label="3\xD73";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="6" y="6" width="4" height="4" fill="currentColor"/><path d="M6 3.6C6 3.03995 6 2.75992 6.10899 2.54601C6.20487 2.35785 6.35785 2.20487 6.54601 2.10899C6.75992 2 7.03995 2 7.6 2H8.4C8.96005 2 9.24008 2 9.45399 2.10899C9.64215 2.20487 9.79513 2.35785 9.89101 2.54601C10 2.75992 10 3.03995 10 3.6V5H6V3.6Z" fill="currentColor"/><path d="M6 11H10V12.4C10 12.9601 10 13.2401 9.89101 13.454C9.79513 13.6422 9.64215 13.7951 9.45399 13.891C9.24008 14 8.96005 14 8.4 14H7.6C7.03995 14 6.75992 14 6.54601 13.891C6.35785 13.7951 6.20487 13.6422 6.10899 13.454C6 13.2401 6 12.9601 6 12.4V11Z" fill="currentColor"/><path d="M2 7.6C2 7.03995 2 6.75992 2.10899 6.54601C2.20487 6.35785 2.35785 6.20487 2.54601 6.10899C2.75992 6 3.03995 6 3.6 6H5V10H3.6C3.03995 10 2.75992 10 2.54601 9.89101C2.35785 9.79513 2.20487 9.64215 2.10899 9.45399C2 9.24008 2 8.96005 2 8.4V7.6Z" fill="currentColor"/><path d="M11 6H12.4C12.9601 6 13.2401 6 13.454 6.10899C13.6422 6.20487 13.7951 6.35785 13.891 6.54601C14 6.75992 14 7.03995 14 7.6V8.4C14 8.96005 14 9.24008 13.891 9.45399C13.7951 9.64215 13.6422 9.79513 13.454 9.89101C13.2401 10 12.9601 10 12.4 10H11V6Z" fill="currentColor"/></svg>';getDefaults(){return{color:"#e2e24a",opacity:.4,showIntersections:!0}}getUISchema(){return[{type:"color",key:"color",label:"Color",default:"#e2e24a"},{type:"range",key:"opacity",label:"Opacity",default:.4,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10},{type:"toggle",key:"showIntersections",label:"Show points",default:!0}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{color:s,opacity:o,showIntersections:a}=i,l=e/3,c=r/3;if(n.appendChild(this.createLine(l,0,l,r,s,o)),n.appendChild(this.createLine(l*2,0,l*2,r,s,o)),n.appendChild(this.createLine(0,c,e,c,s,o)),n.appendChild(this.createLine(0,c*2,e,c*2,s,o)),a){let u=[[l,c],[l*2,c],[l,c*2],[l*2,c*2]];for(let[p,g]of u){let m=document.createElementNS("http://www.w3.org/2000/svg","circle");m.setAttribute("cx",String(p)),m.setAttribute("cy",String(g)),m.setAttribute("r","3"),m.setAttribute("fill",s),m.setAttribute("fill-opacity",String(o*1.5)),n.appendChild(m)}}}};var xi=1.6180339887,Gr=class extends G{type="golden-rectangle";label="Golden";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="10" height="10" rx="3" fill="currentColor"/><path d="M9 13V3" stroke="white"/><path d="M13 9H9" stroke="white"/></svg>';getDefaults(){return{depth:8,showSpiral:!0,color:"#e2a44a",opacity:.4}}getUISchema(){return[{type:"number",key:"depth",label:"Depth",default:8,min:2,max:14,step:1},{type:"toggle",key:"showSpiral",label:"Show spiral",default:!0},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#e2a44a"},{type:"range",key:"opacity",label:"Opacity",default:.4,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{depth:s,showSpiral:o,color:a,opacity:l}=i,c,u;e/r>=xi?(u=r,c=u*xi):(c=e,u=c/xi);let p=(e-c)/2,g=(r-u)/2;if(c<e-1||u<r-1){let S=this.createPath(`M ${p} ${g} L ${p+c} ${g} L ${p+c} ${g+u} L ${p} ${g+u} Z`,a,l*.3,1);S.setAttribute("stroke-dasharray","6 4"),n.appendChild(S)}let m=p,h=g,f=c,b=u,y="",v=!0;for(let S=0;S<s&&!(f<1||b<1);S++){let E=S%4,M=Math.min(f,b),C,A;switch(E){case 0:{C=m+f-M,A=h,f-M>.5&&n.appendChild(this.createLine(C,h,C,h+b,a,l)),o&&(v&&(y=`M ${C+M} ${A}`,v=!1),y+=` A ${M} ${M} 0 0 1 ${C} ${A+M}`),f-=M;break}case 1:{C=m,A=h+b-M,b-M>.5&&n.appendChild(this.createLine(m,A,m+f,A,a,l)),o&&(v&&(y=`M ${C+M} ${A+M}`,v=!1),y+=` A ${M} ${M} 0 0 1 ${C} ${A}`),b-=M;break}case 2:{C=m,A=h,f-M>.5&&n.appendChild(this.createLine(m+M,h,m+M,h+b,a,l)),o&&(v&&(y=`M ${C} ${A+M}`,v=!1),y+=` A ${M} ${M} 0 0 1 ${C+M} ${A}`),m+=M,f-=M;break}case 3:{C=m,A=h,b-M>.5&&n.appendChild(this.createLine(m,h+M,m+f,h+M,a,l)),o&&(v&&(y=`M ${C} ${A}`,v=!1),y+=` A ${M} ${M} 0 0 1 ${C+M} ${A+M}`),h+=M,b-=M;break}}}o&&y&&n.appendChild(this.createPath(y,a,l*.8,1.5))}};var Ci="http://www.w3.org/2000/svg",$r=class d extends G{static MAX_DOT_CELLS=12e4;static MAX_CROSS_CELLS=8e4;type="dot-grid";label="Dots";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="11" y="3" width="2" height="2" fill="currentColor"/><rect x="11" y="7" width="2" height="2" fill="currentColor"/><rect x="11" y="11" width="2" height="2" fill="currentColor"/><rect x="7" y="3" width="2" height="2" fill="currentColor"/><rect x="7" y="7" width="2" height="2" fill="currentColor"/><rect x="7" y="11" width="2" height="2" fill="currentColor"/><rect x="3" y="3" width="2" height="2" fill="currentColor"/><rect x="3" y="7" width="2" height="2" fill="currentColor"/><rect x="3" y="11" width="2" height="2" fill="currentColor"/></svg>';static UNIT_OPTIONS=[{value:"px",label:"px"},{value:"%",label:"%"},{value:"vw",label:"vw"},{value:"vh",label:"vh"},{value:"em",label:"em"},{value:"rem",label:"rem"}];getDefaults(){return{step:16,stepUnit:"px",dotSize:1.5,shape:"dot",color:"#a0a0a0",opacity:.4}}getUISchema(){return[{type:"range",key:"step",label:"Step",default:16,min:0,max:100,step:1,units:d.UNIT_OPTIONS,defaultUnit:"px"},{type:"range",key:"dotSize",label:"Size",default:1.5,min:.5,max:6,step:.5},{type:"select",key:"shape",label:"Shape",default:"dot",options:[{value:"dot",label:"Dot \u25CF"},{value:"cross",label:"Cross +"}]},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#a0a0a0"},{type:"range",key:"opacity",label:"Opacity",default:.4,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{step:s,stepUnit:o,dotSize:a,shape:l,color:c,opacity:u}=i,p=this.resolveUnit(s,o||"px",Math.min(e,r),t.parentElement),g=this.getSafeStep(e,r,p,l);if(g<2)return;let m=this.getPatternId(i.__instanceId),h=this.getDefs(t),f=document.createElementNS(Ci,"pattern");f.setAttribute("id",m),f.setAttribute("data-string-grid-pattern-for",i.__instanceId),f.setAttribute("patternUnits","userSpaceOnUse"),f.setAttribute("width",String(g)),f.setAttribute("height",String(g)),f.setAttribute("x",String(g/2)),f.setAttribute("y",String(g/2));let b=g/2;if(l==="cross")f.appendChild(this.createLine(b-a*2,b,b+a*2,b,c,u,.8)),f.appendChild(this.createLine(b,b-a*2,b,b+a*2,c,u,.8));else{let v=document.createElementNS(Ci,"circle");v.setAttribute("cx",String(b)),v.setAttribute("cy",String(b)),v.setAttribute("r",String(a)),v.setAttribute("fill",c),v.setAttribute("fill-opacity",String(u)),f.appendChild(v)}h.appendChild(f);let y=this.createRect(0,0,e,r,`url(#${m})`,1);y.setAttribute("fill-opacity","1"),n.appendChild(y)}clear(t,e){super.clear(t,e),t.querySelector(`[data-string-grid-pattern-for="${e}"]`)?.remove()}getDefs(t){let e=t.querySelector("defs");return e||(e=document.createElementNS(Ci,"defs"),t.insertBefore(e,t.firstChild)),e}getPatternId(t){return`string-grid-dot-pattern-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}`}getSafeStep(t,e,r,i){let s=Math.max(r,2),o=i==="cross"?d.MAX_CROSS_CELLS:d.MAX_DOT_CELLS;return Math.floor(t/s)*Math.floor(e/s)<=o?s:Math.max(s,Math.sqrt(t*e/o))}};var Ur="string-devtools-overlay-layout:change";var Ti=class{entries=new Map;register(t,e,r=1){this.entries.set(t,{order:e,badgeCount:r})}unregister(t){this.entries.delete(t)}resolveAnchor(t,e,r){let i=this.getSorted(),n=i.findIndex(o=>o.id===t),s=0;for(let o=0;o<n;o+=1)s+=i[o].badgeCount;return{docX:e+0+s*31,docY:r+0}}resolveCollisionOffset(t,e,r,i){let n=[],s=t.parentElement;for(;s;){let l=s.getAttribute("string-id")??s.getAttribute("data-string-id");if(l){let c=i(l);c&&n.push(c)}s=s.parentElement}let o=0,a=!0;for(;a;){a=!1;for(let l of n)if(Math.abs(l.docX-e)<50&&Math.abs(l.docY-(r+o))<31){o+=33,a=!0;break}}return o}emitLayoutChange(){window.dispatchEvent(new CustomEvent(Ur))}getSorted(){let t=[];for(let[e,r]of this.entries)t.push({id:e,...r});return t.sort((e,r)=>e.order!==r.order?e.order-r.order:e.id.localeCompare(r.id)),t}},et=new Ti;function Ln(){return`
|
|
1283
|
+
`,t.addEventListener("click",()=>{this.setCollapsed(!this.collapsed)}),t}setCollapsed(t,e=!0){if(this.collapsed=t,this.root.setAttribute("data-collapsed",t?"true":"false"),this.mainButton.setAttribute("data-collapsed",t?"true":"false"),this.mainButton.setAttribute("aria-label",t?"Expand developer tools":"Collapse developer tools"),t){this.suppressPersist=!0;for(let r of this.entries.values())r.definition.getState().active&&r.definition.setActive(!1);this.suppressPersist=!1}else{this.suppressPersist=!0;for(let r of this.entries.values())this.preferences.active[r.definition.id]===!0&&r.definition.setActive(!0);this.suppressPersist=!1}e&&(this.preferences.collapsed=t,this.savePreferences()),this.syncCollapsedLayout()}syncCollapsedLayout(){let t=ot(window.innerWidth).compact,e=t?this.toolsWrap.scrollHeight:this.toolsWrap.scrollWidth;this.toolsWrap.style.maxHeight=t?this.collapsed?"0px":`${e}px`:"",this.toolsWrap.style.maxWidth=t?"":this.collapsed?"0px":`${e}px`,this.toolsWrap.style.opacity=this.collapsed?"0":"1",this.toolsWrap.style.pointerEvents=this.collapsed?"none":"auto"}handleViewportChange(){this.syncCollapsedLayout();for(let t of this.entries.values())t.subBadges&&t.subBadges.getAttribute("data-open")==="true"&&this.positionSubBadges(t.slot,t.subBadges)}renderButton(t,e,r,i){let n=hn(r),s=n?`${e} (${n})`:e;t.setAttribute("data-active",i.active?"true":"false"),t.setAttribute("aria-label",`${s}: ${i.active?"On":"Off"}`),t.title=`${s}: ${i.active?"On":"Off"}`}syncSubBadgeState(t,e,r){let i=r?"true":"false";if(t.setAttribute("data-active",i),!!e){e.setAttribute("data-parent-active",i);for(let n of e.querySelectorAll("[data-stdg-dock-sub-badge]"))n.setAttribute("data-parent-active",i),n.setAttribute("aria-disabled",r?"false":"true")}}applyStoredActiveState(t){let e=this.preferences.active[t.id];if(typeof e!="boolean")return;let r=this.collapsed?!1:e;r!==t.getState().active&&t.setActive(r)}persistActiveState(t,e){this.suppressPersist||this.collapsed||(this.preferences.active[t]=e,this.savePreferences())}loadPreferences(){try{let t=localStorage.getItem(this.dockStorageKey);if(!t)return{collapsed:!1,active:{}};let e=JSON.parse(t);return{collapsed:e.collapsed===!0,active:e.active&&typeof e.active=="object"?e.active:{}}}catch{return{collapsed:!1,active:{}}}}savePreferences(){try{localStorage.setItem(this.dockStorageKey,JSON.stringify(this.preferences))}catch{}}get dockStorageKey(){return it(zs)}};var Lr=class{definitions=new Map;dock=null;register(t){!t||this.definitions.has(t.id)||(this.definitions.set(t.id,t),this.dock||(this.dock=new Sr),this.dock.add(t))}setFPS(t){this.dock?.setFPS(t)}destroy(){this.definitions.clear(),this.dock?.destroy(),this.dock=null}};var Er=class extends x{constructor(t){super(t),this.htmlKey="scroller"}onObjectConnected(t){let e=t.getProperty("scroller-inited");if(e==null||e==""){t.setProperty("scroller-inited","inited");let r=i=>{this.events.emit("wheel",i)};t.setProperty("scroller-wheel-event",r),t.htmlElement.addEventListener("wheel",r)}}onObjectDisconnected(t){t.setProperty("scroller-inited",""),t.htmlElement.removeEventListener("wheel",t.getProperty("scroller-wheel-event"))}};var Mr=class extends x{states=new WeakMap;constructor(t){super(t),this.htmlKey="scroll-container",this.attributesToMap.push({key:"lerp",type:"number",fallback:.1})}onObjectConnected(t){super.onObjectConnected(t);let e=t.htmlElement;getComputedStyle(e).overflowY==="visible"&&(e.style.overflowY="auto");let r={current:e.scrollTop,target:e.scrollTop,maxScroll:e.scrollHeight-e.clientHeight,velocity:0,lerp:t.getProperty("lerp")||.1,isDragging:!1,isActive:!1};this.states.set(e,r),e.addEventListener("wheel",i=>this.handleWheel(i,e,r),{passive:!1}),e.addEventListener("scroll",i=>this.onNativeScroll(i,e,r),{passive:!0}),this.measure(e,r)}onObjectDisconnected(t){this.states.delete(t.htmlElement)}onFrame(t){for(let e of this.objectsOnPage){let r=e.htmlElement,i=this.states.get(r);i&&i.isActive&&!i.isDragging&&this.updateScroll(r,i)}}onResize(){for(let t of this.objectsOnPage){let e=t.htmlElement,r=this.states.get(e);r&&this.measure(e,r)}}measure(t,e){e.maxScroll=t.scrollHeight-t.clientHeight}handleWheel(t,e,r){let i=t.deltaY,n=i<0,s=i>0,o=r.target<=.1,a=r.target>=r.maxScroll-.1;n&&o||s&&a||(t.preventDefault(),t.stopPropagation(),r.target+=i,r.target=Math.max(0,Math.min(r.target,r.maxScroll)),r.isActive=!0,r.isDragging=!1)}onWheel(t){}onNativeScroll(t,e,r){r.isActive||(r.current=e.scrollTop,r.target=e.scrollTop)}updateScroll(t,e){let r=e.target-e.current;Math.abs(r)<.1?(e.current=e.target,e.isActive=!1):e.current+=r*e.lerp,t.scrollTop=e.current}};function mn(l){let t=l.match(/([^[]+)\[([\d.]+)-([\d.]+)\]/);return t?{id:t[1],start:parseFloat(t[2]),end:parseFloat(t[3])}:null}function js(l,t,e,r,i){return r+(i-r)*(l-t)/(e-t)}var wr=class extends x{constructor(t){super(t),this.htmlKey="progress-part",this.attributesToMap=[...this.attributesToMap,{key:"part-of",type:"string",fallback:""},{key:"easing",type:"easing",fallback:this.settings.easing}]}onObjectConnected(t){let e=t.getProperty("part-of"),r=mn(e);if(r){t.setProperty("part-of-id",r.id),t.setProperty("start",r.start),t.setProperty("end",r.end);let i=n=>{if(r){let s=js(n,r?.start,r?.end,0,1),o=Math.max(0,Math.min(1,s)),a=t.getProperty("easing"),d=typeof a=="function"?a(o):o;t.htmlElement.style.setProperty("--progress-slice",d.toString()),this.emitSignal(t,"progress-slice",d),this.events.emit(this.getObjectEventName(t,"object:progress-slice"),d)}};t.setProperty("progress-event",i),this.events.on(`object:progress:${r.id}`,i)}}onObjectDisconnected(t){let e=t.getProperty("part-of-id");e&&this.events.off(`object:progress:${e}`,t.getProperty("progress-event"))}};var Ys=/^([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\s*(>=|<=|==|!=|>|<)\s*(-?(?:\d+\.?\d*|\d*\.?\d+))$/,qs=/^(.*?)\s*=>\s*([a-z.]+)\((.*)\)$/;function fn(l){return l.split(";").map(t=>t.trim()).filter(Boolean).flatMap(t=>{let e=t.match(qs);if(!e)return[];let[,r,i,n]=e,s=Xs(r.trim());if(!s.length)return[];let o=Zs(i.trim(),n.trim());return o?[{groups:s,effect:o,raw:t}]:[]})}function Xs(l){return l.split(/\s*\|\|\s*/).filter(Boolean).map(t=>t.split(/\s*&&\s*/).filter(Boolean).map(Ks)).filter(t=>t.length>0&&t.every(Boolean))}function Ks(l){let t=l.match(Ys);if(!t)return null;let[,e,r,i,n]=t,s=parseFloat(n);return Number.isFinite(s)?{sourceId:e,signal:r,operator:i,threshold:s,raw:l}:null}function Zs(l,t){let e=Qs(t);switch(l){case"toggle.class":return e[0]?{type:"class-toggle",key:e[0]}:null;case"class.add":return e[0]?{type:"class-add",key:e[0]}:null;case"class.remove":return e[0]?{type:"class-remove",key:e[0]}:null;case"style.set":return e[0]&&e[1]?{type:"style-set",key:e[0],value:e[1]}:null;case"style.remove":return e[0]?{type:"style-remove",key:e[0]}:null;case"var.set":return e[0]&&e[1]?{type:"var-set",key:e[0],value:e[1]}:null;case"var.remove":return e[0]?{type:"var-remove",key:e[0]}:null;default:return null}}function Qs(l){return l.split(",").map(t=>t.trim()).filter(Boolean)}var xr=class extends x{constructor(t){super(t),this.htmlKey="signal",this.attributesToMap=[...this.attributesToMap,{key:"signal",type:"string",fallback:""}]}onObjectConnected(t){let e=t.getProperty("signal");if(!e)return;let r=fn(e);if(r.length===0)return;let i=[];t.setProperty("signal-rules",i);for(let n=0;n<r.length;n++){let s=r[n],o={rule:s,callbacks:[],previousState:null},a=()=>{this.applyRuleState(t,o)};for(let{sourceId:d,signal:c}of ro(s))o.callbacks.push({sourceId:d,signal:c,callback:a}),this.signals.subscribe(d,c,this.events,a);i.push(o),this.applyRuleState(t,o)}}onObjectDisconnected(t){let e=t.getProperty("signal-rules");if(e)for(let r=0;r<e.length;r++){let i=e[r];for(let n=0;n<i.callbacks.length;n++){let s=i.callbacks[n];this.signals.unsubscribe(s.sourceId,s.signal,this.events,s.callback)}i.rule.effect.type==="class-toggle"&&this.resetEffect(t,i.rule.effect)}}applyRuleState(t,e){let r=Js(e.rule,this.signals);e.previousState!==r&&(e.previousState=r,L.run(()=>{this.applyEffectState(t,e.rule.effect,r)}))}applyEffectState(t,e,r){e.type==="class-toggle"?r?this.applyEffect(t,e):this.resetEffect(t,e):r&&this.applyEffect(t,e)}applyEffect(t,e){this.applyToElementAndConnects(t,r=>io(r,e))}resetEffect(t,e){this.applyToElementAndConnects(t,r=>no(r,e))}};function Js(l,t){for(let e=0;e<l.groups.length;e++){let r=l.groups[e],i=!0;for(let n=0;n<r.length;n++)if(!to(r[n],t)){i=!1;break}if(i)return!0}return!1}function to(l,t){let e=t.get(l.sourceId,l.signal);return typeof e!="number"||!Number.isFinite(e)?!1:eo(e,l.operator,l.threshold)}function eo(l,t,e){switch(t){case">":return l>e;case">=":return l>=e;case"<":return l<e;case"<=":return l<=e;case"==":return l===e;case"!=":return l!==e}}function ro(l){let t=new Set,e=[];for(let r of l.groups)for(let{sourceId:i,signal:n}of r){let s=`${i}::${n}`;t.has(s)||(t.add(s),e.push({sourceId:i,signal:n}))}return e}function io(l,t){switch(t.type){case"class-toggle":case"class-add":l.classList.add(t.key);return;case"class-remove":l.classList.remove(t.key);return;case"style-set":L.setProp(l,t.key,t.value);return;case"style-remove":case"var-remove":l.style.removeProperty(t.key);return;case"var-set":L.setVar(l,t.key,t.value);return}}function no(l,t){switch(t.type){case"class-toggle":l.classList.remove(t.key);return;default:return}}var so=(l,t)=>{let e=Math.min(l,t),r=Math.max(l,t);return e+Math.random()*(r-e)},oo=(l,t)=>{let e=Math.ceil(Math.min(l,t)),r=Math.floor(Math.max(l,t));return r<e?e:Math.floor(Math.random()*(r-e+1))+e},ao=l=>{if(Array.isArray(l)&&l.length>=2){let t=Number(l[0]),e=Number(l[1]);if(Number.isFinite(t)&&Number.isFinite(e))return[t,e]}return typeof l=="number"&&Number.isFinite(l)?[0,l]:[0,1]},Cr=class extends x{constructor(t){super(t),this.htmlKey="random",this.attributesToMap.push({key:"random-number",type:"json",fallback:"[0,1]"}),this.attributesToMap.push({key:"random-type",type:"string",fallback:"int"})}onObjectConnected(t){let e=t.htmlElement,r=ao(t.getProperty("random-number")),n=String(t.getProperty("random-type")??"float").toLowerCase()==="int"?oo(r[0],r[1]):so(r[0],r[1]);L.run(()=>{L.setVars(e,{"--random":n})})}};var Tr=class{constructor(t,e){this.id=t;this.zIndex=e}screenRoot=null;world=null;screen=null;worldHost=null;hostPositionWasPatched=!1;hostPositionInlineValue=null;ensure(t){if(this.screenRoot?.isConnected)return t&&this.attachWorldToHost(t),this.screenRoot;let e=document.querySelector(`[data-string-dev-viewport-layer="${this.id}"]`);if(e)return this.screenRoot=e,this.screen=e.querySelector(`[data-string-dev-viewport-screen="${this.id}"]`),t&&this.attachWorldToHost(t),e;let r=document.createElement("div");r.setAttribute("data-string-dev-viewport-layer",this.id),r.setAttribute("data-string-devtools-theme",""),r.style.position="fixed",r.style.inset="0",r.style.zIndex=String(this.zIndex),r.style.pointerEvents="none",r.style.overflow="hidden";let i=document.createElement("div");return i.setAttribute("data-string-dev-viewport-screen",this.id),i.style.position="absolute",i.style.inset="0",i.style.pointerEvents="none",i.style.overflow="hidden",r.appendChild(i),(document.body??document.documentElement).appendChild(r),this.screenRoot=r,this.screen=i,this.attachWorldToHost(t??document.body??document.documentElement),r}getElement(){return this.screenRoot?.isConnected?this.screenRoot:null}getWorldElement(t){return this.ensure(t),this.world}getScreenElement(){return this.ensure(),this.screen}destroy(){this.restoreHostPosition(),this.screenRoot?.remove(),this.screenRoot=null,this.world?.remove(),this.world=null,this.screen=null,this.worldHost=null}attachWorldToHost(t){if(this.worldHost===t&&this.world?.isConnected)return;if(this.restoreHostPosition(),this.worldHost=t,!this.world){let r=document.createElement("div");r.setAttribute("data-string-dev-viewport-world",this.id),r.setAttribute("data-string-devtools-theme",""),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="1px",r.style.height="1px",r.style.pointerEvents="none",r.style.overflow="visible",r.style.zIndex=String(this.zIndex),this.world=r}t!==document.body&&t!==document.documentElement&&window.getComputedStyle(t).position==="static"&&(this.hostPositionWasPatched=!0,this.hostPositionInlineValue=t.style.position||null,t.style.position="relative"),t.appendChild(this.world)}restoreHostPosition(){this.world&&this.world.remove(),this.worldHost&&this.hostPositionWasPatched&&(this.hostPositionInlineValue==null||this.hostPositionInlineValue===""?this.worldHost.style.removeProperty("position"):this.worldHost.style.position=this.hostPositionInlineValue),this.hostPositionWasPatched=!1,this.hostPositionInlineValue=null}};var _t=class l{static instance=null;layers=new Map;static getInstance(){return this.instance||(this.instance=new l),this.instance}acquire(t,e){let r=this.layers.get(t);if(r){if(r.zIndex!==e)throw new Error(`Shared devtools layer "${t}" already exists with z-index ${r.zIndex}, requested ${e}.`);return r.refs+=1,r.layer}let i=new Tr(t,e);return this.layers.set(t,{layer:i,refs:1,zIndex:e}),i}release(t){let e=this.layers.get(t);e&&(e.refs-=1,!(e.refs>0)&&(e.layer.destroy(),this.layers.delete(t)))}};var Z=class extends x{static devtool=null;overlayRegistry=_t.getInstance();acquiredViewportLayers=new Map;devtoolListeners=new Set;hotkeyHandler=null;devtoolConfig=null;constructor(t){super(t),this._type=2,Bt();let e=this.constructor.devtool;e&&(this.configureDevtool(e),this.bindDevtoolHotkey(e.hotkey));let r=e?.styles,i=(typeof r=="function"?r():r)??this.getStyles();i&&this.ensureStyle(`${this.getStyleScopeId(i)}-styles`,i)}get respectSelfDisable(){return!1}get connectsConfig(){return this.constructor.devtool?.connects}canConnect(t){let e=this.connectsConfig;return e?!!(e.global===!0||t.keys.includes("dev-inspect")||e.keys?.some(r=>t.keys.includes(r))||e.attributes?.some(r=>t.htmlElement.hasAttribute(r))):super.canConnect(t)}getStyleScopeId(t){let e=this.htmlKey||this.constructor.devtool?.connects?.keys?.[0];if(e)return e;let r=0;for(let i=0;i<t.length;i+=1)r=r*31+t.charCodeAt(i)>>>0;return`string-dev-${r.toString(16)}`}getStyles(){return null}getDevtoolDefinition(){if(!this.devtoolConfig)return null;let t=this.devtoolConfig,e=this.getDevtoolSubBadges();return{id:t.id,label:t.label,icon:t.icon,order:t.order,group:t.group,hotkey:t.hotkey,subBadges:e.length>0?e:void 0,getState:()=>({active:this.getDevtoolActiveState()}),setActive:r=>{this.setDevtoolActiveState(r)},subscribe:r=>(this.devtoolListeners.add(r),r({active:this.getDevtoolActiveState()}),()=>{this.devtoolListeners.delete(r)})}}getDevtoolSubBadges(){return[]}configureDevtool(t){this.devtoolConfig=t}bindDevtoolHotkey(t){typeof window>"u"||!t||(this.hotkeyHandler=e=>{let r=e.target;r&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r.isContentEditable)||e.key.toLowerCase()!==t.key.toLowerCase()||e.shiftKey!==(t.shiftKey??!1)||e.ctrlKey!==(t.ctrlKey??!1)||e.altKey!==(t.altKey??!1)||e.metaKey!==(t.metaKey??!1)||(e.preventDefault(),this.setDevtoolActiveState(!this.getDevtoolActiveState()))},window.addEventListener("keydown",this.hotkeyHandler))}emitDevtoolState(t=this.getDevtoolActiveState()){let e={active:t};for(let r of this.devtoolListeners)r(e)}acquireViewportLayer(t,e){let r=this.acquiredViewportLayers.get(t);if(r)return r;let i=this.overlayRegistry.acquire(t,e);return this.acquiredViewportLayers.set(t,i),i}releaseViewportLayer(t){this.acquiredViewportLayers.has(t)&&(this.overlayRegistry.release(t),this.acquiredViewportLayers.delete(t))}ensureStyle(t,e){let r=document.getElementById(t);if(r instanceof HTMLStyleElement)return r;let i=document.createElement("style");return i.id=t,i.textContent=e,document.head.appendChild(i),i}getWorldHost(){return this.data.scroll.container??document.body??document.documentElement}getDevtoolActiveState(){return!1}setDevtoolActiveState(t){}destroy(){this.hotkeyHandler&&(window.removeEventListener("keydown",this.hotkeyHandler),this.hotkeyHandler=null),this.devtoolListeners.clear();for(let t of this.acquiredViewportLayers.keys())this.overlayRegistry.release(t);this.acquiredViewportLayers.clear(),super.destroy()}};var Ei=["S","M","L","XL"];var lo=[1280,1024,768,0];function vn(l,t){let e=t-1-l;return Ei[e]??"S"}var bn=0;function Pr(){return`grid-${Date.now()}-${bn++}`}function Ar(){return`layout-${Date.now()}-${bn++}`}function kr(l=2){let t=Math.max(2,Math.min(4,l)),e=[];for(let r=0;r<t;r++){let i=vn(r,t),n=r===t-1?0:lo[r]??0;e.push({id:Ar(),label:i,minWidth:n,instances:[]})}return e}function de(l){return Number.isFinite(l)?Math.max(0,Math.round(l)):0}function Ft(l){let t=l.length;for(let e=0;e<t;e++)l[e].label=vn(e,t)}var co="string-grid:";function Mi(l){return it(co+l)}function uo(l){if(!l||typeof l!="object")return 0;if(Array.isArray(l))return l.length;let t=l,e=Array.isArray(t.layouts)?t.layouts:[],r=0;for(let i of e){if(!i||typeof i!="object")continue;let n=i,s=Array.isArray(n.instances)?n.instances:Array.isArray(n.grids)?n.grids:[];r+=s.length}return r}var Or=class{adapterRegistry=new Map;elementStates=new Map;registerAdapter(t){this.adapterRegistry.set(t.type,t)}getAdapter(t){return this.adapterRegistry.get(t)}getAdapterRegistry(){return this.adapterRegistry}getLayouts(t){return this.getOrInitState(t).layouts}getLayoutCount(t){return this.getOrInitState(t).layouts.length}getSelectedLayoutId(t){return this.getOrInitState(t).selectedLayoutId}getPanelTitle(t){return this.getOrInitState(t).panelTitle?.trim()||"Layout"}getSelectedLayoutLabel(t){let e=this.getOrInitState(t);return this.findSelectedLayout(e)?.label??"S"}getResolvedLayoutId(t,e){let r=this.getOrInitState(t);return this.findResolvedLayout(r,e)?.id??r.layouts[r.layouts.length-1].id}getSelectedInstances(t){let e=this.getOrInitState(t);return this.findSelectedLayout(e)?.instances??[]}getResolvedInstances(t,e){let r=this.getOrInitState(t);return this.findResolvedLayout(r,e)?.instances??[]}addLayout(t){let e=this.getOrInitState(t);if(e.layouts.length>=4)return null;let r=e.layouts[0],i=r?Math.min(1920,r.minWidth+256):1280,n={id:Ar(),label:"XL",minWidth:i,instances:[]};return e.layouts.unshift(n),this.sortLayouts(e),Ft(e.layouts),this.ensureMinWidthConstraints(e),e.layouts.some(s=>s.id===e.selectedLayoutId)||(e.selectedLayoutId=e.layouts[0].id),this.save(t),n}removeLayout(t,e){let r=this.getOrInitState(t);if(r.layouts.length<=2)return!1;let i=r.layouts.findIndex(n=>n.id===e);return i===-1?!1:(r.layouts.splice(i,1),Ft(r.layouts),this.ensureMinWidthConstraints(r),r.layouts.some(n=>n.id===r.selectedLayoutId)||(r.selectedLayoutId=r.layouts[r.layouts.length-1].id),this.save(t),!0)}selectLayout(t,e,r=!0){let i=this.getOrInitState(t);i.layouts.some(n=>n.id===e)&&(i.selectedLayoutId=e,r&&this.save(t))}updateLayoutMinWidth(t,e,r,i=!0){let n=this.getOrInitState(t),s=n.layouts.find(o=>o.id===e);s&&(s.minWidth=de(r),this.sortLayouts(n),Ft(n.layouts),this.ensureMinWidthConstraints(n),i&&this.save(t))}replaceLayouts(t,e,r){let i=this.normalizeLayouts(e),n={elementId:t,layouts:i,selectedLayoutId:r};this.ensureValidSelection(n),this.elementStates.set(t,n),this.save(t)}getInstances(t){return this.getSelectedInstances(t)}addInstance(t,e){let r=this.adapterRegistry.get(e);if(!r)return null;let i=this.findSelectedLayout(this.getOrInitState(t));if(!i)return null;let n={id:Pr(),type:e,visible:!0,settings:{...r.getDefaults()}};return i.instances.push(n),this.save(t),n}removeInstance(t,e){let r=this.findSelectedLayout(this.getOrInitState(t));r&&(r.instances=r.instances.filter(i=>i.id!==e),this.save(t))}reorderInstance(t,e,r,i){let n=this.findSelectedLayout(this.getOrInitState(t));if(!n||e===r)return;let s=n.instances.findIndex(u=>u.id===e),o=n.instances.findIndex(u=>u.id===r);if(s===-1||o===-1)return;let[a]=n.instances.splice(s,1),d=n.instances.findIndex(u=>u.id===r),c=i==="before"?d:d+1;n.instances.splice(c,0,a),this.save(t)}moveInstanceToEnd(t,e){let r=this.findSelectedLayout(this.getOrInitState(t));if(!r)return;let i=r.instances.findIndex(s=>s.id===e);if(i===-1||i===r.instances.length-1)return;let[n]=r.instances.splice(i,1);r.instances.push(n),this.save(t)}toggleVisibility(t,e){let r=this.findInstance(t,e);r&&(r.visible=!r.visible,this.save(t))}renameInstance(t,e,r){let i=this.findInstance(t,e);i&&(i.name=r.trim()||void 0,this.save(t))}renamePanelTitle(t,e){let r=this.getOrInitState(t);r.panelTitle=e.trim()||"Layout",this.save(t)}updateSetting(t,e,r,i){let n=this.findInstance(t,e);n&&(n.settings[r]=i,this.save(t))}findInstance(t,e){return this.getSelectedInstances(t).find(r=>r.id===e)}save(t){let e=this.elementStates.get(t);if(e)try{let r={layouts:e.layouts,selectedLayoutId:e.selectedLayoutId,panelTitle:e.panelTitle??"Layout"},i=Mi(t);localStorage.setItem(i,JSON.stringify(r))}catch(r){console.warn("[StringDevLayout:storage] save failed",{elementId:t,storageSlot:Mi(t),error:r})}}load(t,e=[]){try{let r=[t,...e],i=[];for(let p of r){let g=Mi(p),m=localStorage.getItem(g);if(m)try{let h=JSON.parse(m);i.push({elementId:p,storageSlot:g,raw:m,parsed:h,gridCount:uo(h)})}catch(h){console.warn("[StringDevLayout:storage] candidate parse failed",{elementId:t,candidateId:p,storageSlot:g,error:h})}}let n=i[0]??null;for(let p of i)(!n||p.gridCount>n.gridCount)&&(n=p);if(!n)return;let s=n.parsed,o=n.elementId;if(Array.isArray(s)){let p=s.filter(m=>this.adapterRegistry.has(m.type));for(let m of p){let h=this.adapterRegistry.get(m.type);h&&(m.settings={...h.getDefaults(),...m.settings})}let g=kr(2);g[g.length-1].instances=p,this.elementStates.set(t,{elementId:t,layouts:g,selectedLayoutId:g[0].id,panelTitle:"Layout"}),o!==t&&this.save(t);return}let a=Array.isArray(s?.layouts)?s.layouts:null;if(!a)return;let d=this.normalizeLayouts(a);if(d.length===0)return;let c=typeof s?.selectedLayoutId=="string"?s.selectedLayoutId:d[0].id,u={elementId:t,layouts:d,selectedLayoutId:c,panelTitle:typeof s?.panelTitle=="string"&&s.panelTitle.trim().length>0?s.panelTitle.trim():"Layout"};this.ensureValidSelection(u),this.elementStates.set(t,u),o!==t&&this.save(t)}catch{}}clear(){this.elementStates.clear()}getOrInitState(t){let e=this.elementStates.get(t);if(!e){let r=kr(2);e={elementId:t,layouts:r,selectedLayoutId:r[0].id,panelTitle:"Layout"},this.elementStates.set(t,e)}return this.sortLayouts(e),this.ensureValidSelection(e),e}normalizeLayouts(t){let i=t.filter(n=>n&&typeof n=="object"&&typeof n.id=="string").map(n=>{let s=Array.isArray(n.instances)?n.instances:Array.isArray(n.grids)?n.grids:[];return{id:n.id,label:n.label??"S",minWidth:de(typeof n.minWidth=="number"?n.minWidth:0),instances:s.filter(o=>this.adapterRegistry.has(o.type)).map(o=>{let a=this.adapterRegistry.get(o.type);return a?{...o,visible:o.visible!==!1,settings:{...a.getDefaults(),...o.settings}}:o})}}).slice(0,4);for(;i.length<2;)i.push({id:Ar(),label:"S",minWidth:0,instances:[]});return this.sortLayoutsArr(i),Ft(i),this.ensureMinWidthConstraintsArr(i),i}sortLayouts(t){this.sortLayoutsArr(t.layouts)}sortLayoutsArr(t){t.sort((e,r)=>r.minWidth-e.minWidth)}ensureValidSelection(t){t.layouts.length<2&&(t.layouts=kr(2)),t.layouts.length>4&&(t.layouts=t.layouts.slice(0,4),Ft(t.layouts)),t.layouts.some(e=>e.id===t.selectedLayoutId)||(t.selectedLayoutId=t.layouts[t.layouts.length-1].id)}ensureMinWidthConstraints(t){this.ensureMinWidthConstraintsArr(t.layouts)}ensureMinWidthConstraintsArr(t){if(t.length!==0){t[t.length-1].minWidth=0;for(let e=t.length-2;e>=0;e--){let r=t[e+1].minWidth;t[e].minWidth<=r&&(t[e].minWidth=r+1)}}}findSelectedLayout(t){return t.layouts.find(e=>e.id===t.selectedLayoutId)}findResolvedLayout(t,e){for(let r of t.layouts)if(e>=r.minWidth)return r;return t.layouts[t.layouts.length-1]}};var po="http://www.w3.org/2000/svg",ue=class{svg;target;resizeObserver;enabled=!0;onResize;constructor(t,e,r){this.target=t,this.onResize=r,this.svg=document.createElementNS(po,"svg"),this.svg.setAttribute("data-string-grid-overlay",""),this.svg.style.position="absolute",this.svg.style.pointerEvents="none",this.svg.style.transformOrigin="top left",e.appendChild(this.svg),this.syncViewBox(),this.resizeObserver=new ResizeObserver(()=>{this.syncViewBox(),this.onResize?.()}),this.resizeObserver.observe(this.target)}getElement(){return this.svg}setPosition(t,e,r,i){this.svg.style.width=`${r}px`,this.svg.style.height=`${i}px`,this.svg.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(e)}px, 0)`}render(t,e){if(this.clearAll(),!this.enabled)return;let{width:r,height:i}=this.getDimensions();for(let n of[...t].reverse()){let s=e.get(n.type);if(s&&n.visible){s.render(this.svg,r,i,{...n.settings,__instanceId:n.id});let o=this.svg.querySelector(`[data-grid-id="${n.id}"]`);o&&(o.setAttribute("data-grid-type",n.type),o.setAttribute("data-grid-visible","true"))}}}setEnabled(t){this.enabled=t,this.svg.style.display=t?"":"none",t||this.clearAll()}clearAll(){let t=this.svg.querySelectorAll("[data-grid-id]");for(let e=t.length-1;e>=0;e--)t[e].remove()}clearInstance(t,e){e.clear(this.svg,t)}syncViewBox(){let{width:t,height:e}=this.getDimensions();this.svg.setAttribute("viewBox",`0 0 ${t} ${e}`)}getDimensions(){return{width:this.target.offsetWidth,height:this.target.offsetHeight}}destroy(){this.resizeObserver.disconnect(),this.svg.remove()}ensurePositioned(){getComputedStyle(this.target).position==="static"&&(this.target.style.position="relative")}};var Q=class{key;label;value;onChange;root=null;constructor(t,e,r,i){this.key=t,this.label=e,this.value=r,this.onChange=i}setDisabled(t){this.root&&this.root.setAttribute("data-disabled",t?"true":"false")}getValue(){return this.value}destroy(){this.root?.remove(),this.root=null}emit(t){this.value=t,this.onChange(this.key,t)}createLabel(){let t=document.createElement("label");return t.textContent=this.label,t.setAttribute("data-stdg-label",""),t}createRow(){let t=document.createElement("div");return t.setAttribute("data-stdg-panel-field",""),t}};var go=320,ho=60,yn=6,Dr=class extends Q{min;max;step;input=null;stepperButtons=[];constructor(t,e,r,i,n=0,s=100,o=1){super(t,e,r,i),this.min=n,this.max=s,this.step=o}build(){let t=this.createRow();return t.appendChild(this.createLabel()),t.appendChild(this.createControls()),this.root=t,t}setValue(t){this.value=t,this.input&&(this.input.value=this.formatValue(t))}setDisabled(t){super.setDisabled(t),this.input&&(this.input.disabled=t);for(let e of this.stepperButtons)e.disabled=t}createControls(){let t=document.createElement("div");t.setAttribute("data-stdg-field-input","");let e=document.createElement("div");return e.setAttribute("data-stdg-stepper",""),e.appendChild(this.createStepperButton("up",1)),e.appendChild(this.createStepperButton("down",-1)),t.appendChild(this.createInput()),t.appendChild(e),t}createInput(){let t=document.createElement("input");return t.type="text",t.inputMode="text",t.setAttribute("enterkeyhint","done"),t.autocomplete="off",t.spellcheck=!1,t.value=this.formatValue(this.value),t.setAttribute("data-stdg-input",""),t.addEventListener("focus",()=>{t.select()}),t.addEventListener("blur",()=>{this.commitValue(t.value)}),t.addEventListener("keydown",e=>{if(e.key==="Enter"){t.blur();return}if(e.key==="Escape"){t.value=this.formatValue(this.value),t.blur();return}e.key!=="ArrowUp"&&e.key!=="ArrowDown"||(e.preventDefault(),this.applyDelta(e.key==="ArrowUp"?1:-1,e))}),t.addEventListener("wheel",e=>{document.activeElement===t&&(e.preventDefault(),this.applyDelta(e.deltaY<0?1:-1,e))}),t.addEventListener("mousedown",e=>{e.button===1&&this.startMiddleDrag(e,t)}),t.addEventListener("auxclick",e=>{e.button===1&&e.preventDefault()}),this.input=t,t}createStepperButton(t,e){let r=document.createElement("button");r.type="button",r.setAttribute("data-stdg-button",""),r.setAttribute("data-stdg-button-icon-12",""),r.setAttribute("data-direction",t),r.innerHTML=V(12,t==="up"?"chevrone-up":"chevrone-down");let i=0,n=0,s=!1,o=()=>{window.clearTimeout(i),window.clearInterval(n),document.removeEventListener("pointerup",o),document.removeEventListener("pointercancel",o)};return r.addEventListener("pointerdown",a=>{a.button===0&&(i=window.setTimeout(()=>{s=!0,this.applyDelta(e),n=window.setInterval(()=>{this.applyDelta(e)},ho)},go),document.addEventListener("pointerup",o),document.addEventListener("pointercancel",o))}),r.addEventListener("click",a=>{if(s){s=!1,a.preventDefault();return}this.applyDelta(e),this.input?.focus(),this.input?.select()}),this.stepperButtons.push(r),r}startMiddleDrag(t,e){t.preventDefault();let r=t.clientX,i=0,n=document.body.style.cursor,s=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let o=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",o),document.body.style.cursor=n,document.body.style.userSelect=s},a=d=>{let c=d.clientX-r;for(r=d.clientX,i+=c;Math.abs(i)>=yn;){let u=i>0?1:-1;this.applyDelta(u,d),i-=yn*u}};e.focus(),e.select(),document.addEventListener("mousemove",a),document.addEventListener("mouseup",o)}commitValue(t){let e=parseFloat(t.replace(",","."));if(isNaN(e)){this.input&&(this.input.value=this.formatValue(this.value));return}let r=this.normalizeValue(e);this.input&&(this.input.value=this.formatValue(r)),this.emit(r)}applyDelta(t,e){let r=e?.shiftKey?10:e?.altKey?.1:1,i=this.normalizeValue(this.value+t*this.step*r);this.input&&(this.input.value=this.formatValue(i)),this.emit(i)}normalizeValue(t){let e=Math.round(t/this.step)*this.step,r=this.getPrecision(this.step);return Number(e.toFixed(r))}getPrecision(t){return String(t).split(".")[1]?.length??0}formatValue(t){let e=this.getPrecision(this.step);return e>0?t.toFixed(e):String(t)}};var mo=320,fo=60,Sn=6,Ir=class l extends Q{min;max;step;displayMultiplier;displayStep;suffix;units;currentUnit;valueInput=null;unitSelect=null;stepperButtons=[];static DECIMAL_UNITS=new Set(["rem","em"]);constructor(t,e,r,i,n=0,s=100,o=1,a=1,d,c,u,p){super(t,e,r,i),this.min=n,this.max=s,this.step=o,this.displayMultiplier=a,this.displayStep=d,this.suffix=c,this.units=u,this.currentUnit=p}build(){let t=this.createRow();return t.appendChild(this.createLabel()),t.appendChild(this.createControls()),this.root=t,t}setValue(t){this.value=t,this.valueInput&&(this.valueInput.value=this.formatValue(t))}setDisabled(t){super.setDisabled(t),this.valueInput&&(this.valueInput.disabled=t),this.unitSelect&&(this.unitSelect.disabled=t);for(let e of this.stepperButtons)e.disabled=t}createControls(){let t=document.createElement("div");t.setAttribute("data-stdg-field-input","");let e=document.createElement("div");if(e.setAttribute("data-stdg-field-value",""),e.appendChild(this.createInput()),this.suffix){let i=document.createElement("span");i.setAttribute("data-stdg-field-suffix",""),i.textContent=this.suffix,e.appendChild(i)}if(t.appendChild(e),this.units&&this.units.length>0){let i=document.createElement("select");i.setAttribute("data-stdg-select","");for(let n of this.units){let s=document.createElement("option");s.value=n.value,s.textContent=n.label,i.appendChild(s)}i.value=this.currentUnit||this.units[0].value,i.addEventListener("change",()=>{this.currentUnit=i.value,this.valueInput&&(this.valueInput.value=this.formatValue(this.value)),this.onChange(this.key+"Unit",i.value)}),this.unitSelect=i,t.appendChild(i)}let r=document.createElement("div");return r.setAttribute("data-stdg-stepper",""),r.appendChild(this.createStepperButton("up",1)),r.appendChild(this.createStepperButton("down",-1)),t.appendChild(r),t}createInput(){let t=document.createElement("input");return t.type="text",t.inputMode="text",t.setAttribute("enterkeyhint","done"),t.autocomplete="off",t.spellcheck=!1,t.value=this.formatValue(this.value),t.setAttribute("data-stdg-input",""),t.addEventListener("focus",()=>{t.select()}),t.addEventListener("blur",()=>{this.commitInputValue(t)}),t.addEventListener("keydown",e=>{e.key==="Enter"?t.blur():e.key==="Escape"?(t.value=this.formatValue(this.value),t.blur()):(e.key==="ArrowUp"||e.key==="ArrowDown")&&(e.preventDefault(),this.applyDelta(e.key==="ArrowUp"?1:-1,e,t))}),t.addEventListener("wheel",e=>{document.activeElement===t&&(e.preventDefault(),this.applyDelta(e.deltaY<0?1:-1,e,t))}),t.addEventListener("mousedown",e=>{e.button===1&&this.startMiddleDrag(e,t)}),t.addEventListener("auxclick",e=>{e.button===1&&e.preventDefault()}),this.valueInput=t,t}createStepperButton(t,e){let r=document.createElement("button");r.type="button",r.setAttribute("data-stdg-button",""),r.setAttribute("data-stdg-button-icon-12",""),r.setAttribute("data-direction",t),r.innerHTML=V(12,t==="up"?"chevrone-up":"chevrone-down");let i=0,n=0,s=!1,o=()=>{window.clearTimeout(i),window.clearInterval(n),document.removeEventListener("pointerup",o),document.removeEventListener("pointercancel",o)};return r.addEventListener("pointerdown",a=>{a.button===0&&(i=window.setTimeout(()=>{s=!0,this.valueInput&&(this.applyDelta(e,void 0,this.valueInput),n=window.setInterval(()=>{this.valueInput&&this.applyDelta(e,void 0,this.valueInput)},fo))},mo),document.addEventListener("pointerup",o),document.addEventListener("pointercancel",o))}),r.addEventListener("click",a=>{if(s){s=!1,a.preventDefault();return}this.valueInput&&(this.applyDelta(e,void 0,this.valueInput),this.valueInput.focus(),this.valueInput.select())}),this.stepperButtons.push(r),r}startMiddleDrag(t,e){t.preventDefault();let r=t.clientX,i=0,n=document.body.style.cursor,s=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let o=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",o),document.body.style.cursor=n,document.body.style.userSelect=s},a=d=>{let c=d.clientX-r;for(r=d.clientX,i+=c;Math.abs(i)>=Sn;){let u=i>0?1:-1;this.applyDelta(u,d,e),i-=Sn*u}};e.focus(),e.select(),document.addEventListener("mousemove",a),document.addEventListener("mouseup",o)}commitInputValue(t){let e=parseFloat(t.value.replace(",","."));if(isNaN(e)){t.value=this.formatValue(this.value);return}let r=this.normalizeDisplayValue(e);t.value=this.formatValue(r),this.emit(r)}applyDelta(t,e,r){let i=e?.shiftKey?10:e?.altKey?.1:1,n=this.modelToDisplay(this.value)+t*this.getDisplayStep()*i,s=this.normalizeDisplayValue(n);r.value=this.formatValue(s),this.emit(s)}normalizeValue(t){let e=Math.min(this.max,Math.max(this.min,t));if(l.DECIMAL_UNITS.has(this.currentUnit??""))return Number(e.toFixed(2));let r=Math.round(e/this.step)*this.step,i=this.getPrecision(this.step);return Number(r.toFixed(i))}normalizeDisplayValue(t){let e=this.modelToDisplay(this.min),r=this.modelToDisplay(this.max),i=Math.min(r,Math.max(e,t)),n=this.getDisplayPrecision();if(l.DECIMAL_UNITS.has(this.currentUnit??"")){let d=Number(i.toFixed(n));return this.normalizeValue(this.displayToModel(d))}let s=this.getDisplayStep(),o=Math.round(i/s)*s,a=Number(o.toFixed(n));return this.normalizeValue(this.displayToModel(a))}getPrecision(t){return String(t).split(".")[1]?.length??0}formatValue(t){let e=this.modelToDisplay(t),r=this.getDisplayPrecision();return r>0?e.toFixed(r):String(e)}modelToDisplay(t){let e=this.getDisplayPrecision();return Number((t*this.displayMultiplier).toFixed(e))}displayToModel(t){return t/this.displayMultiplier}getDisplayStep(){return this.displayStep??this.step*this.displayMultiplier}getDisplayPrecision(){if(l.DECIMAL_UNITS.has(this.currentUnit??""))return 2;let t=this.getDisplayStep();return t<1?Math.max(2,this.getPrecision(t)):0}};var Rr=class extends Q{colorInput=null;hexLabel=null;build(){let t=this.createRow();return t.appendChild(this.createLabel()),t.appendChild(this.createControl()),this.root=t,t}setValue(t){this.value=t,this.colorInput&&(this.colorInput.value=t),this.hexLabel&&(this.hexLabel.value=t)}setDisabled(t){super.setDisabled(t),this.colorInput&&(this.colorInput.disabled=t),this.hexLabel&&(this.hexLabel.disabled=t)}createControl(){let t=document.createElement("div");t.setAttribute("data-stdg-field-input","");let e=document.createElement("input");e.type="color",e.value=this.value,e.setAttribute("data-stdg-input",""),e.setAttribute("data-stdg-input-color","");let r=document.createElement("input");return r.type="text",r.inputMode="text",r.value=this.value,r.setAttribute("data-stdg-input",""),e.addEventListener("input",()=>{r.value=e.value,this.emit(e.value)}),r.addEventListener("change",()=>{let i=r.value.trim();e.value=i,this.emit(i)}),this.colorInput=e,this.hexLabel=r,t.appendChild(e),t.appendChild(r),t}};var Hr=class extends Q{options;select=null;stepperButtons=[];constructor(t,e,r,i,n){super(t,e,r,i),this.options=n}build(){let t=this.createRow();return t.appendChild(this.createLabel()),t.appendChild(this.createControl()),this.root=t,t}setValue(t){this.value=t,this.select&&(this.select.value=t)}setDisabled(t){super.setDisabled(t),this.select&&(this.select.disabled=t);for(let e of this.stepperButtons)e.disabled=t}createControl(){let t=document.createElement("div");t.setAttribute("data-stdg-field-input","");let e=document.createElement("select");e.setAttribute("data-stdg-select","");for(let i of this.options){let n=document.createElement("option");n.value=i.value,n.textContent=i.label,i.value===this.value&&(n.selected=!0),e.appendChild(n)}e.addEventListener("change",()=>{this.emit(e.value)}),this.select=e;let r=document.createElement("div");return r.setAttribute("data-stdg-stepper",""),r.appendChild(this.createStepperButton("up",-1)),r.appendChild(this.createStepperButton("down",1)),t.appendChild(e),t.appendChild(r),t}createStepperButton(t,e){let r=document.createElement("button");return r.type="button",r.setAttribute("data-stdg-button",""),r.setAttribute("data-stdg-button-icon-12",""),r.setAttribute("data-direction",t),r.innerHTML=V(12,t==="up"?"chevrone-up":"chevrone-down"),r.addEventListener("click",()=>{if(!this.select)return;let i=this.select.options.length;if(i===0)return;let s=((this.select.selectedIndex+e)%i+i)%i;this.select.selectedIndex=s,this.emit(this.select.value)}),this.stepperButtons.push(r),r}};var Br=class extends Q{checkbox=null;toggle=null;build(){let t=this.createRow();t.appendChild(this.createLabel());let e=document.createElement("label");e.setAttribute("data-stdg-toggle",""),e.setAttribute("data-checked",String(this.value));let r=document.createElement("input");r.type="checkbox",r.checked=this.value,r.setAttribute("data-stdg-toggle-input",""),this.checkbox=r,this.toggle=e;let i=document.createElement("span");return i.setAttribute("data-stdg-toggle-knob",""),r.addEventListener("change",()=>{let n=r.checked;this.value=n,e.setAttribute("data-checked",String(n)),this.emit(n)}),e.appendChild(r),e.appendChild(i),t.appendChild(e),this.root=t,t}setValue(t){this.value=t,this.checkbox&&(this.checkbox.checked=t),this.toggle?.setAttribute("data-checked",String(t))}setDisabled(t){super.setDisabled(t),this.checkbox&&(this.checkbox.disabled=t),this.toggle?.setAttribute("aria-disabled",t?"true":"false")}};var _r=class{fields=[];fieldEntries=[];values={};build(t,e,r){this.destroy(),this.values={...e};let i=(o,a)=>{this.values[o]=a,this.syncDisabledStates(),r(o,a)},n=document.createDocumentFragment(),s=document.createElement("div");s.setAttribute("data-stdg-panel-content",""),n.appendChild(s);for(let o of t){if(o.type==="divider"){s=document.createElement("div"),s.setAttribute("data-stdg-panel-content",""),n.appendChild(s);continue}let a=this.createField(o,e,i);a&&(this.fields.push(a),this.fieldEntries.push({descriptor:o,field:a}),s.appendChild(a.build()))}return this.syncDisabledStates(),n}updateValues(t){this.values={...this.values,...t};for(let e of this.fields){let r=e.key;r&&r in t&&e.setValue(t[r])}this.syncDisabledStates()}destroy(){for(let t of this.fields)t.destroy();this.fields=[],this.fieldEntries=[],this.values={}}createField(t,e,r){switch(t.type){case"number":return new Dr(t.key,t.label,e[t.key]??t.default,r,t.min,t.max,t.step);case"range":return new Ir(t.key,t.label,e[t.key]??t.default,r,t.min,t.max,t.step,t.displayMultiplier,t.displayStep,t.suffix,t.units,e[t.key+"Unit"]??t.defaultUnit);case"color":return new Rr(t.key,t.label,e[t.key]??t.default,r);case"select":return new Hr(t.key,t.label,e[t.key]??t.default,r,t.options);case"toggle":return new Br(t.key,t.label,e[t.key]??t.default,r);default:return null}}syncDisabledStates(){for(let t of this.fieldEntries){let e=t.descriptor.disabledWhen,r=!!e&&this.values[e.key]===e.equals;t.field.setDisabled(r)}}};var wi=12,vo=360,bo=560,pe=class{target;adapterRegistry;hudRoot;trigger;panel;layoutTitle;layoutChipTabs;layoutSettingsToggle;layoutSettingsList;layoutAddButton;layoutIOActions;listContainer;addGuideButton;headerAddButton;addPanel;addGridList;layoutPanel;detailPanel;detailContent;detailTitle=null;detailIcon=null;detailBuilder=null;instances=[];layouts=[];panelTitleValue="Layout";selectedLayoutId="";resolvedLayoutId="";selectedInstanceId=null;selectedBreakpointLayoutId=null;isOpen=!1;panelInBody=!1;isAddPanelOpen=!1;isLayoutSettingsOpen=!1;enabled=!0;onDocumentPointerDownBind;onViewportChangeBind;onAdd;onRemove;onToggle;onSettingChange;onReorder;onMoveToEnd;onSelectLayout;onUpdateLayoutMinWidth;onAddLayout;onRemoveLayout;onExport;onImport;onRenameInstance;onRenamePanelTitle;onHUDOpen;onHUDClose;onLayoutPanelOpen;onLayoutPanelClose;constructor(t,e,r,i){this.target=t,this.adapterRegistry=e,this.onAdd=r.onAdd,this.onRemove=r.onRemove,this.onToggle=r.onToggle,this.onSettingChange=r.onSettingChange,this.onReorder=r.onReorder,this.onMoveToEnd=r.onMoveToEnd,this.onSelectLayout=r.onSelectLayout,this.onUpdateLayoutMinWidth=r.onUpdateLayoutMinWidth,this.onAddLayout=r.onAddLayout,this.onRemoveLayout=r.onRemoveLayout,this.onExport=r.onExport,this.onImport=r.onImport,this.onRenameInstance=r.onRenameInstance,this.onRenamePanelTitle=r.onRenamePanelTitle,this.onHUDOpen=r.onHUDOpen,this.onHUDClose=r.onHUDClose,this.onLayoutPanelOpen=r.onLayoutPanelOpen,this.onLayoutPanelClose=r.onLayoutPanelClose,this.onDocumentPointerDownBind=this.onDocumentPointerDown.bind(this),this.onViewportChangeBind=()=>this.syncPanelPlacement(),this.hudRoot=this.createHudRoot(),this.trigger=this.createTrigger(),this.panel=this.createMainPanel(),this.addPanel=this.createAddPanel(),this.layoutPanel=this.createLayoutPanel(),this.detailPanel=this.createDetailPanel(),i?.attachTrigger!==!1&&this.hudRoot.appendChild(this.trigger),this.panel.appendChild(this.addPanel),this.panel.appendChild(this.layoutPanel),this.panel.appendChild(this.detailPanel),this.hudRoot.appendChild(this.panel),document.addEventListener("pointerdown",this.onDocumentPointerDownBind),window.addEventListener("resize",this.onViewportChangeBind),window.visualViewport?.addEventListener("resize",this.onViewportChangeBind),window.visualViewport?.addEventListener("scroll",this.onViewportChangeBind)}refresh(t,e,r,i,n){this.instances=[...t],this.layouts=[...e],this.panelTitleValue=r.trim()||"Layout",this.selectedLayoutId=i,this.resolvedLayoutId=n,this.selectedInstanceId&&!t.some(s=>s.id===this.selectedInstanceId)&&this.clearSelection(),this.selectedBreakpointLayoutId&&!this.layouts.some(s=>s.id===this.selectedBreakpointLayoutId)&&(this.selectedBreakpointLayoutId=null),this.layoutTitle.value=this.panelTitleValue,this.renderLayoutChips(),this.renderLayoutSettings(),this.renderList(),this.renderDetailPanel()}destroy(){this.detailBuilder?.destroy(),document.removeEventListener("pointerdown",this.onDocumentPointerDownBind),window.removeEventListener("resize",this.onViewportChangeBind),window.visualViewport?.removeEventListener("resize",this.onViewportChangeBind),window.visualViewport?.removeEventListener("scroll",this.onViewportChangeBind),this.panelInBody&&this.panel.remove(),this.hudRoot.remove()}getTriggerElement(){return this.trigger}getHudElement(){return this.hudRoot}setTargetId(t){this.hudRoot.setAttribute("data-target-id",t),this.trigger.setAttribute("data-target-id",t),this.panel.setAttribute("data-target-id",t),this.addPanel.setAttribute("data-target-id",t),this.layoutPanel.setAttribute("data-target-id",t),this.detailPanel.setAttribute("data-target-id",t)}setAnchorPosition(t,e,r="top-left"){this.hudRoot.setAttribute("data-visible","true");let i=r==="top-right"?" translate(-100%, 0%)":"";this.hudRoot.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(e)}px, 0)${i}`,this.syncPanelPlacement()}setAnchorVisible(t){this.hudRoot.setAttribute("data-visible",t?"true":"false")}isHUDOpen(){return this.isOpen}isLayoutSettingsPanelOpen(){return this.isLayoutSettingsOpen}setEnabled(t){this.enabled=t,t||this.hide(),this.hudRoot.style.display=t?"":"none"}isEnabled(){return this.enabled}createHudRoot(){return Rt()}createTrigger(){let t=tt({icon:"settings",label:"Open layout guides",modifiers:["toggle"],attrs:{"data-devguides-id":"layout","data-open":"false","data-state":"visible","data-active":"false","aria-expanded":"false"}});return t.addEventListener("click",e=>{e.stopPropagation(),this.toggle()}),t}createMainPanel(){let t=oe(),e=ae();this.layoutTitle=document.createElement("input"),this.layoutTitle.setAttribute("data-stdg-input",""),this.layoutTitle.setAttribute("data-stdg-panel-title",""),this.layoutTitle.type="text",this.layoutTitle.value=this.panelTitleValue,this.layoutTitle.addEventListener("blur",()=>{let n=this.layoutTitle.value.trim()||"Layout";n!==this.panelTitleValue&&(this.panelTitleValue=n,this.onRenamePanelTitle(n)),this.layoutTitle.value=n}),this.layoutTitle.addEventListener("keydown",n=>{n.stopPropagation(),n.key==="Enter"&&this.layoutTitle.blur(),n.key==="Escape"&&(this.layoutTitle.value=this.panelTitleValue.trim()||"Layout",this.layoutTitle.blur())}),this.layoutTitle.addEventListener("click",n=>{n.stopPropagation(),this.startLayoutTitleRename()}),this.layoutSettingsToggle=tt({icon:"options",label:"Layout Settings",modifiers:["toggle","left"],attrs:{"data-active":"false"}}),this.layoutSettingsToggle.addEventListener("click",n=>{n.stopPropagation(),this.isLayoutSettingsOpen?this.closeLayoutPanel():this.openLayoutPanel()});let r=tt({icon:"close",label:"Close layout guides",modifiers:["right"]});r.addEventListener("click",n=>{n.stopPropagation(),this.hide()}),this.headerAddButton=tt({icon:"plus",label:"Add Layout Guide",modifiers:["toggle","left"],attrs:{"data-active":"false"}}),this.headerAddButton.addEventListener("click",n=>{n.stopPropagation(),this.openAddPanel()}),e.appendChild(this.layoutTitle),e.appendChild(this.headerAddButton),e.appendChild(r);let i=document.createElement("div");return i.setAttribute("data-stdg-panel-responsive",""),this.layoutChipTabs=document.createElement("div"),this.layoutChipTabs.setAttribute("data-stdg-panel-list",""),i.appendChild(this.layoutSettingsToggle),i.appendChild(this.layoutChipTabs),this.listContainer=le({"data-string-grid-list":""}),this.addGuideButton=Ht({icon:"plus",label:"Add Layout Guide",withLabel:!0,attrs:{"data-active":"false"}}),this.addGuideButton.addEventListener("click",n=>{n.stopPropagation(),this.openAddPanel()}),this.listContainer.appendChild(this.addGuideButton),t.appendChild(e),t.appendChild(i),t.appendChild(this.listContainer),t}createAddPanel(){let t=oe({"data-panel":"add"}),e=ae(),r=tt({icon:"close",label:"Close panel",modifiers:["right"]});return r.addEventListener("click",i=>{i.stopPropagation(),this.closeAddPanel()}),e.appendChild(r),this.addGridList=le({"data-string-grid-add-grid-list":"","data-stdg-panel-content-50":""}),this.renderAddPanelList(),t.appendChild(e),t.appendChild(this.addGridList),t}renderAddPanelList(){if(this.addGridList.innerHTML="",this.adapterRegistry.size===0){let t=document.createElement("div");t.setAttribute("data-string-grid-add-grid-empty",""),t.textContent="No layout guides available",this.addGridList.appendChild(t);return}for(let[,t]of this.adapterRegistry){let e=Ht({icon:"",label:t.label,withLabel:!0});e.innerHTML=`${t.icon.replace("<svg","<svg data-stdg-icon-16")}<span>${t.label}</span>`,e.addEventListener("click",r=>{r.stopPropagation(),this.onAdd(t.type),this.closeAddPanel()}),this.addGridList.appendChild(e)}}createLayoutPanel(){let t=oe({"data-panel":"layout"}),e=ae();this.layoutAddButton=tt({icon:"plus",label:"Add Layout Guide",modifiers:["toggle","left"],attrs:{"data-active":"false"}}),this.layoutAddButton.addEventListener("click",o=>{o.stopPropagation(),this.onAddLayout()});let r=tt({icon:"close",label:"Close panel",modifiers:["right"]});r.addEventListener("click",o=>{o.stopPropagation(),this.closeLayoutPanel()}),e.appendChild(this.layoutAddButton),e.appendChild(r),this.layoutSettingsList=le(),this.layoutIOActions=le({"data-stdg-panel-content-50":""});let i=Ht({icon:"export",label:"Export",withLabel:!0,attrs:{"data-io":"export"}});i.addEventListener("click",o=>{o.stopPropagation(),this.onExport()});let n=Ht({icon:"import",label:"Import",withLabel:!0,attrs:{"data-io":"import"}});n.addEventListener("click",o=>{o.stopPropagation(),this.onImport()}),this.layoutIOActions.appendChild(i),this.layoutIOActions.appendChild(n);let s=document.createElement("span");return s.setAttribute("data-stdg-panel-hr",""),t.appendChild(e),t.appendChild(this.layoutSettingsList),t.appendChild(s),t.appendChild(this.layoutIOActions),t}createDetailPanel(){let t=oe({"data-panel":"detail"}),e=ae();this.detailIcon=document.createElement("span"),this.detailIcon.setAttribute("data-stdg-holder-icon-16",""),this.detailIcon.setAttribute("data-stdg-button-left",""),this.detailTitle=document.createElement("span"),this.detailTitle.addEventListener("click",i=>{i.stopPropagation(),this.startDetailRename()});let r=tt({icon:"close",label:"Close detail panel",modifiers:["right"]});return r.addEventListener("click",i=>{i.stopPropagation(),this.closeDetailPanel()}),e.appendChild(this.detailIcon),e.appendChild(this.detailTitle),e.appendChild(r),this.detailContent=document.createElement("div"),this.detailContent.setAttribute("data-string-dev-detail-body",""),t.appendChild(e),t.appendChild(this.detailContent),t}renderLayoutChips(){this.layoutChipTabs.innerHTML="";let t=e=>{this.selectedLayoutId=e,this.renderLayoutChips(),this.renderLayoutSettings()};[...this.layouts].reverse().forEach(e=>{let r=Ht({icon:"",label:`Select ${e.label} layout`});r.innerHTML=`<span>${e.label}</span>`,r.setAttribute("data-active",String(e.id===this.selectedLayoutId)),r.setAttribute("data-resolved",String(e.id===this.resolvedLayoutId)),r.setAttribute("data-mode",e.label),r.addEventListener("click",i=>{i.stopPropagation(),t(e.id),this.onSelectLayout(e.id)}),this.layoutChipTabs.appendChild(r)}),this.layoutSettingsToggle.setAttribute("data-active",String(this.isLayoutSettingsOpen))}renderLayoutSettings(){this.layoutSettingsList.innerHTML="",this.layoutAddButton.style.display=this.layouts.length>=4?"none":"";let{breakpointsRow:t,inputField:e}=this.createBreakpointWidget();this.layoutSettingsList.appendChild(t),this.layoutSettingsList.appendChild(e)}createBreakpointWidget(){let t=[...this.layouts].reverse(),e=t.length>2,r=document.createElement("div");r.setAttribute("data-stdg-panel-breakpoints","");let i=document.createElement("div");i.setAttribute("data-stdg-panel-field","");let n=`st-dg-break-${Date.now()}`,s=document.createElement("span");s.innerHTML=V(16,"break","second");let o=document.createElement("input");o.id=n,o.type="number",o.inputMode="numeric",o.step="1",o.min="1",o.setAttribute("data-stdg-input","");let a=document.createElement("label");a.htmlFor=n,a.setAttribute("data-stdg-field-input-disable",""),a.textContent="px",i.appendChild(s),i.appendChild(o),i.appendChild(a);let d=null,c=null,u=0,p=(h,f,b,y=!1)=>{c?.setAttribute("data-active","false"),d=h,c=b,u=f,this.selectedBreakpointLayoutId=h,b.setAttribute("data-active","true"),o.value=String(f),y&&(o.focus(),o.select())},g=()=>{if(!d||!o.isConnected)return;let h=Number.parseInt(o.value,10);if(Number.isFinite(h)&&h>=0){if(h===u)return;u=h,this.onUpdateLayoutMinWidth(d,h)}else o.value=String(u)};o.addEventListener("keydown",h=>{if(h.stopPropagation(),h.key==="Enter"){g();return}h.key==="Escape"&&(o.value=String(u),o.blur())}),o.addEventListener("blur",()=>requestAnimationFrame(g)),o.addEventListener("click",h=>h.stopPropagation());let m=null;if(t.forEach((h,f)=>{let b=document.createElement("div");b.setAttribute("data-stdg-panel-breakpoint-value","");let y=document.createElement("span");if(y.textContent=h.label,b.appendChild(y),e&&f>=2){let v=yi(`Remove ${h.label} layout`);v.addEventListener("pointerdown",S=>S.stopPropagation()),v.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation(),this.layouts.length>2&&this.onRemoveLayout(h.id)}),b.appendChild(v)}if(r.appendChild(b),f<t.length-1){let v=t[f+1],S=document.createElement("button");S.type="button",S.setAttribute("data-stdg-button",""),S.setAttribute("data-stdg-panel-breakpoint-marker",""),S.setAttribute("data-active","false"),S.setAttribute("aria-label",`Edit ${v.label} breakpoint`);let E=document.createElement("span");E.textContent=String(v.minWidth),S.appendChild(E),S.addEventListener("click",M=>{M.stopPropagation(),p(v.id,v.minWidth,S,!0)}),r.appendChild(S),(this.selectedBreakpointLayoutId===v.id||m===null&&this.selectedBreakpointLayoutId===null)&&(m={layoutId:v.id,value:v.minWidth,el:S})}}),m!==null){let h=m;p(h.layoutId,h.value,h.el)}return{breakpointsRow:r,inputField:i}}syncChipRowStates(){this.layoutChipTabs.querySelectorAll("[data-stdg-panel-button][data-mode]").forEach(e=>{let r=e.getAttribute("data-mode"),i=this.layouts.find(n=>n.label===r);i&&(e.setAttribute("data-active",String(i.id===this.selectedLayoutId)),e.setAttribute("data-resolved",String(i.id===this.resolvedLayoutId)))})}renderList(){for(;this.addGuideButton.nextSibling;)this.listContainer.removeChild(this.addGuideButton.nextSibling);for(let e of this.instances){let r=this.adapterRegistry.get(e.type);if(!r)continue;let i=document.createElement("div");i.setAttribute("data-stdg-panel-list-item",""),i.setAttribute("data-stdg-button",""),i.setAttribute("data-stdg-button-toggle",""),i.setAttribute("data-active",String(e.id===this.selectedInstanceId)),i.innerHTML=`${V(16,"grab","second")}${r.icon.replace("<svg","<svg data-stdg-icon-16")}<span>${e.name?.trim()||r.label}</span>`;let n=this.createToggle(e.visible,()=>this.onToggle(e.id)),s=yi(`Remove ${e.name?.trim()||"instance"}`);s.addEventListener("click",o=>{o.stopPropagation(),this.selectedInstanceId===e.id&&this.closeDetailPanel(),this.onRemove(e.id)}),i.appendChild(n),i.appendChild(s),i.addEventListener("click",()=>{this.selectedInstanceId===e.id?this.closeDetailPanel():this.selectInstance(e.id)}),i.setAttribute("draggable","true"),i.addEventListener("dragstart",o=>{o.stopPropagation(),o.dataTransfer?.setData("text/plain",e.id),i.setAttribute("data-dragging","true")}),i.addEventListener("dragend",()=>{i.removeAttribute("data-dragging"),this.listContainer.querySelectorAll("[data-drag-over]").forEach(o=>o.removeAttribute("data-drag-over"))}),i.addEventListener("dragover",o=>{o.preventDefault(),o.stopPropagation();let a=i.getBoundingClientRect(),d=o.clientY<a.top+a.height/2?"before":"after";this.listContainer.querySelectorAll("[data-drag-over]").forEach(c=>c.removeAttribute("data-drag-over")),i.setAttribute("data-drag-over",d)}),i.addEventListener("dragleave",o=>{i.contains(o.relatedTarget)||i.removeAttribute("data-drag-over")}),i.addEventListener("drop",o=>{o.preventDefault(),o.stopPropagation();let a=o.dataTransfer?.getData("text/plain");if(i.removeAttribute("data-drag-over"),!a||a===e.id)return;let d=i.getBoundingClientRect(),c=o.clientY<d.top+d.height/2?"before":"after";this.onReorder(a,e.id,c)}),this.listContainer.appendChild(i)}this.addGuideButton.setAttribute("data-empty",String(this.instances.length===0));let t=this.instances.length>0;this.addGuideButton.style.display=t?"none":"",this.headerAddButton.style.display=t?"":"none"}renderDetailPanel(){if(!this.selectedInstanceId){this.hideDetailPanelUI();return}let t=this.instances.find(i=>i.id===this.selectedInstanceId);if(!t){this.clearSelection();return}let e=this.adapterRegistry.get(t.type);if(!e){this.clearSelection();return}this.detailIcon&&(this.detailIcon.innerHTML=e.icon.replace("<svg","<svg data-stdg-icon-16 data-stdg-icon-second")),this.detailTitle&&(this.detailTitle.textContent=t.name?.trim()||e.label),this.detailBuilder?.destroy(),this.detailBuilder=new _r;let r=this.detailBuilder.build(e.getUISchema(),t.settings,(i,n)=>this.onSettingChange(t.id,i,n));for(;this.detailContent.firstChild;)this.detailContent.removeChild(this.detailContent.firstChild);this.detailContent.appendChild(r),this.detailPanel.setAttribute("data-open","true"),this.alignDetailPanel(),this.syncPanelPlacement()}createToggle(t,e){let r=document.createElement("label");r.setAttribute("data-stdg-toggle",""),r.setAttribute("data-checked",String(t));let i=document.createElement("input");i.type="checkbox",i.checked=t,i.setAttribute("data-stdg-toggle-input",""),i.addEventListener("change",s=>{s.stopPropagation(),e()});let n=document.createElement("span");return n.setAttribute("data-stdg-toggle-knob",""),r.addEventListener("click",s=>s.stopPropagation()),r.appendChild(i),r.appendChild(n),r}startDetailRename(){if(!this.selectedInstanceId||!this.detailTitle)return;let t=this.instances.find(o=>o.id===this.selectedInstanceId);if(!t)return;let e=this.adapterRegistry.get(t.type);if(!e)return;let r=t.name?.trim()||e.label,i=this.detailTitle.parentElement;if(!i)return;let n=document.createElement("input");n.setAttribute("data-stdg-input",""),n.type="text",n.value=r;let s=()=>{let o=n.value.trim();o!==r&&this.onRenameInstance(t.id,o),i.contains(n)&&i.replaceChild(this.detailTitle,n)};n.addEventListener("blur",s),n.addEventListener("keydown",o=>{o.key==="Enter"&&n.blur(),o.key==="Escape"&&(n.value=r,n.blur())}),n.addEventListener("click",o=>o.stopPropagation()),n.addEventListener("pointerdown",o=>o.stopPropagation()),i.replaceChild(n,this.detailTitle),n.focus(),n.select()}startLayoutTitleRename(){this.layoutTitle.select()}openAddPanel(){this.isAddPanelOpen=!0,this.closeLayoutPanel(),this.clearSelection(),this.renderAddPanelList(),this.addPanel.setAttribute("data-open","true"),this.syncPanelPlacement()}closeAddPanel(){this.isAddPanelOpen=!1,this.addPanel.setAttribute("data-open","false"),this.syncPanelPlacement()}openLayoutPanel(){this.isLayoutSettingsOpen=!0,this.closeAddPanel(),this.clearSelection(),this.layoutPanel.setAttribute("data-open","true"),this.renderLayoutChips(),this.alignLayoutPanel(),this.syncPanelPlacement(),this.onLayoutPanelOpen()}closeLayoutPanel(){this.isLayoutSettingsOpen=!1,this.layoutPanel.setAttribute("data-open","false"),this.renderLayoutChips(),this.syncPanelPlacement(),this.onLayoutPanelClose()}alignLayoutPanel(){if(this.isMobilePanelMode()){this.layoutPanel.style.removeProperty("top");return}if(this.hudRoot.getAttribute("data-target-id")==="__global__"){this.layoutPanel.style.removeProperty("top");return}let t=this.layoutSettingsToggle.getBoundingClientRect(),e=this.panel.getBoundingClientRect();this.layoutPanel.style.top=`${t.top-e.top}px`}selectInstance(t){this.selectedInstanceId=t,this.closeLayoutPanel(),this.closeAddPanel(),this.renderList(),this.renderDetailPanel()}closeDetailPanel(){this.clearSelection(),this.renderList()}clearSelection(){this.selectedInstanceId=null,this.hideDetailPanelUI()}hideDetailPanelUI(){let t=this.detailBuilder;this.detailBuilder=null,this.detailPanel.setAttribute("data-open","false"),this.syncPanelPlacement(),window.setTimeout(()=>{this.detailPanel.getAttribute("data-open")==="false"&&(t?.destroy(),this.detailContent.innerHTML="",this.detailPanel.style.removeProperty("top"))},220)}alignDetailPanel(){if(this.isMobilePanelMode()){this.detailPanel.style.removeProperty("top");return}if(this.hudRoot.getAttribute("data-target-id")==="__global__"){this.detailPanel.style.removeProperty("top");return}let t=this.listContainer.querySelector('[data-stdg-panel-list-item][data-active="true"]');if(!t)return;let e=t.getBoundingClientRect(),r=this.panel.getBoundingClientRect();this.detailPanel.style.top=`${e.top-r.top}px`}show(){this.isOpen=!0,this.panel.setAttribute("data-open","true"),this.trigger.setAttribute("data-active","true"),this.trigger.setAttribute("aria-expanded","true"),this.syncPanelPlacement(),this.onHUDOpen()}hide(){this.isOpen=!1,this.panel.setAttribute("data-open","false"),this.closeAddPanel(),this.closeDetailPanel(),this.closeLayoutPanel(),this.trigger.setAttribute("data-active","false"),this.trigger.setAttribute("aria-expanded","false"),this.syncPanelPlacement(),this.onHUDClose()}toggle(){this.enabled&&(this.isOpen?this.hide():this.show())}isMobilePanelMode(){return typeof window>"u"?!1:window.matchMedia("(max-width: 1024px), (pointer: coarse)").matches}syncPanelPlacement(){if(!this.isMobilePanelMode()){this.panelInBody&&(this.panel.removeAttribute("data-mobile-sheet"),this.panel.style.removeProperty("position"),this.panel.style.removeProperty("bottom"),this.hudRoot.appendChild(this.panel),this.panelInBody=!1),this.hudRoot.setAttribute("data-mobile-sheet","false"),this.panel.style.removeProperty("left"),this.panel.style.removeProperty("top"),this.panel.style.removeProperty("width"),this.panel.style.removeProperty("height"),this.panel.style.removeProperty("max-height");return}if(!this.isOpen)return;this.panelInBody||((document.body??document.documentElement).appendChild(this.panel),this.panelInBody=!0);let e=window.visualViewport,r=e?.width??window.innerWidth,i=e?.height??window.innerHeight,n=Math.max(220,r-wi*2),s=Math.max(120,i-wi*2),o=Math.min(vo,n),a=Math.min(bo,s),d=Math.round((e?.offsetLeft??0)+(r-o)/2);this.hudRoot.setAttribute("data-mobile-sheet","true"),this.panel.setAttribute("data-mobile-sheet","true"),this.panel.style.position="fixed",this.panel.style.left=`${d}px`,this.panel.style.bottom=`${wi}px`,this.panel.style.removeProperty("top"),this.panel.style.width=`${Math.round(o)}px`,this.panel.style.maxHeight=`${Math.round(a)}px`,this.panel.style.removeProperty("height"),this.addPanel.style.removeProperty("top"),this.layoutPanel.style.removeProperty("top"),this.detailPanel.style.removeProperty("top")}onDocumentPointerDown(t){if(!this.isOpen)return;let e=t.target;e instanceof Node&&(this.panel.contains(e)||this.trigger.contains(e)||this.addPanel.contains(e)||this.layoutPanel.contains(e)||this.detailPanel.contains(e)||this.hide())}};var Mt=class{static VERSION=2;static serialize(t,e){return{v:this.VERSION,source:"StringDevLayout",selectedLayout:e,layouts:t.map(r=>({id:r.id,label:r.label,minWidth:r.minWidth,grids:r.instances.map(i=>({id:i.id,type:i.type,visible:i.visible,...i.name!==void 0?{name:i.name}:{},settings:{...i.settings}}))}))}}static deserialize(t,e){if(!t||typeof t!="object")return null;let r=t,i=r.v,n=r.source;if(n!=="StringDevLayout"&&n!=="StringGrid"||i!==1&&i!==2||!Array.isArray(r.layouts))return null;let s=r.layouts.filter(d=>!!d&&typeof d=="object"&&typeof d.id=="string").map((d,c)=>({id:d.id,label:Ei.includes(d.label)?d.label:"S",minWidth:this.resolveImportedMinWidth(d.minWidth,c),instances:(Array.isArray(d.grids)?d.grids:[]).filter(u=>!!u&&typeof u=="object"&&typeof u.type=="string"&&e.has(u.type)).map(u=>{let p=u.type,g=e.get(p);return{id:typeof u.id=="string"?u.id:Pr(),type:p,visible:u.visible!==!1,...typeof u.name=="string"&&u.name?{name:u.name}:{},settings:{...g.getDefaults(),...u.settings&&typeof u.settings=="object"&&!Array.isArray(u.settings)?u.settings:{}}}})}));if(s.length===0)return null;s.sort((d,c)=>c.minWidth-d.minWidth);let o=typeof r.selectedLayout=="string"?r.selectedLayout:typeof r.activeLayout=="string"?r.activeLayout:s[0].id,a=s.some(d=>d.id===o)?o:s[0].id;return{layouts:s,selectedLayoutId:a}}static toFile(t,e){let r=JSON.stringify(e,null,2),i=new Blob([r],{type:"application/json"}),n=URL.createObjectURL(i),s=document.createElement("a");s.href=n,s.download=t,s.click(),URL.revokeObjectURL(n)}static fromFile(){return new Promise((t,e)=>{let r=document.createElement("input");r.type="file",r.accept=".json,application/json";let i=()=>r.remove();r.addEventListener("change",()=>{let n=r.files?.[0];if(!n){i(),e(new Error("No file selected"));return}let s=new FileReader;s.onload=()=>{i();try{t(JSON.parse(s.result))}catch{e(new Error("Invalid JSON"))}},s.onerror=()=>{i(),e(new Error("File read error"))},s.readAsText(n)}),r.addEventListener("cancel",()=>{i(),e(new Error("Cancelled"))}),document.body.appendChild(r),r.click()})}static resolveImportedMinWidth(t,e){return typeof t=="number"&&Number.isFinite(t)?de(t):[1280,1024,768,0][e]??Math.max(0,1280-e*256)}};var Fr="http://www.w3.org/2000/svg",G=class{clear(t,e){let r=t.querySelector(`[data-grid-id="${e}"]`);r&&r.remove()}getGroup(t,e){let r=t.querySelector(`[data-grid-id="${e}"]`);return r||(r=document.createElementNS(Fr,"g"),r.setAttribute("data-grid-id",e),t.appendChild(r)),r}createLine(t,e,r,i,n,s,o=1){let a=document.createElementNS(Fr,"line");return a.setAttribute("data-string-grid-shape","line"),a.setAttribute("x1",String(t)),a.setAttribute("y1",String(e)),a.setAttribute("x2",String(r)),a.setAttribute("y2",String(i)),a.setAttribute("stroke",n),a.setAttribute("stroke-opacity",String(s)),a.setAttribute("stroke-width",String(o)),a}createRect(t,e,r,i,n,s){let o=document.createElementNS(Fr,"rect");return o.setAttribute("data-string-grid-shape","rect"),o.setAttribute("x",String(t)),o.setAttribute("y",String(e)),o.setAttribute("width",String(r)),o.setAttribute("height",String(i)),o.setAttribute("fill",n),o.setAttribute("fill-opacity",String(s)),o}resolveUnit(t,e,r,i){let n=parseFloat(getComputedStyle(document.documentElement).fontSize)||16,s=i instanceof Element&&parseFloat(getComputedStyle(i).fontSize)||n;switch(e){case"%":return t/100*r;case"vw":return t/100*window.innerWidth;case"vh":return t/100*window.innerHeight;case"em":return t*s;case"rem":return t*n;default:return t}}createPath(t,e,r,i=1,n="none"){let s=document.createElementNS(Fr,"path");return s.setAttribute("data-string-grid-shape","path"),s.setAttribute("d",t),s.setAttribute("stroke",e),s.setAttribute("stroke-opacity",String(r)),s.setAttribute("stroke-width",String(i)),s.setAttribute("fill",n),s}};var Vr=class l extends G{type="columns";label="Columns";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7" y="3" width="2" height="10" fill="currentColor"/><rect x="3" y="3" width="2" height="10" fill="currentColor"/><rect x="11" y="3" width="2" height="10" fill="currentColor"/></svg>';static UNIT_OPTIONS=[{value:"px",label:"px"},{value:"%",label:"%"},{value:"vw",label:"vw"},{value:"vh",label:"vh"},{value:"em",label:"em"},{value:"rem",label:"rem"}];getDefaults(){return{count:12,gap:20,gapUnit:"px",margin:0,marginUnit:"px",color:"#4a90e2",opacity:.15,showLines:!1}}getUISchema(){return[{type:"number",key:"count",label:"Columns",default:12,min:1,max:48,step:1},{type:"range",key:"gap",label:"Gap",default:20,min:0,max:100,step:1,units:l.UNIT_OPTIONS,defaultUnit:"px"},{type:"range",key:"margin",label:"Margin",default:0,min:0,max:100,step:1,units:l.UNIT_OPTIONS,defaultUnit:"px"},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#4a90e2"},{type:"range",key:"opacity",label:"Opacity",default:.15,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10},{type:"toggle",key:"showLines",label:"Lines only",default:!1}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{count:s,gap:o,gapUnit:a,margin:d,marginUnit:c,color:u,opacity:p,showLines:g}=i,m=t.parentElement,h=this.resolveUnit(o,a||"px",e,m),f=this.resolveUnit(d,c||"px",e,m),b=e-f*2,y=(s-1)*h,v=(b-y)/s;if(!(v<=0))for(let S=0;S<s;S++){let E=f+S*(v+h);g?(n.appendChild(this.createLine(E,0,E,r,u,p)),n.appendChild(this.createLine(E+v,0,E+v,r,u,p))):n.appendChild(this.createRect(E,0,v,r,u,p))}}};var Wr=class l extends G{type="rows";label="Rows";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="10" height="2" fill="currentColor"/><rect x="3" y="7" width="10" height="2" fill="currentColor"/><rect x="3" y="11" width="10" height="2" fill="currentColor"/></svg>';static UNIT_OPTIONS=[{value:"px",label:"px"},{value:"%",label:"%"},{value:"vh",label:"vh"},{value:"vw",label:"vw"},{value:"em",label:"em"},{value:"rem",label:"rem"}];getDefaults(){return{mode:"count",count:8,size:24,sizeUnit:"px",gap:0,gapUnit:"px",margin:0,marginUnit:"px",color:"#e2784a",opacity:.2,style:"line"}}getUISchema(){return[{type:"select",key:"mode",label:"Mode",default:"count",options:[{value:"count",label:"By count"},{value:"size",label:"By size"}]},{type:"number",key:"count",label:"Rows",default:8,min:1,max:48,step:1,disabledWhen:{key:"mode",equals:"size"}},{type:"range",key:"size",label:"Size",default:24,min:0,max:1200,step:1,units:l.UNIT_OPTIONS,defaultUnit:"px",disabledWhen:{key:"mode",equals:"count"}},{type:"range",key:"gap",label:"Gap",default:0,min:0,max:100,step:1,units:l.UNIT_OPTIONS,defaultUnit:"px"},{type:"range",key:"margin",label:"Margin",default:0,min:0,max:100,step:1,units:l.UNIT_OPTIONS,defaultUnit:"px"},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#e2784a"},{type:"range",key:"opacity",label:"Opacity",default:.2,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10},{type:"select",key:"style",label:"Style",default:"line",options:[{value:"line",label:"Lines"},{value:"fill",label:"Fill"}]}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{mode:s,count:o,size:a,sizeUnit:d,gap:c,gapUnit:u,margin:p,marginUnit:g,color:m,opacity:h,style:f}=i,b=t.parentElement,y=this.resolveUnit(c,u||"px",r,b),v=this.resolveUnit(p,g||"px",r,b),S=r-v*2;if(!(S<=0))if(s==="count")this.renderByCount(n,e,S,v,o,y,m,h,f);else{let E=this.resolveUnit(a,d||"px",r,b);if(E<=0)return;this.renderBySize(n,e,S,v,E,y,m,h,f)}}renderByCount(t,e,r,i,n,s,o,a,d){if(d==="fill"){let c=(r-(n-1)*s)/n;if(c<=0)return;for(let u=0;u<n;u++){let p=i+u*(c+s);t.appendChild(this.createRect(0,p,e,c,o,a))}}else{if(n===1){let u=i+r/2;t.appendChild(this.createLine(0,u,e,u,o,a));return}let c=r/(n-1);for(let u=0;u<n;u++){let p=i+u*c;t.appendChild(this.createLine(0,p,e,p,o,a))}}}renderBySize(t,e,r,i,n,s,o,a,d){if(d==="fill"){let c=n+s;for(let u=0;u<r;u+=c){let p=Math.min(n,r-u);t.appendChild(this.createRect(0,i+u,e,p,o,a))}}else for(let c=0;c<=r;c+=n)t.appendChild(this.createLine(0,i+c,e,i+c,o,a))}};var Nr=class extends G{type="center";label="Center";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="10" height="10" rx="3" fill="currentColor"/><path d="M8 2V14" stroke="white"/><path d="M2 8H14" stroke="white"/></svg>';getDefaults(){return{showVertical:!0,showHorizontal:!0,color:"#50e24a",opacity:.5,dashed:!0}}getUISchema(){return[{type:"toggle",key:"showVertical",label:"Vertical",default:!0},{type:"toggle",key:"showHorizontal",label:"Horizontal",default:!0},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#50e24a"},{type:"range",key:"opacity",label:"Opacity",default:.5,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10},{type:"toggle",key:"dashed",label:"Dashed",default:!0}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{showVertical:s,showHorizontal:o,color:a,opacity:d,dashed:c}=i,u=c?"6 3":"none";if(s){let p=this.createLine(e/2,0,e/2,r,a,d);c&&p.setAttribute("stroke-dasharray",u),n.appendChild(p)}if(o){let p=this.createLine(0,r/2,e,r/2,a,d);c&&p.setAttribute("stroke-dasharray",u),n.appendChild(p)}}};var zr=class extends G{type="rule-of-thirds";label="3\xD73";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="6" y="6" width="4" height="4" fill="currentColor"/><path d="M6 3.6C6 3.03995 6 2.75992 6.10899 2.54601C6.20487 2.35785 6.35785 2.20487 6.54601 2.10899C6.75992 2 7.03995 2 7.6 2H8.4C8.96005 2 9.24008 2 9.45399 2.10899C9.64215 2.20487 9.79513 2.35785 9.89101 2.54601C10 2.75992 10 3.03995 10 3.6V5H6V3.6Z" fill="currentColor"/><path d="M6 11H10V12.4C10 12.9601 10 13.2401 9.89101 13.454C9.79513 13.6422 9.64215 13.7951 9.45399 13.891C9.24008 14 8.96005 14 8.4 14H7.6C7.03995 14 6.75992 14 6.54601 13.891C6.35785 13.7951 6.20487 13.6422 6.10899 13.454C6 13.2401 6 12.9601 6 12.4V11Z" fill="currentColor"/><path d="M2 7.6C2 7.03995 2 6.75992 2.10899 6.54601C2.20487 6.35785 2.35785 6.20487 2.54601 6.10899C2.75992 6 3.03995 6 3.6 6H5V10H3.6C3.03995 10 2.75992 10 2.54601 9.89101C2.35785 9.79513 2.20487 9.64215 2.10899 9.45399C2 9.24008 2 8.96005 2 8.4V7.6Z" fill="currentColor"/><path d="M11 6H12.4C12.9601 6 13.2401 6 13.454 6.10899C13.6422 6.20487 13.7951 6.35785 13.891 6.54601C14 6.75992 14 7.03995 14 7.6V8.4C14 8.96005 14 9.24008 13.891 9.45399C13.7951 9.64215 13.6422 9.79513 13.454 9.89101C13.2401 10 12.9601 10 12.4 10H11V6Z" fill="currentColor"/></svg>';getDefaults(){return{color:"#e2e24a",opacity:.4,showIntersections:!0}}getUISchema(){return[{type:"color",key:"color",label:"Color",default:"#e2e24a"},{type:"range",key:"opacity",label:"Opacity",default:.4,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10},{type:"toggle",key:"showIntersections",label:"Show points",default:!0}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{color:s,opacity:o,showIntersections:a}=i,d=e/3,c=r/3;if(n.appendChild(this.createLine(d,0,d,r,s,o)),n.appendChild(this.createLine(d*2,0,d*2,r,s,o)),n.appendChild(this.createLine(0,c,e,c,s,o)),n.appendChild(this.createLine(0,c*2,e,c*2,s,o)),a){let u=[[d,c],[d*2,c],[d,c*2],[d*2,c*2]];for(let[p,g]of u){let m=document.createElementNS("http://www.w3.org/2000/svg","circle");m.setAttribute("cx",String(p)),m.setAttribute("cy",String(g)),m.setAttribute("r","3"),m.setAttribute("fill",s),m.setAttribute("fill-opacity",String(o*1.5)),n.appendChild(m)}}}};var xi=1.6180339887,Gr=class extends G{type="golden-rectangle";label="Golden";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="10" height="10" rx="3" fill="currentColor"/><path d="M9 13V3" stroke="white"/><path d="M13 9H9" stroke="white"/></svg>';getDefaults(){return{depth:8,showSpiral:!0,color:"#e2a44a",opacity:.4}}getUISchema(){return[{type:"number",key:"depth",label:"Depth",default:8,min:2,max:14,step:1},{type:"toggle",key:"showSpiral",label:"Show spiral",default:!0},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#e2a44a"},{type:"range",key:"opacity",label:"Opacity",default:.4,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{depth:s,showSpiral:o,color:a,opacity:d}=i,c,u;e/r>=xi?(u=r,c=u*xi):(c=e,u=c/xi);let p=(e-c)/2,g=(r-u)/2;if(c<e-1||u<r-1){let S=this.createPath(`M ${p} ${g} L ${p+c} ${g} L ${p+c} ${g+u} L ${p} ${g+u} Z`,a,d*.3,1);S.setAttribute("stroke-dasharray","6 4"),n.appendChild(S)}let m=p,h=g,f=c,b=u,y="",v=!0;for(let S=0;S<s&&!(f<1||b<1);S++){let E=S%4,M=Math.min(f,b),C,A;switch(E){case 0:{C=m+f-M,A=h,f-M>.5&&n.appendChild(this.createLine(C,h,C,h+b,a,d)),o&&(v&&(y=`M ${C+M} ${A}`,v=!1),y+=` A ${M} ${M} 0 0 1 ${C} ${A+M}`),f-=M;break}case 1:{C=m,A=h+b-M,b-M>.5&&n.appendChild(this.createLine(m,A,m+f,A,a,d)),o&&(v&&(y=`M ${C+M} ${A+M}`,v=!1),y+=` A ${M} ${M} 0 0 1 ${C} ${A}`),b-=M;break}case 2:{C=m,A=h,f-M>.5&&n.appendChild(this.createLine(m+M,h,m+M,h+b,a,d)),o&&(v&&(y=`M ${C} ${A+M}`,v=!1),y+=` A ${M} ${M} 0 0 1 ${C+M} ${A}`),m+=M,f-=M;break}case 3:{C=m,A=h,b-M>.5&&n.appendChild(this.createLine(m,h+M,m+f,h+M,a,d)),o&&(v&&(y=`M ${C} ${A}`,v=!1),y+=` A ${M} ${M} 0 0 1 ${C+M} ${A+M}`),h+=M,b-=M;break}}}o&&y&&n.appendChild(this.createPath(y,a,d*.8,1.5))}};var Ci="http://www.w3.org/2000/svg",$r=class l extends G{static MAX_DOT_CELLS=12e4;static MAX_CROSS_CELLS=8e4;type="dot-grid";label="Dots";icon='<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="11" y="3" width="2" height="2" fill="currentColor"/><rect x="11" y="7" width="2" height="2" fill="currentColor"/><rect x="11" y="11" width="2" height="2" fill="currentColor"/><rect x="7" y="3" width="2" height="2" fill="currentColor"/><rect x="7" y="7" width="2" height="2" fill="currentColor"/><rect x="7" y="11" width="2" height="2" fill="currentColor"/><rect x="3" y="3" width="2" height="2" fill="currentColor"/><rect x="3" y="7" width="2" height="2" fill="currentColor"/><rect x="3" y="11" width="2" height="2" fill="currentColor"/></svg>';static UNIT_OPTIONS=[{value:"px",label:"px"},{value:"%",label:"%"},{value:"vw",label:"vw"},{value:"vh",label:"vh"},{value:"em",label:"em"},{value:"rem",label:"rem"}];getDefaults(){return{step:16,stepUnit:"px",dotSize:1.5,shape:"dot",color:"#a0a0a0",opacity:.4}}getUISchema(){return[{type:"range",key:"step",label:"Step",default:16,min:0,max:100,step:1,units:l.UNIT_OPTIONS,defaultUnit:"px"},{type:"range",key:"dotSize",label:"Size",default:1.5,min:.5,max:6,step:.5},{type:"select",key:"shape",label:"Shape",default:"dot",options:[{value:"dot",label:"Dot \u25CF"},{value:"cross",label:"Cross +"}]},{type:"divider"},{type:"color",key:"color",label:"Color",default:"#a0a0a0"},{type:"range",key:"opacity",label:"Opacity",default:.4,min:0,max:1,step:.01,displayMultiplier:100,displayStep:10}]}render(t,e,r,i){let n=this.getGroup(t,i.__instanceId),{step:s,stepUnit:o,dotSize:a,shape:d,color:c,opacity:u}=i,p=this.resolveUnit(s,o||"px",Math.min(e,r),t.parentElement),g=this.getSafeStep(e,r,p,d);if(g<2)return;let m=this.getPatternId(i.__instanceId),h=this.getDefs(t),f=document.createElementNS(Ci,"pattern");f.setAttribute("id",m),f.setAttribute("data-string-grid-pattern-for",i.__instanceId),f.setAttribute("patternUnits","userSpaceOnUse"),f.setAttribute("width",String(g)),f.setAttribute("height",String(g)),f.setAttribute("x",String(g/2)),f.setAttribute("y",String(g/2));let b=g/2;if(d==="cross")f.appendChild(this.createLine(b-a*2,b,b+a*2,b,c,u,.8)),f.appendChild(this.createLine(b,b-a*2,b,b+a*2,c,u,.8));else{let v=document.createElementNS(Ci,"circle");v.setAttribute("cx",String(b)),v.setAttribute("cy",String(b)),v.setAttribute("r",String(a)),v.setAttribute("fill",c),v.setAttribute("fill-opacity",String(u)),f.appendChild(v)}h.appendChild(f);let y=this.createRect(0,0,e,r,`url(#${m})`,1);y.setAttribute("fill-opacity","1"),n.appendChild(y)}clear(t,e){super.clear(t,e),t.querySelector(`[data-string-grid-pattern-for="${e}"]`)?.remove()}getDefs(t){let e=t.querySelector("defs");return e||(e=document.createElementNS(Ci,"defs"),t.insertBefore(e,t.firstChild)),e}getPatternId(t){return`string-grid-dot-pattern-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}`}getSafeStep(t,e,r,i){let s=Math.max(r,2),o=i==="cross"?l.MAX_CROSS_CELLS:l.MAX_DOT_CELLS;return Math.floor(t/s)*Math.floor(e/s)<=o?s:Math.max(s,Math.sqrt(t*e/o))}};var Ur="string-devtools-overlay-layout:change";var Ti=class{entries=new Map;register(t,e,r=1){this.entries.set(t,{order:e,badgeCount:r})}unregister(t){this.entries.delete(t)}resolveAnchor(t,e,r){let i=this.getSorted(),n=i.findIndex(o=>o.id===t),s=0;for(let o=0;o<n;o+=1)s+=i[o].badgeCount;return{docX:e+0+s*31,docY:r+0}}resolveCollisionOffset(t,e,r,i){let n=[],s=t.parentElement;for(;s;){let d=s.getAttribute("string-id")??s.getAttribute("data-string-id");if(d){let c=i(d);c&&n.push(c)}s=s.parentElement}let o=0,a=!0;for(;a;){a=!1;for(let d of n)if(Math.abs(d.docX-e)<50&&Math.abs(d.docY-(r+o))<31){o+=33,a=!0;break}}return o}emitLayoutChange(){window.dispatchEvent(new CustomEvent(Ur))}getSorted(){let t=[];for(let[e,r]of this.entries)t.push({id:e,...r});return t.sort((e,r)=>e.order!==r.order?e.order-r.order:e.id.localeCompare(r.id)),t}},et=new Ti;function Ln(){return`
|
|
1284
1284
|
${yr(["[data-string-grid-root]","[data-stdg-badge]"])}
|
|
1285
1285
|
|
|
1286
1286
|
[data-string-grid-root],
|
|
@@ -1360,7 +1360,7 @@ ${Bs(i," ")}
|
|
|
1360
1360
|
left: 0;
|
|
1361
1361
|
}
|
|
1362
1362
|
}
|
|
1363
|
-
`}var ge="data-string-grid-storage-key",En=/^string-\d+$/,F="__global__";function Pi(d,t){let e=d.getAttribute(ge)?.trim();if(e)return e;let r=d.getAttribute("data-string-id")?.trim()||d.getAttribute("string-id")?.trim()||"";if(r&&!En.test(r)){let s=`string:${window.location.pathname}#${r}`;return d.setAttribute(ge,s),s}let i=d.id.trim();if(i){let s=`dom:${window.location.pathname}#${i}`;return d.setAttribute(ge,s),s}let n=`path:${window.location.pathname}:${bo(d)}`;return d.setAttribute(ge,n),n}function vo(d,t,e){let r=window.location.pathname,i=d.id.trim(),n=d.getAttribute("data-string-id")?.trim()||d.getAttribute("string-id")?.trim()||"",s=[i?`dom:${r}#${i}`:"",n&&!En.test(n)?`string:${r}#${n}`:"",i,n,t.id.trim()].filter(Boolean);return s.filter((o,a)=>o!==e&&s.indexOf(o)===a)}function bo(d){let t=[],e=d;for(;e&&e!==document.body&&e!==document.documentElement;){let r=e.parentElement,i=e.tagName.toLowerCase(),n=1;if(r){let s=e.previousElementSibling;for(;s;)s.tagName===e.tagName&&(n+=1),s=s.previousElementSibling}if(t.unshift(`${i}:nth-of-type(${n})`),r?.id){t.unshift(`#${r.id}`);break}e=r}return t.join(">")}function yo(d){let t=0,e=d.parentElement;for(;e;)e.hasAttribute("data-string-grid-root")&&(t+=1),e=e.parentElement;return t}var jr=class extends Z{gridManager=new Or;viewportLayer;overlayLayer;overlays=new Map;huds=new Map;elementMap=new Map;triggerEntries=new Map;triggerMeasurements=new Map;enabled=!0;needsMeasure=!1;hasPendingMutate=!1;globalHost=null;globalOverlay=null;globalHUD=null;globalSubBadge=null;static devtool={id:"layout",label:"Layout",icon:"layout",order:20,group:1,hotkey:{key:"L",shiftKey:!0},styles:Ln,connects:{global:!1,keys:["layout"]}};constructor(t){super(t),this.attributesToMap=[],this.overlayLayer=this.acquireViewportLayer("devtools-grid-overlay",10010),this.viewportLayer=this.acquireViewportLayer("devtools-hud",10040),this.registerBuiltInAdapters(),this.registerExternalAdapters()}onInit(){this.ensureTriggerLayer(),this.ensureGlobalGrid()}getDevtoolSubBadges(){return[{id:"global-settings",icon:"settings",label:"Open global grid settings",selectorAttribute:"data-string-grid-global-toggle",onClick:t=>this.toggleGlobalPanel(t)}]}onObjectConnected(t){let e=t.htmlElement,r=Pi(e,t),i=vo(e,t,r);e.setAttribute("data-string-grid-root","");let n=yo(e);e.setAttribute("data-string-grid-depth",String(n)),e.style.setProperty("--string-grid-stack-offset","0px"),this.elementMap.set(r,e),this.gridManager.load(r,i);let s=this.overlayLayer.getWorldElement(this.getWorldHost()),o=new ue(e,s,()=>{this.enabled&&(this.renderElement(r),this.scheduleTriggerSync())});this.overlays.set(r,o);let a=new pe(e,this.gridManager.getAdapterRegistry(),{onAdd:l=>this.handleAdd(r,l),onRemove:l=>this.handleRemove(r,l),onToggle:l=>this.handleToggle(r,l),onSettingChange:(l,c,u)=>this.handleSettingChange(r,l,c,u),onReorder:(l,c,u)=>this.handleReorder(r,l,c,u),onMoveToEnd:l=>this.handleMoveToEnd(r,l),onSelectLayout:l=>this.handleSelectLayout(r,l),onUpdateLayoutMinWidth:(l,c)=>this.handleUpdateLayoutMinWidth(r,l,c),onAddLayout:()=>this.handleAddLayout(r),onRemoveLayout:l=>this.handleRemoveLayout(r,l),onExport:()=>this.handleExport(r),onImport:()=>this.handleImport(r),onRenameInstance:(l,c)=>this.handleRenameInstance(r,l,c),onRenamePanelTitle:l=>this.handleRenamePanelTitle(r,l),onHUDOpen:()=>this.handleHUDOpen(r),onHUDClose:()=>this.handleHUDClose(r),onLayoutPanelOpen:()=>this.handleLayoutPanelOpen(r),onLayoutPanelClose:()=>this.handleLayoutPanelClose(r)});this.huds.set(r,a),a.setTargetId(r),this.ensureTriggerLayer(),this.viewportLayer.getWorldElement(this.getWorldHost()).appendChild(a.getHudElement()),this.triggerEntries.set(r,{object:t,hud:a,depth:n}),this.renderElement(r),this.refreshHUD(r),o.setEnabled(this.enabled),a.setEnabled(this.enabled),requestAnimationFrame(()=>this.scheduleTriggerSync())}onObjectDisconnected(t){let e=t.htmlElement,r=Pi(e,t);this.destroyElement(r)}onResize(){for(let[t,e]of this.overlays)e.syncViewBox(),this.renderElement(t),this.refreshHUD(t);this.syncGlobalHostSize(),this.globalOverlay?.syncViewBox(),this.renderGlobal(),this.refreshGlobalHUD(),this.scheduleTriggerSync()}onScroll(){this.enabled&&(this.needsMeasure=!0)}onScrollMeasure(){if(!(!this.enabled||!this.needsMeasure)){this.collectTriggerMeasurements(),this.needsMeasure=!1;for(let[t,e]of this.triggerEntries)this.applyTriggerMeasurement(e,this.triggerMeasurements.get(t));this.hasPendingMutate=!1}}onMutate(){if(!(!this.enabled||!this.hasPendingMutate)){for(let[t,e]of this.triggerEntries)this.applyTriggerMeasurement(e,this.triggerMeasurements.get(t));this.hasPendingMutate=!1}}onDOMRebuild(){this.enabled&&this.scheduleTriggerSync()}destroy(){for(let[t]of this.overlays)this.destroyElement(t);this.destroyGlobalGrid(),this.gridManager.clear(),super.destroy()}setEnabled(t){if(this.enabled!==t){this.enabled=t;for(let e of this.overlays.values())e.setEnabled(t);for(let e of this.huds.values())e.setEnabled(t);if(this.globalOverlay?.setEnabled(t),this.globalHUD?.setEnabled(t),t||this.globalHUD?.hide(),this.applyTriggerLayerState(),t){for(let e of this.overlays.keys())this.renderElement(e);this.renderGlobal(),this.scheduleTriggerSync()}else this.hasPendingMutate=!1;this.emitDevtoolState()}}isEnabled(){return this.enabled}getDevtoolActiveState(){return this.enabled}setDevtoolActiveState(t){this.setEnabled(t)}handleAdd(t,e){this.gridManager.addInstance(t,e),this.renderElement(t),this.refreshHUD(t)}handleRemove(t,e){let r=this.gridManager.findInstance(t,e);if(r){let i=this.gridManager.getAdapter(r.type),n=this.overlays.get(t);i&&n&&n.clearInstance(e,i)}this.gridManager.removeInstance(t,e),this.refreshHUD(t)}handleToggle(t,e){this.gridManager.toggleVisibility(t,e),this.renderElement(t),this.refreshHUD(t)}handleSettingChange(t,e,r,i){this.gridManager.updateSetting(t,e,r,i),this.renderElement(t)}handleReorder(t,e,r,i){this.gridManager.reorderInstance(t,e,r,i),this.renderElement(t),this.refreshHUD(t)}handleMoveToEnd(t,e){this.gridManager.moveInstanceToEnd(t,e),this.renderElement(t),this.refreshHUD(t)}handleSelectLayout(t,e){this.gridManager.selectLayout(t,e),this.renderElement(t),this.refreshHUD(t)}handleUpdateLayoutMinWidth(t,e,r){this.gridManager.updateLayoutMinWidth(t,e,r),this.syncSelectedLayoutToViewport(t),this.renderElement(t),this.refreshHUD(t)}handleAddLayout(t){this.gridManager.addLayout(t),this.syncSelectedLayoutToViewport(t),this.renderElement(t),this.refreshHUD(t)}handleRemoveLayout(t,e){this.gridManager.removeLayout(t,e),this.syncSelectedLayoutToViewport(t),this.renderElement(t),this.refreshHUD(t)}handleRenameInstance(t,e,r){this.gridManager.renameInstance(t,e,r),this.refreshHUD(t)}handleRenamePanelTitle(t,e){this.gridManager.renamePanelTitle(t,e),this.refreshHUD(t)}handleHUDOpen(t){this.syncToResolved(t),this.renderElement(t),this.refreshHUD(t)}handleHUDClose(t){this.syncToResolved(t),this.renderElement(t),this.refreshHUD(t)}handleLayoutPanelOpen(t){this.renderElement(t),this.refreshHUD(t)}handleLayoutPanelClose(t){this.renderElement(t),this.refreshHUD(t)}handleExport(t){let e=this.gridManager.getLayouts(t),r=this.gridManager.getSelectedLayoutId(t),i=Mt.serialize(e,r),n=t.replace(/[^a-z0-9]/gi,"-").toLowerCase()||"element";Mt.toFile(`string-grid-${n}.json`,i)}handleImport(t){Mt.fromFile().then(e=>{let r=Mt.deserialize(e,this.gridManager.getAdapterRegistry());r&&(this.gridManager.replaceLayouts(t,r.layouts,r.selectedLayoutId),this.syncSelectedLayoutToViewport(t),this.renderElement(t),this.refreshHUD(t))}).catch(()=>{})}renderElement(t){if(t===F){this.renderGlobal();return}let e=this.overlays.get(t);if(!e)return;let r=this.huds.get(t),i=this.data.viewport.windowWidth||window.innerWidth,n=r?.isHUDOpen()?this.gridManager.getSelectedInstances(t):this.gridManager.getResolvedInstances(t,i);e.render(n,this.gridManager.getAdapterRegistry())}syncToResolved(t){this.syncSelectedLayoutToViewport(t)}syncSelectedLayoutToViewport(t){let e=this.data.viewport.windowWidth||window.innerWidth,r=this.gridManager.getResolvedLayoutId(t,e);this.gridManager.getSelectedLayoutId(t)!==r&&this.gridManager.selectLayout(t,r,!1)}refreshHUD(t){if(t===F){this.refreshGlobalHUD();return}let e=this.huds.get(t);if(!e)return;let r=this.data.viewport.windowWidth||window.innerWidth,i=this.gridManager.getResolvedLayoutId(t,r);e.isHUDOpen()||this.gridManager.getSelectedLayoutId(t)!==i&&this.gridManager.selectLayout(t,i,!1);let n=this.gridManager.getSelectedLayoutId(t),s=this.gridManager.getSelectedInstances(t),o=this.gridManager.getLayouts(t),a=this.gridManager.getPanelTitle(t);e.refresh(s,o,a,n,i)}ensureGlobalGrid(){if(this.globalOverlay&&this.globalHUD)return;let t=this.overlayLayer.getScreenElement(),e=document.createElement("div");e.setAttribute("data-string-grid-global-root",""),e.style.position="absolute",e.style.inset="0",e.style.pointerEvents="none",t.appendChild(e),this.globalHost=e,this.syncGlobalHostSize(),this.gridManager.load(F);let r=new ue(e,t,()=>{this.enabled&&this.renderGlobal()});this.globalOverlay=r,r.setEnabled(this.enabled),r.setPosition(0,0,e.clientWidth,e.clientHeight);let i=new pe(e,this.gridManager.getAdapterRegistry(),{onAdd:o=>this.handleAdd(F,o),onRemove:o=>this.handleRemove(F,o),onToggle:o=>this.handleToggle(F,o),onSettingChange:(o,a,l)=>this.handleSettingChange(F,o,a,l),onReorder:(o,a,l)=>this.handleReorder(F,o,a,l),onMoveToEnd:o=>this.handleMoveToEnd(F,o),onSelectLayout:o=>this.handleSelectLayout(F,o),onUpdateLayoutMinWidth:(o,a)=>this.handleUpdateLayoutMinWidth(F,o,a),onAddLayout:()=>this.handleAddLayout(F),onRemoveLayout:o=>this.handleRemoveLayout(F,o),onExport:()=>this.handleExport(F),onImport:()=>this.handleImport(F),onRenameInstance:(o,a)=>this.handleRenameInstance(F,o,a),onRenamePanelTitle:o=>this.handleRenamePanelTitle(F,o),onHUDOpen:()=>{this.syncToResolved(F),this.renderGlobal(),this.refreshGlobalHUD(),this.syncGlobalSubBadgeState()},onHUDClose:()=>{this.syncToResolved(F),this.renderGlobal(),this.refreshGlobalHUD(),this.syncGlobalSubBadgeState()},onLayoutPanelOpen:()=>this.refreshGlobalHUD(),onLayoutPanelClose:()=>this.refreshGlobalHUD()},{attachTrigger:!1});this.globalHUD=i,i.setTargetId(F),i.setEnabled(this.enabled);let n=this.viewportLayer.getScreenElement(),s=i.getHudElement();s.setAttribute("data-string-grid-global-hud",""),s.style.position="absolute",s.style.left="24px",s.style.bottom="96px",s.style.pointerEvents="auto",n.appendChild(s),i.setAnchorVisible(!0),this.renderGlobal(),this.refreshGlobalHUD()}syncGlobalHostSize(){let t=this.globalHost;if(!t)return;let e=this.data.viewport.windowWidth||window.innerWidth,r=this.data.viewport.windowHeight||window.innerHeight;t.style.width=`${e}px`,t.style.height=`${r}px`,this.globalOverlay?.setPosition(0,0,e,r)}renderGlobal(){let t=this.globalOverlay;if(!t)return;let e=this.globalHUD,r=this.data.viewport.windowWidth||window.innerWidth,i=e?.isHUDOpen()?this.gridManager.getSelectedInstances(F):this.gridManager.getResolvedInstances(F,r);t.render(i,this.gridManager.getAdapterRegistry())}refreshGlobalHUD(){let t=this.globalHUD;if(!t)return;let e=this.data.viewport.windowWidth||window.innerWidth,r=this.gridManager.getResolvedLayoutId(F,e);t.isHUDOpen()||this.gridManager.getSelectedLayoutId(F)!==r&&this.gridManager.selectLayout(F,r,!1);let i=this.gridManager.getSelectedLayoutId(F),n=this.gridManager.getSelectedInstances(F),s=this.gridManager.getLayouts(F),o=this.gridManager.getPanelTitle(F);t.refresh(n,s,o,i,r)}toggleGlobalPanel(t){this.ensureGlobalGrid(),t&&(this.globalSubBadge=t),this.positionGlobalHudAtAnchor(t),this.globalHUD?.toggle(),this.syncGlobalSubBadgeState()}syncGlobalSubBadgeState(){if(!this.globalSubBadge)return;let t=this.globalHUD?.isHUDOpen()??!1;this.globalSubBadge.setAttribute("data-active",t?"true":"false"),this.globalSubBadge.setAttribute("aria-expanded",t?"true":"false")}positionGlobalHudAtAnchor(t){if(!t||!this.globalHUD)return;let e=this.globalHUD.getHudElement(),r=this.viewportLayer.getScreenElement(),i=t.getBoundingClientRect(),n=r.getBoundingClientRect();e.style.left=`${Math.round(i.right-n.left)}px`,e.style.top=`${Math.round(i.top-n.top+28)}px`,e.style.bottom="auto",e.style.transform=""}destroyGlobalGrid(){this.globalOverlay?.destroy(),this.globalOverlay=null,this.globalHUD?.destroy(),this.globalHUD=null,this.globalHost?.remove(),this.globalHost=null}destroyElement(t){this.overlays.get(t)?.destroy(),this.overlays.delete(t),this.huds.get(t)?.destroy(),this.huds.delete(t),this.triggerEntries.delete(t),this.triggerMeasurements.delete(t),this.elementMap.get(t)?.removeAttribute("data-string-grid-root"),this.elementMap.get(t)?.removeAttribute("data-string-grid-depth"),this.elementMap.get(t)?.removeAttribute(ge),this.elementMap.get(t)?.style.removeProperty("--string-grid-stack-offset"),this.elementMap.delete(t)}ensureTriggerLayer(){this.viewportLayer.ensure(this.getWorldHost()).setAttribute("data-string-grid-trigger-layer","")}applyTriggerLayerState(){}scheduleTriggerSync(){this.ensureTriggerLayer(),this.needsMeasure=!0,this.collectTriggerMeasurements(),this.needsMeasure=!1;for(let[t,e]of this.triggerEntries)this.applyTriggerMeasurement(e,this.triggerMeasurements.get(t));this.hasPendingMutate=!1}collectTriggerMeasurements(){for(let[t,e]of this.triggerEntries)this.triggerMeasurements.set(t,this.measureTrigger(e))}measureTrigger(t){let r=t.object.htmlElement;if(!this.enabled||!r||!r.isConnected)return{visible:!1,docX:0,docY:0,stackOffsetY:0};let i=this.getViewportScrollLeft(),n=this.getViewportScrollTop(),s=r.getBoundingClientRect(),o=s.width||r.offsetWidth||r.clientWidth||0,a=s.height||r.offsetHeight||r.clientHeight||0,l=s.left+i,c=s.top+n;if(o<=0||a<=0)return{visible:!1,docX:0,docY:0,stackOffsetY:0};let u=this.data.viewport.windowHeight||window.innerHeight,p=this.data.viewport.windowWidth||window.innerWidth,g=s.left,m=s.top;if(m+a<0||m>u||g+o<0||g>p)return{visible:!1,docX:0,docY:0,stackOffsetY:0};let f=l+o,b=c,y=this.resolveTriggerStackOffset(t,f,b);return{visible:!0,docX:f,docY:b+y,stackOffsetY:y,elementDocX:l,elementDocY:c,width:o,height:a}}applyTriggerMeasurement(t,e){if(!e||!e.visible){t.hud.setAnchorVisible(!1),t.object.htmlElement.style.setProperty("--string-grid-stack-offset","0px");return}t.hud.setAnchorVisible(!0),t.object.htmlElement.style.setProperty("--string-grid-stack-offset",`${e.stackOffsetY}px`),t.hud.setAnchorPosition(e.docX,e.docY,"top-right");let r=this.overlays.get(Pi(t.object.htmlElement,t.object));r&&e.elementDocX!=null&&e.elementDocY!=null&&e.width!=null&&e.height!=null&&r.setPosition(e.elementDocX,e.elementDocY,e.width,e.height)}getWorldHost(){return this.data.scroll.container??document.body??document.documentElement}getObjectDocY(t){let e=t.getProperty("start"),r=t.getProperty("size");return e!=null&&r!=null&&r>0?e:t.getProperty("layout-doc-top")??0}getViewportScrollLeft(){return this.data.scroll.elementContainer?.scrollLeft??0}getViewportScrollTop(){return this.data.scroll.elementContainer?.scrollTop??0}resolveTriggerStackOffset(t,e,r){return et.resolveCollisionOffset(t.object.htmlElement,e,r,i=>{let n=this.objectManager.all.get(i);if(!n)return null;let s=n.getProperty("layout-width")??n.htmlElement.offsetWidth??n.htmlElement.clientWidth??0;return{docX:(n.getProperty("layout-doc-left")??0)+s,docY:this.getObjectDocY(n)}})}registerBuiltInAdapters(){let t=[new Vr,new Wr,new Nr,new Gr,new zr,new $r];for(let e of t)this.gridManager.registerAdapter(e)}registerExternalAdapters(){let t=this.settings.adapters;if(t)for(let e of t)this.gridManager.registerAdapter(e)}};var Mn=`
|
|
1363
|
+
`}var ge="data-string-grid-storage-key",En=/^string-\d+$/,F="__global__";function Pi(l,t){let e=l.getAttribute(ge)?.trim();if(e)return e;let r=l.getAttribute("data-string-id")?.trim()||l.getAttribute("string-id")?.trim()||"";if(r&&!En.test(r)){let s=`string:${window.location.pathname}#${r}`;return l.setAttribute(ge,s),s}let i=l.id.trim();if(i){let s=`dom:${window.location.pathname}#${i}`;return l.setAttribute(ge,s),s}let n=`path:${window.location.pathname}:${So(l)}`;return l.setAttribute(ge,n),n}function yo(l,t,e){let r=window.location.pathname,i=l.id.trim(),n=l.getAttribute("data-string-id")?.trim()||l.getAttribute("string-id")?.trim()||"",s=[i?`dom:${r}#${i}`:"",n&&!En.test(n)?`string:${r}#${n}`:"",i,n,t.id.trim()].filter(Boolean);return s.filter((o,a)=>o!==e&&s.indexOf(o)===a)}function So(l){let t=[],e=l;for(;e&&e!==document.body&&e!==document.documentElement;){let r=e.parentElement,i=e.tagName.toLowerCase(),n=1;if(r){let s=e.previousElementSibling;for(;s;)s.tagName===e.tagName&&(n+=1),s=s.previousElementSibling}if(t.unshift(`${i}:nth-of-type(${n})`),r?.id){t.unshift(`#${r.id}`);break}e=r}return t.join(">")}function Lo(l){let t=0,e=l.parentElement;for(;e;)e.hasAttribute("data-string-grid-root")&&(t+=1),e=e.parentElement;return t}var jr=class extends Z{gridManager=new Or;viewportLayer;overlayLayer;overlays=new Map;huds=new Map;elementMap=new Map;triggerEntries=new Map;triggerMeasurements=new Map;enabled=!0;needsMeasure=!1;hasPendingMutate=!1;globalHost=null;globalOverlay=null;globalHUD=null;globalSubBadge=null;static devtool={id:"layout",label:"Layout",icon:"layout",order:20,group:1,hotkey:{key:"L",shiftKey:!0},styles:Ln,connects:{global:!1,keys:["layout"]}};constructor(t){super(t),this.attributesToMap=[],this.overlayLayer=this.acquireViewportLayer("devtools-grid-overlay",10010),this.viewportLayer=this.acquireViewportLayer("devtools-hud",10040),this.registerBuiltInAdapters(),this.registerExternalAdapters()}onInit(){this.ensureTriggerLayer(),this.ensureGlobalGrid()}getDevtoolSubBadges(){return[{id:"global-settings",icon:"settings",label:"Open global grid settings",selectorAttribute:"data-string-grid-global-toggle",onClick:t=>this.toggleGlobalPanel(t)}]}onObjectConnected(t){let e=t.htmlElement,r=Pi(e,t),i=yo(e,t,r);e.setAttribute("data-string-grid-root","");let n=Lo(e);e.setAttribute("data-string-grid-depth",String(n)),e.style.setProperty("--string-grid-stack-offset","0px"),this.elementMap.set(r,e),this.gridManager.load(r,i);let s=this.overlayLayer.getWorldElement(this.getWorldHost()),o=new ue(e,s,()=>{this.enabled&&(this.renderElement(r),this.scheduleTriggerSync())});this.overlays.set(r,o);let a=new pe(e,this.gridManager.getAdapterRegistry(),{onAdd:d=>this.handleAdd(r,d),onRemove:d=>this.handleRemove(r,d),onToggle:d=>this.handleToggle(r,d),onSettingChange:(d,c,u)=>this.handleSettingChange(r,d,c,u),onReorder:(d,c,u)=>this.handleReorder(r,d,c,u),onMoveToEnd:d=>this.handleMoveToEnd(r,d),onSelectLayout:d=>this.handleSelectLayout(r,d),onUpdateLayoutMinWidth:(d,c)=>this.handleUpdateLayoutMinWidth(r,d,c),onAddLayout:()=>this.handleAddLayout(r),onRemoveLayout:d=>this.handleRemoveLayout(r,d),onExport:()=>this.handleExport(r),onImport:()=>this.handleImport(r),onRenameInstance:(d,c)=>this.handleRenameInstance(r,d,c),onRenamePanelTitle:d=>this.handleRenamePanelTitle(r,d),onHUDOpen:()=>this.handleHUDOpen(r),onHUDClose:()=>this.handleHUDClose(r),onLayoutPanelOpen:()=>this.handleLayoutPanelOpen(r),onLayoutPanelClose:()=>this.handleLayoutPanelClose(r)});this.huds.set(r,a),a.setTargetId(r),this.ensureTriggerLayer(),this.viewportLayer.getWorldElement(this.getWorldHost()).appendChild(a.getHudElement()),this.triggerEntries.set(r,{object:t,hud:a,depth:n}),this.renderElement(r),this.refreshHUD(r),o.setEnabled(this.enabled),a.setEnabled(this.enabled),requestAnimationFrame(()=>this.scheduleTriggerSync())}onObjectDisconnected(t){let e=t.htmlElement,r=Pi(e,t);this.destroyElement(r)}onResize(){for(let[t,e]of this.overlays)e.syncViewBox(),this.renderElement(t),this.refreshHUD(t);this.syncGlobalHostSize(),this.globalOverlay?.syncViewBox(),this.renderGlobal(),this.refreshGlobalHUD(),this.scheduleTriggerSync()}onScroll(){this.enabled&&(this.needsMeasure=!0)}onScrollMeasure(){if(!(!this.enabled||!this.needsMeasure)){this.collectTriggerMeasurements(),this.needsMeasure=!1;for(let[t,e]of this.triggerEntries)this.applyTriggerMeasurement(e,this.triggerMeasurements.get(t));this.hasPendingMutate=!1}}onMutate(){if(!(!this.enabled||!this.hasPendingMutate)){for(let[t,e]of this.triggerEntries)this.applyTriggerMeasurement(e,this.triggerMeasurements.get(t));this.hasPendingMutate=!1}}onDOMRebuild(){this.enabled&&this.scheduleTriggerSync()}destroy(){for(let[t]of this.overlays)this.destroyElement(t);this.destroyGlobalGrid(),this.gridManager.clear(),super.destroy()}setEnabled(t){if(this.enabled!==t){this.enabled=t;for(let e of this.overlays.values())e.setEnabled(t);for(let e of this.huds.values())e.setEnabled(t);if(this.globalOverlay?.setEnabled(t),this.globalHUD?.setEnabled(t),t||this.globalHUD?.hide(),this.applyTriggerLayerState(),t){for(let e of this.overlays.keys())this.renderElement(e);this.renderGlobal(),this.scheduleTriggerSync()}else this.hasPendingMutate=!1;this.emitDevtoolState()}}isEnabled(){return this.enabled}getDevtoolActiveState(){return this.enabled}setDevtoolActiveState(t){this.setEnabled(t)}handleAdd(t,e){this.gridManager.addInstance(t,e),this.renderElement(t),this.refreshHUD(t)}handleRemove(t,e){let r=this.gridManager.findInstance(t,e);if(r){let i=this.gridManager.getAdapter(r.type),n=this.overlays.get(t);i&&n&&n.clearInstance(e,i)}this.gridManager.removeInstance(t,e),this.refreshHUD(t)}handleToggle(t,e){this.gridManager.toggleVisibility(t,e),this.renderElement(t),this.refreshHUD(t)}handleSettingChange(t,e,r,i){this.gridManager.updateSetting(t,e,r,i),this.renderElement(t)}handleReorder(t,e,r,i){this.gridManager.reorderInstance(t,e,r,i),this.renderElement(t),this.refreshHUD(t)}handleMoveToEnd(t,e){this.gridManager.moveInstanceToEnd(t,e),this.renderElement(t),this.refreshHUD(t)}handleSelectLayout(t,e){this.gridManager.selectLayout(t,e),this.renderElement(t),this.refreshHUD(t)}handleUpdateLayoutMinWidth(t,e,r){this.gridManager.updateLayoutMinWidth(t,e,r),this.syncSelectedLayoutToViewport(t),this.renderElement(t),this.refreshHUD(t)}handleAddLayout(t){this.gridManager.addLayout(t),this.syncSelectedLayoutToViewport(t),this.renderElement(t),this.refreshHUD(t)}handleRemoveLayout(t,e){this.gridManager.removeLayout(t,e),this.syncSelectedLayoutToViewport(t),this.renderElement(t),this.refreshHUD(t)}handleRenameInstance(t,e,r){this.gridManager.renameInstance(t,e,r),this.refreshHUD(t)}handleRenamePanelTitle(t,e){this.gridManager.renamePanelTitle(t,e),this.refreshHUD(t)}handleHUDOpen(t){this.syncToResolved(t),this.renderElement(t),this.refreshHUD(t)}handleHUDClose(t){this.syncToResolved(t),this.renderElement(t),this.refreshHUD(t)}handleLayoutPanelOpen(t){this.renderElement(t),this.refreshHUD(t)}handleLayoutPanelClose(t){this.renderElement(t),this.refreshHUD(t)}handleExport(t){let e=this.gridManager.getLayouts(t),r=this.gridManager.getSelectedLayoutId(t),i=Mt.serialize(e,r),n=t.replace(/[^a-z0-9]/gi,"-").toLowerCase()||"element";Mt.toFile(`string-grid-${n}.json`,i)}handleImport(t){Mt.fromFile().then(e=>{let r=Mt.deserialize(e,this.gridManager.getAdapterRegistry());r&&(this.gridManager.replaceLayouts(t,r.layouts,r.selectedLayoutId),this.syncSelectedLayoutToViewport(t),this.renderElement(t),this.refreshHUD(t))}).catch(()=>{})}renderElement(t){if(t===F){this.renderGlobal();return}let e=this.overlays.get(t);if(!e)return;let r=this.huds.get(t),i=this.data.viewport.windowWidth||window.innerWidth,n=r?.isHUDOpen()?this.gridManager.getSelectedInstances(t):this.gridManager.getResolvedInstances(t,i);e.render(n,this.gridManager.getAdapterRegistry())}syncToResolved(t){this.syncSelectedLayoutToViewport(t)}syncSelectedLayoutToViewport(t){let e=this.data.viewport.windowWidth||window.innerWidth,r=this.gridManager.getResolvedLayoutId(t,e);this.gridManager.getSelectedLayoutId(t)!==r&&this.gridManager.selectLayout(t,r,!1)}refreshHUD(t){if(t===F){this.refreshGlobalHUD();return}let e=this.huds.get(t);if(!e)return;let r=this.data.viewport.windowWidth||window.innerWidth,i=this.gridManager.getResolvedLayoutId(t,r);e.isHUDOpen()||this.gridManager.getSelectedLayoutId(t)!==i&&this.gridManager.selectLayout(t,i,!1);let n=this.gridManager.getSelectedLayoutId(t),s=this.gridManager.getSelectedInstances(t),o=this.gridManager.getLayouts(t),a=this.gridManager.getPanelTitle(t);e.refresh(s,o,a,n,i)}ensureGlobalGrid(){if(this.globalOverlay&&this.globalHUD)return;let t=this.overlayLayer.getScreenElement(),e=document.createElement("div");e.setAttribute("data-string-grid-global-root",""),e.style.position="absolute",e.style.inset="0",e.style.pointerEvents="none",t.appendChild(e),this.globalHost=e,this.syncGlobalHostSize(),this.gridManager.load(F);let r=new ue(e,t,()=>{this.enabled&&this.renderGlobal()});this.globalOverlay=r,r.setEnabled(this.enabled),r.setPosition(0,0,e.clientWidth,e.clientHeight);let i=new pe(e,this.gridManager.getAdapterRegistry(),{onAdd:o=>this.handleAdd(F,o),onRemove:o=>this.handleRemove(F,o),onToggle:o=>this.handleToggle(F,o),onSettingChange:(o,a,d)=>this.handleSettingChange(F,o,a,d),onReorder:(o,a,d)=>this.handleReorder(F,o,a,d),onMoveToEnd:o=>this.handleMoveToEnd(F,o),onSelectLayout:o=>this.handleSelectLayout(F,o),onUpdateLayoutMinWidth:(o,a)=>this.handleUpdateLayoutMinWidth(F,o,a),onAddLayout:()=>this.handleAddLayout(F),onRemoveLayout:o=>this.handleRemoveLayout(F,o),onExport:()=>this.handleExport(F),onImport:()=>this.handleImport(F),onRenameInstance:(o,a)=>this.handleRenameInstance(F,o,a),onRenamePanelTitle:o=>this.handleRenamePanelTitle(F,o),onHUDOpen:()=>{this.syncToResolved(F),this.renderGlobal(),this.refreshGlobalHUD(),this.syncGlobalSubBadgeState()},onHUDClose:()=>{this.syncToResolved(F),this.renderGlobal(),this.refreshGlobalHUD(),this.syncGlobalSubBadgeState()},onLayoutPanelOpen:()=>this.refreshGlobalHUD(),onLayoutPanelClose:()=>this.refreshGlobalHUD()},{attachTrigger:!1});this.globalHUD=i,i.setTargetId(F),i.setEnabled(this.enabled);let n=this.viewportLayer.getScreenElement(),s=i.getHudElement();s.setAttribute("data-string-grid-global-hud",""),s.style.position="absolute",s.style.left="24px",s.style.bottom="96px",s.style.pointerEvents="auto",n.appendChild(s),i.setAnchorVisible(!0),this.renderGlobal(),this.refreshGlobalHUD()}syncGlobalHostSize(){let t=this.globalHost;if(!t)return;let e=this.data.viewport.windowWidth||window.innerWidth,r=this.data.viewport.windowHeight||window.innerHeight;t.style.width=`${e}px`,t.style.height=`${r}px`,this.globalOverlay?.setPosition(0,0,e,r)}renderGlobal(){let t=this.globalOverlay;if(!t)return;let e=this.globalHUD,r=this.data.viewport.windowWidth||window.innerWidth,i=e?.isHUDOpen()?this.gridManager.getSelectedInstances(F):this.gridManager.getResolvedInstances(F,r);t.render(i,this.gridManager.getAdapterRegistry())}refreshGlobalHUD(){let t=this.globalHUD;if(!t)return;let e=this.data.viewport.windowWidth||window.innerWidth,r=this.gridManager.getResolvedLayoutId(F,e);t.isHUDOpen()||this.gridManager.getSelectedLayoutId(F)!==r&&this.gridManager.selectLayout(F,r,!1);let i=this.gridManager.getSelectedLayoutId(F),n=this.gridManager.getSelectedInstances(F),s=this.gridManager.getLayouts(F),o=this.gridManager.getPanelTitle(F);t.refresh(n,s,o,i,r)}toggleGlobalPanel(t){this.ensureGlobalGrid(),t&&(this.globalSubBadge=t),this.positionGlobalHudAtAnchor(t),this.globalHUD?.toggle(),this.syncGlobalSubBadgeState()}syncGlobalSubBadgeState(){if(!this.globalSubBadge)return;let t=this.globalHUD?.isHUDOpen()??!1;this.globalSubBadge.setAttribute("data-active",t?"true":"false"),this.globalSubBadge.setAttribute("aria-expanded",t?"true":"false")}positionGlobalHudAtAnchor(t){if(!t||!this.globalHUD)return;let e=this.globalHUD.getHudElement(),r=this.viewportLayer.getScreenElement(),i=t.getBoundingClientRect(),n=r.getBoundingClientRect();e.style.left=`${Math.round(i.right-n.left)}px`,e.style.top=`${Math.round(i.top-n.top+28)}px`,e.style.bottom="auto",e.style.transform=""}destroyGlobalGrid(){this.globalOverlay?.destroy(),this.globalOverlay=null,this.globalHUD?.destroy(),this.globalHUD=null,this.globalHost?.remove(),this.globalHost=null}destroyElement(t){this.overlays.get(t)?.destroy(),this.overlays.delete(t),this.huds.get(t)?.destroy(),this.huds.delete(t),this.triggerEntries.delete(t),this.triggerMeasurements.delete(t),this.elementMap.get(t)?.removeAttribute("data-string-grid-root"),this.elementMap.get(t)?.removeAttribute("data-string-grid-depth"),this.elementMap.get(t)?.removeAttribute(ge),this.elementMap.get(t)?.style.removeProperty("--string-grid-stack-offset"),this.elementMap.delete(t)}ensureTriggerLayer(){this.viewportLayer.ensure(this.getWorldHost()).setAttribute("data-string-grid-trigger-layer","")}applyTriggerLayerState(){}scheduleTriggerSync(){this.ensureTriggerLayer(),this.needsMeasure=!0,this.collectTriggerMeasurements(),this.needsMeasure=!1;for(let[t,e]of this.triggerEntries)this.applyTriggerMeasurement(e,this.triggerMeasurements.get(t));this.hasPendingMutate=!1}collectTriggerMeasurements(){for(let[t,e]of this.triggerEntries)this.triggerMeasurements.set(t,this.measureTrigger(e))}measureTrigger(t){let r=t.object.htmlElement;if(!this.enabled||!r||!r.isConnected)return{visible:!1,docX:0,docY:0,stackOffsetY:0};let i=this.getViewportScrollLeft(),n=this.getViewportScrollTop(),s=r.getBoundingClientRect(),o=s.width||r.offsetWidth||r.clientWidth||0,a=s.height||r.offsetHeight||r.clientHeight||0,d=s.left+i,c=s.top+n;if(o<=0||a<=0)return{visible:!1,docX:0,docY:0,stackOffsetY:0};let u=this.data.viewport.windowHeight||window.innerHeight,p=this.data.viewport.windowWidth||window.innerWidth,g=s.left,m=s.top;if(m+a<0||m>u||g+o<0||g>p)return{visible:!1,docX:0,docY:0,stackOffsetY:0};let f=d+o,b=c,y=this.resolveTriggerStackOffset(t,f,b);return{visible:!0,docX:f,docY:b+y,stackOffsetY:y,elementDocX:d,elementDocY:c,width:o,height:a}}applyTriggerMeasurement(t,e){if(!e||!e.visible){t.hud.setAnchorVisible(!1),t.object.htmlElement.style.setProperty("--string-grid-stack-offset","0px");return}t.hud.setAnchorVisible(!0),t.object.htmlElement.style.setProperty("--string-grid-stack-offset",`${e.stackOffsetY}px`),t.hud.setAnchorPosition(e.docX,e.docY,"top-right");let r=this.overlays.get(Pi(t.object.htmlElement,t.object));r&&e.elementDocX!=null&&e.elementDocY!=null&&e.width!=null&&e.height!=null&&r.setPosition(e.elementDocX,e.elementDocY,e.width,e.height)}getWorldHost(){return this.data.scroll.container??document.body??document.documentElement}getObjectDocY(t){let e=t.getProperty("start"),r=t.getProperty("size");return e!=null&&r!=null&&r>0?e:t.getProperty("layout-doc-top")??0}getViewportScrollLeft(){return this.data.scroll.elementContainer?.scrollLeft??0}getViewportScrollTop(){return this.data.scroll.elementContainer?.scrollTop??0}resolveTriggerStackOffset(t,e,r){return et.resolveCollisionOffset(t.object.htmlElement,e,r,i=>{let n=this.objectManager.all.get(i);if(!n)return null;let s=n.getProperty("layout-width")??n.htmlElement.offsetWidth??n.htmlElement.clientWidth??0;return{docX:(n.getProperty("layout-doc-left")??0)+s,docY:this.getObjectDocY(n)}})}registerBuiltInAdapters(){let t=[new Vr,new Wr,new Nr,new Gr,new zr,new $r];for(let e of t)this.gridManager.registerAdapter(e)}registerExternalAdapters(){let t=this.settings.adapters;if(t)for(let e of t)this.gridManager.registerAdapter(e)}};var Mn=`
|
|
1364
1364
|
/* \u2500\u2500 Ruler bars \u2500\u2500 */
|
|
1365
1365
|
[data-string-rulers-top],
|
|
1366
1366
|
[data-string-rulers-left] {
|
|
@@ -1773,7 +1773,7 @@ ${Bs(i," ")}
|
|
|
1773
1773
|
visibility: hidden;
|
|
1774
1774
|
pointer-events: none;
|
|
1775
1775
|
}
|
|
1776
|
-
`;var So=0;function wn(){return`ruler-${Date.now()}-${So++}`}var xn="string-rulers:",Yr=class{elementStates=new Map;stateKey(t,e="default"){return`${t}:${e}`}storageKey(t,e="default"){return it(xn+t+":"+e)}legacyStorageKey(t){return it(xn+t)}getLines(t,e="default"){return this.elementStates.get(this.stateKey(t,e))?.lines??[]}addLine(t,e,r,i,n="default",s,o){let a={id:wn(),axis:e,position:r,targetLabel:i,targetSelector:s,targetEdge:o},l=this.stateKey(t,n),c=this.elementStates.get(l);return c||(c={elementId:t,lines:[]},this.elementStates.set(l,c)),c.lines.push(a),this.save(t,n),a}moveLine(t,e,r,i,n="default"){let s=this.findLine(t,e,n);s&&(s.position=r,s.targetLabel=i)}removeLine(t,e,r="default"){let i=this.elementStates.get(this.stateKey(t,r));i&&(i.lines=i.lines.filter(n=>n.id!==e),this.save(t,r))}removeAllLines(t,e="default"){this.elementStates.delete(this.stateKey(t,e));try{localStorage.removeItem(this.storageKey(t,e)),e==="default"&&localStorage.removeItem(this.legacyStorageKey(t))}catch{}}findLine(t,e,r="default"){return this.elementStates.get(this.stateKey(t,r))?.lines.find(i=>i.id===e)}save(t,e="default"){let r=this.elementStates.get(this.stateKey(t,e));if(r)try{let i=JSON.stringify(r.lines);localStorage.setItem(this.storageKey(t,e),i),e==="default"&&localStorage.setItem(this.legacyStorageKey(t),i)}catch{}}load(t,e="default"){let r=this.stateKey(t,e);try{let i=localStorage.getItem(this.storageKey(t,e));if(!i&&e==="default"&&(i=localStorage.getItem(this.legacyStorageKey(t))),!i)return;let n=JSON.parse(i);if(!Array.isArray(n))return;this.elementStates.set(r,{elementId:t,lines:n})}catch{}}clearElement(t){for(let[e]of this.elementStates)e.startsWith(t+":")&&this.elementStates.delete(e)}clearAll(){this.elementStates.clear()}};var qr=class{opts;candidates=[];constructor(t){this.opts=t}buildCandidates(t,e,r,i=window.innerWidth,n=window.innerHeight,s=[],o,a){this.candidates=[],this.candidates.push({position:0,type:"document-origin"}),t==="horizontal"?(this.candidates.push({position:r,type:"viewport-edge"}),this.candidates.push({position:r+n,type:"viewport-edge"})):(this.candidates.push({position:e,type:"viewport-edge"}),this.candidates.push({position:e+i,type:"viewport-edge"})),this.opts.snapToElements&&this.opts.snapSelector&&document.querySelectorAll(this.opts.snapSelector).forEach(l=>{let c=l.getBoundingClientRect();c.width===0&&c.height===0||(t==="horizontal"?(this.candidates.push({position:c.top+r,type:"element-top",el:l}),this.candidates.push({position:c.bottom+r,type:"element-bottom",el:l}),this.candidates.push({position:(c.top+c.bottom)/2+r,type:"element-center-y",el:l})):(this.candidates.push({position:c.left+e,type:"element-left",el:l}),this.candidates.push({position:c.right+e,type:"element-right",el:l}),this.candidates.push({position:(c.left+c.right)/2+e,type:"element-center-x",el:l})))}),this._addLayoutGridCandidates(t,e,r,i,n),this._addGuideGapCandidates(t,s,o),a&&this.candidates.push(...a)}findSnap(t){let e=this.opts.threshold,r=null;for(let i of this.candidates){let n=Math.abs(i.position-t);n<e&&(e=n,r=i)}if(this.opts.snapStep>1){let i=Math.round(t/this.opts.snapStep)*this.opts.snapStep;if(Math.abs(i-t)<e)return{position:i,type:"grid-step"}}return r?{position:r.position,type:r.type,el:r.el,gap:r.gap,referenceLineIds:r.referenceLineIds,label:r.label}:null}snapToStep(t){return this.opts.snapStep<=1?t:Math.round(t/this.opts.snapStep)*this.opts.snapStep}_addLayoutGridCandidates(t,e,r,i,n){if(!this.opts.layoutGrids?.length)return;let s=i,o=n;for(let a of this.opts.layoutGrids){if(a.type==="columns"&&t==="vertical"){let{count:l,marginLeft:c=0,marginRight:u=0,gap:p=0}=a,g=s-c-u;if(g<=0||l<=0)continue;let m=(g-(l-1)*p)/l;this.candidates.push({position:c+e,type:"grid-column-edge"}),this.candidates.push({position:s-u+e,type:"grid-column-edge"});for(let h=0;h<l;h++){let f=c+h*(m+p),b=f+m,y=(f+b)/2;h>0&&this.candidates.push({position:f+e,type:"grid-column-edge"}),h<l-1&&this.candidates.push({position:b+e,type:"grid-column-edge"}),this.candidates.push({position:y+e,type:"grid-column-center"})}}if(a.type==="rows"&&t==="horizontal"){let{height:l,gap:c=0}=a,u=l+c;if(u<=0||l<=0)continue;let p=Math.max(0,r-200),g=r+o+200,m=Math.floor(p/u)*u;for(let h=m;h<g;h+=u)this.candidates.push({position:h,type:"grid-row-edge"}),c>0&&this.candidates.push({position:h+l,type:"grid-row-edge"})}}}_addGuideGapCandidates(t,e,r){let i=e.filter(n=>n.axis===t&&n.id!==r).slice().sort((n,s)=>n.position-s.position);if(!(i.length<2))for(let n=0;n<i.length;n++){let s=i[n],o=n>0?i[n-1]:null,a=n<i.length-1?i[n+1]:null;if(o){let l=s.position-o.position;l>0&&this.candidates.push({position:s.position+l,type:"guide-gap",gap:l,referenceLineIds:[o.id,s.id]})}if(a){let l=a.position-s.position;l>0&&this.candidates.push({position:s.position-l,type:"guide-gap",gap:l,referenceLineIds:[s.id,a.id]})}}}};var Ai=class{id="default";cornerLabel="\u2197";formatPosition(t){return t}getFixedLines(){return[]}},ki=class{id="center";cornerLabel="+";formatPosition(t,e,r,i){let n=i+r/2;return t-n}getFixedLines(t,e,r,i){return[{axis:"horizontal",position:i+e/2},{axis:"vertical",position:r+t/2}]}},Vt={default:new Ai,center:new ki},Xr=["default","center"];function he(d,t){let e=d.currentTarget,r=d.clientX,i=d.clientY,n=d.pointerId,s=t.threshold??0,o=s===0,a=!1;try{e&&"setPointerCapture"in e&&e.setPointerCapture(n)}catch{}let l=()=>{if(!a){a=!0,document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",p),document.removeEventListener("keydown",g);try{e&&"releasePointerCapture"in e&&e.releasePointerCapture(n)}catch{}}},c=m=>{if(m.pointerId!==n)return;let h=m.clientX-r,f=m.clientY-i;if(!o){if(Math.abs(h)<s&&Math.abs(f)<s)return;o=!0}t.onMove(m,{dx:h,dy:f})},u=m=>{m.pointerId===n&&(l(),o&&t.onEnd?.(m))},p=m=>{m.pointerId===n&&(l(),t.onCancel?.())},g=m=>{m.key==="Escape"&&(l(),t.onCancel?.())};return document.addEventListener("pointermove",c),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",p),document.addEventListener("keydown",g),l}var Wt=0,Kr=0,Nt=0,j=null,Zr=new Map;function Lo(){let d=document.documentElement,t=document.body;return{htmlOverflow:d.style.overflow,htmlOverscrollBehavior:d.style.overscrollBehavior,htmlTouchAction:d.style.touchAction,htmlUserSelect:d.style.userSelect,htmlWebkitUserSelect:d.style.webkitUserSelect,bodyOverflow:t.style.overflow,bodyOverscrollBehavior:t.style.overscrollBehavior,bodyTouchAction:t.style.touchAction,bodyUserSelect:t.style.userSelect,bodyWebkitUserSelect:t.style.webkitUserSelect}}function Eo(){j||(j=Lo())}function Mo(d){return!d||d===window||d===document?null:d}function Cn(d){d.cancelable&&d.preventDefault()}function wo(d){let t=Zr.get(d);t?t.count+=1:Zr.set(d,{target:d,overflow:d.style.overflow,overscrollBehavior:d.style.overscrollBehavior,touchAction:d.style.touchAction,count:1}),d.style.overflow="hidden",d.style.overscrollBehavior="none",d.style.touchAction="none"}function xo(d){let t=Zr.get(d);t&&(t.count-=1,!(t.count>0)&&(d.style.overflow=t.overflow,d.style.overscrollBehavior=t.overscrollBehavior,d.style.touchAction=t.touchAction,Zr.delete(d)))}function Co(d){let t=document.documentElement,e=document.body;Nt>0&&(t.style.userSelect="none",t.style.webkitUserSelect="none",e.style.userSelect="none",e.style.webkitUserSelect="none"),Wt>0&&(t.style.overscrollBehavior="none",t.style.touchAction="none",e.style.overscrollBehavior="none",e.style.touchAction="none",d?wo(d):(Kr+=1,t.style.overflow="hidden",e.style.overflow="hidden"),window.addEventListener("touchmove",Cn,{passive:!1}))}function To(d){if(!j)return;let t=document.documentElement,e=document.body;d?xo(d):Kr>0&&(Kr-=1),Kr===0&&(t.style.overflow=j.htmlOverflow,e.style.overflow=j.bodyOverflow),Wt===0&&(t.style.overscrollBehavior=j.htmlOverscrollBehavior,t.style.touchAction=j.htmlTouchAction,e.style.overscrollBehavior=j.bodyOverscrollBehavior,e.style.touchAction=j.bodyTouchAction,window.removeEventListener("touchmove",Cn)),Nt===0&&(t.style.userSelect=j.htmlUserSelect,t.style.webkitUserSelect=j.htmlWebkitUserSelect,e.style.userSelect=j.bodyUserSelect,e.style.webkitUserSelect=j.bodyWebkitUserSelect),Wt===0&&Nt===0&&(j=null)}function Tn(d={}){let t=d.scroll===!0,e=d.selection===!0,r=t?Mo(d.scrollTarget):null;if(!t&&!e)return()=>{};Eo(),t&&(Wt+=1),e&&(Nt+=1),Co(r);let i=!1;return()=>{i||(i=!0,t&&(Wt=Math.max(0,Wt-1)),e&&(Nt=Math.max(0,Nt-1)),To(r))}}var Po=20,Ao=12,Pn="#E3E3E3",An=.85,kn="#000000",On=.25,ko="#313131",Oo=10,Do=`${Oo}px "JetBrains Mono", monospace`,Io=4,Ro=-2,Ho=8,Bo=4,_o=5,Fo=2,Vo="rgba(255, 56, 96, 0.50)",Wo="rgba(255, 56, 96, 0.22)",No="rgba(255, 56, 96, 0.05)",zo="rgba(255, 56, 96, 0.45)",Go=8,$o=`${Go}px "JetBrains Mono", monospace`,Dn="rgba(0, 120, 255, 0.50)",Uo="rgba(0, 120, 255, 0.22)",jo="rgba(0, 120, 255, 0.05)";function Qr(d,t,e,r,i,n,s){d.save(),d.globalAlpha=e,d.fillStyle=t,d.fillRect(r,i,n,s),d.restore()}function Jr(d,t="x",e=window.innerWidth,r=window.innerHeight){let i=d.trim().match(/^(-?[\d.]+)\s*(px|rem|%|vw|vh)?$/);if(!i)return 0;let n=parseFloat(i[1]);switch(i[2]||"px"){case"px":return n;case"rem":return n*parseFloat(getComputedStyle(document.documentElement).fontSize);case"%":return t==="y"?n/100*r:n/100*e;case"vw":return n/100*e;case"vh":return n/100*r;default:return n}}var Yo={snapStep:0,snapToElements:!0,snapThreshold:8,snapSelector:"[string],[data-string]"},qo="rgba(255, 0, 80, 0.08)",Xo="rgba(0, 120, 255, 0.06)",ti=class{viewportLayer;host;gridCanvas;topCanvas;leftCanvas;cornerEl;cornerLabelEl;linesLayer;gapIndicatorEl;gapIndicatorLabelEl;lineEls=new Map;fixedLineEls=new Map;callbacks;options;snapEngine;resizeObserver;currentMode=Vt.default;visible=!1;viewportWidth=window.innerWidth;viewportHeight=window.innerHeight;contentWidth=document.documentElement.scrollWidth;contentHeight=document.documentElement.scrollHeight;viewportOffsetX=0;viewportOffsetY=0;scrollX=0;scrollY=0;renderedScrollX=-1;renderedScrollY=-1;currentLines=[];_snapHighlightEl=null;_guideReferenceLineIds=null;_guideReferenceAxis=null;_guideReferenceGap=null;dragInteractionReleases=new Set;constructor(t,e={},r,i){this.callbacks=t,this.options={...Yo,...e},this.host=r??null,this.viewportLayer=i,this.snapEngine=new qr({threshold:this.options.snapThreshold,snapStep:this.options.snapStep,snapToElements:this.options.snapToElements,snapSelector:this.options.snapSelector,layoutGrids:this.options.layoutGrids}),this.gridCanvas=this.createCanvas("grid"),this.topCanvas=this.createCanvas("top"),this.leftCanvas=this.createCanvas("left"),this.linesLayer=this.createLinesLayer(),this.gapIndicatorEl=this.createGapIndicator(),this.gapIndicatorLabelEl=document.createElement("span"),this.gapIndicatorLabelEl.setAttribute("data-string-rulers-gap-indicator-label",""),this.gapIndicatorLabelEl.setAttribute("data-stdg",""),this.gapIndicatorEl.appendChild(this.gapIndicatorLabelEl),this.cornerEl=document.createElement("div"),this.cornerEl.setAttribute("data-string-rulers-corner",""),this.cornerEl.setAttribute("data-mode",this.currentMode.id),this.cornerLabelEl=document.createElement("span"),this.cornerLabelEl.textContent=this.currentMode.cornerLabel,this.cornerEl.appendChild(this.cornerLabelEl),this.cornerEl.addEventListener("click",()=>this.callbacks.onModeToggle());let n=this.viewportLayer.getScreenElement(),s=this.viewportLayer.getWorldElement(r);s.appendChild(this.gridCanvas),s.appendChild(this.linesLayer),this.linesLayer.appendChild(this.gapIndicatorEl),n.appendChild(this.topCanvas),n.appendChild(this.leftCanvas),n.appendChild(this.cornerEl),document.body.setAttribute("data-string-rulers-hidden",""),this.resizeObserver=new ResizeObserver(()=>{this.visible&&this.redraw()}),this.resizeObserver.observe(document.documentElement),this.bindRulerDrag(this.topCanvas,"horizontal"),this.bindRulerDrag(this.leftCanvas,"vertical")}refresh(t){this.currentLines=t,this.redraw()}updateScroll(t,e,r,i,n,s){let o=this.viewportWidth!==r||this.viewportHeight!==i||this.contentWidth!==n||this.contentHeight!==s;if(this.scrollX=t,this.scrollY=e,this.viewportWidth=r,this.viewportHeight=i,this.contentWidth=n,this.contentHeight=s,this.syncScreenChromePosition(),!this.visible)return;let a=Math.round(t),l=Math.round(e);(o||a!==this.renderedScrollX||l!==this.renderedScrollY)&&(this.renderedScrollX=a,this.renderedScrollY=l,o&&this.syncWorldDimensions(),this.drawTopRuler(this.viewportWidth),this.drawLeftRuler(this.viewportHeight),o&&this.drawGrid(this.contentWidth,this.contentHeight)),this.updateLineLabels(),this._positionGuideReferenceIndicator(),(this.fixedLineEls.size>0||this.currentMode.id!=="default")&&this.syncFixedLines()}setVisible(t){this.visible=t,t?(document.body.removeAttribute("data-string-rulers-hidden"),this.redraw()):document.body.setAttribute("data-string-rulers-hidden","")}setMode(t){this.currentMode=t,this.cornerEl.setAttribute("data-mode",t.id),this.cornerLabelEl.textContent=t.cornerLabel,this.redraw()}destroy(){this.releaseAllDragInteractionLocks(),this._setSnapHighlight(null),this._setGuideReference(null,null,null),this.resizeObserver.disconnect(),this.gridCanvas.remove(),this.topCanvas.remove(),this.leftCanvas.remove(),this.cornerEl.remove(),this.linesLayer.remove(),document.body.removeAttribute("data-string-rulers-hidden"),this.lineEls.clear();for(let[,t]of this.fixedLineEls)t.remove();this.fixedLineEls.clear()}redraw(){this.renderedScrollX=Math.round(this.scrollX),this.renderedScrollY=Math.round(this.scrollY),this.syncScreenChromePosition(),this.syncWorldDimensions(),this.drawTopRuler(this.viewportWidth),this.drawLeftRuler(this.viewportHeight),this.drawGrid(this.contentWidth,this.contentHeight),this.syncLineEls(this.currentLines),this.syncFixedLines(),this._positionGuideReferenceIndicator()}updateLineLabels(){for(let t of this.currentLines){let e=this.lineEls.get(t.id);e&&this.updateLineLabel(t,e.labelEl)}}createCanvas(t){let e=document.createElement("canvas");return e.setAttribute(`data-string-rulers-${t}`,""),e}createLinesLayer(){let t=document.createElement("div");return t.setAttribute("data-string-rulers-lines",""),t}createGapIndicator(){let t=document.createElement("div");return t.setAttribute("data-string-rulers-gap-indicator",""),t.setAttribute("hidden",""),t}syncWorldDimensions(){this.linesLayer.style.width=`${this.contentWidth}px`,this.linesLayer.style.height=`${this.contentHeight}px`,this.gridCanvas.style.width=`${this.contentWidth}px`,this.gridCanvas.style.height=`${this.contentHeight}px`}drawGrid(t,e){let r=this.options.layoutGrids,i=this.gridCanvas;if((i.width!==t||i.height!==e)&&(i.width=t,i.height=e,i.style.width=`${t}px`,i.style.height=`${e}px`),!r?.length)return;let n=i.getContext("2d");n.clearRect(0,0,t,e);for(let s of r)s.type==="columns"&&this._drawColumnsGrid(n,this.viewportWidth,e,s),s.type==="rows"&&this._drawRowsGrid(n,this.viewportWidth,e,s)}_drawColumnsGrid(t,e,r,i){let{count:n,marginLeft:s=0,marginRight:o=0,gap:a=0}=i,l=e-s-o;if(l<=0||n<=0)return;let c=(l-(n-1)*a)/n;t.fillStyle=i.color??qo;for(let u=0;u<n;u++){let p=s+u*(c+a);t.fillRect(p,0,c,r)}}_drawRowsGrid(t,e,r,i){let{height:n,gap:s=0}=i,o=n+s;if(!(o<=0||n<=0)){t.fillStyle=i.color??Xo;for(let a=0;a<r;a+=o)t.fillRect(0,a,e,n)}}drawTopRuler(t){let e=this.getRulerThickness(),r=this.topCanvas;(r.width!==t||r.height!==e)&&(r.width=t,r.height=e);let i=r.getContext("2d");i.clearRect(0,0,t,e),Qr(i,Pn,An,0,0,t,e),Qr(i,kn,On,0,e-1,t,1),this._drawColumnMarkers(i,t,e),this.drawTicks(i,t,e,"top",this.scrollX)}drawLeftRuler(t){let e=this.getRulerThickness(),r=this.leftCanvas;(r.width!==e||r.height!==t)&&(r.width=e,r.height=t);let i=r.getContext("2d");i.clearRect(0,0,e,t),Qr(i,Pn,An,0,0,e,t),Qr(i,kn,On,e-1,0,1,t),this._drawRowMarkers(i,e,t),this.drawTicks(i,t,e,"left",this.scrollY)}drawTicks(t,e,r,i,n){let{tick:s,label:o}=this.pickStep(e),a=i==="top"?"vertical":"horizontal",l=i==="top",c=this.isCompactMobileRuler(),u=!c,p=Math.round(r/2),g=Math.min(r,c?_o:Ho),m=Math.min(r,c?Fo:Bo);t.fillStyle=ko,t.font=Do;let h=Math.ceil(n/s)*s,f=h-n;if(l){t.textAlign="center",t.textBaseline="top";for(let b=0;f+b*s<=e;b++){let y=Math.round(f+b*s),v=h+b*s,S=this.currentMode.formatPosition(v,a,e,n),E=Math.round(S)%o===0,M=E?g:m,C=c?0:r-M;t.fillRect(y,C,1,M),u&&E&&y>4&&t.fillText(String(Math.round(S)),y,Io)}}else{t.textAlign="center",t.textBaseline="middle";for(let b=0;f+b*s<=e;b++){let y=Math.round(f+b*s),v=h+b*s,S=this.currentMode.formatPosition(v,a,e,n),E=Math.round(S)%o===0,M=E?g:m,C=c?0:r-M;t.fillRect(C,y,M,1),u&&E&&y>4&&(t.save(),t.translate(p,y),t.rotate(-Math.PI/2),t.fillText(String(Math.round(S)),0,Ro),t.restore())}}}pickStep(t){return t<300?{tick:5,label:25}:t<800?{tick:10,label:50}:t<1800?{tick:25,label:100}:{tick:50,label:500}}_resolveColumnLayout(){let t=this.options.columnLayout;if(!t||t.columns<=0)return null;let e=Jr(t.margin,"x",this.viewportWidth,this.viewportHeight),r=Jr(t.gap,"x",this.viewportWidth,this.viewportHeight),n=this.viewportWidth-2*e;if(n<=0)return null;let s=(n-(t.columns-1)*r)/t.columns;return s<=0?null:{columns:t.columns,marginPx:e,gapPx:r,colWidth:s}}_drawColumnMarkers(t,e,r){let i=this._resolveColumnLayout();if(!i)return;let{columns:n,marginPx:s,gapPx:o,colWidth:a}=i;t.fillStyle=No;for(let l=0;l<n;l++){let c=s+l*(a+o);t.fillRect(c,0,a,r)}t.fillStyle=Vo;for(let l=0;l<n;l++){let c=s+l*(a+o),u=c+a;t.fillRect(Math.round(c),0,1,r),t.fillRect(Math.round(u),0,1,r)}t.fillStyle=Wo;for(let l=0;l<n;l++){let u=s+l*(a+o)+a/2;t.fillRect(Math.round(u),Math.round(r*.6),1,Math.round(r*.4))}if(!this.isCompactMobileRuler()&&a>16){t.fillStyle=zo,t.font=$o,t.textAlign="center",t.textBaseline="middle";for(let l=0;l<n;l++){let u=s+l*(a+o)+a/2;t.fillText(String(l+1),Math.round(u),Math.round(r/2))}}}_buildColumnCandidates(t){if(t!=="vertical")return[];let e=this._resolveColumnLayout();if(!e)return[];let{columns:r,marginPx:i,gapPx:n,colWidth:s}=e,o=[];for(let a=0;a<r;a++){let l=i+a*(s+n),c=l+s,u=(l+c)/2,p=a+1;o.push({position:l+this.scrollX,type:"grid-column-edge",label:`c${p}`}),o.push({position:c+this.scrollX,type:"grid-column-edge",label:`c${p}\u25C2`}),o.push({position:u+this.scrollX,type:"grid-column-center",label:`c${p}\u2299`})}return o}_resolveRowLayout(){let t=this.options.rowLayout;if(!t)return null;let e=Jr(t.size,"y",this.viewportWidth,this.viewportHeight),r=Jr(t.gap,"y",this.viewportWidth,this.viewportHeight);return e<=0?null:{sizePx:e,gapPx:r,period:e+r}}_drawRowMarkers(t,e,r){let i=this._resolveRowLayout();if(!i)return;let{sizePx:n,gapPx:s,period:o}=i,a=Math.floor(this.scrollY/o)*o,l=this.scrollY+r+o;for(let c=a;c<l;c+=o){let u=Math.round(c-this.scrollY),p=Math.round(c+n-this.scrollY),g=Math.max(0,u),m=Math.min(r,p);if(m>g&&(t.fillStyle=jo,t.fillRect(0,g,e,m-g)),u>=0&&u<=r&&(t.fillStyle=Dn,t.fillRect(0,u,e,1)),s>0&&p>=0&&p<=r&&(t.fillStyle=Dn,t.fillRect(0,p,e,1)),n>4){let h=Math.round(c+n/2-this.scrollY);h>=0&&h<=r&&(t.fillStyle=Uo,t.fillRect(0,h,Math.round(e*.45),1))}}}_buildRowCandidates(t){if(t!=="horizontal")return[];let e=this._resolveRowLayout();if(!e)return[];let{sizePx:r,gapPx:i,period:n}=e,s=this.viewportHeight,o=Math.max(0,this.scrollY-200),a=this.scrollY+s+200,l=Math.floor(o/n)*n,c=[];for(let u=l;u<a;u+=n){let p=Math.round(u/n)+1;c.push({position:u,type:"grid-row-edge",label:`r${p}`}),c.push({position:u+r/2,type:"grid-row-edge",label:`r${p}\u2299`}),i>0&&c.push({position:u+r,type:"grid-row-edge",label:`r${p}\u25C2`})}return c}syncFixedLines(){let t=this.currentMode.getFixedLines(this.viewportWidth,this.viewportHeight,this.scrollX,this.scrollY),e=new Set;for(let r of t){let i=`fixed-${r.axis}`;e.add(i);let n=this.fixedLineEls.get(i);n||(n=document.createElement("div"),n.setAttribute("data-string-rulers-fixed-line",""),n.setAttribute("data-axis",r.axis),this.linesLayer.appendChild(n),this.fixedLineEls.set(i,n)),r.axis==="horizontal"?(n.style.top=`${r.position}px`,n.style.left="0",n.style.width=`${this.contentWidth}px`):(n.style.left=`${r.position}px`,n.style.top="0",n.style.height=`${this.contentHeight}px`)}for(let[r,i]of this.fixedLineEls)e.has(r)||(i.remove(),this.fixedLineEls.delete(r))}syncLineEls(t){for(let[e]of this.lineEls)t.some(r=>r.id===e)||(this.lineEls.get(e).el.remove(),this.lineEls.delete(e));for(let e of t)this.lineEls.has(e.id)||this.createLineEl(e),this.positionLineEl(e)}createLineEl(t){let e=document.createElement("div");e.setAttribute("data-string-rulers-line",t.id),e.setAttribute("data-axis",t.axis),e.setAttribute("data-stdg","");let r=document.createElement("span");r.setAttribute("data-string-rulers-label",""),e.appendChild(r),this.linesLayer.appendChild(e),this.lineEls.set(t.id,{el:e,labelEl:r}),e.addEventListener("pointerdown",i=>{if(i.stopPropagation(),i.button===1){i.preventDefault(),this.callbacks.onLineRemoved(t.id);return}this.startLineDrag(i,t)})}positionLineEl(t){let e=this.lineEls.get(t.id);if(!e)return;let{el:r,labelEl:i}=e;t.axis==="horizontal"?(r.style.top=`${t.position}px`,r.style.left="0",r.style.width=`${this.contentWidth}px`):(r.style.left=`${t.position}px`,r.style.top="0",r.style.height=`${this.contentHeight}px`),this.updateLineLabel(t,i)}updateLineLabel(t,e){let r=t.axis==="horizontal"?this.viewportHeight:this.viewportWidth,i=t.axis==="horizontal"?this.scrollY:this.scrollX,n=this.currentMode.formatPosition(t.position,t.axis,r,i),s=String(Math.round(n)),o=t.targetLabel?`${s} ${t.targetLabel}`:s;e.textContent!==o&&(e.textContent=o)}_setGuideReference(t,e,r){if(this._guideReferenceLineIds)for(let i of this._guideReferenceLineIds)this.lineEls.get(i)?.el.removeAttribute("data-string-rulers-guide-ref");if(this._guideReferenceAxis=t,this._guideReferenceLineIds=e,this._guideReferenceGap=r,e)for(let i of e)this.lineEls.get(i)?.el.setAttribute("data-string-rulers-guide-ref","");this._positionGuideReferenceIndicator()}_positionGuideReferenceIndicator(){let t=this._guideReferenceLineIds,e=this._guideReferenceAxis,r=this._guideReferenceGap;if(!t||!e||r==null){this.gapIndicatorEl.setAttribute("hidden",""),this.gapIndicatorEl.removeAttribute("data-axis");return}let i=t.map(o=>this.currentLines.find(a=>a.id===o)).filter(o=>!!o);if(i.length!==2){this.gapIndicatorEl.setAttribute("hidden",""),this.gapIndicatorEl.removeAttribute("data-axis");return}let n=Math.min(i[0].position,i[1].position),s=Math.max(i[0].position,i[1].position);if(this.gapIndicatorEl.removeAttribute("hidden"),this.gapIndicatorEl.setAttribute("data-axis",e),this.gapIndicatorLabelEl.textContent=`${Math.round(r)}px`,e==="vertical"){let o=Math.round(this.scrollY+Math.max(this.getRulerThickness()+32,this.viewportHeight/2));this.gapIndicatorEl.style.left=`${n}px`,this.gapIndicatorEl.style.top=`${o}px`,this.gapIndicatorEl.style.width=`${Math.max(0,s-n)}px`,this.gapIndicatorEl.style.height="0"}else{let o=Math.round(this.scrollX+Math.max(this.getRulerThickness()+32,this.viewportWidth/2));this.gapIndicatorEl.style.left=`${o}px`,this.gapIndicatorEl.style.top=`${n}px`,this.gapIndicatorEl.style.width="0",this.gapIndicatorEl.style.height=`${Math.max(0,s-n)}px`}}_setSnapHighlight(t){this._snapHighlightEl!==t&&(this._snapHighlightEl?.removeAttribute("data-string-rulers-snap-target"),this._snapHighlightEl=t,t?.setAttribute("data-string-rulers-snap-target",""))}_snapCategory(t){return t==="guide-gap"?"guide":t==="grid-column-edge"||t==="grid-column-center"?"column":t==="grid-step"||t.startsWith("grid-")?"grid":"element"}_snapLabel(t,e,r){let i=t.position??e,n=this.getViewportSizeForAxis(r),s=r==="horizontal"?this.scrollY:this.scrollX,o=String(Math.round(this.currentMode.formatPosition(i,r,n,s)));return t.type==="guide-gap"&&typeof t.gap=="number"?`${o} ${Math.round(t.gap)}px`:t.label?`${o} ${t.label}`:t.el?`${o} ${this._elementLabel(t.el)}`:o}_elementLabel(t){if(t.id)return`#${t.id}`;let e=t.classList[0];if(e)return`.${e}`;let r=t.getAttribute("string")??t.getAttribute("data-string");return r?`[${r}]`:t.tagName.toLowerCase()}_elementSelector(t){if(t.id)return`#${CSS.escape(t.id)}`;let e=t.getAttribute("string");if(e)return`[string="${CSS.escape(e)}"]`;let r=t.getAttribute("data-string");return r?`[data-string="${CSS.escape(r)}"]`:t.classList[0]?`.${CSS.escape(t.classList[0])}`:null}_resolveBinding(t){if(!t)return{};if(t.el){let e;switch(t.type){case"element-top":e="top";break;case"element-bottom":e="bottom";break;case"element-center-y":e="center-y";break;case"element-left":e="left";break;case"element-right":e="right";break;case"element-center-x":e="center-x";break}return{targetLabel:this._elementLabel(t.el),targetSelector:this._elementSelector(t.el)??void 0,targetEdge:e}}if((t.type==="grid-column-edge"||t.type==="grid-column-center")&&t.label){let e=t.label.match(/^c(\d+)(◂|⊙)?$/);if(e){let r=parseInt(e[1],10)-1,i=e[2]==="\u25C2"?"col-right":e[2]==="\u2299"?"col-center":"col-left";return{targetLabel:t.label,targetSelector:`__col:${r}`,targetEdge:i}}}return t.label?{targetLabel:t.label}:{}}recalculateBindings(t){for(let e of t){if(!e.targetSelector||!e.targetEdge)continue;if(e.targetSelector.startsWith("__col:")){let n=parseInt(e.targetSelector.slice(6),10),s=this._resolveColumnLayout();if(!s||n<0||n>=s.columns)continue;let o=s.marginPx+n*(s.colWidth+s.gapPx),a=o+s.colWidth;switch(e.targetEdge){case"col-left":e.position=o+this.scrollX;break;case"col-right":e.position=a+this.scrollX;break;case"col-center":e.position=(o+a)/2+this.scrollX;break}continue}let r=document.querySelector(e.targetSelector);if(!r)continue;let i=r.getBoundingClientRect();switch(e.targetEdge){case"top":e.position=i.top+this.scrollY;break;case"bottom":e.position=i.bottom+this.scrollY;break;case"center-y":e.position=(i.top+i.bottom)/2+this.scrollY;break;case"left":e.position=i.left+this.scrollX;break;case"right":e.position=i.right+this.scrollX;break;case"center-x":e.position=(i.left+i.right)/2+this.scrollX;break}}}bindRulerDrag(t,e){t.addEventListener("pointerdown",r=>{r.preventDefault(),this.startRulerDrag(r,e)})}startRulerDrag(t,e){let r=this.acquireDragInteractionLock(),i=document.createElement("div");i.setAttribute("data-string-rulers-ghost",""),i.setAttribute("data-axis",e);let n=document.createElement("span");n.setAttribute("data-string-rulers-ghost-label",""),n.setAttribute("data-stdg",""),i.appendChild(n),this.linesLayer.appendChild(i),this.snapEngine.buildCandidates(e,this.scrollX,this.scrollY,this.viewportWidth,this.viewportHeight,this.currentLines,void 0,[...this._buildColumnCandidates(e),...this._buildRowCandidates(e)]);let s=l=>{let c=this.resolveDocPositionFromPointer(e,l),u=l.shiftKey?null:this.snapEngine.findSnap(c),p=u?u.position:l.shiftKey?c:this.snapEngine.snapToStep(c);if(e==="horizontal"?(i.style.top=`${p}px`,i.style.left="0",i.style.width=`${this.contentWidth}px`):(i.style.left=`${p}px`,i.style.top="0",i.style.height=`${this.contentHeight}px`),u)i.setAttribute("data-snapping",this._snapCategory(u.type)),this._setSnapHighlight(u.el??null),this._setGuideReference(u.type==="guide-gap"?e:null,u.type==="guide-gap"?u.referenceLineIds??null:null,u.type==="guide-gap"?u.gap??null:null),n.textContent=this._snapLabel(u,p,e);else{i.removeAttribute("data-snapping"),this._setSnapHighlight(null),this._setGuideReference(null,null,null);let g=this.getViewportSizeForAxis(e),m=e==="horizontal"?this.scrollY:this.scrollX;n.textContent=String(Math.round(this.currentMode.formatPosition(p,e,g,m)))}},o=()=>{r(),i.remove(),this._setSnapHighlight(null),this._setGuideReference(null,null,null)};he(t,{onMove:s,onEnd:l=>{o();let c=this.resolveViewportPointerPos(e,l);if(c>this.getRulerThickness()){let u=e==="horizontal"?c+this.scrollY:c+this.scrollX,p=l.shiftKey?null:this.snapEngine.findSnap(u),g=p?p.position:l.shiftKey?u:this.snapEngine.snapToStep(u),m=this._resolveBinding(p);this.callbacks.onLineCreated(e,g,m.targetLabel,m.targetSelector,m.targetEdge)}},onCancel:o})}startLineDrag(t,e){let r=this.acquireDragInteractionLock(),{el:i}=this.lineEls.get(e.id),n=e.axis==="horizontal"?t.clientY:t.clientX,s=e.position;this.snapEngine.buildCandidates(e.axis,this.scrollX,this.scrollY,this.viewportWidth,this.viewportHeight,this.currentLines,e.id,[...this._buildColumnCandidates(e.axis),...this._buildRowCandidates(e.axis)]);let o=c=>{let u=e.axis==="horizontal"?c.clientY-n:c.clientX-n,p=Math.max(0,s+u),g=c.shiftKey?null:this.snapEngine.findSnap(p),m=g?g.position:c.shiftKey?p:this.snapEngine.snapToStep(p);g?(i.setAttribute("data-snapping",this._snapCategory(g.type)),this._setSnapHighlight(g.el??null),this._setGuideReference(g.type==="guide-gap"?e.axis:null,g.type==="guide-gap"?g.referenceLineIds??null:null,g.type==="guide-gap"?g.gap??null:null)):(i.removeAttribute("data-snapping"),this._setSnapHighlight(null),this._setGuideReference(null,null,null)),this.callbacks.onLineMoved(e.id,m,g?.el?this._elementLabel(g.el):g?.label);let h=this.lineEls.get(e.id);if(h)if(g)h.labelEl.textContent=this._snapLabel(g,m,e.axis);else{let f=this.getViewportSizeForAxis(e.axis),b=e.axis==="horizontal"?this.scrollY:this.scrollX;h.labelEl.textContent=String(Math.round(this.currentMode.formatPosition(m,e.axis,f,b)))}},a=()=>{r(),i.removeAttribute("data-snapping"),this._setSnapHighlight(null),this._setGuideReference(null,null,null)};he(t,{onMove:o,onEnd:c=>{a();let u=e.axis==="horizontal"?c.clientY-n:c.clientX-n,p=Math.max(0,s+u),g=c.shiftKey?null:this.snapEngine.findSnap(p),m=g?g.position:c.shiftKey?p:this.snapEngine.snapToStep(p);if((e.axis==="horizontal"?m-this.scrollY:m-this.scrollX)<=this.getRulerThickness())this.callbacks.onLineRemoved(e.id);else{let f=this._resolveBinding(g);this.callbacks.onDragCommit(e.id,m,f.targetLabel,f.targetSelector,f.targetEdge)}},onCancel:a})}syncScreenChromePosition(){let t=this.host,e=this.getRulerThickness(),r=this.viewportWidth,i=this.viewportHeight;if(!t||t===document.body||t===document.documentElement)this.viewportOffsetX=0,this.viewportOffsetY=0;else{let n=t.getBoundingClientRect();this.viewportOffsetX=Math.round(n.left),this.viewportOffsetY=Math.round(n.top),r=Math.max(0,Math.round(n.width)),i=Math.max(0,Math.round(n.height))}this.topCanvas.style.left=`${this.viewportOffsetX}px`,this.topCanvas.style.top=`${this.viewportOffsetY}px`,this.topCanvas.style.width=`${r}px`,this.topCanvas.style.height=`${e}px`,this.leftCanvas.style.left=`${this.viewportOffsetX}px`,this.leftCanvas.style.top=`${this.viewportOffsetY}px`,this.leftCanvas.style.width=`${e}px`,this.leftCanvas.style.height=`${i}px`,this.cornerEl.style.left=`${this.viewportOffsetX}px`,this.cornerEl.style.top=`${this.viewportOffsetY}px`,this.cornerEl.style.width=`${e}px`,this.cornerEl.style.height=`${e}px`}isCompactMobileRuler(){return ot(this.viewportWidth).compact}getRulerThickness(){return this.isCompactMobileRuler()?Ao:Po}getViewportSizeForAxis(t){return t==="horizontal"?this.viewportHeight:this.viewportWidth}resolveViewportPointerPos(t,e){let r=t==="horizontal"?e.clientY:e.clientX,i=t==="horizontal"?this.viewportOffsetY:this.viewportOffsetX;return r-i}resolveDocPositionFromPointer(t,e){let r=this.resolveViewportPointerPos(t,e);return t==="horizontal"?r+this.scrollY:r+this.scrollX}acquireDragInteractionLock(){let t=Tn({selection:!0,scroll:this.isCompactMobileRuler(),scrollTarget:this.options.scrollTarget}),e=()=>{t(),this.dragInteractionReleases.delete(e)};return this.dragInteractionReleases.add(e),e}releaseAllDragInteractionLocks(){for(let t of Array.from(this.dragInteractionReleases))t()}};var Ko="stdg",wt=class{baseStorageKey;defaultValue;validate;legacyKeys;constructor(t){this.baseStorageKey=`${Ko}:${t.moduleId}:${t.name}`,this.defaultValue=t.default,this.validate=t.validate,this.legacyKeys=t.legacyKeys??[]}read(){let t=this.readRaw(this.storageKey);if(t!==void 0)return t;for(let e of this.legacyKeys){let r=it(e),i=this.readRaw(r);if(i!==void 0)return this.write(i),this.clearRaw(r),i}return this.defaultValue}write(t){try{localStorage.setItem(this.storageKey,JSON.stringify(t))}catch{}}clear(){this.clearRaw(this.storageKey)}get storageKey(){return it(this.baseStorageKey)}readRaw(t){let e;try{e=localStorage.getItem(t)}catch{return}if(e==null)return;let r;try{r=JSON.parse(e)}catch{return}if(this.validate){let i=this.validate(r);return i??void 0}return r}clearRaw(t){try{localStorage.removeItem(t)}catch{}}};var me="__string-rulers-global__",Zo=[],ei=class extends Z{manager=new Yr;overlay=null;visible=!1;dockDisabled=!1;currentModeId="default";modeStore=new wt({moduleId:"rulers",name:"mode",default:"default",validate:t=>typeof t=="string"&&t in Vt?t:null,legacyKeys:["string-rulers:mode"]});viewportLayer;_kbHandlers=[];_elHandlers=[];_evHandlers=[];static devtool={id:"rulers",label:"Rulers",icon:"ruler",order:10,group:1,hotkey:{key:"R",shiftKey:!0},styles:Mn,connects:{global:!1,keys:["rulers"]}};constructor(t){super(t),this.attributesToMap=[],this.viewportLayer=this.acquireViewportLayer("devtools-rulers",10020)}onInit(){this.applyStyleSettings(),this.mountOverlay()}onSettingsChange(){this.applyStyleSettings()}onSubscribe(){let t=this.settings.triggers,e=Array.isArray(t)?t:Zo;this._bindTriggers(e)}onUnsubscribe(){this._unbindTriggers()}onFrame(t){!this.visible||!this.overlay||this.pushScrollToOverlay(t)}onResize(){if(!this.overlay)return;this.syncOverlayMetrics();let t=this.manager.getLines(me,this.currentModeId);this.overlay.recalculateBindings(t),this.manager.save(me,this.currentModeId),this.overlay.refresh(t)}destroy(){this._unbindTriggers(),this.overlay?.destroy(),this.overlay=null,this.manager.clearAll(),this.clearStyleSettings(),super.destroy()}toggle(){this.setVisible(!this.visible)}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}clear(){this.manager.removeAllLines(me,this.currentModeId),this.overlay?.refresh([])}isVisible(){return this.visible}getDevtoolActiveState(){return this.visible}setDevtoolActiveState(t){this.setDockActive(t)}getDevtoolSubBadges(){return[{id:"clear-rulers",icon:"noplus",label:"Clear guides",selectorAttribute:"data-string-rulers-clear-all",onClick:()=>this.clear()}]}_bindTriggers(t){for(let e of t)if(e.type==="keyboard"){let r=i=>{i.key===e.key&&i.shiftKey===(e.shiftKey??!1)&&i.ctrlKey===(e.ctrlKey??!1)&&i.altKey===(e.altKey??!1)&&i.metaKey===(e.metaKey??!1)&&(i.preventDefault(),this._applyAction(e.action))};window.addEventListener("keydown",r),this._kbHandlers.push(r)}else if(e.type==="element"){let r=e.event??"click";for(let i of Array.from(document.querySelectorAll(e.selector))){let n=()=>this._applyAction(e.action);i.addEventListener(r,n),this._elHandlers.push({el:i,event:r,fn:n})}}else if(e.type==="event"){let r=()=>this._applyAction(e.action);this.events.on(e.name,r),this._evHandlers.push({name:e.name,fn:r})}}_unbindTriggers(){for(let t of this._kbHandlers)window.removeEventListener("keydown",t);this._kbHandlers=[];for(let{el:t,event:e,fn:r}of this._elHandlers)t.removeEventListener(e,r);this._elHandlers=[];for(let{name:t,fn:e}of this._evHandlers)this.events.off(t,e);this._evHandlers=[]}_applyAction(t="toggle"){this.dockDisabled||(t==="show"?this.show():t==="hide"?this.hide():this.toggle())}setVisible(t){t&&this.dockDisabled||this.visible!==t&&(this.visible=t,this.overlay?.setVisible(t),et.emitLayoutChange(),this.emitDevtoolState())}setDockActive(t){this.dockDisabled=!t,this.setVisible(t)}mountOverlay(){if(this.overlay)return;let t=me;this.currentModeId=this.modeStore.read(),this.manager.load(t,this.currentModeId);let e=this.settings,r=typeof e["rulers-snap"]=="number"?e["rulers-snap"]:0,i=typeof e["rulers-snap-elements"]=="boolean"?e["rulers-snap-elements"]:!0,n=typeof e["rulers-snap-threshold"]=="number"?e["rulers-snap-threshold"]:8,s=typeof e["rulers-snap-selector"]=="string"?e["rulers-snap-selector"]:"[string],[data-string]",o=this._resolveGrids(e.grid),a=typeof e["rulers-columns"]=="number"?e["rulers-columns"]:0,l=typeof e["rulers-margin"]=="string"?e["rulers-margin"]:"0px",c=typeof e["rulers-gap"]=="string"?e["rulers-gap"]:"0px",u=a>0?{columns:a,margin:l,gap:c}:void 0,p=typeof e["rulers-rows"]=="string"?e["rulers-rows"]:"",g=typeof e["rulers-rows-gap"]=="string"?e["rulers-rows-gap"]:"0px",m=p?{size:p,gap:g}:void 0;this.overlay=new ti({onLineCreated:(h,f,b,y,v)=>{this.manager.addLine(t,h,f,b,this.currentModeId,y,v),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))},onLineMoved:(h,f,b)=>{this.manager.moveLine(t,h,f,b,this.currentModeId),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))},onLineRemoved:h=>{this.manager.removeLine(t,h,this.currentModeId),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))},onDragCommit:(h,f,b,y,v)=>{this.manager.moveLine(t,h,f,b,this.currentModeId);let S=this.manager.findLine(t,h,this.currentModeId);S&&(S.targetSelector=y,S.targetEdge=v),this.manager.save(t,this.currentModeId),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))},onModeToggle:()=>this.cycleMode()},{snapStep:r,snapToElements:i,snapThreshold:n,snapSelector:s,layoutGrids:o,columnLayout:u,rowLayout:m,scrollTarget:this.data.scroll.elementContainer},this.data.scroll.container,this.viewportLayer),this.syncOverlayMetrics(),this.overlay.setMode(Vt[this.currentModeId]),this.overlay.setVisible(this.visible),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))}cycleMode(){let e=(Xr.indexOf(this.currentModeId)+1)%Xr.length;this.switchMode(Xr[e])}switchMode(t){let e=me;this.manager.save(e,this.currentModeId),this.currentModeId=t,this.manager.load(e,t),this.overlay?.setMode(Vt[t]),this.overlay?.refresh(this.manager.getLines(e,t)),this.modeStore.write(t)}applyStyleSettings(){let t=this.settings,e=typeof t["rulers-color"]=="string"?t["rulers-color"]:"rgba(0, 120, 255, 0.75)",r=typeof t["rulers-opacity"]=="number"?t["rulers-opacity"]:1,i=Math.max(0,Math.min(1,r));document.documentElement.style.setProperty("--string-rulers-line-color",e),document.documentElement.style.setProperty("--string-rulers-line-opacity",String(i))}clearStyleSettings(){document.documentElement.style.removeProperty("--string-rulers-line-color"),document.documentElement.style.removeProperty("--string-rulers-line-opacity")}_resolveGrids(t){if(t){if(Array.isArray(t))return t;if(typeof t=="object")return[t]}}syncOverlayMetrics(){this.overlay&&this.pushScrollToOverlay(this.data)}pushScrollToOverlay(t){if(!this.overlay)return;let e=t.scroll.elementContainer,r=t.scroll.direction==="horizontal",i=r?e.scrollLeft:0,n=r?0:e.scrollTop;this.overlay.updateScroll(i,n,t.viewport.windowWidth,t.viewport.windowHeight,t.viewport.contentWidth,t.viewport.contentHeight)}};var Qo=20,Jo=20,ta=24,ea=24,ra="data-string-rulers-hidden",ia="[data-string-rulers-left]",na="[data-string-rulers-top]",sa={top:"start",left:"start",start:"start",bottom:"end",right:"end",end:"end"};function ri(d){return d?sa[d.toLowerCase()]??"start":"start"}var zt=class extends Z{_viewportLayer;_badgeLayer;_hudLayer;get viewportLayer(){return this._viewportLayer||(this._viewportLayer=this.acquireViewportLayer(this.layerName,this.layerZIndex)),this._viewportLayer}get badgeLayer(){return this._badgeLayer||(this._badgeLayer=this.acquireViewportLayer("devtools-badges",10030)),this._badgeLayer}get hudLayer(){return this._hudLayer||(this._hudLayer=this.acquireViewportLayer("devtools-hud",10040)),this._hudLayer}entries=new Map;measurements=new Map;enabled=!1;needsMeasure=!1;hasPendingMutate=!1;_rafId=null;_pendingSingleIds=new Set;onOverlayLayoutChangeBind=()=>{this.enabled&&this.scheduleSync()};get _overlayConfig(){return this.constructor.devtool?.overlay}get overlayId(){return this._overlayConfig?.overlayId??null}get overlayBadgeCount(){return 1}get layerName(){return this._overlayConfig?.layerName??""}get layerZIndex(){return this._overlayConfig?.zIndex??10011}get layerAttribute(){return this._overlayConfig?.layerAttribute??""}get defaultEnabled(){return this._overlayConfig?.defaultEnabled??!1}constructor(t){super(t),this.enabled=this.defaultEnabled}onInit(){this.ensureLayer(),this.applyEnabledState(),window.addEventListener(Ur,this.onOverlayLayoutChangeBind)}onObjectConnected(t){this.ensureLayer();let e=this.createOverlayEntry(t);e&&(this.entries.set(t.id,e),this.syncSlotRegistration(),this.scheduleSync())}onObjectDisconnected(t){let e=this.entries.get(t.id);e&&(this.destroyOverlayEntry(e),this.entries.delete(t.id),this.measurements.delete(t.id),this.syncSlotRegistration())}setEnabled(t){this.enabled!==t&&(this.enabled=t,t&&this.measurements.clear(),this.applyEnabledState(),this.onEnabledChange(t),this.scheduleFullSync(),this.emitDevtoolState())}isEnabled(){return this.enabled}getDevtoolActiveState(){return this.enabled}setDevtoolActiveState(t){this.setEnabled(t)}onEnabledChange(t){}onScroll(){this.enabled&&(this.needsMeasure=!0)}onScrollMeasure(){!this.enabled||!this.needsMeasure||(this.collectMeasurements(),this.needsMeasure=!1,this.flushMeasurements(),this.hasPendingMutate=!1)}onMutate(){!this.enabled||!this.hasPendingMutate||(this.flushMeasurements(),this.hasPendingMutate=!1)}onResize(){this.enabled&&this.scheduleSync()}onDOMRebuild(){this.enabled&&this.scheduleSync()}scheduleFullSync(){this.ensureLayer(),this._pendingSingleIds.clear(),this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this.needsMeasure=!0,this.collectMeasurements(),this.needsMeasure=!1,this.flushMeasurements(),this.hasPendingMutate=!1}scheduleSync(){this.enabled&&(this._pendingSingleIds.clear(),this._rafId===null&&(this._rafId=requestAnimationFrame(()=>{this._rafId=null,this.enabled&&(this.ensureLayer(),this.collectMeasurements(),this.flushMeasurements())})))}scheduleSingleSync(t){if(!this.enabled)return;let e=t.object?.id??t.targetId;if(!e){this.scheduleSync();return}this._pendingSingleIds.add(e),this._rafId===null&&(this._rafId=requestAnimationFrame(()=>{if(this._rafId=null,!this.enabled)return;this.ensureLayer();let r=this._pendingSingleIds;this._pendingSingleIds=new Set;let i=[];for(let n of r){let s=this.entries.get(n);if(!s)continue;let o=this.computeBaseMetrics(s),a=this.measureEntry(s,o);this.measurements.set(n,a),i.push(s)}L.run(()=>{for(let n of i){let s=n.object?.id??n.targetId;s&&this.applyMeasurement(n,this.measurements.get(s))}})}))}collectMeasurements(){this.ensureLayer();for(let[t,e]of this.entries){let r=this.computeBaseMetrics(e);this.measurements.set(t,this.measureEntry(e,r))}}flushMeasurements(){L.run(()=>{for(let[t,e]of this.entries)this.applyMeasurement(e,this.measurements.get(t))})}ensureLayer(){let t=this.viewportLayer.ensure(this.getWorldHost());return this.layerAttribute&&t.setAttribute(this.layerAttribute,""),t}applyEnabledState(){let t=this.viewportLayer.getElement();t&&(t.setAttribute("data-enabled",this.enabled?"true":"false"),this.layerAttribute&&(this.enabled?t.setAttribute(this.layerAttribute,""):t.removeAttribute(this.layerAttribute)),this.syncSlotRegistration())}syncSlotRegistration(){if(!this.overlayId)return;this.enabled&&this.entries.size>0?et.register(this.overlayId,this.devtoolConfig?.order??0,this.overlayBadgeCount):et.unregister(this.overlayId),et.emitLayoutChange()}resolveOverlayTargetId(t){return t.htmlElement.id||t.id}resolveOverlayObjectDepth(t){let e=0,r=t.parentElement;for(;r;)(r.hasAttribute("string-id")||r.hasAttribute("data-string-id"))&&(e+=1),r=r.parentElement;return e}createOverlayBadge(t){let e=document.createElement("button");return e.type="button",e.setAttribute("data-stdg-button",""),e.setAttribute("data-stdg-button-icon-16",""),e.setAttribute("data-string-devtools-overlay-badge",""),e.setAttribute("data-target-id",t.targetId),t.selectorAttribute&&e.setAttribute(t.selectorAttribute,""),t.depth!=null&&e.setAttribute("data-depth",String(t.depth)),this.applyOverlayBadgeState(e,{attributes:t.attributes}),e}applyOverlayBadgeState(t,e){if(e.visible!=null&&t.setAttribute("data-visible",e.visible?"true":"false"),e.active!=null&&t.setAttribute("data-active",e.active?"true":"false"),e.disabled!=null&&t instanceof HTMLButtonElement&&(t.disabled=e.disabled),e.title!=null&&(t.title=e.title),e.html!=null){let r=t.querySelector("[data-stdg-badge-label]");t.innerHTML=e.html,r&&t.appendChild(r)}if(e.label!==void 0){let r=t.querySelector("[data-stdg-badge-label]");e.label===null||e.label===""?r?.remove():(r||(r=document.createElement("span"),r.setAttribute("data-stdg-badge-label",""),t.appendChild(r)),r.textContent!==e.label&&(r.textContent=e.label))}if(e.attributes)for(let[r,i]of Object.entries(e.attributes)){if(i==null){t.removeAttribute(r);continue}if(typeof i=="boolean"){t.setAttribute(r,i?"true":"false");continue}t.setAttribute(r,String(i))}}applyOverlayBadgePosition(t,e){if(!e){t.setAttribute("data-visible","false");return}t.setAttribute("data-visible",e.visible?"true":"false"),e.visible&&L.setProps(t,{transform:`translate3d(${Math.round(e.docX)}px, ${Math.round(e.docY)}px, 0)${e.translate?` ${e.translate}`:""}`})}getOverlayTargetLabel(t){let e=t.htmlElement,r=e.getAttribute("id")?.trim();if(r)return`#${r}`;let i=e.getAttribute("class")?.trim();if(i){let s=i.split(/\s+/).filter(Boolean).map(o=>`.${o}`).join("");if(s)return s}let n=e.getAttribute("string-id")?.trim()||e.getAttribute("data-string-id")?.trim();return n||t.id||"<unnamed>"}getViewportAnchorOffset(t,e){return t==="end"?e.viewportPrimarySize:0}getOverlayAnchorAdjustment(t,e,r){return{docX:0,docY:0}}resolveRulerPanelOffset(t,e){if(typeof document>"u")return{x:0,y:0};if(document.body.hasAttribute(ra))return{x:0,y:0};let r=this.getViewportScrollLeft(),i=this.getViewportScrollTop(),n=document.querySelector(ia)&&t-r<Qo?ta:0,s=document.querySelector(na)&&e-i<Jo?ea:0;return{x:n,y:s}}computeBaseMetrics(t){let e=t.object,r=e.htmlElement;if(!this.enabled||!r||!r.isConnected)return this.getHiddenMetrics();let i=this.resolveOverlayObjectGeometry(e,r),{contentX:n,contentY:s,width:o,height:a}=i;if(o<=0||a<=0)return this.getHiddenMetrics();let l=this.data.viewport.windowHeight||window.innerHeight,c=this.data.viewport.windowWidth||window.innerWidth,u=this.getViewportScrollLeft(),p=this.getViewportScrollTop(),g=n-u,m=s-p,h=m+a<0||m>l||g+o<0||g>c;if(h)return this.getHiddenMetrics();let f=n,b=s,y=0;if(this.overlayId){let A=new Map,I=w=>{if(!this.overlayId)return null;if(!this.entries.get(w.id)||this.measurements.get(w.id)?.visible===!1)return A.set(w.id,null),null;let O=A.get(w.id);if(O!==void 0)return O;let T=w.htmlElement;if(!T)return A.set(w.id,null),null;let P=this.resolveOverlayObjectGeometry(w,T),R=P.contentX,B=P.contentY,W=P.width,N=P.height,z=et.resolveAnchor(this.overlayId,R,B),nt=this.getOverlayAnchorAdjustment(w,z,{contentX:R,contentY:B,width:W,height:N}),yt=this.resolveRulerPanelOffset(R,B),st=z.docX+nt.docX+yt.x,dt=z.docY+nt.docY+yt.y,xt=et.resolveCollisionOffset(T,st,dt,Y=>{let ct=this.objectManager.all.get(Y);if(!ct)return null;let ve=I(ct)?.effective;return ve||{docX:st,docY:this.resolveOverlayObjectGeometry(ct).contentY}}),D={base:{docX:st,docY:dt},effective:{docX:st,docY:dt+xt}};return A.set(w.id,D),D},H=I(e);H&&(f=H.base.docX,b=H.base.docY,y=H.effective.docY-H.base.docY)}let v=this.data.scroll.direction==="horizontal"?"x":"y";return{visible:!0,contentX:n,contentY:s,width:o,height:a,isOffscreen:h,baseAnchorX:f,baseAnchorY:b,collisionOffset:y,axis:v,primarySize:v==="y"?a:o,crossSize:v==="y"?o:a,primaryContentOffset:v==="y"?s:n,viewportPrimarySize:v==="y"?l:c}}getHiddenMetrics(){return{visible:!1,contentX:0,contentY:0,width:0,height:0,isOffscreen:!0,baseAnchorX:0,baseAnchorY:0,collisionOffset:0,axis:this.data.scroll.direction==="horizontal"?"x":"y",primarySize:0,crossSize:0,primaryContentOffset:0,viewportPrimarySize:0}}getObjectDocY(t){let e=t.getProperty("start"),r=t.getProperty("size");return e!=null&&r!=null&&r>0?e:t.getProperty("layout-doc-top")??0}resolveOverlayObjectGeometry(t,e=t.htmlElement){let r=e.getBoundingClientRect(),i=this.resolveLiveElementMetrics(e,r),n=i.width||(t.getProperty("layout-width")??(t.getProperty("half-width")??0)*2)||e.offsetWidth||e.clientWidth||0,s=t.getProperty("size"),o=i.height||(t.getProperty("layout-height")??(t.getProperty("half-height")??0)*2)||e.offsetHeight||e.clientHeight||0;return{contentX:i.docLeft??t.getProperty("layout-doc-left")??0,contentY:i.docTop??this.getObjectDocY(t),width:n,height:s!=null&&s>0?s:o}}getViewportScrollLeft(){return this.data.scroll.elementContainer?.scrollLeft??0}getViewportScrollTop(){return this.data.scroll.elementContainer?.scrollTop??0}resolveLiveElementMetrics(t,e){let r=e.width||t.offsetWidth||t.clientWidth||0,i=e.height||t.offsetHeight||t.clientHeight||0,n=this.getWorldHost(),s=this.data.scroll.elementContainer;if(!(r>0)||!(i>0))return{width:r,height:i};if(n===document.body||n===document.documentElement)return{docLeft:e.left+(s?.scrollLeft??window.scrollX??0),docTop:e.top+(s?.scrollTop??window.scrollY??0),width:r,height:i};let o=n.getBoundingClientRect();return{docLeft:e.left-o.left+n.scrollLeft,docTop:e.top-o.top+n.scrollTop,width:r,height:i}}destroy(){this.overlayId&&et.unregister(this.overlayId),window.removeEventListener(Ur,this.onOverlayLayoutChangeBind);for(let t of this.entries.values())this.destroyOverlayEntry(t);this.entries.clear(),this.measurements.clear(),super.destroy()}};var oa=31,ii=class extends zt{get badgeAttribute(){return this.constructor.devtool?.overlay?.badgeAttribute??""}createOverlayEntry(t){let e=this.resolveOverlayTargetId(t),r=this.resolveBadgeDepth(t),i=[],n={object:t,targetId:e,badge:document.createElement("button"),depth:r,extra:void 0,cleanup:i,badges:new Map,groups:new Map},s=this.getBadgeDescriptors(t,e,r),o=this.badgeLayer.getWorldElement(this.getWorldHost());for(let c of s){let u=this.createOverlayBadge({targetId:e,selectorAttribute:c.selectorAttribute,depth:c.depth??r,attributes:{"data-badge-id":c.id,...c.attributes}}),p={id:c.id,descriptor:c,element:u};u.setAttribute("data-visible","false");let g=m=>{m.stopPropagation(),m.preventDefault(),this.onBadgeClick(n,m,p)};if(u.addEventListener("click",g),i.push(()=>u.removeEventListener("click",g)),n.badges.set(c.id,p),c.group){let m=n.groups.get(c.group);m||(m=Rt(e),n.groups.set(c.group,m),o.appendChild(m)),m.appendChild(u)}else o.appendChild(u)}let a=n.badges.values().next().value;if(!a)throw new Error(`${this.constructor.name} must define at least one badge descriptor.`);n.badge=a.element,n.extra=this.createBadgeExtra(t,n.badge,e,r);let l=this.bindBadge(n);return l&&i.push(...l),this.applyBadgeEnabledState(n),this.renderBadge(n),n}destroyOverlayEntry(t){for(let e of t.cleanup)e();this.destroyBadgeExtra(t);for(let e of t.groups.values())e.remove();for(let e of t.badges.values())e.descriptor.group||e.element.remove()}measureEntry(t,e){let r={};if(!e.visible){for(let s of t.badges.values())r[s.id]={visible:!1,docX:0,docY:0};return{visible:!1,badges:r}}let i=new Map,n=new Set;for(let s of t.badges.values()){let o=s.descriptor.slot??"top-left";i.has(o)||i.set(o,[]);let a=i.get(o);if(s.descriptor.group){let l=s.descriptor.group;n.has(l)||(n.add(l),a.push({kind:"group",groupId:l,badges:[]})),a.find(u=>u.kind==="group"&&u.groupId===l)?.badges.push(s)}else a.push({kind:"badge",badge:s})}for(let[s,o]of i)for(let a=0;a<o.length;a+=1){let l=o[a],c=l.kind==="badge"?l.badge:l.badges[0],u=this.resolveBadgeSlotConfig(c.descriptor),p=oa+(u.gap??0),g=u.offsetX??0,m=u.offsetY??0,h=this.resolveBadgePosition(e,s,a,p,g,m);if(l.kind==="badge")r[l.badge.id]=h;else for(let f of l.badges)r[f.id]=h}return{visible:!0,badges:r}}applyMeasurement(t,e){let r=new Set;for(let i of t.badges.values()){let n=i.descriptor.group;if(!n||r.has(n))continue;r.add(n);let s=t.groups.get(n);s&&this.applyOverlayBadgePosition(s,e?.badges[i.id])}for(let i of t.badges.values())if(i.descriptor.group){let n=e?.badges[i.id];i.element.setAttribute("data-visible",n?.visible?"true":"false")}else this.applyOverlayBadgePosition(i.element,e?.badges[i.id]);this.afterBadgeMeasurement(t,e)}onEnabledChange(t){for(let e of this.entries.values())this.applyBadgeEnabledState(e),this.renderBadge(e)}createBadgeExtra(t,e,r,i){}destroyBadgeExtra(t){}bindBadge(t){}resolveBadgeDepth(t){return this.resolveOverlayObjectDepth(t.htmlElement)}getBadgeSlotConfig(){return{}}getBadgeDescriptors(t,e,r){return[{id:"primary",slot:"top-left",selectorAttribute:this.badgeAttribute,attributes:this.getInitialBadgeAttributes(t,e,r)}]}getInitialBadgeAttributes(t,e,r){}applyBadgeEnabledState(t){for(let e of t.badges.values())this.applyOverlayBadgeState(e.element,{disabled:!this.enabled,attributes:{"data-module-enabled":this.enabled}});for(let e of t.groups.values())e.setAttribute("data-module-enabled",this.enabled?"true":"false")}renderBadge(t){for(let e of t.badges.values())this.applyOverlayBadgeState(e.element,this.getBadgeState(t,e))}afterBadgeMeasurement(t,e){}resolveBadgeSlotConfig(t){let e=t.slot??"top-left",r=this.getBadgeSlotConfig()[e]??{};return{gap:t.gap??r.gap??0,offsetX:t.offsetX??r.offsetX??0,offsetY:t.offsetY??r.offsetY??0}}resolveBadgePosition(t,e,r,i,n,s){let o=t.baseAnchorX-t.contentX,a=t.baseAnchorY-t.contentY+t.collisionOffset,l=t.contentX+o,c=t.contentX+t.width+o,u=t.contentY+a,p=t.contentY+t.height+a;switch(e){case"top-right":return{visible:!0,docX:c-r*i+n,docY:u+s,translate:"translate(-100%, 0%)"};case"bottom-right":return{visible:!0,docX:c-r*i+n,docY:p+s,translate:"translate(-100%, -100%)"};case"bottom-left":return{visible:!0,docX:l+r*i+n,docY:p+s,translate:"translate(0%, -100%)"};case"top-left":default:return{visible:!0,docX:l+r*i+n,docY:u+s,translate:"translate(0%, 0%)"}}}};var In=`
|
|
1776
|
+
`;var Eo=0;function wn(){return`ruler-${Date.now()}-${Eo++}`}var xn="string-rulers:",Yr=class{elementStates=new Map;stateKey(t,e="default"){return`${t}:${e}`}storageKey(t,e="default"){return it(xn+t+":"+e)}legacyStorageKey(t){return it(xn+t)}getLines(t,e="default"){return this.elementStates.get(this.stateKey(t,e))?.lines??[]}addLine(t,e,r,i,n="default",s,o){let a={id:wn(),axis:e,position:r,targetLabel:i,targetSelector:s,targetEdge:o},d=this.stateKey(t,n),c=this.elementStates.get(d);return c||(c={elementId:t,lines:[]},this.elementStates.set(d,c)),c.lines.push(a),this.save(t,n),a}moveLine(t,e,r,i,n="default"){let s=this.findLine(t,e,n);s&&(s.position=r,s.targetLabel=i)}removeLine(t,e,r="default"){let i=this.elementStates.get(this.stateKey(t,r));i&&(i.lines=i.lines.filter(n=>n.id!==e),this.save(t,r))}removeAllLines(t,e="default"){this.elementStates.delete(this.stateKey(t,e));try{localStorage.removeItem(this.storageKey(t,e)),e==="default"&&localStorage.removeItem(this.legacyStorageKey(t))}catch{}}findLine(t,e,r="default"){return this.elementStates.get(this.stateKey(t,r))?.lines.find(i=>i.id===e)}save(t,e="default"){let r=this.elementStates.get(this.stateKey(t,e));if(r)try{let i=JSON.stringify(r.lines);localStorage.setItem(this.storageKey(t,e),i),e==="default"&&localStorage.setItem(this.legacyStorageKey(t),i)}catch{}}load(t,e="default"){let r=this.stateKey(t,e);try{let i=localStorage.getItem(this.storageKey(t,e));if(!i&&e==="default"&&(i=localStorage.getItem(this.legacyStorageKey(t))),!i)return;let n=JSON.parse(i);if(!Array.isArray(n))return;this.elementStates.set(r,{elementId:t,lines:n})}catch{}}clearElement(t){for(let[e]of this.elementStates)e.startsWith(t+":")&&this.elementStates.delete(e)}clearAll(){this.elementStates.clear()}};var qr=class{opts;candidates=[];constructor(t){this.opts=t}buildCandidates(t,e,r,i=window.innerWidth,n=window.innerHeight,s=[],o,a){this.candidates=[],this.candidates.push({position:0,type:"document-origin"}),t==="horizontal"?(this.candidates.push({position:r,type:"viewport-edge"}),this.candidates.push({position:r+n,type:"viewport-edge"})):(this.candidates.push({position:e,type:"viewport-edge"}),this.candidates.push({position:e+i,type:"viewport-edge"})),this.opts.snapToElements&&this.opts.snapSelector&&document.querySelectorAll(this.opts.snapSelector).forEach(d=>{let c=d.getBoundingClientRect();c.width===0&&c.height===0||(t==="horizontal"?(this.candidates.push({position:c.top+r,type:"element-top",el:d}),this.candidates.push({position:c.bottom+r,type:"element-bottom",el:d}),this.candidates.push({position:(c.top+c.bottom)/2+r,type:"element-center-y",el:d})):(this.candidates.push({position:c.left+e,type:"element-left",el:d}),this.candidates.push({position:c.right+e,type:"element-right",el:d}),this.candidates.push({position:(c.left+c.right)/2+e,type:"element-center-x",el:d})))}),this._addLayoutGridCandidates(t,e,r,i,n),this._addGuideGapCandidates(t,s,o),a&&this.candidates.push(...a)}findSnap(t){let e=this.opts.threshold,r=null;for(let i of this.candidates){let n=Math.abs(i.position-t);n<e&&(e=n,r=i)}if(this.opts.snapStep>1){let i=Math.round(t/this.opts.snapStep)*this.opts.snapStep;if(Math.abs(i-t)<e)return{position:i,type:"grid-step"}}return r?{position:r.position,type:r.type,el:r.el,gap:r.gap,referenceLineIds:r.referenceLineIds,label:r.label}:null}snapToStep(t){return this.opts.snapStep<=1?t:Math.round(t/this.opts.snapStep)*this.opts.snapStep}_addLayoutGridCandidates(t,e,r,i,n){if(!this.opts.layoutGrids?.length)return;let s=i,o=n;for(let a of this.opts.layoutGrids){if(a.type==="columns"&&t==="vertical"){let{count:d,marginLeft:c=0,marginRight:u=0,gap:p=0}=a,g=s-c-u;if(g<=0||d<=0)continue;let m=(g-(d-1)*p)/d;this.candidates.push({position:c+e,type:"grid-column-edge"}),this.candidates.push({position:s-u+e,type:"grid-column-edge"});for(let h=0;h<d;h++){let f=c+h*(m+p),b=f+m,y=(f+b)/2;h>0&&this.candidates.push({position:f+e,type:"grid-column-edge"}),h<d-1&&this.candidates.push({position:b+e,type:"grid-column-edge"}),this.candidates.push({position:y+e,type:"grid-column-center"})}}if(a.type==="rows"&&t==="horizontal"){let{height:d,gap:c=0}=a,u=d+c;if(u<=0||d<=0)continue;let p=Math.max(0,r-200),g=r+o+200,m=Math.floor(p/u)*u;for(let h=m;h<g;h+=u)this.candidates.push({position:h,type:"grid-row-edge"}),c>0&&this.candidates.push({position:h+d,type:"grid-row-edge"})}}}_addGuideGapCandidates(t,e,r){let i=e.filter(n=>n.axis===t&&n.id!==r).slice().sort((n,s)=>n.position-s.position);if(!(i.length<2))for(let n=0;n<i.length;n++){let s=i[n],o=n>0?i[n-1]:null,a=n<i.length-1?i[n+1]:null;if(o){let d=s.position-o.position;d>0&&this.candidates.push({position:s.position+d,type:"guide-gap",gap:d,referenceLineIds:[o.id,s.id]})}if(a){let d=a.position-s.position;d>0&&this.candidates.push({position:s.position-d,type:"guide-gap",gap:d,referenceLineIds:[s.id,a.id]})}}}};var Ai=class{id="default";cornerLabel="\u2197";formatPosition(t){return t}getFixedLines(){return[]}},ki=class{id="center";cornerLabel="+";formatPosition(t,e,r,i){let n=i+r/2;return t-n}getFixedLines(t,e,r,i){return[{axis:"horizontal",position:i+e/2},{axis:"vertical",position:r+t/2}]}},Vt={default:new Ai,center:new ki},Xr=["default","center"];function he(l,t){let e=l.currentTarget,r=l.clientX,i=l.clientY,n=l.pointerId,s=t.threshold??0,o=s===0,a=!1;try{e&&"setPointerCapture"in e&&e.setPointerCapture(n)}catch{}let d=()=>{if(!a){a=!0,document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",p),document.removeEventListener("keydown",g);try{e&&"releasePointerCapture"in e&&e.releasePointerCapture(n)}catch{}}},c=m=>{if(m.pointerId!==n)return;let h=m.clientX-r,f=m.clientY-i;if(!o){if(Math.abs(h)<s&&Math.abs(f)<s)return;o=!0}t.onMove(m,{dx:h,dy:f})},u=m=>{m.pointerId===n&&(d(),o&&t.onEnd?.(m))},p=m=>{m.pointerId===n&&(d(),t.onCancel?.())},g=m=>{m.key==="Escape"&&(d(),t.onCancel?.())};return document.addEventListener("pointermove",c),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",p),document.addEventListener("keydown",g),d}var Wt=0,Kr=0,Nt=0,j=null,Zr=new Map;function Mo(){let l=document.documentElement,t=document.body;return{htmlOverflow:l.style.overflow,htmlOverscrollBehavior:l.style.overscrollBehavior,htmlTouchAction:l.style.touchAction,htmlUserSelect:l.style.userSelect,htmlWebkitUserSelect:l.style.webkitUserSelect,bodyOverflow:t.style.overflow,bodyOverscrollBehavior:t.style.overscrollBehavior,bodyTouchAction:t.style.touchAction,bodyUserSelect:t.style.userSelect,bodyWebkitUserSelect:t.style.webkitUserSelect}}function wo(){j||(j=Mo())}function xo(l){return!l||l===window||l===document?null:l}function Cn(l){l.cancelable&&l.preventDefault()}function Co(l){let t=Zr.get(l);t?t.count+=1:Zr.set(l,{target:l,overflow:l.style.overflow,overscrollBehavior:l.style.overscrollBehavior,touchAction:l.style.touchAction,count:1}),l.style.overflow="hidden",l.style.overscrollBehavior="none",l.style.touchAction="none"}function To(l){let t=Zr.get(l);t&&(t.count-=1,!(t.count>0)&&(l.style.overflow=t.overflow,l.style.overscrollBehavior=t.overscrollBehavior,l.style.touchAction=t.touchAction,Zr.delete(l)))}function Po(l){let t=document.documentElement,e=document.body;Nt>0&&(t.style.userSelect="none",t.style.webkitUserSelect="none",e.style.userSelect="none",e.style.webkitUserSelect="none"),Wt>0&&(t.style.overscrollBehavior="none",t.style.touchAction="none",e.style.overscrollBehavior="none",e.style.touchAction="none",l?Co(l):(Kr+=1,t.style.overflow="hidden",e.style.overflow="hidden"),window.addEventListener("touchmove",Cn,{passive:!1}))}function Ao(l){if(!j)return;let t=document.documentElement,e=document.body;l?To(l):Kr>0&&(Kr-=1),Kr===0&&(t.style.overflow=j.htmlOverflow,e.style.overflow=j.bodyOverflow),Wt===0&&(t.style.overscrollBehavior=j.htmlOverscrollBehavior,t.style.touchAction=j.htmlTouchAction,e.style.overscrollBehavior=j.bodyOverscrollBehavior,e.style.touchAction=j.bodyTouchAction,window.removeEventListener("touchmove",Cn)),Nt===0&&(t.style.userSelect=j.htmlUserSelect,t.style.webkitUserSelect=j.htmlWebkitUserSelect,e.style.userSelect=j.bodyUserSelect,e.style.webkitUserSelect=j.bodyWebkitUserSelect),Wt===0&&Nt===0&&(j=null)}function Tn(l={}){let t=l.scroll===!0,e=l.selection===!0,r=t?xo(l.scrollTarget):null;if(!t&&!e)return()=>{};wo(),t&&(Wt+=1),e&&(Nt+=1),Po(r);let i=!1;return()=>{i||(i=!0,t&&(Wt=Math.max(0,Wt-1)),e&&(Nt=Math.max(0,Nt-1)),Ao(r))}}var ko=20,Oo=12,Pn="#E3E3E3",An=.85,kn="#000000",On=.25,Do="#313131",Io=10,Ro=`${Io}px "JetBrains Mono", monospace`,Ho=4,Bo=-2,_o=8,Fo=4,Vo=5,Wo=2,No="rgba(255, 56, 96, 0.50)",zo="rgba(255, 56, 96, 0.22)",Go="rgba(255, 56, 96, 0.05)",$o="rgba(255, 56, 96, 0.45)",Uo=8,jo=`${Uo}px "JetBrains Mono", monospace`,Dn="rgba(0, 120, 255, 0.50)",Yo="rgba(0, 120, 255, 0.22)",qo="rgba(0, 120, 255, 0.05)";function Qr(l,t,e,r,i,n,s){l.save(),l.globalAlpha=e,l.fillStyle=t,l.fillRect(r,i,n,s),l.restore()}function Jr(l,t="x",e=window.innerWidth,r=window.innerHeight){let i=l.trim().match(/^(-?[\d.]+)\s*(px|rem|%|vw|vh)?$/);if(!i)return 0;let n=parseFloat(i[1]);switch(i[2]||"px"){case"px":return n;case"rem":return n*parseFloat(getComputedStyle(document.documentElement).fontSize);case"%":return t==="y"?n/100*r:n/100*e;case"vw":return n/100*e;case"vh":return n/100*r;default:return n}}var Xo={snapStep:0,snapToElements:!0,snapThreshold:8,snapSelector:"[string],[data-string]"},Ko="rgba(255, 0, 80, 0.08)",Zo="rgba(0, 120, 255, 0.06)",ti=class{viewportLayer;host;gridCanvas;topCanvas;leftCanvas;cornerEl;cornerLabelEl;linesLayer;gapIndicatorEl;gapIndicatorLabelEl;lineEls=new Map;fixedLineEls=new Map;callbacks;options;snapEngine;resizeObserver;currentMode=Vt.default;visible=!1;viewportWidth=window.innerWidth;viewportHeight=window.innerHeight;contentWidth=document.documentElement.scrollWidth;contentHeight=document.documentElement.scrollHeight;viewportOffsetX=0;viewportOffsetY=0;scrollX=0;scrollY=0;renderedScrollX=-1;renderedScrollY=-1;currentLines=[];_snapHighlightEl=null;_guideReferenceLineIds=null;_guideReferenceAxis=null;_guideReferenceGap=null;dragInteractionReleases=new Set;constructor(t,e={},r,i){this.callbacks=t,this.options={...Xo,...e},this.host=r??null,this.viewportLayer=i,this.snapEngine=new qr({threshold:this.options.snapThreshold,snapStep:this.options.snapStep,snapToElements:this.options.snapToElements,snapSelector:this.options.snapSelector,layoutGrids:this.options.layoutGrids}),this.gridCanvas=this.createCanvas("grid"),this.topCanvas=this.createCanvas("top"),this.leftCanvas=this.createCanvas("left"),this.linesLayer=this.createLinesLayer(),this.gapIndicatorEl=this.createGapIndicator(),this.gapIndicatorLabelEl=document.createElement("span"),this.gapIndicatorLabelEl.setAttribute("data-string-rulers-gap-indicator-label",""),this.gapIndicatorLabelEl.setAttribute("data-stdg",""),this.gapIndicatorEl.appendChild(this.gapIndicatorLabelEl),this.cornerEl=document.createElement("div"),this.cornerEl.setAttribute("data-string-rulers-corner",""),this.cornerEl.setAttribute("data-mode",this.currentMode.id),this.cornerLabelEl=document.createElement("span"),this.cornerLabelEl.textContent=this.currentMode.cornerLabel,this.cornerEl.appendChild(this.cornerLabelEl),this.cornerEl.addEventListener("click",()=>this.callbacks.onModeToggle());let n=this.viewportLayer.getScreenElement(),s=this.viewportLayer.getWorldElement(r);s.appendChild(this.gridCanvas),s.appendChild(this.linesLayer),this.linesLayer.appendChild(this.gapIndicatorEl),n.appendChild(this.topCanvas),n.appendChild(this.leftCanvas),n.appendChild(this.cornerEl),document.body.setAttribute("data-string-rulers-hidden",""),this.resizeObserver=new ResizeObserver(()=>{this.visible&&this.redraw()}),this.resizeObserver.observe(document.documentElement),this.bindRulerDrag(this.topCanvas,"horizontal"),this.bindRulerDrag(this.leftCanvas,"vertical")}refresh(t){this.currentLines=t,this.redraw()}updateScroll(t,e,r,i,n,s){let o=this.viewportWidth!==r||this.viewportHeight!==i||this.contentWidth!==n||this.contentHeight!==s;if(this.scrollX=t,this.scrollY=e,this.viewportWidth=r,this.viewportHeight=i,this.contentWidth=n,this.contentHeight=s,this.syncScreenChromePosition(),!this.visible)return;let a=Math.round(t),d=Math.round(e);(o||a!==this.renderedScrollX||d!==this.renderedScrollY)&&(this.renderedScrollX=a,this.renderedScrollY=d,o&&this.syncWorldDimensions(),this.drawTopRuler(this.viewportWidth),this.drawLeftRuler(this.viewportHeight),o&&this.drawGrid(this.contentWidth,this.contentHeight)),this.updateLineLabels(),this._positionGuideReferenceIndicator(),(this.fixedLineEls.size>0||this.currentMode.id!=="default")&&this.syncFixedLines()}setVisible(t){this.visible=t,t?(document.body.removeAttribute("data-string-rulers-hidden"),this.redraw()):document.body.setAttribute("data-string-rulers-hidden","")}setMode(t){this.currentMode=t,this.cornerEl.setAttribute("data-mode",t.id),this.cornerLabelEl.textContent=t.cornerLabel,this.redraw()}destroy(){this.releaseAllDragInteractionLocks(),this._setSnapHighlight(null),this._setGuideReference(null,null,null),this.resizeObserver.disconnect(),this.gridCanvas.remove(),this.topCanvas.remove(),this.leftCanvas.remove(),this.cornerEl.remove(),this.linesLayer.remove(),document.body.removeAttribute("data-string-rulers-hidden"),this.lineEls.clear();for(let[,t]of this.fixedLineEls)t.remove();this.fixedLineEls.clear()}redraw(){this.renderedScrollX=Math.round(this.scrollX),this.renderedScrollY=Math.round(this.scrollY),this.syncScreenChromePosition(),this.syncWorldDimensions(),this.drawTopRuler(this.viewportWidth),this.drawLeftRuler(this.viewportHeight),this.drawGrid(this.contentWidth,this.contentHeight),this.syncLineEls(this.currentLines),this.syncFixedLines(),this._positionGuideReferenceIndicator()}updateLineLabels(){for(let t of this.currentLines){let e=this.lineEls.get(t.id);e&&this.updateLineLabel(t,e.labelEl)}}createCanvas(t){let e=document.createElement("canvas");return e.setAttribute(`data-string-rulers-${t}`,""),e}createLinesLayer(){let t=document.createElement("div");return t.setAttribute("data-string-rulers-lines",""),t}createGapIndicator(){let t=document.createElement("div");return t.setAttribute("data-string-rulers-gap-indicator",""),t.setAttribute("hidden",""),t}syncWorldDimensions(){this.linesLayer.style.width=`${this.contentWidth}px`,this.linesLayer.style.height=`${this.contentHeight}px`,this.gridCanvas.style.width=`${this.contentWidth}px`,this.gridCanvas.style.height=`${this.contentHeight}px`}drawGrid(t,e){let r=this.options.layoutGrids,i=this.gridCanvas;if((i.width!==t||i.height!==e)&&(i.width=t,i.height=e,i.style.width=`${t}px`,i.style.height=`${e}px`),!r?.length)return;let n=i.getContext("2d");n.clearRect(0,0,t,e);for(let s of r)s.type==="columns"&&this._drawColumnsGrid(n,this.viewportWidth,e,s),s.type==="rows"&&this._drawRowsGrid(n,this.viewportWidth,e,s)}_drawColumnsGrid(t,e,r,i){let{count:n,marginLeft:s=0,marginRight:o=0,gap:a=0}=i,d=e-s-o;if(d<=0||n<=0)return;let c=(d-(n-1)*a)/n;t.fillStyle=i.color??Ko;for(let u=0;u<n;u++){let p=s+u*(c+a);t.fillRect(p,0,c,r)}}_drawRowsGrid(t,e,r,i){let{height:n,gap:s=0}=i,o=n+s;if(!(o<=0||n<=0)){t.fillStyle=i.color??Zo;for(let a=0;a<r;a+=o)t.fillRect(0,a,e,n)}}drawTopRuler(t){let e=this.getRulerThickness(),r=this.topCanvas;(r.width!==t||r.height!==e)&&(r.width=t,r.height=e);let i=r.getContext("2d");i.clearRect(0,0,t,e),Qr(i,Pn,An,0,0,t,e),Qr(i,kn,On,0,e-1,t,1),this._drawColumnMarkers(i,t,e),this.drawTicks(i,t,e,"top",this.scrollX)}drawLeftRuler(t){let e=this.getRulerThickness(),r=this.leftCanvas;(r.width!==e||r.height!==t)&&(r.width=e,r.height=t);let i=r.getContext("2d");i.clearRect(0,0,e,t),Qr(i,Pn,An,0,0,e,t),Qr(i,kn,On,e-1,0,1,t),this._drawRowMarkers(i,e,t),this.drawTicks(i,t,e,"left",this.scrollY)}drawTicks(t,e,r,i,n){let{tick:s,label:o}=this.pickStep(e),a=i==="top"?"vertical":"horizontal",d=i==="top",c=this.isCompactMobileRuler(),u=!c,p=Math.round(r/2),g=Math.min(r,c?Vo:_o),m=Math.min(r,c?Wo:Fo);t.fillStyle=Do,t.font=Ro;let h=Math.ceil(n/s)*s,f=h-n;if(d){t.textAlign="center",t.textBaseline="top";for(let b=0;f+b*s<=e;b++){let y=Math.round(f+b*s),v=h+b*s,S=this.currentMode.formatPosition(v,a,e,n),E=Math.round(S)%o===0,M=E?g:m,C=c?0:r-M;t.fillRect(y,C,1,M),u&&E&&y>4&&t.fillText(String(Math.round(S)),y,Ho)}}else{t.textAlign="center",t.textBaseline="middle";for(let b=0;f+b*s<=e;b++){let y=Math.round(f+b*s),v=h+b*s,S=this.currentMode.formatPosition(v,a,e,n),E=Math.round(S)%o===0,M=E?g:m,C=c?0:r-M;t.fillRect(C,y,M,1),u&&E&&y>4&&(t.save(),t.translate(p,y),t.rotate(-Math.PI/2),t.fillText(String(Math.round(S)),0,Bo),t.restore())}}}pickStep(t){return t<300?{tick:5,label:25}:t<800?{tick:10,label:50}:t<1800?{tick:25,label:100}:{tick:50,label:500}}_resolveColumnLayout(){let t=this.options.columnLayout;if(!t||t.columns<=0)return null;let e=Jr(t.margin,"x",this.viewportWidth,this.viewportHeight),r=Jr(t.gap,"x",this.viewportWidth,this.viewportHeight),n=this.viewportWidth-2*e;if(n<=0)return null;let s=(n-(t.columns-1)*r)/t.columns;return s<=0?null:{columns:t.columns,marginPx:e,gapPx:r,colWidth:s}}_drawColumnMarkers(t,e,r){let i=this._resolveColumnLayout();if(!i)return;let{columns:n,marginPx:s,gapPx:o,colWidth:a}=i;t.fillStyle=Go;for(let d=0;d<n;d++){let c=s+d*(a+o);t.fillRect(c,0,a,r)}t.fillStyle=No;for(let d=0;d<n;d++){let c=s+d*(a+o),u=c+a;t.fillRect(Math.round(c),0,1,r),t.fillRect(Math.round(u),0,1,r)}t.fillStyle=zo;for(let d=0;d<n;d++){let u=s+d*(a+o)+a/2;t.fillRect(Math.round(u),Math.round(r*.6),1,Math.round(r*.4))}if(!this.isCompactMobileRuler()&&a>16){t.fillStyle=$o,t.font=jo,t.textAlign="center",t.textBaseline="middle";for(let d=0;d<n;d++){let u=s+d*(a+o)+a/2;t.fillText(String(d+1),Math.round(u),Math.round(r/2))}}}_buildColumnCandidates(t){if(t!=="vertical")return[];let e=this._resolveColumnLayout();if(!e)return[];let{columns:r,marginPx:i,gapPx:n,colWidth:s}=e,o=[];for(let a=0;a<r;a++){let d=i+a*(s+n),c=d+s,u=(d+c)/2,p=a+1;o.push({position:d+this.scrollX,type:"grid-column-edge",label:`c${p}`}),o.push({position:c+this.scrollX,type:"grid-column-edge",label:`c${p}\u25C2`}),o.push({position:u+this.scrollX,type:"grid-column-center",label:`c${p}\u2299`})}return o}_resolveRowLayout(){let t=this.options.rowLayout;if(!t)return null;let e=Jr(t.size,"y",this.viewportWidth,this.viewportHeight),r=Jr(t.gap,"y",this.viewportWidth,this.viewportHeight);return e<=0?null:{sizePx:e,gapPx:r,period:e+r}}_drawRowMarkers(t,e,r){let i=this._resolveRowLayout();if(!i)return;let{sizePx:n,gapPx:s,period:o}=i,a=Math.floor(this.scrollY/o)*o,d=this.scrollY+r+o;for(let c=a;c<d;c+=o){let u=Math.round(c-this.scrollY),p=Math.round(c+n-this.scrollY),g=Math.max(0,u),m=Math.min(r,p);if(m>g&&(t.fillStyle=qo,t.fillRect(0,g,e,m-g)),u>=0&&u<=r&&(t.fillStyle=Dn,t.fillRect(0,u,e,1)),s>0&&p>=0&&p<=r&&(t.fillStyle=Dn,t.fillRect(0,p,e,1)),n>4){let h=Math.round(c+n/2-this.scrollY);h>=0&&h<=r&&(t.fillStyle=Yo,t.fillRect(0,h,Math.round(e*.45),1))}}}_buildRowCandidates(t){if(t!=="horizontal")return[];let e=this._resolveRowLayout();if(!e)return[];let{sizePx:r,gapPx:i,period:n}=e,s=this.viewportHeight,o=Math.max(0,this.scrollY-200),a=this.scrollY+s+200,d=Math.floor(o/n)*n,c=[];for(let u=d;u<a;u+=n){let p=Math.round(u/n)+1;c.push({position:u,type:"grid-row-edge",label:`r${p}`}),c.push({position:u+r/2,type:"grid-row-edge",label:`r${p}\u2299`}),i>0&&c.push({position:u+r,type:"grid-row-edge",label:`r${p}\u25C2`})}return c}syncFixedLines(){let t=this.currentMode.getFixedLines(this.viewportWidth,this.viewportHeight,this.scrollX,this.scrollY),e=new Set;for(let r of t){let i=`fixed-${r.axis}`;e.add(i);let n=this.fixedLineEls.get(i);n||(n=document.createElement("div"),n.setAttribute("data-string-rulers-fixed-line",""),n.setAttribute("data-axis",r.axis),this.linesLayer.appendChild(n),this.fixedLineEls.set(i,n)),r.axis==="horizontal"?(n.style.top=`${r.position}px`,n.style.left="0",n.style.width=`${this.contentWidth}px`):(n.style.left=`${r.position}px`,n.style.top="0",n.style.height=`${this.contentHeight}px`)}for(let[r,i]of this.fixedLineEls)e.has(r)||(i.remove(),this.fixedLineEls.delete(r))}syncLineEls(t){for(let[e]of this.lineEls)t.some(r=>r.id===e)||(this.lineEls.get(e).el.remove(),this.lineEls.delete(e));for(let e of t)this.lineEls.has(e.id)||this.createLineEl(e),this.positionLineEl(e)}createLineEl(t){let e=document.createElement("div");e.setAttribute("data-string-rulers-line",t.id),e.setAttribute("data-axis",t.axis),e.setAttribute("data-stdg","");let r=document.createElement("span");r.setAttribute("data-string-rulers-label",""),e.appendChild(r),this.linesLayer.appendChild(e),this.lineEls.set(t.id,{el:e,labelEl:r}),e.addEventListener("pointerdown",i=>{if(i.stopPropagation(),i.button===1){i.preventDefault(),this.callbacks.onLineRemoved(t.id);return}this.startLineDrag(i,t)})}positionLineEl(t){let e=this.lineEls.get(t.id);if(!e)return;let{el:r,labelEl:i}=e;t.axis==="horizontal"?(r.style.top=`${t.position}px`,r.style.left="0",r.style.width=`${this.contentWidth}px`):(r.style.left=`${t.position}px`,r.style.top="0",r.style.height=`${this.contentHeight}px`),this.updateLineLabel(t,i)}updateLineLabel(t,e){let r=t.axis==="horizontal"?this.viewportHeight:this.viewportWidth,i=t.axis==="horizontal"?this.scrollY:this.scrollX,n=this.currentMode.formatPosition(t.position,t.axis,r,i),s=String(Math.round(n)),o=t.targetLabel?`${s} ${t.targetLabel}`:s;e.textContent!==o&&(e.textContent=o)}_setGuideReference(t,e,r){if(this._guideReferenceLineIds)for(let i of this._guideReferenceLineIds)this.lineEls.get(i)?.el.removeAttribute("data-string-rulers-guide-ref");if(this._guideReferenceAxis=t,this._guideReferenceLineIds=e,this._guideReferenceGap=r,e)for(let i of e)this.lineEls.get(i)?.el.setAttribute("data-string-rulers-guide-ref","");this._positionGuideReferenceIndicator()}_positionGuideReferenceIndicator(){let t=this._guideReferenceLineIds,e=this._guideReferenceAxis,r=this._guideReferenceGap;if(!t||!e||r==null){this.gapIndicatorEl.setAttribute("hidden",""),this.gapIndicatorEl.removeAttribute("data-axis");return}let i=t.map(o=>this.currentLines.find(a=>a.id===o)).filter(o=>!!o);if(i.length!==2){this.gapIndicatorEl.setAttribute("hidden",""),this.gapIndicatorEl.removeAttribute("data-axis");return}let n=Math.min(i[0].position,i[1].position),s=Math.max(i[0].position,i[1].position);if(this.gapIndicatorEl.removeAttribute("hidden"),this.gapIndicatorEl.setAttribute("data-axis",e),this.gapIndicatorLabelEl.textContent=`${Math.round(r)}px`,e==="vertical"){let o=Math.round(this.scrollY+Math.max(this.getRulerThickness()+32,this.viewportHeight/2));this.gapIndicatorEl.style.left=`${n}px`,this.gapIndicatorEl.style.top=`${o}px`,this.gapIndicatorEl.style.width=`${Math.max(0,s-n)}px`,this.gapIndicatorEl.style.height="0"}else{let o=Math.round(this.scrollX+Math.max(this.getRulerThickness()+32,this.viewportWidth/2));this.gapIndicatorEl.style.left=`${o}px`,this.gapIndicatorEl.style.top=`${n}px`,this.gapIndicatorEl.style.width="0",this.gapIndicatorEl.style.height=`${Math.max(0,s-n)}px`}}_setSnapHighlight(t){this._snapHighlightEl!==t&&(this._snapHighlightEl?.removeAttribute("data-string-rulers-snap-target"),this._snapHighlightEl=t,t?.setAttribute("data-string-rulers-snap-target",""))}_snapCategory(t){return t==="guide-gap"?"guide":t==="grid-column-edge"||t==="grid-column-center"?"column":t==="grid-step"||t.startsWith("grid-")?"grid":"element"}_snapLabel(t,e,r){let i=t.position??e,n=this.getViewportSizeForAxis(r),s=r==="horizontal"?this.scrollY:this.scrollX,o=String(Math.round(this.currentMode.formatPosition(i,r,n,s)));return t.type==="guide-gap"&&typeof t.gap=="number"?`${o} ${Math.round(t.gap)}px`:t.label?`${o} ${t.label}`:t.el?`${o} ${this._elementLabel(t.el)}`:o}_elementLabel(t){if(t.id)return`#${t.id}`;let e=t.classList[0];if(e)return`.${e}`;let r=t.getAttribute("string")??t.getAttribute("data-string");return r?`[${r}]`:t.tagName.toLowerCase()}_elementSelector(t){if(t.id)return`#${CSS.escape(t.id)}`;let e=t.getAttribute("string");if(e)return`[string="${CSS.escape(e)}"]`;let r=t.getAttribute("data-string");return r?`[data-string="${CSS.escape(r)}"]`:t.classList[0]?`.${CSS.escape(t.classList[0])}`:null}_resolveBinding(t){if(!t)return{};if(t.el){let e;switch(t.type){case"element-top":e="top";break;case"element-bottom":e="bottom";break;case"element-center-y":e="center-y";break;case"element-left":e="left";break;case"element-right":e="right";break;case"element-center-x":e="center-x";break}return{targetLabel:this._elementLabel(t.el),targetSelector:this._elementSelector(t.el)??void 0,targetEdge:e}}if((t.type==="grid-column-edge"||t.type==="grid-column-center")&&t.label){let e=t.label.match(/^c(\d+)(◂|⊙)?$/);if(e){let r=parseInt(e[1],10)-1,i=e[2]==="\u25C2"?"col-right":e[2]==="\u2299"?"col-center":"col-left";return{targetLabel:t.label,targetSelector:`__col:${r}`,targetEdge:i}}}return t.label?{targetLabel:t.label}:{}}recalculateBindings(t){for(let e of t){if(!e.targetSelector||!e.targetEdge)continue;if(e.targetSelector.startsWith("__col:")){let n=parseInt(e.targetSelector.slice(6),10),s=this._resolveColumnLayout();if(!s||n<0||n>=s.columns)continue;let o=s.marginPx+n*(s.colWidth+s.gapPx),a=o+s.colWidth;switch(e.targetEdge){case"col-left":e.position=o+this.scrollX;break;case"col-right":e.position=a+this.scrollX;break;case"col-center":e.position=(o+a)/2+this.scrollX;break}continue}let r=document.querySelector(e.targetSelector);if(!r)continue;let i=r.getBoundingClientRect();switch(e.targetEdge){case"top":e.position=i.top+this.scrollY;break;case"bottom":e.position=i.bottom+this.scrollY;break;case"center-y":e.position=(i.top+i.bottom)/2+this.scrollY;break;case"left":e.position=i.left+this.scrollX;break;case"right":e.position=i.right+this.scrollX;break;case"center-x":e.position=(i.left+i.right)/2+this.scrollX;break}}}bindRulerDrag(t,e){t.addEventListener("pointerdown",r=>{r.preventDefault(),this.startRulerDrag(r,e)})}startRulerDrag(t,e){let r=this.acquireDragInteractionLock(),i=document.createElement("div");i.setAttribute("data-string-rulers-ghost",""),i.setAttribute("data-axis",e);let n=document.createElement("span");n.setAttribute("data-string-rulers-ghost-label",""),n.setAttribute("data-stdg",""),i.appendChild(n),this.linesLayer.appendChild(i),this.snapEngine.buildCandidates(e,this.scrollX,this.scrollY,this.viewportWidth,this.viewportHeight,this.currentLines,void 0,[...this._buildColumnCandidates(e),...this._buildRowCandidates(e)]);let s=d=>{let c=this.resolveDocPositionFromPointer(e,d),u=d.shiftKey?null:this.snapEngine.findSnap(c),p=u?u.position:d.shiftKey?c:this.snapEngine.snapToStep(c);if(e==="horizontal"?(i.style.top=`${p}px`,i.style.left="0",i.style.width=`${this.contentWidth}px`):(i.style.left=`${p}px`,i.style.top="0",i.style.height=`${this.contentHeight}px`),u)i.setAttribute("data-snapping",this._snapCategory(u.type)),this._setSnapHighlight(u.el??null),this._setGuideReference(u.type==="guide-gap"?e:null,u.type==="guide-gap"?u.referenceLineIds??null:null,u.type==="guide-gap"?u.gap??null:null),n.textContent=this._snapLabel(u,p,e);else{i.removeAttribute("data-snapping"),this._setSnapHighlight(null),this._setGuideReference(null,null,null);let g=this.getViewportSizeForAxis(e),m=e==="horizontal"?this.scrollY:this.scrollX;n.textContent=String(Math.round(this.currentMode.formatPosition(p,e,g,m)))}},o=()=>{r(),i.remove(),this._setSnapHighlight(null),this._setGuideReference(null,null,null)};he(t,{onMove:s,onEnd:d=>{o();let c=this.resolveViewportPointerPos(e,d);if(c>this.getRulerThickness()){let u=e==="horizontal"?c+this.scrollY:c+this.scrollX,p=d.shiftKey?null:this.snapEngine.findSnap(u),g=p?p.position:d.shiftKey?u:this.snapEngine.snapToStep(u),m=this._resolveBinding(p);this.callbacks.onLineCreated(e,g,m.targetLabel,m.targetSelector,m.targetEdge)}},onCancel:o})}startLineDrag(t,e){let r=this.acquireDragInteractionLock(),{el:i}=this.lineEls.get(e.id),n=e.axis==="horizontal"?t.clientY:t.clientX,s=e.position;this.snapEngine.buildCandidates(e.axis,this.scrollX,this.scrollY,this.viewportWidth,this.viewportHeight,this.currentLines,e.id,[...this._buildColumnCandidates(e.axis),...this._buildRowCandidates(e.axis)]);let o=c=>{let u=e.axis==="horizontal"?c.clientY-n:c.clientX-n,p=Math.max(0,s+u),g=c.shiftKey?null:this.snapEngine.findSnap(p),m=g?g.position:c.shiftKey?p:this.snapEngine.snapToStep(p);g?(i.setAttribute("data-snapping",this._snapCategory(g.type)),this._setSnapHighlight(g.el??null),this._setGuideReference(g.type==="guide-gap"?e.axis:null,g.type==="guide-gap"?g.referenceLineIds??null:null,g.type==="guide-gap"?g.gap??null:null)):(i.removeAttribute("data-snapping"),this._setSnapHighlight(null),this._setGuideReference(null,null,null)),this.callbacks.onLineMoved(e.id,m,g?.el?this._elementLabel(g.el):g?.label);let h=this.lineEls.get(e.id);if(h)if(g)h.labelEl.textContent=this._snapLabel(g,m,e.axis);else{let f=this.getViewportSizeForAxis(e.axis),b=e.axis==="horizontal"?this.scrollY:this.scrollX;h.labelEl.textContent=String(Math.round(this.currentMode.formatPosition(m,e.axis,f,b)))}},a=()=>{r(),i.removeAttribute("data-snapping"),this._setSnapHighlight(null),this._setGuideReference(null,null,null)};he(t,{onMove:o,onEnd:c=>{a();let u=e.axis==="horizontal"?c.clientY-n:c.clientX-n,p=Math.max(0,s+u),g=c.shiftKey?null:this.snapEngine.findSnap(p),m=g?g.position:c.shiftKey?p:this.snapEngine.snapToStep(p);if((e.axis==="horizontal"?m-this.scrollY:m-this.scrollX)<=this.getRulerThickness())this.callbacks.onLineRemoved(e.id);else{let f=this._resolveBinding(g);this.callbacks.onDragCommit(e.id,m,f.targetLabel,f.targetSelector,f.targetEdge)}},onCancel:a})}syncScreenChromePosition(){let t=this.host,e=this.getRulerThickness(),r=this.viewportWidth,i=this.viewportHeight;if(!t||t===document.body||t===document.documentElement)this.viewportOffsetX=0,this.viewportOffsetY=0;else{let n=t.getBoundingClientRect();this.viewportOffsetX=Math.round(n.left),this.viewportOffsetY=Math.round(n.top),r=Math.max(0,Math.round(n.width)),i=Math.max(0,Math.round(n.height))}this.topCanvas.style.left=`${this.viewportOffsetX}px`,this.topCanvas.style.top=`${this.viewportOffsetY}px`,this.topCanvas.style.width=`${r}px`,this.topCanvas.style.height=`${e}px`,this.leftCanvas.style.left=`${this.viewportOffsetX}px`,this.leftCanvas.style.top=`${this.viewportOffsetY}px`,this.leftCanvas.style.width=`${e}px`,this.leftCanvas.style.height=`${i}px`,this.cornerEl.style.left=`${this.viewportOffsetX}px`,this.cornerEl.style.top=`${this.viewportOffsetY}px`,this.cornerEl.style.width=`${e}px`,this.cornerEl.style.height=`${e}px`}isCompactMobileRuler(){return ot(this.viewportWidth).compact}getRulerThickness(){return this.isCompactMobileRuler()?Oo:ko}getViewportSizeForAxis(t){return t==="horizontal"?this.viewportHeight:this.viewportWidth}resolveViewportPointerPos(t,e){let r=t==="horizontal"?e.clientY:e.clientX,i=t==="horizontal"?this.viewportOffsetY:this.viewportOffsetX;return r-i}resolveDocPositionFromPointer(t,e){let r=this.resolveViewportPointerPos(t,e);return t==="horizontal"?r+this.scrollY:r+this.scrollX}acquireDragInteractionLock(){let t=Tn({selection:!0,scroll:this.isCompactMobileRuler(),scrollTarget:this.options.scrollTarget}),e=()=>{t(),this.dragInteractionReleases.delete(e)};return this.dragInteractionReleases.add(e),e}releaseAllDragInteractionLocks(){for(let t of Array.from(this.dragInteractionReleases))t()}};var Qo="stdg",wt=class{baseStorageKey;defaultValue;validate;legacyKeys;constructor(t){this.baseStorageKey=`${Qo}:${t.moduleId}:${t.name}`,this.defaultValue=t.default,this.validate=t.validate,this.legacyKeys=t.legacyKeys??[]}read(){let t=this.readRaw(this.storageKey);if(t!==void 0)return t;for(let e of this.legacyKeys){let r=it(e),i=this.readRaw(r);if(i!==void 0)return this.write(i),this.clearRaw(r),i}return this.defaultValue}write(t){try{localStorage.setItem(this.storageKey,JSON.stringify(t))}catch{}}clear(){this.clearRaw(this.storageKey)}get storageKey(){return it(this.baseStorageKey)}readRaw(t){let e;try{e=localStorage.getItem(t)}catch{return}if(e==null)return;let r;try{r=JSON.parse(e)}catch{return}if(this.validate){let i=this.validate(r);return i??void 0}return r}clearRaw(t){try{localStorage.removeItem(t)}catch{}}};var me="__string-rulers-global__",Jo=[],ei=class extends Z{manager=new Yr;overlay=null;visible=!1;dockDisabled=!1;currentModeId="default";modeStore=new wt({moduleId:"rulers",name:"mode",default:"default",validate:t=>typeof t=="string"&&t in Vt?t:null,legacyKeys:["string-rulers:mode"]});viewportLayer;_kbHandlers=[];_elHandlers=[];_evHandlers=[];static devtool={id:"rulers",label:"Rulers",icon:"ruler",order:10,group:1,hotkey:{key:"R",shiftKey:!0},styles:Mn,connects:{global:!1,keys:["rulers"]}};constructor(t){super(t),this.attributesToMap=[],this.viewportLayer=this.acquireViewportLayer("devtools-rulers",10020)}onInit(){this.applyStyleSettings(),this.mountOverlay()}onSettingsChange(){this.applyStyleSettings()}onSubscribe(){let t=this.settings.triggers,e=Array.isArray(t)?t:Jo;this._bindTriggers(e)}onUnsubscribe(){this._unbindTriggers()}onFrame(t){!this.visible||!this.overlay||this.pushScrollToOverlay(t)}onResize(){if(!this.overlay)return;this.syncOverlayMetrics();let t=this.manager.getLines(me,this.currentModeId);this.overlay.recalculateBindings(t),this.manager.save(me,this.currentModeId),this.overlay.refresh(t)}destroy(){this._unbindTriggers(),this.overlay?.destroy(),this.overlay=null,this.manager.clearAll(),this.clearStyleSettings(),super.destroy()}toggle(){this.setVisible(!this.visible)}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}clear(){this.manager.removeAllLines(me,this.currentModeId),this.overlay?.refresh([])}isVisible(){return this.visible}getDevtoolActiveState(){return this.visible}setDevtoolActiveState(t){this.setDockActive(t)}getDevtoolSubBadges(){return[{id:"clear-rulers",icon:"noplus",label:"Clear guides",selectorAttribute:"data-string-rulers-clear-all",onClick:()=>this.clear()}]}_bindTriggers(t){for(let e of t)if(e.type==="keyboard"){let r=i=>{i.key===e.key&&i.shiftKey===(e.shiftKey??!1)&&i.ctrlKey===(e.ctrlKey??!1)&&i.altKey===(e.altKey??!1)&&i.metaKey===(e.metaKey??!1)&&(i.preventDefault(),this._applyAction(e.action))};window.addEventListener("keydown",r),this._kbHandlers.push(r)}else if(e.type==="element"){let r=e.event??"click";for(let i of Array.from(document.querySelectorAll(e.selector))){let n=()=>this._applyAction(e.action);i.addEventListener(r,n),this._elHandlers.push({el:i,event:r,fn:n})}}else if(e.type==="event"){let r=()=>this._applyAction(e.action);this.events.on(e.name,r),this._evHandlers.push({name:e.name,fn:r})}}_unbindTriggers(){for(let t of this._kbHandlers)window.removeEventListener("keydown",t);this._kbHandlers=[];for(let{el:t,event:e,fn:r}of this._elHandlers)t.removeEventListener(e,r);this._elHandlers=[];for(let{name:t,fn:e}of this._evHandlers)this.events.off(t,e);this._evHandlers=[]}_applyAction(t="toggle"){this.dockDisabled||(t==="show"?this.show():t==="hide"?this.hide():this.toggle())}setVisible(t){t&&this.dockDisabled||this.visible!==t&&(this.visible=t,this.overlay?.setVisible(t),et.emitLayoutChange(),this.emitDevtoolState())}setDockActive(t){this.dockDisabled=!t,this.setVisible(t)}mountOverlay(){if(this.overlay)return;let t=me;this.currentModeId=this.modeStore.read(),this.manager.load(t,this.currentModeId);let e=this.settings,r=typeof e["rulers-snap"]=="number"?e["rulers-snap"]:0,i=typeof e["rulers-snap-elements"]=="boolean"?e["rulers-snap-elements"]:!0,n=typeof e["rulers-snap-threshold"]=="number"?e["rulers-snap-threshold"]:8,s=typeof e["rulers-snap-selector"]=="string"?e["rulers-snap-selector"]:"[string],[data-string]",o=this._resolveGrids(e.grid),a=typeof e["rulers-columns"]=="number"?e["rulers-columns"]:0,d=typeof e["rulers-margin"]=="string"?e["rulers-margin"]:"0px",c=typeof e["rulers-gap"]=="string"?e["rulers-gap"]:"0px",u=a>0?{columns:a,margin:d,gap:c}:void 0,p=typeof e["rulers-rows"]=="string"?e["rulers-rows"]:"",g=typeof e["rulers-rows-gap"]=="string"?e["rulers-rows-gap"]:"0px",m=p?{size:p,gap:g}:void 0;this.overlay=new ti({onLineCreated:(h,f,b,y,v)=>{this.manager.addLine(t,h,f,b,this.currentModeId,y,v),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))},onLineMoved:(h,f,b)=>{this.manager.moveLine(t,h,f,b,this.currentModeId),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))},onLineRemoved:h=>{this.manager.removeLine(t,h,this.currentModeId),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))},onDragCommit:(h,f,b,y,v)=>{this.manager.moveLine(t,h,f,b,this.currentModeId);let S=this.manager.findLine(t,h,this.currentModeId);S&&(S.targetSelector=y,S.targetEdge=v),this.manager.save(t,this.currentModeId),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))},onModeToggle:()=>this.cycleMode()},{snapStep:r,snapToElements:i,snapThreshold:n,snapSelector:s,layoutGrids:o,columnLayout:u,rowLayout:m,scrollTarget:this.data.scroll.elementContainer},this.data.scroll.container,this.viewportLayer),this.syncOverlayMetrics(),this.overlay.setMode(Vt[this.currentModeId]),this.overlay.setVisible(this.visible),this.overlay.refresh(this.manager.getLines(t,this.currentModeId))}cycleMode(){let e=(Xr.indexOf(this.currentModeId)+1)%Xr.length;this.switchMode(Xr[e])}switchMode(t){let e=me;this.manager.save(e,this.currentModeId),this.currentModeId=t,this.manager.load(e,t),this.overlay?.setMode(Vt[t]),this.overlay?.refresh(this.manager.getLines(e,t)),this.modeStore.write(t)}applyStyleSettings(){let t=this.settings,e=typeof t["rulers-color"]=="string"?t["rulers-color"]:"rgba(0, 120, 255, 0.75)",r=typeof t["rulers-opacity"]=="number"?t["rulers-opacity"]:1,i=Math.max(0,Math.min(1,r));document.documentElement.style.setProperty("--string-rulers-line-color",e),document.documentElement.style.setProperty("--string-rulers-line-opacity",String(i))}clearStyleSettings(){document.documentElement.style.removeProperty("--string-rulers-line-color"),document.documentElement.style.removeProperty("--string-rulers-line-opacity")}_resolveGrids(t){if(t){if(Array.isArray(t))return t;if(typeof t=="object")return[t]}}syncOverlayMetrics(){this.overlay&&this.pushScrollToOverlay(this.data)}pushScrollToOverlay(t){if(!this.overlay)return;let e=t.scroll.elementContainer,r=t.scroll.direction==="horizontal",i=r?e.scrollLeft:0,n=r?0:e.scrollTop;this.overlay.updateScroll(i,n,t.viewport.windowWidth,t.viewport.windowHeight,t.viewport.contentWidth,t.viewport.contentHeight)}};var ta=20,ea=20,ra=24,ia=24,na="data-string-rulers-hidden",sa="[data-string-rulers-left]",oa="[data-string-rulers-top]",aa={top:"start",left:"start",start:"start",bottom:"end",right:"end",end:"end"};function ri(l){return l?aa[l.toLowerCase()]??"start":"start"}var zt=class extends Z{_viewportLayer;_badgeLayer;_hudLayer;get viewportLayer(){return this._viewportLayer||(this._viewportLayer=this.acquireViewportLayer(this.layerName,this.layerZIndex)),this._viewportLayer}get badgeLayer(){return this._badgeLayer||(this._badgeLayer=this.acquireViewportLayer("devtools-badges",10030)),this._badgeLayer}get hudLayer(){return this._hudLayer||(this._hudLayer=this.acquireViewportLayer("devtools-hud",10040)),this._hudLayer}entries=new Map;measurements=new Map;enabled=!1;needsMeasure=!1;hasPendingMutate=!1;_rafId=null;_pendingSingleIds=new Set;onOverlayLayoutChangeBind=()=>{this.enabled&&this.scheduleSync()};get _overlayConfig(){return this.constructor.devtool?.overlay}get overlayId(){return this._overlayConfig?.overlayId??null}get overlayBadgeCount(){return 1}get layerName(){return this._overlayConfig?.layerName??""}get layerZIndex(){return this._overlayConfig?.zIndex??10011}get layerAttribute(){return this._overlayConfig?.layerAttribute??""}get defaultEnabled(){return this._overlayConfig?.defaultEnabled??!1}constructor(t){super(t),this.enabled=this.defaultEnabled}onInit(){this.ensureLayer(),this.applyEnabledState(),window.addEventListener(Ur,this.onOverlayLayoutChangeBind)}onObjectConnected(t){this.ensureLayer();let e=this.createOverlayEntry(t);e&&(this.entries.set(t.id,e),this.syncSlotRegistration(),this.scheduleSync())}onObjectDisconnected(t){let e=this.entries.get(t.id);e&&(this.destroyOverlayEntry(e),this.entries.delete(t.id),this.measurements.delete(t.id),this.syncSlotRegistration())}setEnabled(t){this.enabled!==t&&(this.enabled=t,t&&this.measurements.clear(),this.applyEnabledState(),this.onEnabledChange(t),this.scheduleFullSync(),this.emitDevtoolState())}isEnabled(){return this.enabled}getDevtoolActiveState(){return this.enabled}setDevtoolActiveState(t){this.setEnabled(t)}onEnabledChange(t){}onScroll(){this.enabled&&(this.needsMeasure=!0)}onScrollMeasure(){!this.enabled||!this.needsMeasure||(this.collectMeasurements(),this.needsMeasure=!1,this.flushMeasurements(),this.hasPendingMutate=!1)}onMutate(){!this.enabled||!this.hasPendingMutate||(this.flushMeasurements(),this.hasPendingMutate=!1)}onResize(){this.enabled&&this.scheduleSync()}onDOMRebuild(){this.enabled&&this.scheduleSync()}scheduleFullSync(){this.ensureLayer(),this._pendingSingleIds.clear(),this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this.needsMeasure=!0,this.collectMeasurements(),this.needsMeasure=!1,this.flushMeasurements(),this.hasPendingMutate=!1}scheduleSync(){this.enabled&&(this._pendingSingleIds.clear(),this._rafId===null&&(this._rafId=requestAnimationFrame(()=>{this._rafId=null,this.enabled&&(this.ensureLayer(),this.collectMeasurements(),this.flushMeasurements())})))}scheduleSingleSync(t){if(!this.enabled)return;let e=t.object?.id??t.targetId;if(!e){this.scheduleSync();return}this._pendingSingleIds.add(e),this._rafId===null&&(this._rafId=requestAnimationFrame(()=>{if(this._rafId=null,!this.enabled)return;this.ensureLayer();let r=this._pendingSingleIds;this._pendingSingleIds=new Set;let i=[];for(let n of r){let s=this.entries.get(n);if(!s)continue;let o=this.computeBaseMetrics(s),a=this.measureEntry(s,o);this.measurements.set(n,a),i.push(s)}L.run(()=>{for(let n of i){let s=n.object?.id??n.targetId;s&&this.applyMeasurement(n,this.measurements.get(s))}})}))}collectMeasurements(){this.ensureLayer();for(let[t,e]of this.entries){let r=this.computeBaseMetrics(e);this.measurements.set(t,this.measureEntry(e,r))}}flushMeasurements(){L.run(()=>{for(let[t,e]of this.entries)this.applyMeasurement(e,this.measurements.get(t))})}ensureLayer(){let t=this.viewportLayer.ensure(this.getWorldHost());return this.layerAttribute&&t.setAttribute(this.layerAttribute,""),t}applyEnabledState(){let t=this.viewportLayer.getElement();t&&(t.setAttribute("data-enabled",this.enabled?"true":"false"),this.layerAttribute&&(this.enabled?t.setAttribute(this.layerAttribute,""):t.removeAttribute(this.layerAttribute)),this.syncSlotRegistration())}syncSlotRegistration(){if(!this.overlayId)return;this.enabled&&this.entries.size>0?et.register(this.overlayId,this.devtoolConfig?.order??0,this.overlayBadgeCount):et.unregister(this.overlayId),et.emitLayoutChange()}resolveOverlayTargetId(t){return t.htmlElement.id||t.id}resolveOverlayObjectDepth(t){let e=0,r=t.parentElement;for(;r;)(r.hasAttribute("string-id")||r.hasAttribute("data-string-id"))&&(e+=1),r=r.parentElement;return e}createOverlayBadge(t){let e=document.createElement("button");return e.type="button",e.setAttribute("data-stdg-button",""),e.setAttribute("data-stdg-button-icon-16",""),e.setAttribute("data-string-devtools-overlay-badge",""),e.setAttribute("data-target-id",t.targetId),t.selectorAttribute&&e.setAttribute(t.selectorAttribute,""),t.depth!=null&&e.setAttribute("data-depth",String(t.depth)),this.applyOverlayBadgeState(e,{attributes:t.attributes}),e}applyOverlayBadgeState(t,e){if(e.visible!=null&&t.setAttribute("data-visible",e.visible?"true":"false"),e.active!=null&&t.setAttribute("data-active",e.active?"true":"false"),e.disabled!=null&&t instanceof HTMLButtonElement&&(t.disabled=e.disabled),e.title!=null&&(t.title=e.title),e.html!=null){let r=t.querySelector("[data-stdg-badge-label]");t.innerHTML=e.html,r&&t.appendChild(r)}if(e.label!==void 0){let r=t.querySelector("[data-stdg-badge-label]");e.label===null||e.label===""?r?.remove():(r||(r=document.createElement("span"),r.setAttribute("data-stdg-badge-label",""),t.appendChild(r)),r.textContent!==e.label&&(r.textContent=e.label))}if(e.attributes)for(let[r,i]of Object.entries(e.attributes)){if(i==null){t.removeAttribute(r);continue}if(typeof i=="boolean"){t.setAttribute(r,i?"true":"false");continue}t.setAttribute(r,String(i))}}applyOverlayBadgePosition(t,e){if(!e){t.setAttribute("data-visible","false");return}t.setAttribute("data-visible",e.visible?"true":"false"),e.visible&&L.setProps(t,{transform:`translate3d(${Math.round(e.docX)}px, ${Math.round(e.docY)}px, 0)${e.translate?` ${e.translate}`:""}`})}getOverlayTargetLabel(t){let e=t.htmlElement,r=e.getAttribute("id")?.trim();if(r)return`#${r}`;let i=e.getAttribute("class")?.trim();if(i){let s=i.split(/\s+/).filter(Boolean).map(o=>`.${o}`).join("");if(s)return s}let n=e.getAttribute("string-id")?.trim()||e.getAttribute("data-string-id")?.trim();return n||t.id||"<unnamed>"}getViewportAnchorOffset(t,e){return t==="end"?e.viewportPrimarySize:0}getOverlayAnchorAdjustment(t,e,r){return{docX:0,docY:0}}resolveRulerPanelOffset(t,e){if(typeof document>"u")return{x:0,y:0};if(document.body.hasAttribute(na))return{x:0,y:0};let r=this.getViewportScrollLeft(),i=this.getViewportScrollTop(),n=document.querySelector(sa)&&t-r<ta?ra:0,s=document.querySelector(oa)&&e-i<ea?ia:0;return{x:n,y:s}}computeBaseMetrics(t){let e=t.object,r=e.htmlElement;if(!this.enabled||!r||!r.isConnected)return this.getHiddenMetrics();let i=this.resolveOverlayObjectGeometry(e,r),{contentX:n,contentY:s,width:o,height:a}=i;if(o<=0||a<=0)return this.getHiddenMetrics();let d=this.data.viewport.windowHeight||window.innerHeight,c=this.data.viewport.windowWidth||window.innerWidth,u=this.getViewportScrollLeft(),p=this.getViewportScrollTop(),g=n-u,m=s-p,h=m+a<0||m>d||g+o<0||g>c;if(h)return this.getHiddenMetrics();let f=n,b=s,y=0;if(this.overlayId){let A=new Map,I=w=>{if(!this.overlayId)return null;if(!this.entries.get(w.id)||this.measurements.get(w.id)?.visible===!1)return A.set(w.id,null),null;let O=A.get(w.id);if(O!==void 0)return O;let T=w.htmlElement;if(!T)return A.set(w.id,null),null;let P=this.resolveOverlayObjectGeometry(w,T),R=P.contentX,B=P.contentY,W=P.width,N=P.height,z=et.resolveAnchor(this.overlayId,R,B),nt=this.getOverlayAnchorAdjustment(w,z,{contentX:R,contentY:B,width:W,height:N}),yt=this.resolveRulerPanelOffset(R,B),st=z.docX+nt.docX+yt.x,dt=z.docY+nt.docY+yt.y,xt=et.resolveCollisionOffset(T,st,dt,Y=>{let ct=this.objectManager.all.get(Y);if(!ct)return null;let ve=I(ct)?.effective;return ve||{docX:st,docY:this.resolveOverlayObjectGeometry(ct).contentY}}),D={base:{docX:st,docY:dt},effective:{docX:st,docY:dt+xt}};return A.set(w.id,D),D},H=I(e);H&&(f=H.base.docX,b=H.base.docY,y=H.effective.docY-H.base.docY)}let v=this.data.scroll.direction==="horizontal"?"x":"y";return{visible:!0,contentX:n,contentY:s,width:o,height:a,isOffscreen:h,baseAnchorX:f,baseAnchorY:b,collisionOffset:y,axis:v,primarySize:v==="y"?a:o,crossSize:v==="y"?o:a,primaryContentOffset:v==="y"?s:n,viewportPrimarySize:v==="y"?d:c}}getHiddenMetrics(){return{visible:!1,contentX:0,contentY:0,width:0,height:0,isOffscreen:!0,baseAnchorX:0,baseAnchorY:0,collisionOffset:0,axis:this.data.scroll.direction==="horizontal"?"x":"y",primarySize:0,crossSize:0,primaryContentOffset:0,viewportPrimarySize:0}}getObjectDocY(t){let e=t.getProperty("start"),r=t.getProperty("size");return e!=null&&r!=null&&r>0?e:t.getProperty("layout-doc-top")??0}resolveOverlayObjectGeometry(t,e=t.htmlElement){let r=e.getBoundingClientRect(),i=this.resolveLiveElementMetrics(e,r),n=i.width||(t.getProperty("layout-width")??(t.getProperty("half-width")??0)*2)||e.offsetWidth||e.clientWidth||0,s=t.getProperty("size"),o=i.height||(t.getProperty("layout-height")??(t.getProperty("half-height")??0)*2)||e.offsetHeight||e.clientHeight||0;return{contentX:i.docLeft??t.getProperty("layout-doc-left")??0,contentY:i.docTop??this.getObjectDocY(t),width:n,height:s!=null&&s>0?s:o}}getViewportScrollLeft(){return this.data.scroll.elementContainer?.scrollLeft??0}getViewportScrollTop(){return this.data.scroll.elementContainer?.scrollTop??0}resolveLiveElementMetrics(t,e){let r=e.width||t.offsetWidth||t.clientWidth||0,i=e.height||t.offsetHeight||t.clientHeight||0,n=this.getWorldHost(),s=this.data.scroll.elementContainer;if(!(r>0)||!(i>0))return{width:r,height:i};if(n===document.body||n===document.documentElement)return{docLeft:e.left+(s?.scrollLeft??window.scrollX??0),docTop:e.top+(s?.scrollTop??window.scrollY??0),width:r,height:i};let o=n.getBoundingClientRect();return{docLeft:e.left-o.left+n.scrollLeft,docTop:e.top-o.top+n.scrollTop,width:r,height:i}}destroy(){this.overlayId&&et.unregister(this.overlayId),window.removeEventListener(Ur,this.onOverlayLayoutChangeBind);for(let t of this.entries.values())this.destroyOverlayEntry(t);this.entries.clear(),this.measurements.clear(),super.destroy()}};var la=31,ii=class extends zt{get badgeAttribute(){return this.constructor.devtool?.overlay?.badgeAttribute??""}createOverlayEntry(t){let e=this.resolveOverlayTargetId(t),r=this.resolveBadgeDepth(t),i=[],n={object:t,targetId:e,badge:document.createElement("button"),depth:r,extra:void 0,cleanup:i,badges:new Map,groups:new Map},s=this.getBadgeDescriptors(t,e,r),o=this.badgeLayer.getWorldElement(this.getWorldHost());for(let c of s){let u=this.createOverlayBadge({targetId:e,selectorAttribute:c.selectorAttribute,depth:c.depth??r,attributes:{"data-badge-id":c.id,...c.attributes}}),p={id:c.id,descriptor:c,element:u};u.setAttribute("data-visible","false");let g=m=>{m.stopPropagation(),m.preventDefault(),this.onBadgeClick(n,m,p)};if(u.addEventListener("click",g),i.push(()=>u.removeEventListener("click",g)),n.badges.set(c.id,p),c.group){let m=n.groups.get(c.group);m||(m=Rt(e),n.groups.set(c.group,m),o.appendChild(m)),m.appendChild(u)}else o.appendChild(u)}let a=n.badges.values().next().value;if(!a)throw new Error(`${this.constructor.name} must define at least one badge descriptor.`);n.badge=a.element,n.extra=this.createBadgeExtra(t,n.badge,e,r);let d=this.bindBadge(n);return d&&i.push(...d),this.applyBadgeEnabledState(n),this.renderBadge(n),n}destroyOverlayEntry(t){for(let e of t.cleanup)e();this.destroyBadgeExtra(t);for(let e of t.groups.values())e.remove();for(let e of t.badges.values())e.descriptor.group||e.element.remove()}measureEntry(t,e){let r={};if(!e.visible){for(let s of t.badges.values())r[s.id]={visible:!1,docX:0,docY:0};return{visible:!1,badges:r}}let i=new Map,n=new Set;for(let s of t.badges.values()){let o=s.descriptor.slot??"top-left";i.has(o)||i.set(o,[]);let a=i.get(o);if(s.descriptor.group){let d=s.descriptor.group;n.has(d)||(n.add(d),a.push({kind:"group",groupId:d,badges:[]})),a.find(u=>u.kind==="group"&&u.groupId===d)?.badges.push(s)}else a.push({kind:"badge",badge:s})}for(let[s,o]of i)for(let a=0;a<o.length;a+=1){let d=o[a],c=d.kind==="badge"?d.badge:d.badges[0],u=this.resolveBadgeSlotConfig(c.descriptor),p=la+(u.gap??0),g=u.offsetX??0,m=u.offsetY??0,h=this.resolveBadgePosition(e,s,a,p,g,m);if(d.kind==="badge")r[d.badge.id]=h;else for(let f of d.badges)r[f.id]=h}return{visible:!0,badges:r}}applyMeasurement(t,e){let r=new Set;for(let i of t.badges.values()){let n=i.descriptor.group;if(!n||r.has(n))continue;r.add(n);let s=t.groups.get(n);s&&this.applyOverlayBadgePosition(s,e?.badges[i.id])}for(let i of t.badges.values())if(i.descriptor.group){let n=e?.badges[i.id];i.element.setAttribute("data-visible",n?.visible?"true":"false")}else this.applyOverlayBadgePosition(i.element,e?.badges[i.id]);this.afterBadgeMeasurement(t,e)}onEnabledChange(t){for(let e of this.entries.values())this.applyBadgeEnabledState(e),this.renderBadge(e)}createBadgeExtra(t,e,r,i){}destroyBadgeExtra(t){}bindBadge(t){}resolveBadgeDepth(t){return this.resolveOverlayObjectDepth(t.htmlElement)}getBadgeSlotConfig(){return{}}getBadgeDescriptors(t,e,r){return[{id:"primary",slot:"top-left",selectorAttribute:this.badgeAttribute,attributes:this.getInitialBadgeAttributes(t,e,r)}]}getInitialBadgeAttributes(t,e,r){}applyBadgeEnabledState(t){for(let e of t.badges.values())this.applyOverlayBadgeState(e.element,{disabled:!this.enabled,attributes:{"data-module-enabled":this.enabled}});for(let e of t.groups.values())e.setAttribute("data-module-enabled",this.enabled?"true":"false")}renderBadge(t){for(let e of t.badges.values())this.applyOverlayBadgeState(e.element,this.getBadgeState(t,e))}afterBadgeMeasurement(t,e){}resolveBadgeSlotConfig(t){let e=t.slot??"top-left",r=this.getBadgeSlotConfig()[e]??{};return{gap:t.gap??r.gap??0,offsetX:t.offsetX??r.offsetX??0,offsetY:t.offsetY??r.offsetY??0}}resolveBadgePosition(t,e,r,i,n,s){let o=t.baseAnchorX-t.contentX,a=t.baseAnchorY-t.contentY+t.collisionOffset,d=t.contentX+o,c=t.contentX+t.width+o,u=t.contentY+a,p=t.contentY+t.height+a;switch(e){case"top-right":return{visible:!0,docX:c-r*i+n,docY:u+s,translate:"translate(-100%, 0%)"};case"bottom-right":return{visible:!0,docX:c-r*i+n,docY:p+s,translate:"translate(-100%, -100%)"};case"bottom-left":return{visible:!0,docX:d+r*i+n,docY:p+s,translate:"translate(0%, -100%)"};case"top-left":default:return{visible:!0,docX:d+r*i+n,docY:u+s,translate:"translate(0%, 0%)"}}}};var In=`
|
|
1777
1777
|
[data-string-inview-layer] {
|
|
1778
1778
|
|
|
1779
1779
|
}
|
|
@@ -1956,7 +1956,7 @@ ${Bs(i," ")}
|
|
|
1956
1956
|
[data-string-offset-edge-marker="exit"][data-compact="true"][data-flip-y="true"] {
|
|
1957
1957
|
clip-path: polygon(7px 0, 100% 0, 100% 100%, 0 100%);
|
|
1958
1958
|
}
|
|
1959
|
-
`;var bt=1,Rn=4,Hn=4,aa=64,la=16,ni=14;function fe(d,t){return`translate3d(${Math.round(d)}px, ${Math.round(t)}px, 0)`}function Oi(d){return Math.min(100,Math.max(0,d))}function Bn(d,t,e){return Math.min(e,Math.max(t,d))}var da={outlineDocX:0,outlineDocY:0,outlineWidth:0,outlineHeight:0,enterConnectorDocX:0,enterConnectorDocY:0,enterConnectorWidth:0,enterConnectorHeight:0,exitConnectorDocX:0,exitConnectorDocY:0,exitConnectorWidth:0,exitConnectorHeight:0,enterMarkerDocX:0,enterMarkerDocY:0,enterMarkerFlippedY:!1,exitMarkerDocX:0,exitMarkerDocY:0,exitMarkerFlippedY:!1},si=class extends ii{static devtool={id:"inview",label:"Inview",icon:"intersection",order:25,group:2,hotkey:{key:"I",shiftKey:!0},styles:In,overlay:{layerName:"devtools-inview",zIndex:10011,layerAttribute:"data-string-inview-layer",overlayId:"inview",defaultEnabled:!0},connects:{global:!0}};get overlayBadgeCount(){return 2}getDevtoolSubBadges(){return[{id:"hide-all-offsets",icon:"nooffset",label:"Hide all inview offsets",selectorAttribute:"data-string-inview-hide-all-offsets",onClick:()=>this.disableAllOffsets()}]}entryEnabled=new Map;markerSizeCache=new WeakMap;disabledStore=new wt({moduleId:"inview",name:"disabled-targets",default:[],validate:t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):null,legacyKeys:["string-devtools:inview"]});markerStore=new wt({moduleId:"inview",name:"marker-offsets",default:{},validate:t=>{if(!t||typeof t!="object")return null;let e={};for(let[r,i]of Object.entries(t)){if(!i||typeof i!="object")continue;let n={},s=i;s.enter&&typeof s.enter.xPercent=="number"&&(n.enter={xPercent:s.enter.xPercent}),s.exit&&typeof s.exit.xPercent=="number"&&(n.exit={xPercent:s.exit.xPercent}),(n.enter||n.exit)&&(e[r]=n)}return e},legacyKeys:["string-devtools:inview-marker-offsets"]});disabledTargetIds=new Set(this.disabledStore.read());markerOffsets=new Map(Object.entries(this.markerStore.read()));stableCoarseViewportWidth=0;stableCoarseViewportHeight=0;getBadgeDescriptors(t,e,r){return[{id:"inview-toggle",slot:"top-left",group:"main",selectorAttribute:"data-string-inview-toggle"},{id:"offsets",slot:"top-left",group:"main",selectorAttribute:"data-string-offsets-badge",attributes:{"data-string-inview-tool":"offsets"}}]}createBadgeExtra(t,e,r,i){let n=!this.disabledTargetIds.has(r);this.entryEnabled.set(t.id,n);let s=document.createElement("div");s.setAttribute("data-string-offset-outline",""),s.setAttribute("data-target-id",r),s.setAttribute("data-visible","false");let o=document.createElement("div");o.setAttribute("data-string-offset-connector","enter"),o.setAttribute("data-stdg",""),o.setAttribute("data-target-id",r),o.setAttribute("data-visible","false");let a=document.createElement("div");a.setAttribute("data-string-offset-connector","exit"),a.setAttribute("data-stdg",""),a.setAttribute("data-target-id",r),a.setAttribute("data-visible","false");let l=document.createElement("div");l.setAttribute("data-string-offset-edge-marker","enter"),l.setAttribute("data-stdg",""),l.setAttribute("data-target-id",r),l.setAttribute("data-visible","false");let c=document.createElement("span");c.setAttribute("data-string-offset-edge-marker-label",""),l.append(c);let u=document.createElement("div");u.setAttribute("data-string-offset-edge-marker","exit"),u.setAttribute("data-stdg",""),u.setAttribute("data-target-id",r),u.setAttribute("data-visible","false");let p=document.createElement("span");p.setAttribute("data-string-offset-edge-marker-label",""),u.append(p);let g=this.viewportLayer.getWorldElement(this.getWorldHost());g.appendChild(s),g.appendChild(o),g.appendChild(a),g.appendChild(l),g.appendChild(u);let m={outline:s,enterConnector:o,exitConnector:a,enterMarker:l,exitMarker:u,enterMarkerLabel:c,exitMarkerLabel:p};return this.syncCompactModeForExtra(m),m}destroyBadgeExtra(t){t.extra.outline.remove(),t.extra.enterConnector.remove(),t.extra.exitConnector.remove(),t.extra.enterMarker.remove(),t.extra.exitMarker.remove(),this.entryEnabled.delete(t.object.id)}bindBadge(t){let e=()=>{this.renderBadge(t),this.scheduleSingleSync(t)},r=this.bindMarkerDrag(t,"enter",[t.extra.enterMarker,t.extra.enterConnector]),i=this.bindMarkerDrag(t,"exit",[t.extra.exitMarker,t.extra.exitConnector]);return this.events.on(t.object.getScopedEventName("object:inview"),e),[r,i,()=>this.events.off(t.object.getScopedEventName("object:inview"),e)]}measureEntry(t,e){let r=super.measureEntry(t,e).badges,i=t.object,n=this.isEntryEnabled(i.id),s=e.visible?null:this.resolveLiveStickyGeometry(i.htmlElement),o=e.visible||s!=null,a=s?s.contentX:e.visible?e.contentX:i.getProperty("layout-doc-left")??0,l=s?s.contentY:e.visible?e.contentY:this.getObjectDocY(i),c=s?s.width:e.visible?e.width:i.getProperty("layout-width")??(i.getProperty("half-width")??0)*2,u=s?s.height:e.visible?e.height:i.getProperty("layout-height")??(i.getProperty("half-height")??0)*2;if(c<=0||u<=0)return this.hiddenMeasurement(i,r);let p=this.getViewportScrollTop(),g=this.getStableViewportHeight(),m=i.getProperty("enter-vp")??"bottom",h=i.getProperty("exit-vp")??"top",f=i.getProperty("enter-el")??"top",b=i.getProperty("exit-el")??"bottom",y=i.getProperty("inview-start-position"),v=i.getProperty("inview-end-position"),S=f==="bottom"?l+u:l,E=b==="top"?l:l+u,M=ri(m)==="end"?g:0,C=ri(h)==="end"?g:0,A=y!=null?y+M:S,I=v!=null?v+C:E,H=this.measureMarkerSize(t.extra.enterMarker),w=this.measureMarkerSize(t.extra.exitMarker),_=H.width,k=H.height,O=w.width,T=w.height,P=this.getMarkerOffset(t.targetId,"enter"),R=this.getMarkerOffset(t.targetId,"exit"),B=this.clampMarkerPercentInViewport(a,c,P?.xPercent??100,"enter",_),W=this.clampMarkerPercentInViewport(a,c,R?.xPercent??0,"exit",O),N=a+c*(B/100),z=a+c*(W/100),nt=N+bt,yt=Math.min(S,A),st=ni,dt=Math.abs(A-S),xt=z,D=Math.min(E,I),Y=ni,ct=Math.abs(I-E),ve=N+bt,Nn=z,be=this.data.viewport.contentHeight||this.data.viewport.windowHeight||window.innerHeight,Ii=A-k<0,Ri=I<0,Hi=A>be,Bi=I+T>be,zn=Ii||Hi,Gn=Ri||Bi,$n=Hi?be:A+(Ii?k:0),Un=Bi?be-T:I+(Ri?T:0),jn=A-p>=-k&&A-p<=g,Yn=I-p>=-T&&I-p<=g,_i=this.enabled&&n&&(jn||Yn);return!o&&!_i?this.hiddenMeasurement(i,r):{visible:o,badges:r,overlayVisible:this.enabled&&n,badgeVisible:this.enabled,markersVisible:_i,inview:i.getProperty("is-inview")===!0,outlineDocX:a,outlineDocY:l,outlineWidth:c,outlineHeight:u,enterConnectorDocX:nt,enterConnectorDocY:yt,enterConnectorWidth:st,enterConnectorHeight:dt,exitConnectorDocX:xt,exitConnectorDocY:D,exitConnectorWidth:Y,exitConnectorHeight:ct,enterMarkerDocX:ve,enterMarkerDocY:$n,enterMarkerFlippedY:zn,exitMarkerDocX:Nn,exitMarkerDocY:Un,exitMarkerFlippedY:Gn}}afterBadgeMeasurement(t,e){this.syncCompactMode(t);let r=t.object,i=r.getProperty("enter-vp")??"bottom",n=r.getProperty("exit-vp")??"top";this.syncMarkerContent(t,"enter",this.getViewportMarkerLabel(i)),this.syncMarkerContent(t,"exit",this.getViewportMarkerLabel(n));let{outline:s,enterConnector:o,exitConnector:a,enterMarker:l,exitMarker:c}=t.extra,u=!!e?.visible&&!!e.overlayVisible,p=!!e?.markersVisible&&!!e.overlayVisible;s.setAttribute("data-visible",u?"true":"false");let g=e;if(g&&u&&(s.setAttribute("data-inview",g.inview?"true":"false"),L.setProps(s,{transform:fe(g.outlineDocX,g.outlineDocY),width:`${Math.max(0,g.outlineWidth)}px`,height:`${Math.max(0,g.outlineHeight)}px`})),!p){for(let h of[o,a,l,c])h.setAttribute("data-visible","false");return}if(!g)return;let m=g.inview?"true":"false";for(let h of[o,a,l,c])h.setAttribute("data-visible","true"),h.setAttribute("data-inview",m);l.setAttribute("data-flip-y",g.enterMarkerFlippedY?"true":"false"),c.setAttribute("data-flip-y",g.exitMarkerFlippedY?"true":"false"),L.setProps(o,{transform:fe(g.enterConnectorDocX-g.enterConnectorWidth/2,g.enterConnectorDocY),width:`${Math.max(0,g.enterConnectorWidth)}px`,height:`${Math.max(0,g.enterConnectorHeight)}px`}),L.setProps(a,{transform:fe(g.exitConnectorDocX-g.exitConnectorWidth/2,g.exitConnectorDocY),width:`${Math.max(0,g.exitConnectorWidth)}px`,height:`${Math.max(0,g.exitConnectorHeight)}px`}),L.setProps(l,{transform:`${fe(g.enterMarkerDocX,g.enterMarkerDocY)} translate(-100%, -100%)`}),L.setProps(c,{transform:fe(g.exitMarkerDocX,g.exitMarkerDocY)})}onBadgeClick(t,e,r){if(r.id==="inview-toggle"){this.toggleInview(t.object),this.renderBadge(t),this.scheduleSingleSync(t);return}r.id==="offsets"&&(this.setEntryEnabled(t.object.id,!this.isEntryEnabled(t.object.id)),this.renderBadge(t),this.scheduleFullSync())}getBadgeState(t,e){if(e?.id==="offsets"){let i=this.isEntryEnabled(t.object.id);return{active:i,title:i?"Hide offsets for this element":"Show offsets for this element",html:V(16,"offset")}}let r=this.getInviewBadgeState(t.object);return{active:r.active,title:r.title,html:r.html,attributes:{"data-inview":r.inview,"data-blocked":r.blocked}}}hiddenMeasurement(t,e){let r={};for(let[i,n]of Object.entries(e))r[i]={...n,visible:!1};return{visible:!1,badges:r,overlayVisible:this.enabled&&this.isEntryEnabled(t.id),badgeVisible:this.enabled,markersVisible:!1,inview:t.getProperty("is-inview")===!0,...da}}getInviewBadgeState(t){let e=t.getProperty("is-inview")===!0,r=t.isInviewAutoBlocked();return{active:this.isInviewBadgeActive(t),blocked:r,inview:e,title:r?"Enable automatic -inview":"Disable automatic -inview",html:V(16,"eye")}}toggleInview(t){if(this.isInviewBadgeActive(t)){t.setInviewManualActive(!1),t.setInviewAutoBlocked(!0),t.htmlElement.classList.remove("-inview");return}t.setInviewAutoBlocked(!1),t.setInviewManualActive(!0),t.syncInviewClass()}isInviewBadgeActive(t){return t.isInviewAutoBlocked()?!1:t.isInviewManualActive()||t.getProperty("is-inview")===!0?!0:t.getProperty("repeat")===!0?!1:t.htmlElement.classList.contains("-inview")}isEntryEnabled(t){return this.entryEnabled.get(t)!==!1}setEntryEnabled(t,e){this.entryEnabled.set(t,e);let r=this.entries.get(t);if(r){let i=r.targetId;e?this.disabledTargetIds.delete(i):this.disabledTargetIds.add(i),this.disabledStore.write([...this.disabledTargetIds])}this.enabled&&(r?this.scheduleSingleSync(r):this.scheduleSync())}disableAllOffsets(){let t=!1;for(let e of this.entries.values())this.entryEnabled.get(e.object.id)!==!1&&(this.entryEnabled.set(e.object.id,!1),this.disabledTargetIds.add(e.targetId),this.renderBadge(e),t=!0);t&&(this.disabledStore.write([...this.disabledTargetIds]),this.enabled&&this.scheduleSync())}bindMarkerDrag(t,e,r){let i=n=>{n.preventDefault(),n.stopPropagation();let s=t.object.htmlElement;if(!s?.isConnected)return;let o=s.getBoundingClientRect();if(o.width<=0)return;let a=e==="enter"?t.extra.enterMarker.getBoundingClientRect().width:t.extra.exitMarker.getBoundingClientRect().width,l=this.getMarkerOffset(t.targetId,e),c=this.clampMarkerPercentInViewport(o.left+this.getViewportScrollLeft(),o.width,l?.xPercent??(e==="enter"?100:0),e,a),u=o.left+o.width*(c/100),p=n.clientX-u,g=this.badgeLayer.getWorldElement(this.getWorldHost()),m=Array.from(g.querySelectorAll(`[data-stdg-badge][data-target-id="${t.targetId}"]`));for(let h of m)h.setAttribute("data-dragging","");g.setAttribute("data-dragging-active",""),he(n,{onMove:h=>{let f=s.getBoundingClientRect();if(f.width<=0)return;let b=h.clientX-p,y=this.clampMarkerPercentInClientViewport(f,b,e,a);this.setMarkerOffset(t.targetId,e,{xPercent:y}),this.scheduleSingleSync(t)},onEnd:()=>{for(let h of m)h.removeAttribute("data-dragging");g.removeAttribute("data-dragging-active")}})};for(let n of r)n.addEventListener("pointerdown",i);return()=>{for(let n of r)n.removeEventListener("pointerdown",i)}}getMarkerOffset(t,e){return this.markerOffsets.get(t)?.[e]??null}setMarkerOffset(t,e,r){let i=this.markerOffsets.get(t)??{};i[e]=r,this.markerOffsets.set(t,i),this.markerStore.write(Object.fromEntries(this.markerOffsets.entries()))}syncMarkerContent(t,e,r){let i=e==="enter"?t.extra.enterMarker:t.extra.exitMarker,n=e==="enter"?t.extra.enterMarkerLabel:t.extra.exitMarkerLabel,s=this.getOverlayTargetLabel(t.object);n.textContent!==s&&(n.textContent=s),this.setAttributeIfChanged(i,"data-viewport-anchor",r);let o=`${s} -> viewport ${r}`;i.title!==o&&(i.title=o)}getViewportMarkerLabel(t){return ri(t)==="end"?"bottom":"top"}measureMarkerSize(t){let e=t.getBoundingClientRect();if(e.width>0&&e.height>0){let r={width:e.width,height:e.height};return this.markerSizeCache.set(t,r),r}return this.markerSizeCache.get(t)??{width:aa,height:la}}resolveLiveStickyGeometry(t){if(!t?.isConnected||window.getComputedStyle(t).position!=="sticky")return null;let e=t.getBoundingClientRect(),r=this.resolveLiveElementMetrics(t,e),i=r.width,n=r.height;if(i<=0||n<=0)return null;let s=this.data.viewport.windowWidth||window.innerWidth,o=this.data.viewport.windowHeight||window.innerHeight;return!(e.bottom>=0&&e.top<=o&&e.right>=0&&e.left<=s)||r.docLeft==null||r.docTop==null?null:{contentX:r.docLeft,contentY:r.docTop,width:i,height:n}}clampMarkerPercentInViewport(t,e,r,i,n){if(e<=0)return i==="enter"?100:0;let s=t+e*(Oi(r)/100),o=this.getViewportScrollLeft(),a=this.data.viewport.windowWidth||window.innerWidth,l=Rn+Hn,c=o+l,u=o+a-l,p=ni/2,g=i==="enter"?Math.max(c+n-bt,c+p-bt):c+p,m=i==="enter"?u-p-bt:Math.min(u-n,u-p),h=Math.max(t,g),f=Math.min(t+e,m),b=Bn(s,h,Math.max(h,f));return Oi((b-t)/e*100)}clampMarkerPercentInClientViewport(t,e,r,i){if(t.width<=0)return r==="enter"?100:0;let n=this.data.viewport.windowWidth||window.innerWidth,s=Rn+Hn,o=ni/2,a=r==="enter"?Math.max(s+i-bt,s+o-bt):s+o,l=r==="enter"?n-s-o-bt:Math.min(n-s-i,n-s-o),c=Math.max(t.left,a),u=Math.min(t.right,l),p=Bn(e,c,Math.max(c,u));return Oi((p-t.left)/t.width*100)}syncCompactMode(t){this.syncCompactModeForExtra(t.extra)}syncCompactModeForExtra(t){let e=this.data.viewport.windowWidth||window.innerWidth,r=ot(e),i=r.compact?"true":"false",n=r.coarsePointer?"coarse":"fine";for(let s of[t.outline,t.enterConnector,t.exitConnector,t.enterMarker,t.exitMarker])this.setAttributeIfChanged(s,"data-compact",i),this.setAttributeIfChanged(s,"data-pointer",n)}setAttributeIfChanged(t,e,r){t.getAttribute(e)!==r&&t.setAttribute(e,r)}getStableViewportHeight(){let t=this.data.viewport.windowWidth||window.innerWidth,e=this.data.viewport.windowHeight||window.innerHeight;return ot(t).coarsePointer?Math.abs(this.stableCoarseViewportWidth-t)>1?(this.stableCoarseViewportWidth=t,this.stableCoarseViewportHeight=e,e):(this.stableCoarseViewportWidth=t,this.stableCoarseViewportHeight=Math.max(this.stableCoarseViewportHeight,e),this.stableCoarseViewportHeight):(this.stableCoarseViewportWidth=t,this.stableCoarseViewportHeight=e,e)}};function _n(d,t,e={}){let r=i=>{let n=i.target;if(n instanceof Node&&!d.contains(n)){for(let s of e.ignore??[])if(s&&s.contains(n))return;t(i)}};return document.addEventListener("pointerdown",r),()=>document.removeEventListener("pointerdown",r)}var Fn="";function lt(d){if(!Number.isFinite(d)||d<=0)return 0;if(d>=1)return 1;let t=1e-4;return d>1-t?1:d<t?0:d}function Vn(d){let t=lt(d)*100;return`${Math.round(t*10)/10}%`}var oi=class extends zt{static devtool={id:"progress",label:"Progress",icon:"progress",order:35,group:2,hotkey:{key:"P",shiftKey:!0},styles:Fn,overlay:{layerName:"devtools-progress",zIndex:10012,layerAttribute:"data-string-progress-layer",overlayId:"progress"},connects:{keys:["progress"]}};openTargetLabel=null;panelRoot=null;panelTitle=null;panelSlider=null;panelValue=null;panelEasedValue=null;panelPlayForwardButton=null;panelPlayBackwardButton=null;autoplayRaf=null;autoplayDirection=1;autoplayProgress=0;onPanelSliderInputBind=()=>{this.onPanelSliderInput()};unbindOutsideClick=null;constructor(t){super(t),this.attributesToMap=[...this.attributesToMap,{key:"easing",type:"easing",fallback:this.settings.easing}]}onInit(){super.onInit(),this.ensurePanel()}destroy(){this.unbindOutsideClick?.(),this.unbindOutsideClick=null,this.panelSlider?.removeEventListener("input",this.onPanelSliderInputBind),this.stopAutoplay(),this.panelRoot?.remove(),this.panelRoot=null,this.panelTitle=null,this.panelSlider=null,this.panelValue=null,this.panelEasedValue=null,this.panelPlayForwardButton=null,this.panelPlayBackwardButton=null,this.clearAllProgressOverrides(),this.openTargetLabel=null,super.destroy()}createOverlayEntry(t){let e=this.resolveOverlayTargetId(t),r=Rt(e);r.setAttribute("data-string-devtools-overlay-hud","");let i=this.createOverlayBadge({targetId:e,selectorAttribute:"data-string-progress-badge",attributes:{"data-stdg-button-toggle":"","data-active":"false","aria-label":`Open progress controller for ${e}`}});this.applyOverlayBadgeState(i,{html:V(16,"play-r")});let n=s=>{if(s.stopPropagation(),s.preventDefault(),this.openTargetLabel===e){this.closePanel(e);return}this.openPanel(e)};return i.addEventListener("click",n),r.appendChild(i),this.badgeLayer.getWorldElement(this.getWorldHost()).appendChild(r),this.applyEntryEnabledState(r),{object:t,hud:r,badge:i,onBadgeClick:n}}destroyOverlayEntry(t){let e=this.resolveOverlayTargetId(t.object);this.openTargetLabel===e&&(this.clearEntryProgressOverride(t.object),this.closePanel(e)),t.badge.removeEventListener("click",t.onBadgeClick),t.hud.remove()}measureEntry(t,e){let r=t.object,i=this.resolveOverlayTargetId(r),n=this.data.scroll.transformedCurrent,s=r.getProperty("key")||"--progress",{startPosition:o,differencePosition:a}=this.getEntryRange(r),l=r.getProperty("end-position")??o+a,c=this.resolveEntryRawProgress(r,n),u=this.resolveEasedProgress(r,c);return{visible:e.visible,docX:e.visible?e.baseAnchorX:0,docY:e.visible?e.baseAnchorY+e.collisionOffset:0,targetId:i,progress:u,rawProgress:c,startPosition:o,endPosition:l,currentScroll:n,key:s}}applyMeasurement(t,e){let r=this.resolveOverlayTargetId(t.object);if(!e||!e.visible){t.hud.setAttribute("data-visible","false"),this.openTargetLabel===r&&this.renderPanel();return}t.hud.setAttribute("data-visible","true"),L.setProps(t.hud,{transform:`translate3d(${Math.round(e.docX)}px, ${Math.round(e.docY)}px, 0)`}),t.badge.title=`${this.getOverlayTargetLabel(t.object)}: ${Vn(e.progress)}`,this.applyOverlayBadgeState(t.badge,{label:e.progress.toFixed(2)}),this.openTargetLabel===e.targetId&&this.renderPanel()}onEnabledChange(t){for(let e of this.entries.values())this.applyEntryEnabledState(e.hud);t||(this.closeAllPanels(),this.clearAllProgressOverrides()),this.panelRoot&&(this.panelRoot.style.display=t?"":"none")}applyEntryEnabledState(t){t.style.display=this.enabled?"":"none"}openPanel(t){this.ensurePanel(),this.closeAllPanels(),this.openTargetLabel=t;let e=this.findEntryByTargetLabel(t);e&&e.badge.setAttribute("data-active","true"),this.panelRoot&&(this.unbindOutsideClick=_n(this.panelRoot,()=>this.closeAllPanels(),{ignore:this.collectEntryHuds()})),this.renderPanel()}closePanel(t){this.stopAutoplay();let e=this.findEntryByTargetLabel(t);e&&(e.badge.setAttribute("data-active","false"),this.clearEntryProgressOverride(e.object)),this.openTargetLabel===t&&(this.openTargetLabel=null),this.renderPanel()}closeAllPanels(){this.stopAutoplay();for(let t of this.entries.values())t.badge.setAttribute("data-active","false"),this.clearEntryProgressOverride(t.object);this.openTargetLabel=null,this.unbindOutsideClick?.(),this.unbindOutsideClick=null,this.renderPanel()}collectEntryHuds(){let t=[];for(let e of this.entries.values())t.push(e.hud);return t}startAutoplay(t){this.stopAutoplay(),this.autoplayDirection=t,this.autoplayProgress=t===1?0:1;let e=1200,r=null,i=n=>{if(r===null){r=n,this.autoplayRaf=requestAnimationFrame(i);return}let s=(n-r)/e;r=n,this.autoplayProgress+=s*this.autoplayDirection;let o=this.openTargetLabel?this.findEntryByTargetLabel(this.openTargetLabel):null;if(this.autoplayProgress>=1){this.autoplayProgress=1,o&&this.setEntryProgressOverride(o.object,1),this.stopAutoplay();return}if(this.autoplayProgress<=0){this.autoplayProgress=0,o&&this.setEntryProgressOverride(o.object,0),this.stopAutoplay();return}o&&this.setEntryProgressOverride(o.object,this.autoplayProgress),this.autoplayRaf=requestAnimationFrame(i)};this.autoplayRaf=requestAnimationFrame(i),this.syncPlayButtonState()}stopAutoplay(){this.autoplayRaf!==null&&(cancelAnimationFrame(this.autoplayRaf),this.autoplayRaf=null),this.syncPlayButtonState()}syncPlayButtonState(){let t=this.autoplayRaf!==null,e=t&&this.autoplayDirection===1,r=t&&this.autoplayDirection===-1;this.panelPlayForwardButton?.setAttribute("data-active",String(e)),this.panelPlayBackwardButton?.setAttribute("data-active",String(r))}getEntryRange(t){let e=t.getProperty("start-position")??t.getProperty("progress-start-position")??0,r=t.getProperty("difference-position")??t.getProperty("progress-difference-position")??0;return{startPosition:e,differencePosition:r}}resolveEntryRawProgress(t,e){let r=t.getProperty(Lt);if(r!=null)return lt(r);let{startPosition:i,differencePosition:n}=this.getEntryRange(t);return lt(n===0?0:(e-i)/n)}resolveEasedProgress(t,e){let r=t.getProperty("easing");return typeof r=="function"?lt(r(e)):e}setEntryProgressOverride(t,e){t.setProperty(Lt,lt(e)),this.applyObjectProgress(t,e);let r=this.entries.get(t.id);r?this.scheduleSingleSync(r):this.scheduleSync()}clearEntryProgressOverride(t){if(t.getProperty(Lt)==null)return;t.setProperty(Lt,null);let e=this.resolveEntryRawProgress(t,this.data.scroll.transformedCurrent);this.applyObjectProgress(t,e);let r=this.entries.get(t.id);r?this.scheduleSingleSync(r):this.scheduleSync()}clearAllProgressOverrides(){for(let t of this.entries.values())this.clearEntryProgressOverride(t.object)}applyObjectProgress(t,e){let r=lt(e),i=t.getProperty("easing"),n=this.resolveEasedProgress(t,r),s=t.getProperty("key");t.setProperty("progress-raw",r),t.setProperty("progress-value",n),t.setProperty("progress-applied",n);let o=t.getProperty("event-progress-name")??t.getScopedEventName("object:progress");t.setProperty("event-progress-name",o),o&&this.events.emit(o,n),this.tools.styleTxn.run(()=>{s&&this.tools.styleTxn.setVar(t.htmlElement,s,n);for(let a of t.mirrorObjects){let l=a.applyProgress(r,typeof i=="function"?i:void 0);a.setProperty("progress",l),s&&this.tools.styleTxn.setVar(a.htmlElement,s,l)}})}ensurePanel(){if(this.panelRoot)return;let t=document.createElement("div");t.setAttribute("data-string-progress-panel",""),t.setAttribute("data-stdg",""),t.setAttribute("data-stdg-panel",""),t.setAttribute("data-stdg-progress",""),t.setAttribute("data-string-devtools-theme",""),t.setAttribute("data-open","false"),t.setAttribute("data-target-id",""),t.setAttribute("hidden",""),t.addEventListener("pointerdown",r=>r.stopPropagation()),t.innerHTML=`
|
|
1959
|
+
`;var bt=1,Rn=4,Hn=4,da=64,ca=16,ni=14;function fe(l,t){return`translate3d(${Math.round(l)}px, ${Math.round(t)}px, 0)`}function Oi(l){return Math.min(100,Math.max(0,l))}function Bn(l,t,e){return Math.min(e,Math.max(t,l))}var ua={outlineDocX:0,outlineDocY:0,outlineWidth:0,outlineHeight:0,enterConnectorDocX:0,enterConnectorDocY:0,enterConnectorWidth:0,enterConnectorHeight:0,exitConnectorDocX:0,exitConnectorDocY:0,exitConnectorWidth:0,exitConnectorHeight:0,enterMarkerDocX:0,enterMarkerDocY:0,enterMarkerFlippedY:!1,exitMarkerDocX:0,exitMarkerDocY:0,exitMarkerFlippedY:!1},si=class extends ii{static devtool={id:"inview",label:"Inview",icon:"intersection",order:25,group:2,hotkey:{key:"I",shiftKey:!0},styles:In,overlay:{layerName:"devtools-inview",zIndex:10011,layerAttribute:"data-string-inview-layer",overlayId:"inview",defaultEnabled:!0},connects:{global:!0}};get overlayBadgeCount(){return 2}getDevtoolSubBadges(){return[{id:"hide-all-offsets",icon:"nooffset",label:"Hide all inview offsets",selectorAttribute:"data-string-inview-hide-all-offsets",onClick:()=>this.disableAllOffsets()}]}entryEnabled=new Map;markerSizeCache=new WeakMap;disabledStore=new wt({moduleId:"inview",name:"disabled-targets",default:[],validate:t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):null,legacyKeys:["string-devtools:inview"]});markerStore=new wt({moduleId:"inview",name:"marker-offsets",default:{},validate:t=>{if(!t||typeof t!="object")return null;let e={};for(let[r,i]of Object.entries(t)){if(!i||typeof i!="object")continue;let n={},s=i;s.enter&&typeof s.enter.xPercent=="number"&&(n.enter={xPercent:s.enter.xPercent}),s.exit&&typeof s.exit.xPercent=="number"&&(n.exit={xPercent:s.exit.xPercent}),(n.enter||n.exit)&&(e[r]=n)}return e},legacyKeys:["string-devtools:inview-marker-offsets"]});disabledTargetIds=new Set(this.disabledStore.read());markerOffsets=new Map(Object.entries(this.markerStore.read()));stableCoarseViewportWidth=0;stableCoarseViewportHeight=0;getBadgeDescriptors(t,e,r){return[{id:"inview-toggle",slot:"top-left",group:"main",selectorAttribute:"data-string-inview-toggle"},{id:"offsets",slot:"top-left",group:"main",selectorAttribute:"data-string-offsets-badge",attributes:{"data-string-inview-tool":"offsets"}}]}createBadgeExtra(t,e,r,i){let n=!this.disabledTargetIds.has(r);this.entryEnabled.set(t.id,n);let s=document.createElement("div");s.setAttribute("data-string-offset-outline",""),s.setAttribute("data-target-id",r),s.setAttribute("data-visible","false");let o=document.createElement("div");o.setAttribute("data-string-offset-connector","enter"),o.setAttribute("data-stdg",""),o.setAttribute("data-target-id",r),o.setAttribute("data-visible","false");let a=document.createElement("div");a.setAttribute("data-string-offset-connector","exit"),a.setAttribute("data-stdg",""),a.setAttribute("data-target-id",r),a.setAttribute("data-visible","false");let d=document.createElement("div");d.setAttribute("data-string-offset-edge-marker","enter"),d.setAttribute("data-stdg",""),d.setAttribute("data-target-id",r),d.setAttribute("data-visible","false");let c=document.createElement("span");c.setAttribute("data-string-offset-edge-marker-label",""),d.append(c);let u=document.createElement("div");u.setAttribute("data-string-offset-edge-marker","exit"),u.setAttribute("data-stdg",""),u.setAttribute("data-target-id",r),u.setAttribute("data-visible","false");let p=document.createElement("span");p.setAttribute("data-string-offset-edge-marker-label",""),u.append(p);let g=this.viewportLayer.getWorldElement(this.getWorldHost());g.appendChild(s),g.appendChild(o),g.appendChild(a),g.appendChild(d),g.appendChild(u);let m={outline:s,enterConnector:o,exitConnector:a,enterMarker:d,exitMarker:u,enterMarkerLabel:c,exitMarkerLabel:p};return this.syncCompactModeForExtra(m),m}destroyBadgeExtra(t){t.extra.outline.remove(),t.extra.enterConnector.remove(),t.extra.exitConnector.remove(),t.extra.enterMarker.remove(),t.extra.exitMarker.remove(),this.entryEnabled.delete(t.object.id)}bindBadge(t){let e=()=>{this.renderBadge(t),this.scheduleSingleSync(t)},r=this.bindMarkerDrag(t,"enter",[t.extra.enterMarker,t.extra.enterConnector]),i=this.bindMarkerDrag(t,"exit",[t.extra.exitMarker,t.extra.exitConnector]);return this.events.on(t.object.getScopedEventName("object:inview"),e),[r,i,()=>this.events.off(t.object.getScopedEventName("object:inview"),e)]}measureEntry(t,e){let r=super.measureEntry(t,e).badges,i=t.object,n=this.isEntryEnabled(i.id),s=e.visible?null:this.resolveLiveStickyGeometry(i.htmlElement),o=e.visible||s!=null,a=s?s.contentX:e.visible?e.contentX:i.getProperty("layout-doc-left")??0,d=s?s.contentY:e.visible?e.contentY:this.getObjectDocY(i),c=s?s.width:e.visible?e.width:i.getProperty("layout-width")??(i.getProperty("half-width")??0)*2,u=s?s.height:e.visible?e.height:i.getProperty("layout-height")??(i.getProperty("half-height")??0)*2;if(c<=0||u<=0)return this.hiddenMeasurement(i,r);let p=this.getViewportScrollTop(),g=this.getStableViewportHeight(),m=i.getProperty("enter-vp")??"bottom",h=i.getProperty("exit-vp")??"top",f=i.getProperty("enter-el")??"top",b=i.getProperty("exit-el")??"bottom",y=i.getProperty("inview-start-position"),v=i.getProperty("inview-end-position"),S=f==="bottom"?d+u:d,E=b==="top"?d:d+u,M=ri(m)==="end"?g:0,C=ri(h)==="end"?g:0,A=y!=null?y+M:S,I=v!=null?v+C:E,H=this.measureMarkerSize(t.extra.enterMarker),w=this.measureMarkerSize(t.extra.exitMarker),_=H.width,k=H.height,O=w.width,T=w.height,P=this.getMarkerOffset(t.targetId,"enter"),R=this.getMarkerOffset(t.targetId,"exit"),B=this.clampMarkerPercentInViewport(a,c,P?.xPercent??100,"enter",_),W=this.clampMarkerPercentInViewport(a,c,R?.xPercent??0,"exit",O),N=a+c*(B/100),z=a+c*(W/100),nt=N+bt,yt=Math.min(S,A),st=ni,dt=Math.abs(A-S),xt=z,D=Math.min(E,I),Y=ni,ct=Math.abs(I-E),ve=N+bt,Nn=z,be=this.data.viewport.contentHeight||this.data.viewport.windowHeight||window.innerHeight,Ii=A-k<0,Ri=I<0,Hi=A>be,Bi=I+T>be,zn=Ii||Hi,Gn=Ri||Bi,$n=Hi?be:A+(Ii?k:0),Un=Bi?be-T:I+(Ri?T:0),jn=A-p>=-k&&A-p<=g,Yn=I-p>=-T&&I-p<=g,_i=this.enabled&&n&&(jn||Yn);return!o&&!_i?this.hiddenMeasurement(i,r):{visible:o,badges:r,overlayVisible:this.enabled&&n,badgeVisible:this.enabled,markersVisible:_i,inview:i.getProperty("is-inview")===!0,outlineDocX:a,outlineDocY:d,outlineWidth:c,outlineHeight:u,enterConnectorDocX:nt,enterConnectorDocY:yt,enterConnectorWidth:st,enterConnectorHeight:dt,exitConnectorDocX:xt,exitConnectorDocY:D,exitConnectorWidth:Y,exitConnectorHeight:ct,enterMarkerDocX:ve,enterMarkerDocY:$n,enterMarkerFlippedY:zn,exitMarkerDocX:Nn,exitMarkerDocY:Un,exitMarkerFlippedY:Gn}}afterBadgeMeasurement(t,e){this.syncCompactMode(t);let r=t.object,i=r.getProperty("enter-vp")??"bottom",n=r.getProperty("exit-vp")??"top";this.syncMarkerContent(t,"enter",this.getViewportMarkerLabel(i)),this.syncMarkerContent(t,"exit",this.getViewportMarkerLabel(n));let{outline:s,enterConnector:o,exitConnector:a,enterMarker:d,exitMarker:c}=t.extra,u=!!e?.visible&&!!e.overlayVisible,p=!!e?.markersVisible&&!!e.overlayVisible;s.setAttribute("data-visible",u?"true":"false");let g=e;if(g&&u&&(s.setAttribute("data-inview",g.inview?"true":"false"),L.setProps(s,{transform:fe(g.outlineDocX,g.outlineDocY),width:`${Math.max(0,g.outlineWidth)}px`,height:`${Math.max(0,g.outlineHeight)}px`})),!p){for(let h of[o,a,d,c])h.setAttribute("data-visible","false");return}if(!g)return;let m=g.inview?"true":"false";for(let h of[o,a,d,c])h.setAttribute("data-visible","true"),h.setAttribute("data-inview",m);d.setAttribute("data-flip-y",g.enterMarkerFlippedY?"true":"false"),c.setAttribute("data-flip-y",g.exitMarkerFlippedY?"true":"false"),L.setProps(o,{transform:fe(g.enterConnectorDocX-g.enterConnectorWidth/2,g.enterConnectorDocY),width:`${Math.max(0,g.enterConnectorWidth)}px`,height:`${Math.max(0,g.enterConnectorHeight)}px`}),L.setProps(a,{transform:fe(g.exitConnectorDocX-g.exitConnectorWidth/2,g.exitConnectorDocY),width:`${Math.max(0,g.exitConnectorWidth)}px`,height:`${Math.max(0,g.exitConnectorHeight)}px`}),L.setProps(d,{transform:`${fe(g.enterMarkerDocX,g.enterMarkerDocY)} translate(-100%, -100%)`}),L.setProps(c,{transform:fe(g.exitMarkerDocX,g.exitMarkerDocY)})}onBadgeClick(t,e,r){if(r.id==="inview-toggle"){this.toggleInview(t.object),this.renderBadge(t),this.scheduleSingleSync(t);return}r.id==="offsets"&&(this.setEntryEnabled(t.object.id,!this.isEntryEnabled(t.object.id)),this.renderBadge(t),this.scheduleFullSync())}getBadgeState(t,e){if(e?.id==="offsets"){let i=this.isEntryEnabled(t.object.id);return{active:i,title:i?"Hide offsets for this element":"Show offsets for this element",html:V(16,"offset")}}let r=this.getInviewBadgeState(t.object);return{active:r.active,title:r.title,html:r.html,attributes:{"data-inview":r.inview,"data-blocked":r.blocked}}}hiddenMeasurement(t,e){let r={};for(let[i,n]of Object.entries(e))r[i]={...n,visible:!1};return{visible:!1,badges:r,overlayVisible:this.enabled&&this.isEntryEnabled(t.id),badgeVisible:this.enabled,markersVisible:!1,inview:t.getProperty("is-inview")===!0,...ua}}getInviewBadgeState(t){let e=t.getProperty("is-inview")===!0,r=t.isInviewAutoBlocked();return{active:this.isInviewBadgeActive(t),blocked:r,inview:e,title:r?"Enable automatic -inview":"Disable automatic -inview",html:V(16,"eye")}}toggleInview(t){if(this.isInviewBadgeActive(t)){t.setInviewManualActive(!1),t.setInviewAutoBlocked(!0),t.htmlElement.classList.remove("-inview");return}t.setInviewAutoBlocked(!1),t.setInviewManualActive(!0),t.syncInviewClass()}isInviewBadgeActive(t){return t.isInviewAutoBlocked()?!1:t.isInviewManualActive()||t.getProperty("is-inview")===!0?!0:t.getProperty("repeat")===!0?!1:t.htmlElement.classList.contains("-inview")}isEntryEnabled(t){return this.entryEnabled.get(t)!==!1}setEntryEnabled(t,e){this.entryEnabled.set(t,e);let r=this.entries.get(t);if(r){let i=r.targetId;e?this.disabledTargetIds.delete(i):this.disabledTargetIds.add(i),this.disabledStore.write([...this.disabledTargetIds])}this.enabled&&(r?this.scheduleSingleSync(r):this.scheduleSync())}disableAllOffsets(){let t=!1;for(let e of this.entries.values())this.entryEnabled.get(e.object.id)!==!1&&(this.entryEnabled.set(e.object.id,!1),this.disabledTargetIds.add(e.targetId),this.renderBadge(e),t=!0);t&&(this.disabledStore.write([...this.disabledTargetIds]),this.enabled&&this.scheduleSync())}bindMarkerDrag(t,e,r){let i=n=>{n.preventDefault(),n.stopPropagation();let s=t.object.htmlElement;if(!s?.isConnected)return;let o=s.getBoundingClientRect();if(o.width<=0)return;let a=e==="enter"?t.extra.enterMarker.getBoundingClientRect().width:t.extra.exitMarker.getBoundingClientRect().width,d=this.getMarkerOffset(t.targetId,e),c=this.clampMarkerPercentInViewport(o.left+this.getViewportScrollLeft(),o.width,d?.xPercent??(e==="enter"?100:0),e,a),u=o.left+o.width*(c/100),p=n.clientX-u,g=this.badgeLayer.getWorldElement(this.getWorldHost()),m=Array.from(g.querySelectorAll(`[data-stdg-badge][data-target-id="${t.targetId}"]`));for(let h of m)h.setAttribute("data-dragging","");g.setAttribute("data-dragging-active",""),he(n,{onMove:h=>{let f=s.getBoundingClientRect();if(f.width<=0)return;let b=h.clientX-p,y=this.clampMarkerPercentInClientViewport(f,b,e,a);this.setMarkerOffset(t.targetId,e,{xPercent:y}),this.scheduleSingleSync(t)},onEnd:()=>{for(let h of m)h.removeAttribute("data-dragging");g.removeAttribute("data-dragging-active")}})};for(let n of r)n.addEventListener("pointerdown",i);return()=>{for(let n of r)n.removeEventListener("pointerdown",i)}}getMarkerOffset(t,e){return this.markerOffsets.get(t)?.[e]??null}setMarkerOffset(t,e,r){let i=this.markerOffsets.get(t)??{};i[e]=r,this.markerOffsets.set(t,i),this.markerStore.write(Object.fromEntries(this.markerOffsets.entries()))}syncMarkerContent(t,e,r){let i=e==="enter"?t.extra.enterMarker:t.extra.exitMarker,n=e==="enter"?t.extra.enterMarkerLabel:t.extra.exitMarkerLabel,s=this.getOverlayTargetLabel(t.object);n.textContent!==s&&(n.textContent=s),this.setAttributeIfChanged(i,"data-viewport-anchor",r);let o=`${s} -> viewport ${r}`;i.title!==o&&(i.title=o)}getViewportMarkerLabel(t){return ri(t)==="end"?"bottom":"top"}measureMarkerSize(t){let e=t.getBoundingClientRect();if(e.width>0&&e.height>0){let r={width:e.width,height:e.height};return this.markerSizeCache.set(t,r),r}return this.markerSizeCache.get(t)??{width:da,height:ca}}resolveLiveStickyGeometry(t){if(!t?.isConnected||window.getComputedStyle(t).position!=="sticky")return null;let e=t.getBoundingClientRect(),r=this.resolveLiveElementMetrics(t,e),i=r.width,n=r.height;if(i<=0||n<=0)return null;let s=this.data.viewport.windowWidth||window.innerWidth,o=this.data.viewport.windowHeight||window.innerHeight;return!(e.bottom>=0&&e.top<=o&&e.right>=0&&e.left<=s)||r.docLeft==null||r.docTop==null?null:{contentX:r.docLeft,contentY:r.docTop,width:i,height:n}}clampMarkerPercentInViewport(t,e,r,i,n){if(e<=0)return i==="enter"?100:0;let s=t+e*(Oi(r)/100),o=this.getViewportScrollLeft(),a=this.data.viewport.windowWidth||window.innerWidth,d=Rn+Hn,c=o+d,u=o+a-d,p=ni/2,g=i==="enter"?Math.max(c+n-bt,c+p-bt):c+p,m=i==="enter"?u-p-bt:Math.min(u-n,u-p),h=Math.max(t,g),f=Math.min(t+e,m),b=Bn(s,h,Math.max(h,f));return Oi((b-t)/e*100)}clampMarkerPercentInClientViewport(t,e,r,i){if(t.width<=0)return r==="enter"?100:0;let n=this.data.viewport.windowWidth||window.innerWidth,s=Rn+Hn,o=ni/2,a=r==="enter"?Math.max(s+i-bt,s+o-bt):s+o,d=r==="enter"?n-s-o-bt:Math.min(n-s-i,n-s-o),c=Math.max(t.left,a),u=Math.min(t.right,d),p=Bn(e,c,Math.max(c,u));return Oi((p-t.left)/t.width*100)}syncCompactMode(t){this.syncCompactModeForExtra(t.extra)}syncCompactModeForExtra(t){let e=this.data.viewport.windowWidth||window.innerWidth,r=ot(e),i=r.compact?"true":"false",n=r.coarsePointer?"coarse":"fine";for(let s of[t.outline,t.enterConnector,t.exitConnector,t.enterMarker,t.exitMarker])this.setAttributeIfChanged(s,"data-compact",i),this.setAttributeIfChanged(s,"data-pointer",n)}setAttributeIfChanged(t,e,r){t.getAttribute(e)!==r&&t.setAttribute(e,r)}getStableViewportHeight(){let t=this.data.viewport.windowWidth||window.innerWidth,e=this.data.viewport.windowHeight||window.innerHeight;return ot(t).coarsePointer?Math.abs(this.stableCoarseViewportWidth-t)>1?(this.stableCoarseViewportWidth=t,this.stableCoarseViewportHeight=e,e):(this.stableCoarseViewportWidth=t,this.stableCoarseViewportHeight=Math.max(this.stableCoarseViewportHeight,e),this.stableCoarseViewportHeight):(this.stableCoarseViewportWidth=t,this.stableCoarseViewportHeight=e,e)}};function _n(l,t,e={}){let r=i=>{let n=i.target;if(n instanceof Node&&!l.contains(n)){for(let s of e.ignore??[])if(s&&s.contains(n))return;t(i)}};return document.addEventListener("pointerdown",r),()=>document.removeEventListener("pointerdown",r)}var Fn="";function lt(l){if(!Number.isFinite(l)||l<=0)return 0;if(l>=1)return 1;let t=1e-4;return l>1-t?1:l<t?0:l}function Vn(l){let t=lt(l)*100;return`${Math.round(t*10)/10}%`}var oi=class extends zt{static devtool={id:"progress",label:"Progress",icon:"progress",order:35,group:2,hotkey:{key:"P",shiftKey:!0},styles:Fn,overlay:{layerName:"devtools-progress",zIndex:10012,layerAttribute:"data-string-progress-layer",overlayId:"progress"},connects:{keys:["progress"]}};openTargetLabel=null;panelRoot=null;panelTitle=null;panelSlider=null;panelValue=null;panelEasedValue=null;panelPlayForwardButton=null;panelPlayBackwardButton=null;autoplayRaf=null;autoplayDirection=1;autoplayProgress=0;onPanelSliderInputBind=()=>{this.onPanelSliderInput()};unbindOutsideClick=null;constructor(t){super(t),this.attributesToMap=[...this.attributesToMap,{key:"easing",type:"easing",fallback:this.settings.easing}]}onInit(){super.onInit(),this.ensurePanel()}destroy(){this.unbindOutsideClick?.(),this.unbindOutsideClick=null,this.panelSlider?.removeEventListener("input",this.onPanelSliderInputBind),this.stopAutoplay(),this.panelRoot?.remove(),this.panelRoot=null,this.panelTitle=null,this.panelSlider=null,this.panelValue=null,this.panelEasedValue=null,this.panelPlayForwardButton=null,this.panelPlayBackwardButton=null,this.clearAllProgressOverrides(),this.openTargetLabel=null,super.destroy()}createOverlayEntry(t){let e=this.resolveOverlayTargetId(t),r=Rt(e);r.setAttribute("data-string-devtools-overlay-hud","");let i=this.createOverlayBadge({targetId:e,selectorAttribute:"data-string-progress-badge",attributes:{"data-stdg-button-toggle":"","data-active":"false","aria-label":`Open progress controller for ${e}`}});this.applyOverlayBadgeState(i,{html:V(16,"play-r")});let n=s=>{if(s.stopPropagation(),s.preventDefault(),this.openTargetLabel===e){this.closePanel(e);return}this.openPanel(e)};return i.addEventListener("click",n),r.appendChild(i),this.badgeLayer.getWorldElement(this.getWorldHost()).appendChild(r),this.applyEntryEnabledState(r),{object:t,hud:r,badge:i,onBadgeClick:n}}destroyOverlayEntry(t){let e=this.resolveOverlayTargetId(t.object);this.openTargetLabel===e&&(this.clearEntryProgressOverride(t.object),this.closePanel(e)),t.badge.removeEventListener("click",t.onBadgeClick),t.hud.remove()}measureEntry(t,e){let r=t.object,i=this.resolveOverlayTargetId(r),n=this.data.scroll.transformedCurrent,s=r.getProperty("key")||"--progress",{startPosition:o,differencePosition:a}=this.getEntryRange(r),d=r.getProperty("end-position")??o+a,c=this.resolveEntryRawProgress(r,n),u=this.resolveEasedProgress(r,c);return{visible:e.visible,docX:e.visible?e.baseAnchorX:0,docY:e.visible?e.baseAnchorY+e.collisionOffset:0,targetId:i,progress:u,rawProgress:c,startPosition:o,endPosition:d,currentScroll:n,key:s}}applyMeasurement(t,e){let r=this.resolveOverlayTargetId(t.object);if(!e||!e.visible){t.hud.setAttribute("data-visible","false"),this.openTargetLabel===r&&this.renderPanel();return}t.hud.setAttribute("data-visible","true"),L.setProps(t.hud,{transform:`translate3d(${Math.round(e.docX)}px, ${Math.round(e.docY)}px, 0)`}),t.badge.title=`${this.getOverlayTargetLabel(t.object)}: ${Vn(e.progress)}`,this.applyOverlayBadgeState(t.badge,{label:e.progress.toFixed(2)}),this.openTargetLabel===e.targetId&&this.renderPanel()}onEnabledChange(t){for(let e of this.entries.values())this.applyEntryEnabledState(e.hud);t||(this.closeAllPanels(),this.clearAllProgressOverrides()),this.panelRoot&&(this.panelRoot.style.display=t?"":"none")}applyEntryEnabledState(t){t.style.display=this.enabled?"":"none"}openPanel(t){this.ensurePanel(),this.closeAllPanels(),this.openTargetLabel=t;let e=this.findEntryByTargetLabel(t);e&&e.badge.setAttribute("data-active","true"),this.panelRoot&&(this.unbindOutsideClick=_n(this.panelRoot,()=>this.closeAllPanels(),{ignore:this.collectEntryHuds()})),this.renderPanel()}closePanel(t){this.stopAutoplay();let e=this.findEntryByTargetLabel(t);e&&(e.badge.setAttribute("data-active","false"),this.clearEntryProgressOverride(e.object)),this.openTargetLabel===t&&(this.openTargetLabel=null),this.renderPanel()}closeAllPanels(){this.stopAutoplay();for(let t of this.entries.values())t.badge.setAttribute("data-active","false"),this.clearEntryProgressOverride(t.object);this.openTargetLabel=null,this.unbindOutsideClick?.(),this.unbindOutsideClick=null,this.renderPanel()}collectEntryHuds(){let t=[];for(let e of this.entries.values())t.push(e.hud);return t}startAutoplay(t){this.stopAutoplay(),this.autoplayDirection=t,this.autoplayProgress=t===1?0:1;let e=1200,r=null,i=n=>{if(r===null){r=n,this.autoplayRaf=requestAnimationFrame(i);return}let s=(n-r)/e;r=n,this.autoplayProgress+=s*this.autoplayDirection;let o=this.openTargetLabel?this.findEntryByTargetLabel(this.openTargetLabel):null;if(this.autoplayProgress>=1){this.autoplayProgress=1,o&&this.setEntryProgressOverride(o.object,1),this.stopAutoplay();return}if(this.autoplayProgress<=0){this.autoplayProgress=0,o&&this.setEntryProgressOverride(o.object,0),this.stopAutoplay();return}o&&this.setEntryProgressOverride(o.object,this.autoplayProgress),this.autoplayRaf=requestAnimationFrame(i)};this.autoplayRaf=requestAnimationFrame(i),this.syncPlayButtonState()}stopAutoplay(){this.autoplayRaf!==null&&(cancelAnimationFrame(this.autoplayRaf),this.autoplayRaf=null),this.syncPlayButtonState()}syncPlayButtonState(){let t=this.autoplayRaf!==null,e=t&&this.autoplayDirection===1,r=t&&this.autoplayDirection===-1;this.panelPlayForwardButton?.setAttribute("data-active",String(e)),this.panelPlayBackwardButton?.setAttribute("data-active",String(r))}getEntryRange(t){let e=t.getProperty("start-position")??t.getProperty("progress-start-position")??0,r=t.getProperty("difference-position")??t.getProperty("progress-difference-position")??0;return{startPosition:e,differencePosition:r}}resolveEntryRawProgress(t,e){let r=t.getProperty(Lt);if(r!=null)return lt(r);let{startPosition:i,differencePosition:n}=this.getEntryRange(t);return lt(n===0?0:(e-i)/n)}resolveEasedProgress(t,e){let r=t.getProperty("easing");return typeof r=="function"?lt(r(e)):e}setEntryProgressOverride(t,e){t.setProperty(Lt,lt(e)),this.applyObjectProgress(t,e);let r=this.entries.get(t.id);r?this.scheduleSingleSync(r):this.scheduleSync()}clearEntryProgressOverride(t){if(t.getProperty(Lt)==null)return;t.setProperty(Lt,null);let e=this.resolveEntryRawProgress(t,this.data.scroll.transformedCurrent);this.applyObjectProgress(t,e);let r=this.entries.get(t.id);r?this.scheduleSingleSync(r):this.scheduleSync()}clearAllProgressOverrides(){for(let t of this.entries.values())this.clearEntryProgressOverride(t.object)}applyObjectProgress(t,e){let r=lt(e),i=t.getProperty("easing"),n=this.resolveEasedProgress(t,r),s=t.getProperty("key");t.setProperty("progress-raw",r),t.setProperty("progress-value",n),t.setProperty("progress-applied",n);let o=t.getProperty("event-progress-name")??t.getScopedEventName("object:progress");t.setProperty("event-progress-name",o),o&&this.events.emit(o,n),this.tools.styleTxn.run(()=>{s&&this.tools.styleTxn.setVar(t.htmlElement,s,n);for(let a of t.mirrorObjects){let d=a.applyProgress(r,typeof i=="function"?i:void 0);a.setProperty("progress",d),s&&this.tools.styleTxn.setVar(a.htmlElement,s,d)}})}ensurePanel(){if(this.panelRoot)return;let t=document.createElement("div");t.setAttribute("data-string-progress-panel",""),t.setAttribute("data-stdg",""),t.setAttribute("data-stdg-panel",""),t.setAttribute("data-stdg-progress",""),t.setAttribute("data-string-devtools-theme",""),t.setAttribute("data-open","false"),t.setAttribute("data-target-id",""),t.setAttribute("hidden",""),t.addEventListener("pointerdown",r=>r.stopPropagation()),t.innerHTML=`
|
|
1960
1960
|
<div data-stdg-panel-header>
|
|
1961
1961
|
<span data-string-progress-dock-title>Element ID</span>
|
|
1962
1962
|
<nav data-stdg-button-left data-string-progress-dock-play-group>
|
|
@@ -2040,5 +2040,5 @@ ${Bs(i," ")}
|
|
|
2040
2040
|
</div>
|
|
2041
2041
|
<span data-field="eased" hidden>0%</span>
|
|
2042
2042
|
</div>
|
|
2043
|
-
`,this.panelRoot=t,this.panelTitle=t.querySelector("[data-string-progress-dock-title]"),this.panelSlider=t.querySelector("[data-string-progress-slider]"),this.panelValue=t.querySelector("[data-string-progress-value-number]"),this.panelEasedValue=t.querySelector('[data-field="eased"]'),this.panelPlayForwardButton=t.querySelector("[data-string-progress-dock-play-forward]"),this.panelPlayForwardButton.addEventListener("click",r=>{r.stopPropagation(),this.autoplayRaf!==null&&this.autoplayDirection===1?this.stopAutoplay():this.startAutoplay(1)}),this.panelPlayBackwardButton=t.querySelector("[data-string-progress-dock-play-backward]"),this.panelPlayBackwardButton.addEventListener("click",r=>{r.stopPropagation(),this.autoplayRaf!==null&&this.autoplayDirection===-1?this.stopAutoplay():this.startAutoplay(-1)}),t.querySelector("[data-string-progress-dock-close]").addEventListener("click",r=>{r.stopPropagation(),this.openTargetLabel&&this.closePanel(this.openTargetLabel)}),this.panelSlider.addEventListener("input",this.onPanelSliderInputBind),this.panelValue.addEventListener("input",()=>{if(!this.openTargetLabel||!this.panelValue)return;let r=this.findEntryByTargetLabel(this.openTargetLabel);if(!r)return;let i=Math.max(0,Math.min(100,Number(this.panelValue.value)));if(!Number.isFinite(i))return;this.stopAutoplay();let n=i/100;this.autoplayProgress=n,this.setEntryProgressOverride(r.object,n)}),this.panelValue.addEventListener("keydown",r=>{r.key==="Enter"&&r.target.blur()}),this.hudLayer.getWorldElement(this.getWorldHost()).appendChild(t)}onPanelSliderInput(){if(!this.openTargetLabel||!this.panelSlider)return;let t=this.findEntryByTargetLabel(this.openTargetLabel);if(!t)return;this.stopAutoplay();let e=lt(Number(this.panelSlider.value)/1e3);this.autoplayProgress=e,this.setEntryProgressOverride(t.object,e)}renderPanel(){if(!this.panelRoot||!this.panelTitle||!this.panelSlider||!this.panelValue||!this.panelEasedValue)return;let t=this.openTargetLabel?this.findEntryByTargetLabel(this.openTargetLabel):null;if(!this.enabled||!t){this.panelRoot.setAttribute("hidden",""),this.panelRoot.setAttribute("data-open","false"),this.panelRoot.setAttribute("data-target-id","");return}let e=this.resolveOverlayTargetId(t.object),r=this.getOverlayTargetLabel(t.object),i=this.measurements.get(t.object.id),n=i?lt(i.progress):0,s=i?lt(i.rawProgress):0;this.panelRoot.removeAttribute("hidden"),this.panelRoot.setAttribute("data-open","true"),this.panelRoot.setAttribute("data-target-id",e),this.panelTitle.textContent=r,this.panelSlider.setAttribute("aria-label",`Preview progress for ${r}`),L.setVarDirect(this.panelSlider,"--string-progress-slider-fill",`${Math.round(s*1e3)/10}%`);let o=String(Math.round(s*1e3));this.panelSlider.value!==o&&(this.panelSlider.value=o);let a=String(Math.round(n*100));document.activeElement!==this.panelValue&&(this.panelValue.value=a),this.panelEasedValue.textContent=Vn(n)}findEntryByTargetLabel(t){for(let e of this.entries.values())if(this.resolveOverlayTargetId(e.object)===t)return e;return null}};function Wn(d){return typeof d=="object"&&d!==null&&"getDevtoolDefinition"in d&&typeof d.getDevtoolDefinition=="function"}function ca(){return"ontouchstart"in window||navigator.maxTouchPoints>0}var Di=class d{static DEVTOOLS_ACCESS_URL="https://access.fiddle.digital/";static DEVTOOLS_LOG_PREFIX="[StringTune Devtools]";static DEVTOOLS_ARTIFACT_SELECTORS=["[data-string-dev-viewport-layer]","[data-string-dev-viewport-world]","[data-stdg-dock]","[data-stdg-dock-sub-badges]"];onScrollStartBind;onScrollStopBind;onDirectionChangeBind;onScrollConfigChangeBind;onWheelBind;onScrollBind;onResizeBind;onMouseMoveBind;onScrollToBind;onDOMChangedBind;onContainerTransitionEndBind;onResizeObserverBind;pendingScroll=!1;lastScrollEmitted=NaN;observerContainerMutation=null;pendingResizeRaf=null;pendingResizeForce=!1;pendingRebuildRaf=null;activeScrollIntent=null;static i;root;window;prevWidth=0;prevHeight=0;moduleManager;scrollManager;objectManager;eventManager;signalHub;cursorController;tools;loop=new pr;data;context;centers;hoverManager;devtools;devtoolsFpsLastSampleTime=0;devtoolsFpsFrameCount=0;observerContainerResize=null;devtoolsAccessToken="";devtoolsAccessState="unknown";devtoolsAccessRequestId=0;pendingDevtoolUses=[];hasStarted=!1;devtoolsAccessLastMessage="none";canRebuild=!0;set scrollPosition(t){this.data.scroll.current=t,this.data.scroll.target=t,this.data.scroll.transformedCurrent=this.data.scroll.current*this.data.viewport.transformScale,this.data.scroll.delta=0,this.data.scroll.lerped=0,this.scrollManager.updatePosition(),this.moduleManager.onScroll(),this.objectManager.checkInview()}set accessDevtoolToken(t){let e=t.trim();if(!(e===this.devtoolsAccessToken&&(this.devtoolsAccessState==="granted"||this.devtoolsAccessState==="pending"))){if(this.devtoolsAccessToken=e,e.length===0){this.devtoolsAccessState="unknown";return}this.validateDevtoolsAccess(e)}}set scrollContainer(t){this.observerContainerResize?.unobserve(this.context.data.scroll.container),this.data.scroll.elementContainer.removeEventListener("transitionend",this.onContainerTransitionEndBind),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.data.scroll.elementContainer.addEventListener("transitionend",this.onContainerTransitionEndBind),this.observerContainerResize?.observe(this.context.data.scroll.container),this.observeContainerMutations(),this.queueResize(!0,"scrollContainer")}get scrollPosition(){return this.data.scroll.current}get scrollHeight(){return this.data.viewport.contentHeight}get containerHeight(){return this.data.viewport.windowHeight}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)}set FPSTrackerVisible(t){this.data.system.fpsTracker=t,this.eventManager.emit("tracker:fps:visible",t)}set PositionTrackerVisible(t){this.data.system.positionTracker=t,this.eventManager.emit("tracker:position:visible",t)}set domBatcherEnabled(t){this.objectManager.setDOMBatcherEnabled(t)}set intersectionObserverEnabled(t){this.objectManager.setIntersectionObserverEnabled(t)}debouncedResize=vi(t=>{this.queueResize(!1,t)},30);debouncedRebuild=vi(()=>{this.queueRebuild()},30);constructor(){this.cleanupExistingDevtoolsArtifacts(),this.root=document.body,this.window=window,this.tools=new Be,this.data=new Gt,this.eventManager=new Ct,this.signalHub=new br((t,e)=>this.eventManager.emit(t,e)),this.moduleManager=new Se(this.data),this.objectManager=new Me(this.data,this.moduleManager,this.eventManager,this.tools),this.centers=new fr,this.hoverManager=new vr,this.devtools=new Lr,this.context={events:this.eventManager,data:this.data,tools:this.tools,settings:{},centers:this.centers,hover:this.hoverManager,objectManager:this.objectManager,signals:this.signalHub},this.cursorController=new ye(1,this.context),this.scrollManager=new Te(this.context),this.setupSettings({"global-class":!1,"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","cursor-lerp":"0.75",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,"position-strength":3,"position-tension":.05,"position-friction":.15,"position-max-velocity":10,"position-update-threshold":.1,"rotation-strength":.75,"rotation-tension":.06,"rotation-friction":.18,"rotation-max-angular-velocity":6,"rotation-max-angle":18,"rotation-update-threshold":.15,"max-offset":220,"sleep-epsilon":.01,"continuous-push":!0}),this.onContainerTransitionEndBind=this.onContainerTransitionEnd.bind(this),this.onResizeObserverBind=this.onResizeObserverEvent.bind(this),this.observerContainerResize=new ResizeObserver(this.onResizeObserverBind),this.observerContainerResize.observe(this.context.data.scroll.container),this.onWheelBind=this.onWheelEvent.bind(this),this.onScrollBind=this.onScrollEvent.bind(this),this.onResizeBind=()=>{this.queueResize(!1,"resizeBind")},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.onScrollConfigChangeBind=this.onScrollConfigChange.bind(this),this.onScrollToBind=this.scrollTo.bind(this),this.onDOMChangedBind=this.onDOMChanged.bind(this),this.eventManager.on("wheel",this.onWheelBind),this.eventManager.on("resize",this.onResizeBind),this.eventManager.on("scrollTo",this.onScrollToBind),this.eventManager.on("dom:changed",this.onDOMChangedBind),this.scrollManager.bindEvents({onScrollStart:this.onScrollStartBind,onScrollStop:this.onScrollStopBind,onDirectionChange:this.onDirectionChangeBind,onModeChange:this.onScrollConfigChangeBind}),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.updateDevtoolsFPS(t)}),this.on("image:load:all",()=>{this.onRebuild()}),this.scrollContainer=window}static getInstance(){return d.i||(d.i=new d),d.i}reuse(t){return this.moduleManager.find(t)}use(t,e=null){this.moduleManager.find(t)||this.shouldDeferDevtoolModule(t,e)||this.instantiateModule(t,e)}cleanupExistingDevtoolsArtifacts(){for(let t of d.DEVTOOLS_ARTIFACT_SELECTORS)document.querySelectorAll(t).forEach(e=>e.remove())}instantiateModule(t,e=null){let r={...this.context.settings,...e},i=new t({events:this.eventManager,data:this.data,tools:this.tools,settings:r,centers:this.centers,hover:this.hoverManager,objectManager:this.objectManager,signals:this.signalHub});this.moduleManager.register(i),Wn(i)&&this.devtools.register(i.getDevtoolDefinition()),this.hasStarted&&(this.objectManager.attachModule(i),i.onInit(),i.onResize(),i.onScroll(this.data),i.onFrame(this.data))}shouldDeferDevtoolModule(t,e){return!(t===Z||t.prototype instanceof Z)||this.devtoolsAccessState==="granted"?!1:(this.pendingDevtoolUses.push({objectClass:t,settings:e}),this.devtoolsAccessToken.length>0&&this.devtoolsAccessState!=="pending"&&this.validateDevtoolsAccess(this.devtoolsAccessToken),!0)}async validateDevtoolsAccess(t){let e=++this.devtoolsAccessRequestId;this.devtoolsAccessState="pending";try{let r=await fetch(`${d.DEVTOOLS_ACCESS_URL}?token=${encodeURIComponent(t)}`),i=await this.resolveDevtoolsAccessResponse(r);if(e!==this.devtoolsAccessRequestId||t!==this.devtoolsAccessToken)return;if(this.devtoolsAccessState=i?"granted":"denied",!i){this.logDevtoolsAccess("denied"),this.pendingDevtoolUses=[];return}this.logDevtoolsAccess("granted");let n=[...this.pendingDevtoolUses];this.pendingDevtoolUses=[],n.forEach(({objectClass:s,settings:o})=>{this.instantiateModule(s,o)})}catch{if(e!==this.devtoolsAccessRequestId||t!==this.devtoolsAccessToken||this.devtoolsAccessState==="granted")return;this.devtoolsAccessState="denied",this.logDevtoolsAccess("error"),this.pendingDevtoolUses=[]}}logDevtoolsAccess(t){if(this.devtoolsAccessLastMessage!==t){if(this.devtoolsAccessLastMessage=t,t==="granted"){console.info(`${d.DEVTOOLS_LOG_PREFIX} Access granted. Devtools modules are enabled.`);return}if(t==="denied"){console.warn(`${d.DEVTOOLS_LOG_PREFIX} Access denied. Devtools modules were not enabled. Check accessDevtoolToken.`);return}console.warn(`${d.DEVTOOLS_LOG_PREFIX} Access check failed. Devtools modules were not enabled.`)}}async resolveDevtoolsAccessResponse(t){if(!t.ok)return!1;if((t.headers.get("content-type")?.toLowerCase()??"").includes("application/json")){let i=await t.json();return typeof i=="boolean"?i:i&&typeof i=="object"&&"allowed"in i?i.allowed===!0:!1}return(await t.text()).trim().toLowerCase()==="true"}registerScrollMode(t,e){let r;if(typeof e=="function"&&e.prototype instanceof J){let i=e;r=new i(this.context)}else r=e(this.context);r.name||(r.name=t),this.scrollManager.registerMode(t,r)}on(t,e,r=""){this.eventManager.on(t,e,r)}emit(t,e){this.eventManager.emit(t,e)}off(t,e,r=""){this.eventManager.off(t,e,r)}addScrollMark(t){this.scrollManager.addScrollMark(t)}removeScrollMark(t){this.scrollManager.removeScrollMark(t)}start(t){if(this.hasStarted)return;this.hasStarted=!0,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),this.observeContainerMutations(),this.use(Ye);let e=window.getComputedStyle(document.documentElement).fontSize,r=parseFloat(e);this.context.data.viewport.baseRem=r,document.documentElement.classList.add("-string"),this.syncDebugScrollState(),this.moduleManager.onInit(),this.onResize(!1,"start"),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.linkMirror(e,t)}),this.moduleManager.onResize(),this.moduleManager.onScroll(),this.moduleManager.onFrame()}setupSettings(t){this.context.settings={...this.context.settings,...t},typeof t.storageToken=="string"?Li(t.storageToken):typeof t["storage-token"]=="string"&&Li(t["storage-token"]),typeof t.accessDevtoolToken=="string"&&(this.accessDevtoolToken=t.accessDevtoolToken),this.onSettingsChange({isDesktop:this.data.viewport.windowWidth>1024,widthChanged:!0,heightChanged:!0,scrollHeightChanged:!0,isForceRebuild:!1})}onResizeObserverEvent(){this.debouncedResize("resizeObserver")}onContainerTransitionEnd(t){t.target===this.context.data.scroll.container&&this.queueResize(!0,"containerTransition")}onDOMChanged(){this.debouncedRebuild()}observeContainerMutations(){this.observerContainerMutation?.disconnect();let t=this.context.data.scroll.container;t&&(this.observerContainerMutation=new MutationObserver(e=>{for(let r=0;r<e.length;r++){let i=e[r];if(i.type==="attributes"&&(i.attributeName==="style"||i.attributeName==="class")){this.debouncedResize("containerMutation");break}}}),this.observerContainerMutation.observe(t,{attributes:!0,attributeFilter:["style","class"]}))}queueResize(t=!1,e=""){t&&(this.pendingResizeForce=!0),this.pendingResizeRaf==null&&(this.pendingResizeRaf=requestAnimationFrame(()=>{this.pendingResizeRaf=null;let r=this.pendingResizeForce;this.pendingResizeForce=!1,this.onResize(r,e)}))}queueRebuild(){this.pendingRebuildRaf==null&&(this.pendingRebuildRaf=requestAnimationFrame(()=>{this.pendingRebuildRaf=null,this.onRebuild()}))}onRebuild(){let t=this.context.data.scroll,e=t.container.scrollHeight;this.context.data.viewport.contentHeight!==e&&(this.context.data.viewport.contentHeight=e,t.bottomPosition=e-this.context.data.viewport.windowHeight,this.moduleManager.onRebuild())}onMouseMoveEvent(t){this.cursorController.onMouseMove(t),this.moduleManager.onMouseMove(t),U.measure(()=>{this.moduleManager.onMouseMoveMeasure()})}onWheelEvent(t){t.target.closest("[string-isolation],[data-string-isolation]")==null&&(this.clearActiveScrollIntent("wheel"),this.scrollManager.get().onWheel(t),this.moduleManager.onWheel(t))}onScrollStart(){this.moduleManager.onScrollStart(),this.eventManager.emit("scroll:start",null)}onScrollStop(){this.clearActiveScrollIntent("scroll-stop"),this.moduleManager.onScrollStop(),this.eventManager.emit("scroll:stop",null)}onDirectionChange(){this.moduleManager.onDirectionChange()}onScrollConfigChange(){this.moduleManager.onScrollConfigChange(),this.syncDebugScrollState(),this.moduleManager.onScroll(),this.moduleManager.onScrollMeasure(),this.moduleManager.onFrame(),L.run(()=>{this.moduleManager.onMutate()})}syncDebugScrollState(){let t=document.documentElement,e=window.innerWidth<1024;t.setAttribute("data-string-scroll-mode",String(this.data.scroll.mode)),t.setAttribute("data-string-scroll-device",e?"mobile":"desktop")}onSettingsChange(t){this.cursorController.onSettingsChange(t),this.objectManager.onSettingsChange(t),this.moduleManager.onSettingsChange(t)}onScrollEvent(t){return t.preventDefault(),this.context.centers.invalidateAll(),this.scrollManager.get().onScroll(t),this.data.scroll.mode!=="smooth"&&this.clearActiveScrollIntent("native-scroll-non-smooth"),this.pendingScroll=!0,!1}onUpdateEvent(){this.cursorController.onFrame(),this.scrollManager.get().onFrame(),this.moduleManager.onFrame(),(this.pendingScroll||this.data.scroll.current!==this.lastScrollEmitted)&&(this.pendingScroll=!1,this.moduleManager.onScroll(),this.objectManager.checkInview(),this.eventManager.emit("lerp",this.data.scroll.lerped),this.eventManager.emit("scroll",this.data.scroll.current),U.measure(()=>{this.moduleManager.onScrollMeasure()}),this.lastScrollEmitted=this.data.scroll.current),U.mutate(()=>{L.begin(),this.moduleManager.onMutate(),L.commit()}),this.eventManager.emit("update",null),U.flush()}updateDevtoolsFPS(t){this.devtoolsFpsLastSampleTime===0&&(this.devtoolsFpsLastSampleTime=t),this.devtoolsFpsFrameCount+=1;let e=t-this.devtoolsFpsLastSampleTime;if(e<1e3)return;let r=this.devtoolsFpsFrameCount*1e3/e;this.devtools.setFPS(r),this.devtoolsFpsFrameCount=0,this.devtoolsFpsLastSampleTime=t}onResize(t=!1,e=""){if(this.canRebuild==!1)return;let r=this.data.scroll.container,i=this.context.data.scroll,n=0,s=0;var o,a=0;let l=r.getBoundingClientRect();r.tagName=="BODY"?(n=document.documentElement.clientWidth||window.innerWidth||l.width,s=window.innerHeight):(n=l.width,s=l.height),a=r.tagName==="BODY"?0:l.top,o=i.container.scrollHeight;let c=this.tools.transformScaleParser.process({value:window.getComputedStyle(r).transform});this.context.data.viewport.transformScale=window.getComputedStyle(r).scale=="none"?c:Number(window.getComputedStyle(r).scale),this.context.data.scroll.transformedCurrent=this.context.data.scroll.current*this.context.data.viewport.transformScale;let u=ca(),p=n>1024,g=this.prevWidth!==n,m=this.prevHeight!==s,h=Math.abs(this.prevHeight-s),f=this.context.data.viewport.contentHeight!==o,b=g||!u&&m||u&&h>150||f;this.context.data.scroll.topPosition=Math.floor(a),this.context.data.viewport.contentWidth=n,this.context.data.viewport.contentHeight=o,this.prevWidth=n,this.prevHeight=s,this.context.data.viewport.windowWidth=n,this.context.data.viewport.windowHeight=s;let y=window.getComputedStyle(document.documentElement).fontSize,v=parseFloat(y);if(this.context.data.viewport.baseRem=v*c,this.syncDebugScrollState(),i.bottomPosition=this.context.data.viewport.contentHeight-s,(g||typeof t=="boolean"&&t)&&this.moduleManager.onResizeWidth(),b||typeof t=="boolean"&&t){let S=this.context.data.scroll.elementContainer.scrollTop,E=this.context.data.scroll.target,M=i.mode==="smooth"&&(Math.abs(i.target-i.current)>1||Math.abs(i.delta)>1e-4);if((S>0||i.current!==0)&&(this.context.data.scroll.current=Math.max(0,Math.min(S,this.context.data.scroll.bottomPosition))),M){let A=(this.activeScrollIntent?this.resolveScrollIntentPosition(this.activeScrollIntent):null)??this.context.data.scroll.target,I=Math.max(0,Math.min(A,this.context.data.scroll.bottomPosition));this.context.data.scroll.target=I,Math.abs(this.context.data.scroll.target-this.context.data.scroll.current)<=1&&(this.context.data.scroll.target=this.context.data.scroll.current,this.context.data.scroll.delta=0,this.context.data.scroll.lerped=0)}else S>0&&(this.context.data.scroll.target=this.context.data.scroll.current);this.moduleManager.onResize(),this.scrollManager&&this.scrollManager.updateResponsiveMode(),this.onSettingsChange({isDesktop:p,widthChanged:g,heightChanged:m,scrollHeightChanged:f,isForceRebuild:t===!0}),this.objectManager.invalidateInviewIndex(),this.moduleManager.onScroll(),this.moduleManager.onScrollMeasure(),this.moduleManager.onFrame()}this.objectManager.checkInview()}invalidateCenter(t){this.objectManager.all.get(t)&&this.centers.invalidate(t)}scrollTo(t){let e=this.resolveScrollToValue(t);e!=null&&(this.activeScrollIntent=e.intent,this.scrollManager.get().scrollTo(e.position,e.immediate))}resolveScrollToValue(t){if(typeof t=="number")return{position:t,immediate:!1,intent:{kind:"position",position:t,immediate:!1}};if(typeof t=="string"||t instanceof HTMLElement){let s=this.resolveElementScrollPosition(t);return s==null?null:{position:s,immediate:!1,intent:typeof t=="string"?{kind:"selector",selector:t,offset:0,immediate:!1}:{kind:"element",element:t,offset:0,immediate:!1}}}let e=t.immediate===!0,r=t.offset??0;if("position"in t)return{position:t.position+r,immediate:e,intent:{kind:"position",position:t.position+r,immediate:e}};let i="selector"in t?t.selector:t.element,n=this.resolveElementScrollPosition(i);return n==null?null:{position:n+r,immediate:e,intent:"selector"in t?{kind:"selector",selector:t.selector,offset:r,immediate:e}:{kind:"element",element:t.element,offset:r,immediate:e}}}resolveElementScrollPosition(t){let e=typeof t=="string"?document.querySelector(t):t;if(!(e instanceof HTMLElement))return null;let r=this.data.scroll.container??document.body??document.documentElement,i=this.data.scroll.elementContainer??document.documentElement,n=this.tools.transformNullify.process({element:e});if(r===document.body||r===document.documentElement)return n.top+i.scrollTop;let s=r.getBoundingClientRect();return n.top-s.top+r.scrollTop}resolveScrollIntentPosition(t){switch(t.kind){case"position":return t.position;case"selector":{let e=this.resolveElementScrollPosition(t.selector);return e==null?null:e+t.offset}case"element":{let e=this.resolveElementScrollPosition(t.element);return e==null?null:e+t.offset}}}clearActiveScrollIntent(t){this.activeScrollIntent&&(this.activeScrollIntent=null)}destroy(){this.hasStarted=!1,this.data.scroll.scrollContainer?.removeEventListener("scroll",this.onScrollBind),this.data.scroll.container?.removeEventListener("wheel",this.onWheelBind),window.removeEventListener("resize",this.onResizeBind),this.root.removeEventListener("mousemove",this.onMouseMoveBind),this.eventManager.off("dom:changed",this.onDOMChangedBind),this.observerContainerMutation?.disconnect(),this.observerContainerMutation=null,this.pendingResizeRaf!=null&&(cancelAnimationFrame(this.pendingResizeRaf),this.pendingResizeRaf=null),this.pendingRebuildRaf!=null&&(cancelAnimationFrame(this.pendingRebuildRaf),this.pendingRebuildRaf=null),this.objectManager.destroy(),this.scrollManager.destroy(),this.devtools.destroy()}};0&&(module.exports={CursorReactiveModule,DOMBatcher,GridAdapter,ScrollController,StringAnchor,StringCursor,StringData,StringDelayLerpTracker,StringDevIconRegistry,StringDevInview,StringDevLayout,StringDevModule,StringDevOverlayRegistry,StringDevProgress,StringDevRulers,StringFPSTracker,StringForm,StringGlide,StringImpulse,StringLazy,StringLerp,StringLerpTracker,StringLoading,StringMagnetic,StringMarquee,StringMasonry,StringModule,StringObject,StringParallax,StringPositionTracker,StringProgress,StringProgressPart,StringRandom,StringResponsive,StringScrollContainer,StringScrollbar,StringScroller,StringSequence,StringSignal,StringSplit,StringSpotlight,StringTune,StringVideoAutoplay,buildDevtoolsThemeBlock,ensureStringDevtoolsSharedStyles,frameDOM,resolveDevtoolsIcon,styleTxn});
|
|
2043
|
+
`,this.panelRoot=t,this.panelTitle=t.querySelector("[data-string-progress-dock-title]"),this.panelSlider=t.querySelector("[data-string-progress-slider]"),this.panelValue=t.querySelector("[data-string-progress-value-number]"),this.panelEasedValue=t.querySelector('[data-field="eased"]'),this.panelPlayForwardButton=t.querySelector("[data-string-progress-dock-play-forward]"),this.panelPlayForwardButton.addEventListener("click",r=>{r.stopPropagation(),this.autoplayRaf!==null&&this.autoplayDirection===1?this.stopAutoplay():this.startAutoplay(1)}),this.panelPlayBackwardButton=t.querySelector("[data-string-progress-dock-play-backward]"),this.panelPlayBackwardButton.addEventListener("click",r=>{r.stopPropagation(),this.autoplayRaf!==null&&this.autoplayDirection===-1?this.stopAutoplay():this.startAutoplay(-1)}),t.querySelector("[data-string-progress-dock-close]").addEventListener("click",r=>{r.stopPropagation(),this.openTargetLabel&&this.closePanel(this.openTargetLabel)}),this.panelSlider.addEventListener("input",this.onPanelSliderInputBind),this.panelValue.addEventListener("input",()=>{if(!this.openTargetLabel||!this.panelValue)return;let r=this.findEntryByTargetLabel(this.openTargetLabel);if(!r)return;let i=Math.max(0,Math.min(100,Number(this.panelValue.value)));if(!Number.isFinite(i))return;this.stopAutoplay();let n=i/100;this.autoplayProgress=n,this.setEntryProgressOverride(r.object,n)}),this.panelValue.addEventListener("keydown",r=>{r.key==="Enter"&&r.target.blur()}),this.hudLayer.getWorldElement(this.getWorldHost()).appendChild(t)}onPanelSliderInput(){if(!this.openTargetLabel||!this.panelSlider)return;let t=this.findEntryByTargetLabel(this.openTargetLabel);if(!t)return;this.stopAutoplay();let e=lt(Number(this.panelSlider.value)/1e3);this.autoplayProgress=e,this.setEntryProgressOverride(t.object,e)}renderPanel(){if(!this.panelRoot||!this.panelTitle||!this.panelSlider||!this.panelValue||!this.panelEasedValue)return;let t=this.openTargetLabel?this.findEntryByTargetLabel(this.openTargetLabel):null;if(!this.enabled||!t){this.panelRoot.setAttribute("hidden",""),this.panelRoot.setAttribute("data-open","false"),this.panelRoot.setAttribute("data-target-id","");return}let e=this.resolveOverlayTargetId(t.object),r=this.getOverlayTargetLabel(t.object),i=this.measurements.get(t.object.id),n=i?lt(i.progress):0,s=i?lt(i.rawProgress):0;this.panelRoot.removeAttribute("hidden"),this.panelRoot.setAttribute("data-open","true"),this.panelRoot.setAttribute("data-target-id",e),this.panelTitle.textContent=r,this.panelSlider.setAttribute("aria-label",`Preview progress for ${r}`),L.setVarDirect(this.panelSlider,"--string-progress-slider-fill",`${Math.round(s*1e3)/10}%`);let o=String(Math.round(s*1e3));this.panelSlider.value!==o&&(this.panelSlider.value=o);let a=String(Math.round(n*100));document.activeElement!==this.panelValue&&(this.panelValue.value=a),this.panelEasedValue.textContent=Vn(n)}findEntryByTargetLabel(t){for(let e of this.entries.values())if(this.resolveOverlayTargetId(e.object)===t)return e;return null}};function Wn(l){return typeof l=="object"&&l!==null&&"getDevtoolDefinition"in l&&typeof l.getDevtoolDefinition=="function"}function pa(){return"ontouchstart"in window||navigator.maxTouchPoints>0}var Di=class l{static DEVTOOLS_ACCESS_URL="https://access.fiddle.digital/";static DEVTOOLS_LOG_PREFIX="[StringTune Devtools]";static DEVTOOLS_ARTIFACT_SELECTORS=["[data-string-dev-viewport-layer]","[data-string-dev-viewport-world]","[data-stdg-dock]","[data-stdg-dock-sub-badges]"];onScrollStartBind;onScrollStopBind;onDirectionChangeBind;onScrollConfigChangeBind;onWheelBind;onScrollBind;onResizeBind;onMouseMoveBind;onScrollToBind;onDOMChangedBind;onContainerTransitionEndBind;onResizeObserverBind;pendingScroll=!1;lastScrollEmitted=NaN;observerContainerMutation=null;pendingResizeRaf=null;pendingResizeForce=!1;pendingRebuildRaf=null;activeScrollIntent=null;static i;root;window;prevWidth=0;prevHeight=0;moduleManager;scrollManager;objectManager;eventManager;signalHub;cursorController;tools;loop=new pr;data;context;centers;hoverManager;devtools;devtoolsFpsLastSampleTime=0;devtoolsFpsFrameCount=0;observerContainerResize=null;devtoolsAccessToken="";devtoolsAccessState="unknown";devtoolsAccessRequestId=0;pendingDevtoolUses=[];hasStarted=!1;devtoolsAccessLastMessage="none";canRebuild=!0;set scrollPosition(t){this.data.scroll.current=t,this.data.scroll.target=t,this.data.scroll.transformedCurrent=this.data.scroll.current*this.data.viewport.transformScale,this.data.scroll.delta=0,this.data.scroll.lerped=0,this.scrollManager.updatePosition(),this.moduleManager.onScroll(),this.objectManager.checkInview()}set accessDevtoolToken(t){let e=t.trim();if(!(e===this.devtoolsAccessToken&&(this.devtoolsAccessState==="granted"||this.devtoolsAccessState==="pending"))){if(this.devtoolsAccessToken=e,e.length===0){this.devtoolsAccessState="unknown";return}this.validateDevtoolsAccess(e)}}set scrollContainer(t){this.observerContainerResize?.unobserve(this.context.data.scroll.container),this.data.scroll.elementContainer.removeEventListener("transitionend",this.onContainerTransitionEndBind),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.data.scroll.elementContainer.addEventListener("transitionend",this.onContainerTransitionEndBind),this.observerContainerResize?.observe(this.context.data.scroll.container),this.observeContainerMutations(),this.queueResize(!0,"scrollContainer")}get scrollPosition(){return this.data.scroll.current}get scrollHeight(){return this.data.viewport.contentHeight}get containerHeight(){return this.data.viewport.windowHeight}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)}set FPSTrackerVisible(t){this.data.system.fpsTracker=t,this.eventManager.emit("tracker:fps:visible",t)}set PositionTrackerVisible(t){this.data.system.positionTracker=t,this.eventManager.emit("tracker:position:visible",t)}set domBatcherEnabled(t){this.objectManager.setDOMBatcherEnabled(t)}set intersectionObserverEnabled(t){this.objectManager.setIntersectionObserverEnabled(t)}debouncedResize=vi(t=>{this.queueResize(!1,t)},30);debouncedRebuild=vi(()=>{this.queueRebuild()},30);constructor(){this.cleanupExistingDevtoolsArtifacts(),this.root=document.body,this.window=window,this.tools=new Be,this.data=new Gt,this.eventManager=new Ct,this.signalHub=new br((t,e)=>this.eventManager.emit(t,e)),this.moduleManager=new Se(this.data),this.objectManager=new Me(this.data,this.moduleManager,this.eventManager,this.tools),this.centers=new fr,this.hoverManager=new vr,this.devtools=new Lr,this.context={events:this.eventManager,data:this.data,tools:this.tools,settings:{},centers:this.centers,hover:this.hoverManager,objectManager:this.objectManager,signals:this.signalHub},this.cursorController=new ye(1,this.context),this.scrollManager=new Te(this.context),this.setupSettings({"global-class":!1,"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","cursor-lerp":"0.75",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,"position-strength":3,"position-tension":.05,"position-friction":.15,"position-max-velocity":10,"position-update-threshold":.1,"rotation-strength":.75,"rotation-tension":.06,"rotation-friction":.18,"rotation-max-angular-velocity":6,"rotation-max-angle":18,"rotation-update-threshold":.15,"max-offset":220,"sleep-epsilon":.01,"continuous-push":!0}),this.onContainerTransitionEndBind=this.onContainerTransitionEnd.bind(this),this.onResizeObserverBind=this.onResizeObserverEvent.bind(this),this.observerContainerResize=new ResizeObserver(this.onResizeObserverBind),this.observerContainerResize.observe(this.context.data.scroll.container),this.onWheelBind=this.onWheelEvent.bind(this),this.onScrollBind=this.onScrollEvent.bind(this),this.onResizeBind=()=>{this.queueResize(!1,"resizeBind")},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.onScrollConfigChangeBind=this.onScrollConfigChange.bind(this),this.onScrollToBind=this.scrollTo.bind(this),this.onDOMChangedBind=this.onDOMChanged.bind(this),this.eventManager.on("wheel",this.onWheelBind),this.eventManager.on("resize",this.onResizeBind),this.eventManager.on("scrollTo",this.onScrollToBind),this.eventManager.on("dom:changed",this.onDOMChangedBind),this.scrollManager.bindEvents({onScrollStart:this.onScrollStartBind,onScrollStop:this.onScrollStopBind,onDirectionChange:this.onDirectionChangeBind,onModeChange:this.onScrollConfigChangeBind}),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.updateDevtoolsFPS(t)}),this.on("image:load:all",()=>{this.onRebuild()}),this.scrollContainer=window}static getInstance(){return l.i||(l.i=new l),l.i}reuse(t){return this.moduleManager.find(t)}use(t,e=null){this.moduleManager.find(t)||this.shouldDeferDevtoolModule(t,e)||this.instantiateModule(t,e)}cleanupExistingDevtoolsArtifacts(){for(let t of l.DEVTOOLS_ARTIFACT_SELECTORS)document.querySelectorAll(t).forEach(e=>e.remove())}instantiateModule(t,e=null){let r={...this.context.settings,...e},i=new t({events:this.eventManager,data:this.data,tools:this.tools,settings:r,centers:this.centers,hover:this.hoverManager,objectManager:this.objectManager,signals:this.signalHub});this.moduleManager.register(i),Wn(i)&&this.devtools.register(i.getDevtoolDefinition()),this.hasStarted&&(this.objectManager.attachModule(i),i.onInit(),i.onResize(),i.onScroll(this.data),i.onFrame(this.data))}shouldDeferDevtoolModule(t,e){return!(t===Z||t.prototype instanceof Z)||this.devtoolsAccessState==="granted"?!1:(this.pendingDevtoolUses.push({objectClass:t,settings:e}),this.devtoolsAccessToken.length>0&&this.devtoolsAccessState!=="pending"&&this.validateDevtoolsAccess(this.devtoolsAccessToken),!0)}async validateDevtoolsAccess(t){let e=++this.devtoolsAccessRequestId;this.devtoolsAccessState="pending";try{let r=await fetch(`${l.DEVTOOLS_ACCESS_URL}?token=${encodeURIComponent(t)}`),i=await this.resolveDevtoolsAccessResponse(r);if(e!==this.devtoolsAccessRequestId||t!==this.devtoolsAccessToken)return;if(this.devtoolsAccessState=i?"granted":"denied",!i){this.logDevtoolsAccess("denied"),this.pendingDevtoolUses=[];return}this.logDevtoolsAccess("granted");let n=[...this.pendingDevtoolUses];this.pendingDevtoolUses=[],n.forEach(({objectClass:s,settings:o})=>{this.instantiateModule(s,o)})}catch{if(e!==this.devtoolsAccessRequestId||t!==this.devtoolsAccessToken||this.devtoolsAccessState==="granted")return;this.devtoolsAccessState="denied",this.logDevtoolsAccess("error"),this.pendingDevtoolUses=[]}}logDevtoolsAccess(t){if(this.devtoolsAccessLastMessage!==t){if(this.devtoolsAccessLastMessage=t,t==="granted"){console.info(`${l.DEVTOOLS_LOG_PREFIX} Access granted. Devtools modules are enabled.`);return}if(t==="denied"){console.warn(`${l.DEVTOOLS_LOG_PREFIX} Access denied. Devtools modules were not enabled. Check accessDevtoolToken.`);return}console.warn(`${l.DEVTOOLS_LOG_PREFIX} Access check failed. Devtools modules were not enabled.`)}}async resolveDevtoolsAccessResponse(t){if(!t.ok)return!1;if((t.headers.get("content-type")?.toLowerCase()??"").includes("application/json")){let i=await t.json();return typeof i=="boolean"?i:i&&typeof i=="object"&&"allowed"in i?i.allowed===!0:!1}return(await t.text()).trim().toLowerCase()==="true"}registerScrollMode(t,e){let r;if(typeof e=="function"&&e.prototype instanceof J){let i=e;r=new i(this.context)}else r=e(this.context);r.name||(r.name=t),this.scrollManager.registerMode(t,r)}on(t,e,r=""){this.eventManager.on(t,e,r)}emit(t,e){this.eventManager.emit(t,e)}off(t,e,r=""){this.eventManager.off(t,e,r)}addScrollMark(t){this.scrollManager.addScrollMark(t)}removeScrollMark(t){this.scrollManager.removeScrollMark(t)}start(t){if(this.hasStarted)return;this.hasStarted=!0,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),this.observeContainerMutations(),this.use(Ye);let e=window.getComputedStyle(document.documentElement).fontSize,r=parseFloat(e);this.context.data.viewport.baseRem=r,document.documentElement.classList.add("-string"),this.syncDebugScrollState(),this.moduleManager.onInit(),this.onResize(!1,"start"),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.linkMirror(e,t)}),this.moduleManager.onResize(),this.moduleManager.onScroll(),this.moduleManager.onFrame()}setupSettings(t){this.context.settings={...this.context.settings,...t},typeof t.storageToken=="string"?Li(t.storageToken):typeof t["storage-token"]=="string"&&Li(t["storage-token"]),typeof t.accessDevtoolToken=="string"&&(this.accessDevtoolToken=t.accessDevtoolToken),this.onSettingsChange({isDesktop:this.data.viewport.windowWidth>1024,widthChanged:!0,heightChanged:!0,scrollHeightChanged:!0,isForceRebuild:!1})}onResizeObserverEvent(){this.debouncedResize("resizeObserver")}onContainerTransitionEnd(t){t.target===this.context.data.scroll.container&&this.queueResize(!0,"containerTransition")}onDOMChanged(){this.debouncedRebuild()}observeContainerMutations(){this.observerContainerMutation?.disconnect();let t=this.context.data.scroll.container;t&&(this.observerContainerMutation=new MutationObserver(e=>{for(let r=0;r<e.length;r++){let i=e[r];if(i.type==="attributes"&&(i.attributeName==="style"||i.attributeName==="class")){this.debouncedResize("containerMutation");break}}}),this.observerContainerMutation.observe(t,{attributes:!0,attributeFilter:["style","class"]}))}queueResize(t=!1,e=""){t&&(this.pendingResizeForce=!0),this.pendingResizeRaf==null&&(this.pendingResizeRaf=requestAnimationFrame(()=>{this.pendingResizeRaf=null;let r=this.pendingResizeForce;this.pendingResizeForce=!1,this.onResize(r,e)}))}queueRebuild(){this.pendingRebuildRaf==null&&(this.pendingRebuildRaf=requestAnimationFrame(()=>{this.pendingRebuildRaf=null,this.onRebuild()}))}onRebuild(){let t=this.context.data.scroll,e=t.container.scrollHeight;this.context.data.viewport.contentHeight!==e&&(this.context.data.viewport.contentHeight=e,t.bottomPosition=e-this.context.data.viewport.windowHeight,this.moduleManager.onRebuild())}onMouseMoveEvent(t){this.cursorController.onMouseMove(t),this.moduleManager.onMouseMove(t),U.measure(()=>{this.moduleManager.onMouseMoveMeasure()})}onWheelEvent(t){t.target.closest("[string-isolation],[data-string-isolation]")==null&&(this.clearActiveScrollIntent("wheel"),this.scrollManager.get().onWheel(t),this.moduleManager.onWheel(t))}onScrollStart(){this.moduleManager.onScrollStart(),this.eventManager.emit("scroll:start",null)}onScrollStop(){this.clearActiveScrollIntent("scroll-stop"),this.moduleManager.onScrollStop(),this.eventManager.emit("scroll:stop",null)}onDirectionChange(){this.moduleManager.onDirectionChange()}onScrollConfigChange(){this.moduleManager.onScrollConfigChange(),this.syncDebugScrollState(),this.moduleManager.onScroll(),this.moduleManager.onScrollMeasure(),this.moduleManager.onFrame(),L.run(()=>{this.moduleManager.onMutate()})}syncDebugScrollState(){let t=document.documentElement,e=window.innerWidth<1024;t.setAttribute("data-string-scroll-mode",String(this.data.scroll.mode)),t.setAttribute("data-string-scroll-device",e?"mobile":"desktop")}onSettingsChange(t){this.cursorController.onSettingsChange(t),this.objectManager.onSettingsChange(t),this.moduleManager.onSettingsChange(t)}onScrollEvent(t){return t.preventDefault(),this.context.centers.invalidateAll(),this.scrollManager.get().onScroll(t),this.data.scroll.mode!=="smooth"&&this.clearActiveScrollIntent("native-scroll-non-smooth"),this.pendingScroll=!0,!1}onUpdateEvent(){this.cursorController.onFrame(),this.scrollManager.get().onFrame(),this.moduleManager.onFrame(),(this.pendingScroll||this.data.scroll.current!==this.lastScrollEmitted)&&(this.pendingScroll=!1,this.moduleManager.onScroll(),this.objectManager.checkInview(),this.eventManager.emit("lerp",this.data.scroll.lerped),this.eventManager.emit("scroll",this.data.scroll.current),U.measure(()=>{this.moduleManager.onScrollMeasure()}),this.lastScrollEmitted=this.data.scroll.current),U.mutate(()=>{L.begin(),this.moduleManager.onMutate(),L.commit()}),this.eventManager.emit("update",null),U.flush()}updateDevtoolsFPS(t){this.devtoolsFpsLastSampleTime===0&&(this.devtoolsFpsLastSampleTime=t),this.devtoolsFpsFrameCount+=1;let e=t-this.devtoolsFpsLastSampleTime;if(e<1e3)return;let r=this.devtoolsFpsFrameCount*1e3/e;this.devtools.setFPS(r),this.devtoolsFpsFrameCount=0,this.devtoolsFpsLastSampleTime=t}onResize(t=!1,e=""){if(this.canRebuild==!1)return;let r=this.data.scroll.container,i=this.context.data.scroll,n=0,s=0;var o,a=0;let d=r.getBoundingClientRect();r.tagName=="BODY"?(n=document.documentElement.clientWidth||window.innerWidth||d.width,s=window.innerHeight):(n=d.width,s=d.height),a=r.tagName==="BODY"?0:d.top,o=i.container.scrollHeight;let c=this.tools.transformScaleParser.process({value:window.getComputedStyle(r).transform});this.context.data.viewport.transformScale=window.getComputedStyle(r).scale=="none"?c:Number(window.getComputedStyle(r).scale),this.context.data.scroll.transformedCurrent=this.context.data.scroll.current*this.context.data.viewport.transformScale;let u=pa(),p=n>1024,g=this.prevWidth!==n,m=this.prevHeight!==s,h=Math.abs(this.prevHeight-s),f=this.context.data.viewport.contentHeight!==o,b=g||!u&&m||u&&h>150||f;this.context.data.scroll.topPosition=Math.floor(a),this.context.data.viewport.contentWidth=n,this.context.data.viewport.contentHeight=o,this.prevWidth=n,this.prevHeight=s,this.context.data.viewport.windowWidth=n,this.context.data.viewport.windowHeight=s;let y=window.getComputedStyle(document.documentElement).fontSize,v=parseFloat(y);if(this.context.data.viewport.baseRem=v*c,this.syncDebugScrollState(),i.bottomPosition=this.context.data.viewport.contentHeight-s,(g||typeof t=="boolean"&&t)&&this.moduleManager.onResizeWidth(),b||typeof t=="boolean"&&t){let S=this.context.data.scroll.elementContainer.scrollTop,E=this.context.data.scroll.target,M=i.mode==="smooth"&&(Math.abs(i.target-i.current)>1||Math.abs(i.delta)>1e-4);if((S>0||i.current!==0)&&(this.context.data.scroll.current=Math.max(0,Math.min(S,this.context.data.scroll.bottomPosition))),M){let A=(this.activeScrollIntent?this.resolveScrollIntentPosition(this.activeScrollIntent):null)??this.context.data.scroll.target,I=Math.max(0,Math.min(A,this.context.data.scroll.bottomPosition));this.context.data.scroll.target=I,Math.abs(this.context.data.scroll.target-this.context.data.scroll.current)<=1&&(this.context.data.scroll.target=this.context.data.scroll.current,this.context.data.scroll.delta=0,this.context.data.scroll.lerped=0)}else S>0&&(this.context.data.scroll.target=this.context.data.scroll.current);this.moduleManager.onResize(),this.scrollManager&&this.scrollManager.updateResponsiveMode(),this.onSettingsChange({isDesktop:p,widthChanged:g,heightChanged:m,scrollHeightChanged:f,isForceRebuild:t===!0}),this.objectManager.invalidateInviewIndex(),this.moduleManager.onScroll(),this.moduleManager.onScrollMeasure(),this.moduleManager.onFrame()}this.objectManager.checkInview()}invalidateCenter(t){this.objectManager.all.get(t)&&this.centers.invalidate(t)}scrollTo(t){let e=this.resolveScrollToValue(t);e!=null&&(this.activeScrollIntent=e.intent,this.scrollManager.get().scrollTo(e.position,e.immediate))}resolveScrollToValue(t){if(typeof t=="number")return{position:t,immediate:!1,intent:{kind:"position",position:t,immediate:!1}};if(typeof t=="string"||t instanceof HTMLElement){let s=this.resolveElementScrollPosition(t);return s==null?null:{position:s,immediate:!1,intent:typeof t=="string"?{kind:"selector",selector:t,offset:0,immediate:!1}:{kind:"element",element:t,offset:0,immediate:!1}}}let e=t.immediate===!0,r=t.offset??0;if("position"in t)return{position:t.position+r,immediate:e,intent:{kind:"position",position:t.position+r,immediate:e}};let i="selector"in t?t.selector:t.element,n=this.resolveElementScrollPosition(i);return n==null?null:{position:n+r,immediate:e,intent:"selector"in t?{kind:"selector",selector:t.selector,offset:r,immediate:e}:{kind:"element",element:t.element,offset:r,immediate:e}}}resolveElementScrollPosition(t){let e=typeof t=="string"?document.querySelector(t):t;if(!(e instanceof HTMLElement))return null;let r=this.data.scroll.container??document.body??document.documentElement,i=this.data.scroll.elementContainer??document.documentElement,n=this.tools.transformNullify.process({element:e});if(r===document.body||r===document.documentElement)return n.top+i.scrollTop;let s=r.getBoundingClientRect();return n.top-s.top+r.scrollTop}resolveScrollIntentPosition(t){switch(t.kind){case"position":return t.position;case"selector":{let e=this.resolveElementScrollPosition(t.selector);return e==null?null:e+t.offset}case"element":{let e=this.resolveElementScrollPosition(t.element);return e==null?null:e+t.offset}}}clearActiveScrollIntent(t){this.activeScrollIntent&&(this.activeScrollIntent=null)}destroy(){this.hasStarted=!1,this.data.scroll.scrollContainer?.removeEventListener("scroll",this.onScrollBind),this.data.scroll.container?.removeEventListener("wheel",this.onWheelBind),window.removeEventListener("resize",this.onResizeBind),this.root.removeEventListener("mousemove",this.onMouseMoveBind),this.eventManager.off("dom:changed",this.onDOMChangedBind),this.observerContainerMutation?.disconnect(),this.observerContainerMutation=null,this.pendingResizeRaf!=null&&(cancelAnimationFrame(this.pendingResizeRaf),this.pendingResizeRaf=null),this.pendingRebuildRaf!=null&&(cancelAnimationFrame(this.pendingRebuildRaf),this.pendingRebuildRaf=null),this.objectManager.destroy(),this.scrollManager.destroy(),this.devtools.destroy()}};0&&(module.exports={CursorReactiveModule,DOMBatcher,GridAdapter,ScrollController,StringAnchor,StringCursor,StringData,StringDelayLerpTracker,StringDevIconRegistry,StringDevInview,StringDevLayout,StringDevModule,StringDevOverlayRegistry,StringDevProgress,StringDevRulers,StringFPSTracker,StringForm,StringGlide,StringImpulse,StringLazy,StringLerp,StringLerpTracker,StringLoading,StringMagnetic,StringMarquee,StringMasonry,StringModule,StringObject,StringParallax,StringPositionTracker,StringProgress,StringProgressPart,StringRandom,StringResponsive,StringScrollContainer,StringScrollbar,StringScroller,StringSequence,StringSignal,StringSplit,StringSpotlight,StringTune,StringVideoAutoplay,buildDevtoolsThemeBlock,ensureStringDevtoolsSharedStyles,frameDOM,resolveDevtoolsIcon,styleTxn});
|
|
2044
2044
|
//# sourceMappingURL=index.cjs.map
|