cineview 0.0.1-beta
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/LICENSE +21 -0
- package/README.md +102 -0
- package/README.zh-CN.md +102 -0
- package/dist/animations/animationParser.d.ts +24 -0
- package/dist/animations/composer.d.ts +13 -0
- package/dist/animations/presets/blink.d.ts +18 -0
- package/dist/animations/presets/blur.d.ts +18 -0
- package/dist/animations/presets/bounce.d.ts +18 -0
- package/dist/animations/presets/elastic.d.ts +23 -0
- package/dist/animations/presets/fade.d.ts +18 -0
- package/dist/animations/presets/flip.d.ts +18 -0
- package/dist/animations/presets/index.d.ts +38 -0
- package/dist/animations/presets/rotate.d.ts +23 -0
- package/dist/animations/presets/shake.d.ts +28 -0
- package/dist/animations/presets/slide.d.ts +23 -0
- package/dist/animations/presets/special.d.ts +38 -0
- package/dist/animations/presets/zoom.d.ts +23 -0
- package/dist/animations/registry.d.ts +51 -0
- package/dist/artifacts.json +40 -0
- package/dist/blink-BGmsrTwW.mjs +81 -0
- package/dist/blur-CQoB_VWp.mjs +52 -0
- package/dist/bounce-B_QJxgOq.mjs +64 -0
- package/dist/cineview-dev.css +2 -0
- package/dist/cineview-dev.es.mjs +2 -0
- package/dist/cineview-drag.umd.js +2 -0
- package/dist/cineview-scroll.umd.js +2 -0
- package/dist/cineview.es.mjs +2 -0
- package/dist/cineview.umd.js +2 -0
- package/dist/components/Animate/Animate.d.ts +67 -0
- package/dist/components/Animate/AnimateRenderBridge.d.ts +16 -0
- package/dist/components/Animate/AnimateVideo.d.ts +59 -0
- package/dist/components/Animate/StaggerContainer.d.ts +35 -0
- package/dist/components/Animate/__fixtures__/animate-media-public-path.fixture.d.ts +1 -0
- package/dist/components/Animate/animateInterpolation.d.ts +41 -0
- package/dist/components/Animate/animateRenderState.d.ts +23 -0
- package/dist/components/Animate/animateSemantics.d.ts +38 -0
- package/dist/components/Animate/animateTimeline.d.ts +14 -0
- package/dist/components/Animate/dragVisualState.d.ts +26 -0
- package/dist/components/Animate/index.d.ts +6 -0
- package/dist/components/Animate/useAnimateArrival.d.ts +35 -0
- package/dist/components/Animate/useAnimateDrag.d.ts +34 -0
- package/dist/components/Animate/useAnimatePublicTimeline.d.ts +16 -0
- package/dist/components/Animate/useAnimateScroll.d.ts +83 -0
- package/dist/components/Animate/useAnimatedPropertyLanes.d.ts +30 -0
- package/dist/components/Animate/visibilityScheduler.d.ts +12 -0
- package/dist/components/Cineview/Cineview.d.ts +46 -0
- package/dist/components/Cineview/CineviewDispatch.d.ts +2 -0
- package/dist/components/Cineview/DirectScrollCineview.d.ts +8 -0
- package/dist/components/Cineview/DragSceneStack.d.ts +55 -0
- package/dist/components/Cineview/ScrollSceneSlot.d.ts +42 -0
- package/dist/components/Cineview/ScrollSceneStack.d.ts +13 -0
- package/dist/components/Cineview/ScrollbarOverlay.d.ts +24 -0
- package/dist/components/Cineview/directScrollHelpers.d.ts +77 -0
- package/dist/components/Cineview/index.d.ts +5 -0
- package/dist/components/Cineview/preloadTargets.d.ts +18 -0
- package/dist/components/Cineview/regroupCallbacks.d.ts +10 -0
- package/dist/components/Cineview/useCineviewImperativeApi.d.ts +21 -0
- package/dist/components/Cineview/useNativeScrollController.d.ts +38 -0
- package/dist/components/Cineview/useScrollInputBindings.d.ts +9 -0
- package/dist/components/Cineview/useScrollSceneLayout.d.ts +24 -0
- package/dist/components/Cineview/useScrollSceneSnapshots.d.ts +32 -0
- package/dist/components/Cineview/useScrollViewport.d.ts +20 -0
- package/dist/components/Cineview/useScrollZoneRegistry.d.ts +35 -0
- package/dist/components/Container/Container.d.ts +2 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/Image/Image.d.ts +12 -0
- package/dist/components/Image/index.d.ts +2 -0
- package/dist/components/Position/Position.d.ts +13 -0
- package/dist/components/Position/index.d.ts +1 -0
- package/dist/components/Scene/Scene.d.ts +10 -0
- package/dist/components/Scene/SceneFixedLayer.d.ts +14 -0
- package/dist/components/Scene/__fixtures__/scene-grouped-public-path.fixture.d.ts +1 -0
- package/dist/components/Scene/dragPreparedState.d.ts +49 -0
- package/dist/components/Scene/helpers.d.ts +101 -0
- package/dist/components/Scene/index.d.ts +1 -0
- package/dist/components/Scene/sceneScrollBudget.d.ts +38 -0
- package/dist/components/Scene/sceneScrollRuntime.d.ts +65 -0
- package/dist/components/Scene/types.d.ts +189 -0
- package/dist/components/Scene/useDragSceneEngine.d.ts +67 -0
- package/dist/components/Scene/useElementTrack.d.ts +82 -0
- package/dist/components/Scene/useNativePointerDrag.d.ts +25 -0
- package/dist/components/Scene/useSceneAnimationRegistry.d.ts +56 -0
- package/dist/components/Scene/useScenePointerInput.d.ts +28 -0
- package/dist/components/Scene/useSceneRuntimeState.d.ts +17 -0
- package/dist/components/Scene/useSceneScrollTakeover.d.ts +13 -0
- package/dist/components/Scene/useScrollSceneEngine.d.ts +28 -0
- package/dist/components/runtime/runtimeContext.d.ts +14 -0
- package/dist/components/runtime/scrollExternalStore.d.ts +13 -0
- package/dist/components/runtime/scrollSceneFrameStore.d.ts +29 -0
- package/dist/context/CineviewContext.d.ts +25 -0
- package/dist/dev/PerfPanel.d.ts +16 -0
- package/dist/dev/index.d.ts +14 -0
- package/dist/dev/usePerfMonitor.d.ts +9 -0
- package/dist/drag-scene-engine-y8Wj9ivV.mjs +270 -0
- package/dist/elastic-CBP_FdRv.mjs +129 -0
- package/dist/element-track-Du10P12_.mjs +316 -0
- package/dist/entry-drag.d.ts +14 -0
- package/dist/entry-scroll.d.ts +14 -0
- package/dist/fade-DXxFsgxR.mjs +22 -0
- package/dist/flip-CrCoNIws.mjs +49 -0
- package/dist/hooks/imagePreloadCache.d.ts +4 -0
- package/dist/hooks/mediaPreloadCache.d.ts +31 -0
- package/dist/hooks/useFirstSceneEnter.d.ts +65 -0
- package/dist/hooks/useImagePreloader.d.ts +31 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +12 -0
- package/dist/hooks/useSceneManager.d.ts +79 -0
- package/dist/index.d.ts +17 -0
- package/dist/media/VideoFrameRenderer.d.ts +48 -0
- package/dist/media/videoPlaybackOwnership.d.ts +63 -0
- package/dist/performance-monitor-AlOOwzY_.mjs +73 -0
- package/dist/public-api.d.ts +12 -0
- package/dist/rotate-BMEBKDk5.mjs +69 -0
- package/dist/scene-animation-registry-8b0m_IaZ.mjs +422 -0
- package/dist/shake-BV6SdR9O.mjs +171 -0
- package/dist/slide-DWmVtj0L.mjs +63 -0
- package/dist/special-DDz8BopB.mjs +224 -0
- package/dist/types/index.d.ts +552 -0
- package/dist/utils/animationHelpers.d.ts +15 -0
- package/dist/utils/debounce.d.ts +18 -0
- package/dist/utils/devLog.d.ts +16 -0
- package/dist/utils/dragTimelineMapping.d.ts +30 -0
- package/dist/utils/gestureDetector.d.ts +67 -0
- package/dist/utils/performanceMonitor.d.ts +66 -0
- package/dist/utils/styleConvert.d.ts +7 -0
- package/dist/utils/useIsomorphicLayoutEffect.d.ts +22 -0
- package/dist/utils/useStructurallyStableValue.d.ts +5 -0
- package/dist/zoom-CuAthpqd.mjs +63 -0
- package/package.json +171 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./scene-animation-registry-8b0m_IaZ.mjs";import{t as o}from"./drag-scene-engine-y8Wj9ivV.mjs";import{n as a,r as s,t as c}from"./element-track-Du10P12_.mjs";import{n as l,t as u}from"./performance-monitor-AlOOwzY_.mjs";import d,{Children as g,createContext as f,forwardRef as m,isValidElement as h,memo as p,useCallback as v,useContext as S,useEffect as y,useId as x,useImperativeHandle as b,useLayoutEffect as w,useMemo as P,useRef as I,useState as M,useSyncExternalStore as E}from"react";import{animate as R,motion as D,useAnimation as A,useMotionValue as k,useMotionValueEvent as C,useTransform as T}from"framer-motion";import{Fragment as L,jsx as O,jsxs as V}from"react/jsx-runtime";import{createPortal as z}from"react-dom";var N=class extends Error{constructor(e,t,n){super(t),this.code=e,this.permanent=n.permanent,this.category=n.category,this.presetName=n.presetName,this.cause=n.cause,this.name="PresetLoadError"}};function F(e){return e instanceof N}var B={fade:"fade","fade-in":"fade","fade-out":"fade","slide-up":"slide","slide-down":"slide","slide-left":"slide","slide-right":"slide","zoom-in":"zoom","zoom-out":"zoom","scale-up":"zoom","scale-down":"zoom",rotate:"rotate","rotate-in":"rotate","rotate-out":"rotate",spin:"rotate",flip:"flip","flip-x":"flip","flip-y":"flip",bounce:"bounce","bounce-in":"bounce","bounce-out":"bounce",blink:"blink",flash:"blink",pulse:"blink",shake:"shake","shake-x":"shake","shake-y":"shake",vibrate:"shake",jello:"shake","blur-in":"blur","blur-out":"blur","focus-in":"blur",elastic:"elastic","rubber-band":"elastic",wobble:"elastic",swing:"elastic",heartbeat:"special",tada:"special",wave:"special","roll-in":"special","roll-out":"special",hinge:"special","jack-in-the-box":"special"},j=["fade","slide","zoom","rotate","flip","bounce","blink","shake","blur","elastic","special"],$=new Map,W=new Map,H=new Map,q=new Map,Y=new Map,X={left:"0%",center:"50%",right:"100%"},U={top:"0%",center:"50%",bottom:"100%"},Z={center:"50% 50%","top center":"50% 0%","center top":"50% 0%","bottom center":"50% 100%","center bottom":"50% 100%","top left":"0% 0%","left top":"0% 0%","top right":"100% 0%","right top":"100% 0%","bottom left":"0% 100%","left bottom":"0% 100%","bottom right":"100% 100%","right bottom":"100% 100%","center left":"0% 50%","left center":"0% 50%","center right":"100% 50%","right center":"100% 50%"};function K(e,t){return Array.isArray(t)?t.map(t=>K(e,t)):t&&"object"==typeof t?_(t):"transformOrigin"===e&&"string"==typeof t?function(e){const t=e.trim().toLowerCase().replace(/\s+/g," "),n=Z[t];if(n)return n;const r=t.split(" ");if(1===r.length){const t=X[r[0]],n=U[r[0]];return t&&n?`${t} ${n}`:t?`${t} 50%`:n?`50% ${n}`:e}if(2===r.length){const[e,t]=r,n=X[e]??X[t],i=U[e]??U[t];if(n&&i)return`${n} ${i}`}return e}(t):t}function _(e){const t={};return Object.entries(e).forEach(([e,n])=>{t[e]=K(e,n)}),t}function G(e){return{initial:_(e.initial||{}),animate:_(e.animate||{}),exit:_(e.exit||{})}}var J=async e=>"string"==typeof e?await(async e=>G(await async function(e){const t=Y.get(e);if(t)throw t;const n=B[e];if(!n){const t=new N("INVALID_ANIMATION",`Unknown preset animation: ${e}`,{permanent:!0,presetName:e});throw Y.set(e,t),t}const r=(await function(e){const t=$.get(e);if(t)return Promise.resolve(t);const n=q.get(e);if(n)return Promise.reject(n);if(!function(e){return j.includes(e)}(e)){const t=new N("INVALID_ANIMATION",`Unknown animation category: ${e}`,{permanent:!0,category:e});return q.set(e,t),H.set(e,"failed-permanent"),Promise.reject(t)}const r=W.get(e);if(r)return r;H.set(e,"pending");const i=function(e,t){return new Promise((n,r)=>{const i=setTimeout(()=>{r(new N("ANIMATION_ASSET_LOAD_FAILED",`Timed out loading animation category "${t}".`,{permanent:!1,category:t}))},3e3);e.then(e=>{clearTimeout(i),n(e)},e=>{clearTimeout(i),r(e)})})}(async function(e){switch(e){case"fade":return(await import("./fade-DXxFsgxR.mjs")).fadeAnimations;case"slide":return(await import("./slide-DWmVtj0L.mjs")).slideAnimations;case"zoom":return(await import("./zoom-CuAthpqd.mjs")).zoomAnimations;case"rotate":return(await import("./rotate-BMEBKDk5.mjs")).rotateAnimations;case"flip":return(await import("./flip-CrCoNIws.mjs")).flipAnimations;case"bounce":return(await import("./bounce-B_QJxgOq.mjs")).bounceAnimations;case"blink":return(await import("./blink-BGmsrTwW.mjs")).blinkAnimations;case"shake":return(await import("./shake-BV6SdR9O.mjs")).shakeAnimations;case"blur":return(await import("./blur-CQoB_VWp.mjs")).blurAnimations;case"elastic":return(await import("./elastic-CBP_FdRv.mjs")).elasticAnimations;case"special":return(await import("./special-DDz8BopB.mjs")).specialAnimations;default:throw new N("INVALID_ANIMATION",`Unknown animation category: ${e}`,{permanent:!0,category:e})}}(e),e).then(t=>($.set(e,t),H.set(e,"success"),t)).catch(t=>{const n=function(e,t){return F(t)?t:new N("ANIMATION_ASSET_LOAD_FAILED",`Failed to load animation category "${e}".`,{permanent:!1,category:e,cause:t})}(e,t);throw H.set(e,n.permanent?"failed-permanent":"failed-transient"),n.permanent&&q.set(e,n),n}).finally(()=>{W.get(e)===i&&W.delete(e)});return W.set(e,i),i}(n))[e];if(r)return r;const i=new N("INVALID_ANIMATION",`Preset animation "${e}" is missing from category "${n}".`,{permanent:!0,category:n,presetName:e});throw Y.set(e,i),i}(e)))(e):"object"==typeof e?(e=>{if(!(e=>{if(!e||"object"!=typeof e)return!1;const t=new Set(["initial","animate","exit"]),n=Object.entries(e);return 0!==n.length&&!n.some(([e])=>!t.has(e))&&n.some(([,e])=>null!=e&&"object"==typeof e&&!Array.isArray(e)&&Object.keys(e).length>0)})(e))return null;try{return(e=>G({initial:e.initial??{},animate:e.animate??{},exit:e.exit??{}}))(e)}catch(e){return null}})(e):null,Q=e=>{const t={};return e.forEach(e=>{Object.assign(t,e)}),t},ee=async e=>{const t=[];for(let n=0;n<e.length;n++){const r=await J(e[n]);r&&t.push({variant:r,sourceIndex:n})}return t},te=e=>{const{transition:t,...n}=e.animate;return{values:n,transition:t||{}}},ne=e=>{const t={},n={};return e.forEach(({values:e,transition:r})=>{Object.entries(e).forEach(([e,i])=>{t[e]=i,n[e]=r})}),t.transition=n,t};async function re(e,t,n,r){if(!e)return null;try{const i=await(async e=>"object"==typeof e&&"mode"in e&&"animations"in e?await(async e=>{if(!(e=>!!(e&&"object"==typeof e&&e.mode&&["sequential","parallel"].includes(e.mode)&&Array.isArray(e.animations)&&0!==e.animations.length))(e))return null;try{const{mode:t,animations:n,delays:r=[]}=e;return"sequential"===t?await(async(e,t=[])=>{const n=await ee(e);if(0===n.length)throw new Error("No valid animations in sequential composition");const r=n[0].variant.initial,i=n[n.length-1].variant.exit;let o=0;const a=n.map(({variant:e,sourceIndex:n})=>{const r=t[n]||0,{values:i,transition:a}=te(e),s={...a,delay:o+r/1e3};return o+=("number"==typeof a.duration?a.duration:1)+r/1e3,{values:i,transition:s}});return{initial:r,animate:ne(a),exit:i}})(n,r):"parallel"===t?await(async(e,t=[])=>{const n=await ee(e);if(0===n.length)throw new Error("No valid animations in parallel composition");const r=n.map(({variant:e})=>e.initial),i=n.map(({variant:e,sourceIndex:n})=>{const r=t[n]||0,{values:i,transition:o}=te(e);return{values:i,transition:{...o,delay:r/1e3}}}),o=n.map(({variant:e})=>e.exit);return{initial:Q(r),animate:ne(i),exit:Q(o)}})(n,r):null}catch(e){if(F(e))throw e;return null}})(e):await J(e))(e);if(i)return i;const o=`Failed to parse ${n} animation for "${t}".`;r?.({code:"INVALID_ANIMATION",message:o,context:{componentId:t,animationType:n,animation:e}})}catch(i){const o=F(i)?{code:i.code,message:i.message,context:{componentId:t,animationType:n,animation:e,category:i.category,presetName:i.presetName}}:{code:"INVALID_ANIMATION",message:`Error parsing ${n} animation for "${t}".`,context:{componentId:t,animationType:n,animation:e}};r?.(o)}return null}function ie(e){return"string"==typeof e&&!e.includes("(")&&e.trim().includes(" ")}function oe(e,t,n){const r={};return new Set([...Object.keys(e),...Object.keys(t)]).forEach(i=>{if("transition"===i)return;const o=e[i],a=t[i];if(void 0===a)return void(r[i]=o);if(o===a)return void(r[i]=a);const s=void 0!==o?o:"opacity"===i?1:"number"==typeof a?0:"0";if(ie(s)||ie(a))r[i]=n>.5?a:s;else if("number"!=typeof a||"number"!=typeof s){if("number"==typeof s&&"string"==typeof a){if(a.includes("px"))return void(r[i]=`${s+((parseFloat(a)||0)-s)*n}px`);if(a.includes("%"))return void(r[i]=`${s+((parseFloat(a)||0)-s)*n}%`);if(a.includes("deg"))return void(r[i]=`${s+((parseFloat(a)||0)-s)*n}deg`)}if("string"==typeof s&&"number"==typeof a){if(s.includes("px")){const e=parseFloat(s)||0;return void(r[i]=`${e+(a-e)*n}px`)}if(s.includes("%")){const e=parseFloat(s)||0;return void(r[i]=`${e+(a-e)*n}%`)}if(s.includes("deg")){const e=parseFloat(s)||0;return void(r[i]=`${e+(a-e)*n}deg`)}}if("string"==typeof a&&"string"==typeof s){if(a.includes("px")||s.includes("px")){const e=parseFloat(s)||0;return void(r[i]=`${e+((parseFloat(a)||0)-e)*n}px`)}if(a.includes("%")||s.includes("%")){const e=parseFloat(s)||0;return void(r[i]=`${e+((parseFloat(a)||0)-e)*n}%`)}if(a.includes("deg")||s.includes("deg")){const e=parseFloat(s)||0;return void(r[i]=`${e+((parseFloat(a)||0)-e)*n}deg`)}if(a.includes("(")&&a.includes(")")||s.includes("(")&&s.includes(")")){const e=String(s).match(/([a-zA-Z]+)\(([^)]+)\)/),t=a.match(/([a-zA-Z]+)\(([^)]+)\)/);if(e&&t&&e[1]===t[1]){const o=e[1],a=e[2],s=t[2];if(!isNaN(parseFloat(a))&&!isNaN(parseFloat(s))){const e=parseFloat(a),t=e+(parseFloat(s)-e)*n;return void(r[i]=`${o}(${t})`)}}}}r[i]=n>.5?a:s}else r[i]=s+(a-s)*n}),r}function ae(e,t,n){for(let n=t;n>=0;n-=1){const t=e[n];if("number"==typeof t||"string"==typeof t)return t}return n}function se(e,t,n){return Math.min(n,Math.max(t,e))}function ce(e,t,n){return e+(t-e)*n}function le(e,t,n){if("number"==typeof e&&"number"==typeof t)return ce(e,t,n);const r=String(e),i=String(t),o=r.match(/^([-\d.]+)(.*)$/),a=i.match(/^([-\d.]+)(.*)$/);if(o&&a){const e=parseFloat(o[1]),t=parseFloat(a[1]),r=a[2]||o[2]||"",i=ce(e,t,n);return r?`${i}${r}`:i}const s=r.match(/^([a-zA-Z]+)\(([-\d.]+)(.*)\)$/),c=i.match(/^([a-zA-Z]+)\(([-\d.]+)(.*)\)$/);if(s&&c&&s[1]===c[1]){const e=parseFloat(s[2]),t=parseFloat(c[2]),r=c[3]||s[3]||"",i=ce(e,t,n);return`${c[1]}(${i}${r})`}return n>=1?t:e}function ue(e,t,n,r,i){const o=t[n]??r,a=se(i,0,1);if(!Array.isArray(o))return le(e,o,a);if(0===o.length)return e;const s=function(e,t,n){const r=e.transition,i=r?.[t],o=(i&&!Array.isArray(i)?i.times:null)??r?.times;return Array.isArray(o)&&o.length===n?o:null}(t,n,o.length);if(1===o.length||a<=(s?.[0]??0))return ae(o,0,e);for(let t=1;t<o.length;t+=1){const n=s?.[t]??t/(o.length-1);if(a>n)continue;const r=s?.[t-1]??(t-1)/(o.length-1),i=n-r,c=i<=0?1:(a-r)/i;return le(ae(o,t-1,e),ae(o,t,e),c)}return ae(o,o.length-1,e)}function de(e,t,n){const r=e[t]??n;return Array.isArray(r)?ae(r,r.length-1,n):r}function ge(e,t){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){const t=parseFloat(e);if(Number.isFinite(t))return t}return t}function fe(e,t){switch(e){case"opacity":return"initial"===t||"exit"===t?0:1;case"scale":return 1;case"filter":return"none";default:return 0}}function me(e,t,n){const r=e[t];return void 0===r?n:r}function he(e,t,n,r){return T(e,e=>r(e,t.current,n))}function pe(e,t,n,r,i){return T(e,e=>{const o=ge(fe(n,"animate"),0);return ge((i??r)(e,t.current,n),o)})}function ve(e,t,n,r){const i=pe(e,t,"opacity",n,r),o=he(e,t,"x",n),a=he(e,t,"y",n),s=pe(e,t,"scale",n,r),c=he(e,t,"rotate",n),l=he(e,t,"rotateX",n),u=he(e,t,"rotateY",n),d=he(e,t,"skewX",n),g=he(e,t,"skewY",n),f=he(e,t,"filter",n);return{style:{opacity:i,x:o,y:a,scale:s,rotate:c,rotateX:l,rotateY:u,skewX:d,skewY:g,filter:f},opacity:i,x:o,y:a,scale:s,rotate:c,rotateX:l,rotateY:u,skewX:d,skewY:g,filter:f}}var Se=.001;function ye(e){return e.renderProgressMotion?.get()??e.renderProgress??0}function xe(e){return e.dragTransaction?e.dragTransaction:!0===e.firstSceneEnterActive?e.preparedSnapshot??null:null}function be(e){return xe(e)?.registrySnapshot.timelineDuration??e.getTimelineDuration?.()??e.sceneTransitionDuration}function we(e,t,n,r,i,o){const a=function(e,t,n,r){const i=function(e){return ye(e)>=0?"forward":"backward"}(e),o=function(e){return Math.max(0,e.sharedElapsedMotion?.get()??0)}(e),a=function(e){const t=e.dragTimelineProgress;return se("number"==typeof t?t:Math.abs(ye(e)),0,1)}(e),s=function(e){const t=be(e);if(xe(e))return t;const n=e.sharedTimelineDurationMs??0;return n>0?n:t}(e),c=be(e),l=Math.abs(ye(e)),u=function(e,t,n){return n<=0?e>=t-Se?1:0:e<=t?0:se((e-t)/n,0,1)}(o,t,n),d={direction:i,transitionProgress:a,sharedElapsedMs:o,projectedSceneElapsedMs:o,sharedTimelineDurationMs:s,sceneTimelineDurationMs:c,sceneOffset:e.sceneOffset};if(0===e.sceneOffset&&e.isActive){const t=!0===e.firstSceneEnterActive||"settle"===e.dragRelease?.mode||"enter"===e.dragRelease?.mode;if(e.isDragging||l>Se){if(l<=Se&&t)return{...d,mode:"enter",localProgress:u};const n=Math.max(r,1),i=l*e.sceneTransitionDuration;return{...d,mode:"outgoing",localProgress:se(i/n,0,1)}}return t?{...d,mode:"enter",localProgress:u}:{...d,mode:"rest",projectedSceneElapsedMs:c,localProgress:1}}return("forward"===i&&1===e.sceneOffset||"backward"===i&&-1===e.sceneOffset)&&(e.isDragging||l>Se)?{...d,mode:"enter",localProgress:u}:{...d,mode:"hidden",projectedSceneElapsedMs:0,localProgress:0}}(e,t,n,r);return o?{...a,mode:"hidden",localProgress:0,projectedSceneElapsedMs:0}:i?{...a,mode:"rest",localProgress:1,projectedSceneElapsedMs:a.sceneTimelineDurationMs}:a}function Pe(e,t,n){return e?function(e,t,n){const r=de(t.enterInitial,n,fe(n,"initial")),i=de(t.enterAnimate,n,fe(n,"animate"));switch(e.mode){case"rest":default:return i;case"hidden":return r;case"enter":return ue(r,t.enterAnimate,n,fe(n,"animate"),e.localProgress);case"outgoing":return 0===Object.keys(t.exitTarget).length?i:"forward"===e.direction?ue(i,t.exitTarget,n,fe(n,"exit"),e.localProgress):ue(r,t.enterAnimate,n,fe(n,"animate"),1-e.localProgress)}}(e,t,n):de(t.enterAnimate,n,fe(n,"animate"))}var Ie=f(null),Me=({designSize:e,children:t})=>{const n=function(e){return void 0===e?750:Number.isFinite(e)&&e>0?e:(String(e),750)}(e),[r,i]=M(typeof window<"u"?window.innerWidth:750),o=P(()=>r/n,[r,n]),a=v(e=>e*o,[o]);y(()=>{if(typeof window>"u")return;const{debounced:e,cancel:t}=function(){let e=null;return{debounced:function(...t){e&&clearTimeout(e),e=setTimeout(()=>{(()=>{i(window.innerWidth)})(...t),e=null},150)},cancel:()=>{e&&(clearTimeout(e),e=null)}}}();return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),t()}},[]);const s=P(()=>({scale:o,convert:a}),[o,a]),c=P(()=>({"--cineview-unit":`${o}px`}),[o]);return O(Ie.Provider,{value:s,children:O("div",{className:"cineview-responsive-container",style:c,children:t})})},Ee=()=>S(Ie),Re=f(null);function De(){return S(Re)}var Ae=new WeakMap,ke=new WeakMap;function Ce(e,t){return"entered"===e&&t}function Te(e,t,n,r){return void 0===e?t:n+(r-n)*se(e,0,1)}function Le(e,t,n){return le(me(t.initial,n,fe(n,"initial")),me(t.animate,n,fe(n,"animate")),e)}function Oe(e,t,n){const r=ge(fe(n,"animate"),0),i=ge(me(t.initial,n,fe(n,"initial")),r);return i+(ge(me(t.animate,n,fe(n,"animate")),r)-i)*e}function Ve(e,t){switch(e){case"hidden":default:return"idle";case"outgoing":return"exiting";case"rest":return"entered";case"enter":return t>=.999?"entered":"entering"}}function ze(e){return e<=0?0:e>=1?1:e}function Ne(e,t){return{enterProgress:ze(t),phase:e}}function Fe(e,t){const n=t<=0?0:t>=1?1:t;return{enterProgress:n,phase:Ve(e,n)}}var Be={enterProgress:0,phase:"idle"};function je({signedVisual:e,phaseMotion:t,render:n}){const[r,i]=M(()=>Ne(t.get(),e.get()));return C(e,"change",e=>{i(Ne(t.get(),e))}),C(t,"change",t=>{i(Ne(t,e.get()))}),O(L,{children:n(r)})}function $e({visualState:e,render:t}){const[n,r]=M(()=>{const t=e.get();return t?Fe(t.mode,t.localProgress):Be});return C(e,"change",e=>{r(e?Fe(e.mode,e.localProgress):Be)}),O(L,{children:t(n)})}function We(e){if("string"==typeof e){const t=D[e];if(t)return t}return D.div}function He(e,t,n){return"last"===n?t-1-e:"center"===n?Math.abs(e-(t-1)/2):e}function qe(e){return g.toArray(e.props.children).filter(h)}function Ye(e){return qe(e).length}function Xe(e,t,n,r,i,o="animate"){const a=e[o]?.transition?.duration,s="number"==typeof a&&Number.isFinite(a)?Math.max(1e3*a,0):Math.max(t,0),c=Math.max(n,0);let l=0;for(let e=0;e<i;e+=1)l=Math.max(l,He(e,i,r));const u=l*c;return{itemDurationMs:s,tailDurationMs:u,effectiveDurationMs:Math.max(t,u+s)}}function Ue(e,t,n,r,i){return Xe(e,t??0,n,r,Ye(i)).effectiveDurationMs}function Ze(e,t){const n=t(e.get()),r=I(n),[i,o]=M(()=>({phase:n,revision:0}));return C(e,"change",e=>{const n=t(e);n!==r.current&&(r.current=n,o(e=>({phase:n,revision:e.revision+1})))}),[i.phase,i.revision]}function Ke(e,t,n=0){const r=I(Math.max(t,0)),[i,o]=M(null);return y(()=>{r.current=Math.max(t,0)},[t]),y(()=>{if("animate"!==e)return;const t=r.current;if(0===t)return void o(n);const i=window.setTimeout(()=>o(n),t);return()=>window.clearTimeout(i)},[e,n]),"animate"===e&&i===n}function _e(e,t,n,r,i,o,a,s,c=!1){const l=g.toArray(e.props.children),u=qe(e).length,d=Math.max(n,0)/1e3,f="boolean"==typeof i?i?"animate":"initial":i,m=t.animate.transition??{},p={initial:t.initial,animate:e=>({...t.animate,transition:c?{...m,duration:0,delay:0}:{...m,...void 0===m.duration&&void 0!==o?{duration:Math.max(o,0)/1e3}:{},delay:He(e,u,r)*d}}),exit:e=>{const n=a?.exit??t.initial,i=n.transition??{};return{...n,transition:{...i,...void 0===i.duration&&void 0!==s?{duration:Math.max(s,0)/1e3}:{},delay:He(e,u,r)*d}}}};let v=0;const S=l.map((e,t)=>{if(!h(e))return e;const n=v;v+=1;const r=We(e.type);return O(r,{custom:n,variants:p,className:e.props.className,style:e.props.style,children:e.props.children},e.key??t)}),y=We(e.type),{children:x,...b}=e.props;return O(y,{...b,initial:"initial",animate:f,variants:{initial:{},animate:{},exit:{}},children:S})}function Ge({container:e,variant:t,each:n,from:r,itemDurationMs:i,effectiveDurationMs:o,exitVariant:a,exitItemDurationMs:s,signedVisual:c}){const[l,u]=Ze(c,e=>e>0?"animate":e<0&&a?"exit":"initial");return _e(e,t,n,r,l,i,a,s,Ke(l,o??Ue(t,i,n,r,e),u))}function Je({container:e,variant:t,each:n,from:r,itemDurationMs:i,effectiveDurationMs:o,phaseMotion:a,staticReveal:s}){const[c,l]=Ze(a,e=>"entering"===e||"entered"===e?"animate":"initial"),u=Ke(c,o??Ue(t,i,n,r,e),l);return _e(e,t,n,r,c,i,void 0,void 0,s||u)}function Qe({container:e,variant:t,each:n,from:r,itemDurationMs:i,effectiveDurationMs:o,exitVariant:a,exitItemDurationMs:s,visualState:c}){const[l,u]=Ze(c,e=>"outgoing"===e?.mode&&a?"exit":e&&("enter"===e.mode&&e.localProgress>0||"rest"===e.mode)?"animate":"initial");return _e(e,t,n,r,l,i,a,s,Ke(l,o??Ue(t,i,n,r,e),u))}var et=f(null);function tt({value:e,children:t}){return O(et.Provider,{value:e,children:t})}function nt(){const e=S(et);if(!e)throw new Error("useAnimateTimeline must be used inside an <Animate> child.");return e}var rt=Object.freeze({progress:0,signedProgress:0,phase:"idle",source:"idle"});function it(e,t){if(!t)return"idle";switch(e?.dragTransaction?.phase){case"driving":return"gesture";case"settling":case"bouncing":return"continuation";case"programmatic":return"programmatic"}return"settle"===e?.dragRelease?.mode||"bounce"===e?.dragRelease?.mode?"continuation":"enter"===e?.dragRelease?.mode||e?.firstSceneEnterActive?"programmatic":"idle"}var ot=f(null),at=f(null),st=f(null);function ct(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function lt(e,t,n,r){if(Object.is(e,t))return!0;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1}else if(!ct(e)||!ct(t))return!1;const i=e,o=t,a=n.get(i),s=r.get(o);if(a||s)return a===o&&s===i;n.set(i,o),r.set(o,i);try{if(Array.isArray(e)&&Array.isArray(t))return e.every((e,i)=>lt(e,t[i],n,r));const i=e,o=t,a=Object.keys(i).sort(),s=Object.keys(o).sort();if(a.length!==s.length)return!1;for(let e=0;e<a.length;e+=1){const t=a[e];if(t!==s[e]||!lt(i[t],o[t],n,r))return!1}return!0}finally{n.delete(i),r.delete(o)}}function ut(e){const t=I(e);return lt(t.current,e,new WeakMap,new WeakMap)||(t.current=e),t.current}var dt=f(null),gt=Object.freeze({opacity:1}),ft=0,mt=({enterAnimation:e,exitAnimation:t,loopAnimation:n,animateId:r,duration:i,timeline:o,visibility:a,stagger:s,enterRef:c,exitRef:l,children:u})=>{const d=I(r||"animate-"+ ++ft).current,g=S(dt),f=De(),m=f?.reportError,p=!0===f?.prefersReducedMotion,x=S(ot),b=S(st),[w,E]=M(null),[C,T]=M(null),[L,V]=M(null),[z,N]=M(0),F=I(0),B=I(null),j=I(new Set),$=I(null),W=I(new Set),H=ut(e),q=ut(t),Y=ut(n),X=A(),U=A(),Z=P(()=>function({duration:e,timeline:t,visibility:n}){return{duration:{enter:e?.enter??600,exit:e?.exit??600},timeline:{driver:t?.driver??"scene",delay:t?.delay??0,after:t?.after,phase:{start:t?.phase?.start,end:t?.phase?.end}},visibility:{replay:n?.replay??!0,enterMargin:n?.enterMargin,exitMargin:n?.exitMargin}}}({duration:i,timeline:o,visibility:a}),[i,o,a]),K=g?.mode??f?.mode??"drag",_="drag"===K&&"clock"===Z.timeline.driver,G=I(null),J="drag"===K&&g?.isActive?g.activationToken??0:0;(null===G.current||G.current.mode!==K||G.current.token!==J||0===J&&G.current.arrival!==_)&&(G.current={token:J,mode:K,arrival:_});const Q="drag"===K&&G.current.arrival,ee=g?.beginPreparation,te=g?.declareAnimateLane,ne=P(()=>{const{driver:e,...t}=Z.timeline;return{...t,lane:"scroll"===K&&"scene"===e&&b?"scroll":"visibility"}},[b,K,Z.timeline]),ie=Z.duration.enter,oe=Z.duration.exit,ae=ne.delay,ce=ne.after,le=S(at),ge=Q&&g?.isActive?g.activationToken??0:0,me=z>0&&B.current?.enterAnimation===H&&B.current?.exitAnimation===q&&B.current?.loopAnimation===Y,he=I(null),pe=he.current;Q&&(0===ge||null===pe||pe.token!==ge)&&(he.current={token:ge,ready:me,enterVariant:me?w:null,exitVariant:me?C:null,infiniteVariant:me?L:null,hasAuthoredEnterAnimation:!!H,enterDuration:ie,exitDuration:oe,delay:ae,stagger:s,enterAnimation:H,exitAnimation:q,loopAnimation:Y});const Se=Q?he.current:null;Se&&!Se.ready&&z>0&&B.current?.enterAnimation===Se.enterAnimation&&B.current?.exitAnimation===Se.exitAnimation&&B.current?.loopAnimation===Se.loopAnimation&&(Se.ready=!0,Se.enterVariant=w,Se.exitVariant=C,Se.infiniteVariant=L);const be=Se?Se.enterAnimation:H,Ie=Se?Se.exitAnimation:q,Me=Se?Se.loopAnimation:Y,Re=Se?.ready?Se.enterVariant:Q?null:w,Ne=Se?.ready?Se.exitVariant:Q?null:C,Fe=Se?.ready?Se.infiniteVariant:Q?null:L,We=Se?.enterDuration??ie,He=Se?.exitDuration??oe,qe=Se?.delay??ae,Ue=Se?Se.stagger:s;y(()=>{if(!Q)return;const e=te?.(d,"visibility");return()=>e?.dispose()},[te,d,Q]),y(()=>{if(!Q)return;const e=(e,t)=>{const n=`${d}:${e}`;j.current.has(n)||(j.current.add(n),m?.({code:"INVALID_ANIMATION",message:t,context:{componentId:d,field:e,lane:"visibility",mode:"drag"}}))};ce&&e("after",`Animate "${d}" ignores after in drag mode when timeline.driver is 'clock'.`),q&&e("exitAnimation",`Animate "${d}" ignores exitAnimation in drag mode when timeline.driver is 'clock'.`)},[d,Q,ce,m,q]);const Ze="function"==typeof u,Ke=!(!be&&!Me||(Q?Se?.ready??me:me)||Re||Ne||Fe),_e="drag"===K?!Q:"scroll"===ne.lane,et="scroll"===K&&!_e,nt=I(new Set);y(()=>{if(!c&&!l)return;const e=(e,t)=>{const n=`${d}:${e}`;nt.current.has(n)||(nt.current.add(n),m?.({code:"INVALID_ANIMATION",message:t,context:{componentId:d,field:e,mode:K,scrub:_e}}))};if(_e){const t="drag"===K?"the Scene element track (drag)":"the zone scroll budget (scroll takeover)";return c&&e("enterRef",`Animate "${d}" ignores enterRef: this element is driven by ${t}, whose progress has a single owner. Use timeline.driver:'clock' (drag) or move it outside the takeover zone (scroll) for manual control.`),void(l&&e("exitRef",`Animate "${d}" ignores exitRef: this element is driven by ${t}, whose progress has a single owner. Use timeline.driver:'clock' (drag) or move it outside the takeover zone (scroll) for manual control.`))}Q&&l&&e("exitRef",`Animate "${d}" ignores exitRef in drag mode when timeline.driver is 'clock': this lane has no exit pass (it also ignores exitAnimation).`)},[c,l,d,Q,_e,K,m]);const ct=Q?Ue:s,lt=ct&&!Ze&&Re&&h(u)?u:null,mt=!!lt,ht=ct?.each??40,pt=ct?.from??"first",vt=P(()=>lt&&Re?Xe(Re,We,ht,pt,Ye(lt)):null,[We,Re,lt,ht,pt]),St=P(()=>lt&&Ne?Xe(Ne,He,ht,pt,Ye(lt),"exit"):null,[He,Ne,lt,ht,pt]),yt=vt?.effectiveDurationMs??We,xt=St?.effectiveDurationMs??He,bt=P(()=>x?{...x,zoneStates:le?.zoneStates??{},store:le?.store}:null,[x,le?.store,le?.zoneStates]);y(()=>{const e=W.current,t=++F.current,n=()=>F.current===t;$.current?.lease.cancel(),$.current=null;const r="drag"!==K||Q?void 0:ee?.();r&&e.add(r),$.current=r?{generation:t,lease:r}:null;const i=e=>{n()&&m?.(e)};return E(null),T(null),V(null),N(0),be||Me?((async()=>{const[e,n,r]=await Promise.all([re(be,d,"enter",i),re(Ie,d,"exit",i),re(Me,d,"loop",i)]);F.current===t&&(B.current={enterAnimation:be,exitAnimation:Ie,loopAnimation:Me},E(e??null),T(n??null),V(r??null),N(t))})(),()=>{e.forEach(e=>e.cancel()),e.clear(),n()&&(F.current+=1)}):(m?.({code:"INVALID_ANIMATION",message:`Animate "${d}" requires enterAnimation or loopAnimation.`,context:{componentId:d,hasExitAnimation:!!Ie}}),(()=>{const n=$.current;!n||n.generation!==t||(n.lease.complete(),e.delete(n.lease),$.current=null)})(),()=>{e.forEach(e=>e.cancel()),e.clear(),n()&&(F.current+=1)})},[d,K,Q,m,ee,be,Ie,Me]),y(()=>{!Q||0===ge||!Se||(Se.enterAnimation!==H||Se.exitAnimation!==q||Se.loopAnimation!==Y)&&Promise.all([re(H,d,"enter"),re(q,d,"exit"),re(Y,d,"loop")])},[Se,ge,d,Q,H,q,Y]);const wt=function({sceneContext:e,enterVariant:t,exitVariant:n,componentId:r,delay:i,enterDuration:o,exitDuration:a,after:s,variantsPending:c=!1}){const l=e?xe(e):null,u=l?.registrySnapshot.registrations.get(r),d=l?.enterVariantsByAnimateId.get(r)??null,g=!(!l||u&&d),f=u?.duration??o,m=l?.registrySnapshot.calculatedDelays.get(r)??0,h=d??t,p=I(m),v=I(l);v.current=l;const S=I({enterInitial:h?.initial||{},enterAnimate:h?.animate||{},exitTarget:n?.exit||{}}),x=e?we(e,p.current,f,a,g,c):null,b=x?"outgoing"===x.mode?("forward"===x.direction?1:-1)*x.localProgress:x.localProgress:0,w=k(b),P=k(x),[E,R]=M(!1),D=(I(null),I(null)),A=I(null);I({identity:null,categories:new Set}),y(()=>{},[r,i,o,t,d,u,g,l,e?.isActive,e?.sceneOffset,s]),y(()=>{S.current={enterInitial:h?.initial||{},enterAnimate:h?.animate||{},exitTarget:n?.exit||{}},l&&(p.current=m)},[n,m,l,h]),y(()=>{const n=e?.registerAnimate,a=e?.unregisterAnimate,c=e?.getCalculatedDelay;if(!n||!c||!t)return;const l=n(r,{delay:i,duration:o,after:s,lane:"drag"});return l?.setEnterVariant?.(t),v.current||(p.current=l?.getCalculatedDelay?.()??c(r)),()=>{l?.dispose?l.dispose():a?.(r)}},[e?.registerAnimate,e?.unregisterAnimate,e?.getCalculatedDelay,t,r,i,o,s]),y(()=>{if(!e)return;const t=()=>{if(l)p.current=m;else{const t=e.getCalculatedDelay?.(r);"number"==typeof t&&(p.current=t)}const t=we(e,p.current,f,a,g,c),n="outgoing"===t.mode?("forward"===t.direction?1:-1)*t.localProgress:t.localProgress,i=[t.mode,t.direction,e.sceneOffset,e.isActive?"active":"inactive",e.isDragging?"dragging":"idle"].join(":"),o=D.current!==i;if(w.set(n),P.set(t),D.current=i,o&&(t.mode,t.direction,e.sceneOffset,e.isActive,e.isDragging,e.sceneState,ye(e).toFixed(3),t.transitionProgress.toFixed(3),t.sharedElapsedMs.toFixed(1),t.projectedSceneElapsedMs.toFixed(1),t.sharedTimelineDurationMs,t.sceneTimelineDurationMs,t.localProgress.toFixed(3),p.current),"enter"===t.mode){const n=t.localProgress<=.001?"before-delay":t.localProgress>=.999?"enter-complete":"enter-active";A.current!==`${t.mode}:${n}`&&(t.mode,t.sharedElapsedMs.toFixed(1),t.projectedSceneElapsedMs.toFixed(1),t.sharedTimelineDurationMs,t.sceneTimelineDurationMs,t.transitionProgress.toFixed(3),p.current,t.localProgress.toFixed(3),ye(e).toFixed(3),e.sceneOffset,A.current=`${t.mode}:${n}`)}};t();const n=[e.sharedElapsedMotion?.on("change",t),e.renderProgressMotion?.on("change",t)].filter(e=>"function"==typeof e);return()=>{n.forEach(e=>e())}},[e,w,P,r,o,a,g,c,m,f,l,e?.renderProgressMotion,e?.renderProgress,e?.isDragging,e?.isActive,e?.sceneOffset,e?.sceneState,e?.dragRelease,e?.firstSceneEnterActive]);const C=ve(P,S,Pe);return y(()=>{if(!e)return void R(!1);const t=()=>{const t=we(e,p.current,f,a,g,c);R(e.isActive&&0===e.sceneOffset&&!e.isDragging&&("rest"===t.mode||"enter"===t.mode)&&t.localProgress>=.999)};t();const n=[e.sharedElapsedMotion?.on("change",t),e.renderProgressMotion?.on("change",t)].filter(e=>"function"==typeof e);return()=>{n.forEach(e=>e())}},[e,f,g,c,a,e?.isActive,e?.sceneOffset,e?.isDragging,e?.renderProgressMotion,e?.renderProgress,e?.dragRelease,e?.firstSceneEnterActive]),{style:C.style,opacity:C.opacity,x:C.x,y:C.y,scale:C.scale,rotate:C.rotate,useInteractiveStyles:!0,shouldRunInfinite:E,visualState:P}}({sceneContext:"drag"!==K||Q?null:g,enterVariant:w,exitVariant:C,componentId:d,delay:ae,enterDuration:yt,exitDuration:xt,after:ce,variantsPending:Ke}),Pt=function({enabled:e,sceneContext:t,enterVariant:n,hasAuthoredEnterAnimation:r,parseReady:i,delay:o,enterDuration:a,enterRef:s}){const c=I({initial:{},animate:{}}),l=!!s&&o<=0,u=I({delay:o,enterDuration:a,hasAuthoredEnterAnimation:r,parseReady:i,enterVariant:n,autoEnterSuppressed:l});u.current={delay:o,enterDuration:a,hasAuthoredEnterAnimation:r,parseReady:i,enterVariant:n,autoEnterSuppressed:l};const d=k(r?0:1),g=k(r?"idle":"entered"),[f,m]=M(!1),[h,p]=M(!1),S=I(null),x=I(null),b=I(0),w=I(0),P=I(null),E=I(!1),D=I(0===(t?.activationToken??0)),A=I(t);A.current=t;const C=v(()=>{S.current?.stop(),S.current=null,null!==x.current&&(clearTimeout(x.current),x.current=null)},[]),T=v(()=>{const e=u.current;C(),b.current=0,w.current=0,P.current=null,E.current=!1,m(!1),p(!1),g.set(e.hasAuthoredEnterAnimation?"idle":"entered"),d.set(e.hasAuthoredEnterAnimation?0:1)},[g,C,d]),L=v((e,t)=>{const n=A.current,r=u.current;if(!n?.isActive||(n.activationToken??0)!==e||e<=0)return;if(r.hasAuthoredEnterAnimation&&!r.parseReady)return void(w.current=e);if(b.current===e)return;w.current=0,b.current=e,C(),P.current=null,m(!1),c.current={initial:r.enterVariant?.initial??{},animate:r.enterVariant?.animate??{}};const i="static"===t&&D.current;p(i);const o=()=>{const t=A.current;return!(!t?.isActive||(t.activationToken??0)!==e)},a=()=>{o()&&m(!0)};if(!r.hasAuthoredEnterAnimation||null===r.enterVariant||i)return g.set("entered"),d.set(1),void(()=>{const e=Math.max(r.delay,0);e<=0?a():x.current=setTimeout(()=>{x.current=null,a()},e)})();g.set("waiting"),d.set(0);const s=()=>{if(x.current=null,!o())return;g.set("entering");const e=Math.max(r.enterDuration,0);if(e<=0)return g.set("entered"),d.set(1),void m(!0);S.current=R(d,1,{duration:e/1e3,ease:"easeInOut",onComplete:()=>{S.current=null,o()&&(g.set("entered"),d.set(1),m(!0))}})},l=Math.max(r.delay,0);if(r.autoEnterSuppressed)return P.current=s,void(E.current&&(E.current=!1,P.current=null,s()));l>0?x.current=setTimeout(s,l):s()},[g,C,d]),O=e&&t?.isActive?t.activationToken??0:0,V=t?.activationKind??null;y(()=>{O<=0?T():L(O,V)},[V,O,T,L]),y(()=>{const e=w.current;e<=0||!i||L(e,A.current?.activationKind??null)},[n,i,L]),y(()=>()=>{C(),b.current=0,w.current=0},[C]);const z=v(()=>{const e=P.current;e?(P.current=null,E.current=!1,null!==x.current&&(clearTimeout(x.current),x.current=null),e()):E.current=!0},[]);return y(()=>{if(s&&e)return s.current=z,()=>{s.current===z&&(s.current=null)}},[e,s,z]),{style:ve(d,c,Le,Oe).style,visualMotion:d,phaseMotion:g,shouldRunInfinite:f,staticReveal:h}}({enabled:Q,sceneContext:"drag"===K?g:null,enterVariant:Re,hasAuthoredEnterAnimation:Se?.hasAuthoredEnterAnimation??!!e,parseReady:Se?.ready??z>0,delay:qe,enterDuration:yt,enterRef:Q?c:void 0}),It=function({sceneContext:e,zoneRuntime:t,zoneId:n,enterVariant:r,exitVariant:i,hasAuthoredEnterAnimation:o,hasAuthoredExitAnimation:a,hasInfiniteAnimation:s=!1,componentId:c,duration:l,timeline:u,visibility:d,globalEnterMargin:g,globalExitMargin:f,enterRef:m,exitRef:h,variantsPending:p=!1}){const S=l.enter,x=l.exit,b=!0===De()?.prefersReducedMotion,w=b?0:S,P=b?0:x,E=u.delay,D=u.after,A="scroll"===u.lane,C=u.phase?.start,T=u.phase?.end,L=d.replay,O=Ee()?.scale??1,V=d.enterMargin??g??50,z=d.exitMargin??f??50,N=Math.max(0,V*O),F=Math.max(0,z*O),B=I({enterInitial:{},enterAnimate:{},exitTarget:{}}),j=k(0),$=k(n&&t?t.store?.getKeySnapshot(n)??t.zoneStates[n]??null:null),[W,H]=M(!1),q=I(null),[Y,X]=M(0),U=t?.registerZoneAnimation,Z=t?.unregisterZoneAnimation,K=!!(r?.animate&&Object.keys(r.animate).length>0)||!!o,_=function(e,t){return!!(t>0&&e?.exit&&Object.keys(e.exit).length>0)}(i,x)||!!a;y(()=>{B.current={enterInitial:r?.initial||{},enterAnimate:r?.animate||{},exitTarget:i?.exit||{}}},[r,i]);const G=I("idle"),J=k("idle"),Q=v(e=>{G.current=e,J.set(e)},[J]),ee=I(null),te=I(null),ne=I(0),re=I(!1),ie=I(null),oe=I(null),ae=I(null),ce=I(()=>{}),le=I(0),ge=I(null),me=I(!1),he=I(!1),pe=I(!1),Se=v(()=>t&&n?t.store?.getKeySnapshot(n)??t.zoneStates[n]??null:null,[n,t]);y(()=>{if(!A||!t||!n)return void $.set(null);const e=()=>{$.set(Se())};return e(),t.store?.subscribeKey(n,e)},[A,Se,n,t,$]);const ye=!!m&&!A&&!(D||E>0),xe=!!h&&!A,be=I(!1),we=I(!1),Pe=v(e=>{e?.publishEnterCompleted()},[]),Ie=v(()=>{le.current+=1,ge.current=null,ie.current&&(clearTimeout(ie.current),ie.current=null),oe.current&&(oe.current(),oe.current=null),ae.current&&(ae.current(),ae.current=null)},[]),Me=v(()=>{ne.current+=1,te.current&&(te.current.stop(),te.current=null),Ie()},[Ie]),Re=v(()=>{const e=q.current?.ownerDocument?.defaultView;e&&(ae.current?.(),ae.current=function(e,t){let n=ke.get(e);if(!n){const t=e.requestAnimationFrame?.bind(e)??(t=>e.setTimeout(()=>t(Date.now()),16)),r=e.cancelAnimationFrame?.bind(e)??(t=>e.clearTimeout(t));n={callbacks:new Map,frame:null,requestFrame:t,cancelFrame:r},ke.set(e,n)}const r=n,i=r.callbacks.get(t)??{callback:t,cancelled:!1};return r.callbacks.set(t,i),null===r.frame&&(r.frame=r.requestFrame(()=>{r.frame=null;const t=[...r.callbacks.values()];r.callbacks.clear(),t.forEach(e=>{e.cancelled||e.callback()}),0===r.callbacks.size&&null===r.frame&&ke.get(e)===r&&ke.delete(e)})),()=>{i.cancelled=!0,r.callbacks.get(t)===i&&r.callbacks.delete(t),0===r.callbacks.size&&null!==r.frame&&(r.cancelFrame(r.frame),r.frame=null,ke.get(e)===r&&ke.delete(e))}}(e,()=>{ae.current=null,ce.current()}))},[]),Le=v(()=>{Ie(),Q("entering"),j.get()<0&&j.set(0);const e=ee.current,t=++ne.current,n=R(j,1,{duration:Math.max(w,0)/1e3,ease:"easeInOut",onComplete:()=>{ne.current===t&&(te.current=null,Q("entered"),Pe(e),Re())}});te.current=n},[Ie,w,Pe,Re,Q,j]),Oe=v((e=!1)=>{const t=G.current,n="exited"===t?"exited":"exiting"===t?"exiting":"idle";Me();const r={token:++le.current,origin:n,dependencyReady:!D,delayStarted:!1,delayReady:!1,coldStartBypass:e};ge.current=r,Q("waiting"),H(!1);const i=e=>{ge.current?.token!==r.token||"pending"===e.kind||(r.dependencyReady=!0,oe.current=null,Re())};if(!D)return;const o=ee.current;o?oe.current=o.observeAfter(i):i({kind:"invalid",leaderId:D,reason:"missing"})},[Re,Q,Me,D]),Ve=v(()=>{const e=ge.current;if(e&&e.dependencyReady){if(!e.delayStarted){if(e.delayStarted=!0,E>0){const t=e.token;return void(ie.current=setTimeout(()=>{ie.current=null,ge.current?.token===t&&(e.delayReady=!0,Re())},E))}e.delayReady=!0}e.delayReady&&Le()}},[E,Le,Re]),ze=v(()=>{Me(),Q("exiting"),H(!1),j.get()>=0&&j.set(-1e-6);const e=++ne.current,t=R(j,-1,{duration:Math.max(P,0)/1e3,ease:"easeInOut",onComplete:()=>{ne.current===e&&(te.current=null,Q("exited"))}});te.current=t},[P,Me,Q,j]),Ne=v(t=>{if(A||p)return;const n=q.current;if(!(n instanceof HTMLElement))return;const r=e?.firstSceneEnterGateKnown,i=e?.firstSceneEnterReady,o=e?.firstSceneEnterActive;if(!1===r)return Me(),Q("idle"),j.set(0),void H(!1);if(!1===i&&!0===o)return he.current=!1,Me(),Q("idle"),j.set(0),void H(!1);const a=!1===i&&!1===o&&!he.current&&!ye;a&&(he.current=!0,me.current=!0,Me(),Q("entered"),j.set(1),Pe(ee.current));const s=n.getBoundingClientRect();if(!(s.width>0||s.height>0||s.bottom!==s.top))return;const c=n.closest('[data-cineview-container="true"]'),l=t?.top??(c?c.getBoundingClientRect().top:0),u=(t?.height??c?.clientHeight??0)||window.innerHeight||1,d=s.top-l,g=s.bottom-l,f=Math.max(s.height,g-d,0)>u-N,m=f?d<=u/2:d>=0&&g<=u-N,h=f?g<=.7*u:d<=F||g>=u-F,v=f?m&&!h:m,S=g<=0,y=g>0&&d<u;if(a)return S&&(pe.current=!1),void H(Ce("entered",y));if(!me.current){if(me.current=!0,ye)return void H(!1);if(S)return Me(),Q("entered"),j.set(1),Pe(ee.current),H(Ce("entered",!1)),void(pe.current=!1);if(!0===i&&!f&&d>=0&&g<=u)return Oe(!0),void Ve()}if("waiting"===G.current){const e=ge.current;if(e&&(!0===e?.coldStartBypass&&!0===i&&!f&&d>=0&&g<=u||v&&!h))Ve();else{const t=e?.origin??"idle";Ie(),Q(t)}}else{const e=function(e,t,n,r){switch(e){case"idle":return t&&!n?"enter":null;case"entering":case"entered":return n&&!t&&r.hasExplicitExit?"exit":null;case"exiting":case"exited":return t&&!n&&r.replay?"enter":null;default:return null}}(G.current,v,h,{hasExplicitExit:_,replay:L});y&&!pe.current&&(pe.current=!0),"enter"!==e||ye||be.current||we.current?"exit"===e&&!xe&&(!pe.current&&S||ze()):(Oe(),Ve())}H(Ce(G.current,y))},[Ve,ye,xe,Oe,Ie,N,F,_,A,Pe,L,ze,e?.firstSceneEnterGateKnown,e?.firstSceneEnterActive,e?.firstSceneEnterReady,Q,Me,p,j]);ce.current=Ne;const Fe=v(()=>{be.current=!0,we.current=!1,me.current=!0,he.current=!0,Le()},[Le]),Be=v(()=>{we.current=!0,ze()},[ze]);y(()=>{if(m&&!A)return m.current=Fe,()=>{m.current===Fe&&(m.current=null)}},[m,A,Fe]),y(()=>{if(h&&!A)return h.current=Be,()=>{h.current===Be&&(h.current=null)}},[h,A,Be]),y(()=>{const t=e?.registerAnimate,n=e?.unregisterAnimate;if(!t||!K&&!_)return;const r=t(c,{delay:E,duration:K?S:x,after:D,lane:A?"scroll":"visibility"});return ee.current=r??null,re.current=!1,()=>{Ie(),ee.current===r&&(ee.current=null),r?.dispose?r.dispose():n?.(c)}},[e?.registerAnimate,e?.unregisterAnimate,Ie,c,E,S,x,D,K,_,A]),y(()=>{if(typeof document>"u"||p||q.current?.isConnected)return;const e=document.querySelector(`[data-cineview-animate-host="${c}"]`)??document.querySelector(`[data-cineview-animate-id="${c}"]`);e instanceof HTMLElement&&q.current!==e&&(q.current=e,X(e=>e+1))},[c,r,i,p]),y(()=>{if(!(A&&U&&Z&&n&&(K||_)))return;const e=U(n,{animateId:c,delay:E,enterDuration:S,exitDuration:_?x:0,after:D,...void 0!==C||void 0!==T?{phase:{start:C,end:T}}:{}});return()=>{Z(n,c,e)}},[c,E,S,x,_,K,A,T,C,n,D,U,Z]);const je=v(e=>{if(!K&&!_)return"entered"!==G.current&&Q("entered"),void(1!==j.get()&&j.set(1));if(!t||!n)return void(0!==j.get()&&j.set(0));const r=e?.sequence.budgets[c];if(!e||!r)return void(0!==j.get()&&j.set(0));const i=se(e.progressPx,0,e.totalBudgetPx),o=r.enterStartPx,a=Math.max(r.enterEndPx,r.enterStartPx+1),s="number"==typeof r.phaseStartPx?r.phaseStartPx:Te(C,o,o,a),l=Math.max("number"==typeof r.phaseEndPx?r.phaseEndPx:Te(T,a,o,a),s+1);if(i>=l&&!re.current&&(re.current=!0,Pe(ee.current)),i<=s)return void(0!==j.get()&&j.set(0));if(!r.hasExit)return i>=l?void(1!==j.get()&&j.set(1)):void j.set(se((i-s)/Math.max(l-s,1),0,1));const u=r.exitStartPx??l,d=r.exitEndPx??u+1;i<=l?j.set(se((i-s)/Math.max(l-s,1),0,1)):i<=u?1!==j.get()&&j.set(1):i>=d?-1!==j.get()&&j.set(-1):j.set(-se((i-u)/Math.max(d-u,1),0,1))},[c,K,_,T,C,Pe,Q,j,n,t]);y(()=>{if(!A)return;const e=()=>je($.get());return e(),K||_?$.on("change",e):void 0},[je,K,_,A,$]),y(()=>{A||Ne()},[Y,A,Ne,e?.scrollProgress,e?.scrollTimelineState]),y(()=>{if(A)return;const e=q.current;return e instanceof HTMLElement&&!(typeof window>"u")?function(e,t){const n=function(e){const t=Ae.get(e);if(t)return t;const n=function(e){return typeof window<"u"&&e===window||typeof Window<"u"&&e instanceof Window}(e),r=n?e:e.ownerDocument?.defaultView??window,i=r.requestAnimationFrame?.bind(r)??(e=>r.setTimeout(()=>e(Date.now()),16)),o=r.cancelAnimationFrame?.bind(r)??(e=>r.clearTimeout(e)),a={subscribers:new Set,frame:null,requestFrame:i,cancelFrame:o,schedule:()=>{null===a.frame&&(a.frame=a.requestFrame(()=>{a.frame=null;const t=n?{top:0,height:e.innerHeight||1}:{top:e.getBoundingClientRect().top,height:e.clientHeight||r.innerHeight||1};[...a.subscribers].forEach(e=>e(t))}))},cleanup:()=>{e.removeEventListener("scroll",a.schedule),n||r.removeEventListener("resize",a.schedule),null!==a.frame&&(a.cancelFrame(a.frame),a.frame=null)}};return e.addEventListener("scroll",a.schedule,{passive:!0}),n||r.addEventListener("resize",a.schedule,{passive:!0}),Ae.set(e,a),a}(e);return n.subscribers.add(t),n.schedule(),()=>{n.subscribers.delete(t),0===n.subscribers.size&&(n.cleanup(),Ae.delete(e))}}(e.closest('[data-cineview-container="true"]')??window,Ne):void 0},[Y,A,Ne]),y(()=>Me,[Me]);const $e=I(!1),We=v(r=>{if(!(s&&A&&t&&n))return void($e.current&&($e.current=!1,H(!1)));const i=e?.runtimeState,o=void 0===i||"covered"!==i&&"inactive"!==i&&"parked"!==i&&"exiting"!==i;if(!K&&!_)return void($e.current!==o&&($e.current=o,H(o)));const a=r?.sequence.budgets[c];if(!r||!a||!o)return void($e.current&&($e.current=!1,H(!1)));const l=se(r.progressPx,0,r.totalBudgetPx),u=a.enterStartPx,d=Math.max(a.enterEndPx,a.enterStartPx+1),g="number"==typeof a.phaseStartPx?a.phaseStartPx:Te(C,u,u,d),f=Math.max("number"==typeof a.phaseEndPx?a.phaseEndPx:Te(T,d,u,d),g+1),m=K?l>=f-.5:l>.5,h=!a.hasExit||null===a.exitStartPx||l<=a.exitStartPx+.5,p=m&&h;$e.current!==p&&($e.current=p,H(p))},[c,K,_,s,A,T,C,e?.runtimeState,H,n,t]);return y(()=>{if(A&&s)return We($.get()),K||_?$.on("change",We):void 0;We(null)},[K,_,s,A,We,$]),{style:ve(j,B,(e,t,n)=>function(e,t,n){const r=n>=0,i=r?e.enterAnimate:e.exitTarget;return ue(de(r?e.enterInitial:e.enterAnimate,t,fe(t,r?"initial":"animate")),i,t,fe(t,r?"animate":"exit"),r?n:Math.abs(n))}(t,n,e)).style,shouldRunInfinite:W,visualMotion:j,phaseMotion:J}}({sceneContext:"scroll"===K?g:null,zoneRuntime:"scroll"===K?bt:null,zoneId:b,enterVariant:w,exitVariant:C,hasAuthoredEnterAnimation:!!e,hasAuthoredExitAnimation:!!t,hasInfiniteAnimation:!!L,componentId:d,duration:{enter:yt,exit:xt},timeline:ne,visibility:Z.visibility,globalEnterMargin:f?.scrollEnterMargin,globalExitMargin:f?.scrollExitMargin,enterRef:et?c:void 0,exitRef:et?l:void 0,variantsPending:Ke});y(()=>{if("drag"!==K||0===z)return;const e=$.current;!e||e.generation!==z||(e.lease.complete(),$.current=null)},[K,z]);const Mt=function({mode:e,isDragArrival:t,timelineLane:n,sceneContext:r,arrivalVisualMotion:i,arrivalPhaseMotion:o,scrollVisualMotion:a,scrollPhaseMotion:s,dragVisualState:c}){const l=k(0),u=k(0),d=k("idle"),g=k(rt);return y(()=>{const f="scroll"===e||t?n:"drag",m=e=>{l.set(e.progress),u.set(e.signedProgress),d.set(e.phase),g.set(e)};if("scroll"===e||t){const e=t?i:a,n=t?o:s,r=()=>{const t=e.get();m({progress:ze(t),signedProgress:t,phase:n.get(),source:"scroll"===f?"scroll":"visibility"})};r();const c=e.on("change",r),l=n.on("change",r);return()=>{c(),l()}}const h=e=>{if(!e)return void m(rt);const t=Math.max(0,Math.min(1,e.localProgress)),n="outgoing"===e.mode?("forward"===e.direction?1:-1)*t:t;m({progress:t,signedProgress:n,phase:Ve(e.mode,t),source:it(r,e)})};return h(c.get()),c.on("change",h)},[o,i,c,t,e,g,d,l,u,n,r,s,a]),P(()=>({mode:e,lane:"scroll"===e||t?n:"drag",progress:l,signedProgress:u,phase:d,frame:g}),[t,e,g,d,l,u,n])}({mode:K,isDragArrival:Q,timelineLane:"scroll"===K||Q?ne.lane:"drag",sceneContext:g,arrivalVisualMotion:Pt.visualMotion,arrivalPhaseMotion:Pt.phaseMotion,scrollVisualMotion:It.visualMotion,scrollPhaseMotion:It.phaseMotion,dragVisualState:wt.visualState});y(()=>{const e=Q?Fe:L;if("drag"===K&&e){if(p||!(Q?Pt.shouldRunInfinite:wt.shouldRunInfinite))return void X.stop();X.start({...e.animate,transition:{...e.animate.transition||{},repeat:1/0}})}},[Pt.shouldRunInfinite,X,wt.shouldRunInfinite,L,Q,K,p,Fe]),y(()=>{if("scroll"===K&&L){if(p||!It.shouldRunInfinite)return void U.stop();U.start({...L.animate,transition:{...L.animate.transition||{},repeat:1/0}})}},[K,L,p,It.shouldRunInfinite,U]);const Et=Ze?u:void 0,Rt=Ze?null:u,Dt=O(tt,{value:Mt,children:mt?lt&&Re?"scroll"===K?O(Ge,{container:lt,variant:Re,each:ht,from:pt,itemDurationMs:vt?.itemDurationMs,effectiveDurationMs:vt?.effectiveDurationMs,exitVariant:Ne,exitItemDurationMs:St?.itemDurationMs,signedVisual:It.visualMotion}):Q?O(Je,{container:lt,variant:Re,each:ht,from:pt,itemDurationMs:vt?.itemDurationMs,effectiveDurationMs:vt?.effectiveDurationMs,phaseMotion:Pt.phaseMotion,staticReveal:Pt.staticReveal}):O(Qe,{container:lt,variant:Re,each:ht,from:pt,itemDurationMs:vt?.itemDurationMs,effectiveDurationMs:vt?.effectiveDurationMs,exitVariant:Ne,exitItemDurationMs:St?.itemDurationMs,visualState:wt.visualState}):null:Et?"scroll"===K||Q?O(je,{signedVisual:Q?Pt.visualMotion:It.visualMotion,phaseMotion:Q?Pt.phaseMotion:It.phaseMotion,render:Et}):O($e,{visualState:wt.visualState,render:Et}):Rt}),At=mt?gt:It.style,kt=mt?gt:Q?Pt.style:wt.style;return Re||Ne||Fe||Ke?"scroll"===K?O("div",Fe?{"data-cineview-animate-host":d,children:O(D.div,{style:At,className:"cineview-animate","data-cineview-animate-id":d,children:O(D.div,{animate:U,children:Dt})})}:{"data-cineview-animate-host":d,children:O(D.div,{style:At,className:"cineview-animate","data-cineview-animate-id":d,children:Dt})}):O(D.div,Fe?{style:kt,className:"cineview-animate","data-cineview-animate-id":d,children:O(D.div,{animate:X,children:Dt})}:{style:kt,className:"cineview-animate","data-cineview-animate-id":d,children:Dt}):O(tt,{value:Mt,children:Et?Et(Be):Rt})};mt.displayName="Animate";var ht=f({lastX:0,lastY:0}),pt=f(null),vt=m(function({at:e,x:t,y:n,offsetX:r,offsetY:i,fixed:o=!1,children:a,style:s,className:c,...l},u){const d=Ee(),g=De(),f=S(ht),m=S(pt),h=e?.x??t,p=e?.y??n,v=e?.offsetX??r,y=e?.offsetY??i,x=o,b=e?.anchor,w="center"===b||"center-x"===b,I="center"===b||"center-y"===b,M=x&&"scroll"===g?.mode&&!m,{finalLeft:E,finalTop:R,finalX:D,finalY:A}=P(()=>{const e=d?.convert??(e=>e);if(void 0!==h||void 0!==p){const t=void 0!==h?h:0,n=void 0!==p?p:0;return{finalLeft:e(t),finalTop:e(n),finalX:t,finalY:n}}if(void 0!==v||void 0!==y){const t=f.lastX+(void 0!==v?v:0),n=f.lastY+(void 0!==y?y:0);return{finalLeft:e(t),finalTop:e(n),finalX:t,finalY:n}}return{finalLeft:0,finalTop:0,finalX:0,finalY:0}},[d,f,v,y,h,p]),{leftStyle:k,topStyle:C,centerTransform:T}=P(()=>{const e=d?.convert??(e=>e),t=[];let n=E;if(w){const r=e(h??0);n=0===r?"50%":`calc(50% + ${r}px)`,t.push("translateX(-50%)")}let r=R;if(I){const n=e(p??0);r=0===n?"50%":`calc(50% + ${n}px)`,t.push("translateY(-50%)")}return{leftStyle:n,topStyle:r,centerTransform:t.length>0?t.join(" "):void 0}},[d,w,I,h,p,E,R]),L=P(()=>({lastX:D,lastY:A}),[D,A]),V=P(()=>{const e=[T,s?.transform].filter(Boolean).join(" ")||void 0;return{...s,position:M?"sticky":"absolute",left:k,top:C,pointerEvents:x?s?.pointerEvents??"auto":s?.pointerEvents,transform:e}},[M,x,k,C,T,s]),N=O(ht.Provider,{value:L,children:O("div",{ref:u,style:V,className:c,...l,children:a})});return x&&m&&!M?z(N,m):N});vt.displayName="Position";var St={opacity:1,x:0,y:0,scale:1,rotate:0};function yt(e,t){return function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(e)?{...t,...e}:t}function xt(e){return Math.max(0,Math.min(e,1))}function bt(e,t){return"drag"!==e?"auto":"y"===t?"pan-x pinch-zoom":"pan-y pinch-zoom"}function wt({effectiveMode:e,isActive:t,globalScrollTimelineState:n,hasExitAnimation:r}){if("scroll"!==e||!n)return t?1:0;switch(n.phase){case"before":default:return 0;case"enter":return n.enterProgress;case"hold":return 1;case"exit":return r?1-n.exitProgress:1;case"after":return r?0:1}}function Pt({onVisibilityChange:e,sceneVisibilityCallback:t,sceneIndex:n,visible:r,progress:i}){e?.(r,i),t?.({sceneIndex:n,visible:r,progress:i})}function It({effectiveMode:e,effectiveDirection:t,globalScrollTimelineState:n,globalScrollViewportOffset:r,globalViewportWidth:i,globalViewportHeight:o}){if("scroll"!==e)return{visible:!1,isHorizontal:!1,hostOffset:0,hostSpan:0,clipWidth:0,clipHeight:0};const a=n?.rangeStart??0,s=n?.rangeEnd??a,c="x"===t,l=Math.max(s-a,0),u=Math.max(c?i:o,0),d=a-r,g=s-r,f=Math.max(Math.min(u,Math.max(l,1)),1),m=function(e,t,n){return Math.min(n,Math.max(0,e))}(r-a,0,Math.max(l-f,0));return{visible:l>0&&g>0&&d<u,isHorizontal:c,hostOffset:m,hostSpan:f,clipWidth:c?l:0,clipHeight:c?0:l}}function Mt({sceneIndex:e,metrics:t,setHostRef:n,frameStore:r,direction:i="y",viewportWidth:o=0,viewportHeight:a=0}){const s=I(null),c=I(null);return y(()=>{if(!r||"number"!=typeof e)return;const t=()=>{const t=r.getKeySnapshot(e);if(!t)return;const n=It({effectiveMode:"scroll",effectiveDirection:i,globalScrollTimelineState:t.timelineState,globalScrollViewportOffset:t.visualViewportOffset,globalViewportWidth:o,globalViewportHeight:a}),l=s.current,u=c.current;!l||!u||(l.style.width=n.clipWidth>0?`${n.clipWidth}px`:"100%",l.style.height=n.clipHeight>0?`${n.clipHeight}px`:"100%",l.style.opacity=n.visible?"1":"0",l.style.visibility=n.visible?"visible":"hidden",u.style.top=n.isHorizontal?"0px":`${n.hostOffset}px`,u.style.left=n.isHorizontal?`${n.hostOffset}px`:"0px",u.style.width=n.isHorizontal&&n.hostSpan>0?`${n.hostSpan}px`:"100%",u.style.height=n.isHorizontal?"100%":n.hostSpan>0?`${n.hostSpan}px`:"100%")};return t(),r.subscribeKey(e,t)},[i,r,e,a,o]),O("div",{ref:s,"data-scene-fixed-layer":e,"data-scene-fixed-role":"clip",style:{position:"absolute",inset:0,width:t.clipWidth>0?t.clipWidth:"100%",height:t.clipHeight>0?t.clipHeight:"100%",overflow:"hidden",pointerEvents:"none",opacity:t.visible?1:0,visibility:t.visible?"visible":"hidden",zIndex:20},children:O("div",{ref:c,"data-scene-fixed-layer":e,"data-scene-fixed-role":"frame",style:{position:"absolute",top:t.isHorizontal?0:t.hostOffset,left:t.isHorizontal?t.hostOffset:0,width:t.isHorizontal&&t.hostSpan>0?t.hostSpan:"100%",height:t.isHorizontal?"100%":t.hostSpan>0?t.hostSpan:"100%",pointerEvents:"none"},children:O("div",{ref:n,"data-scene-fixed-layer":e,"data-scene-fixed-host":e,"data-scene-fixed-role":"host",style:{position:"relative",width:"100%",height:"100%",pointerEvents:"none"}})})})}function Et(){return typeof performance<"u"?performance.now():Date.now()}function Rt(e,t,n){const r=e.panInfo??{point:{x:0,y:0},delta:{x:0,y:0},offset:{x:0,y:0},velocity:{x:0,y:0}};return r.point.x=t,r.point.y=n,r.delta.x=t-e.lastX,r.delta.y=n-e.lastY,r.offset.x=t-e.startX,r.offset.y=n-e.startY,r.velocity.x=e.velocityX,r.velocity.y=e.velocityY,e.panInfo=r,r}function Dt(e){return Math.max(0,Math.min(Number.isFinite(e)?e:0,1))}function At(e){return Object.freeze({...e,mapping:Object.freeze({...e.mapping}),enterVariantsByAnimateId:n(e.enterVariantsByAnimateId)})}var kt=class{constructor(){this.preparedScenes=new Map,this.activeTransactions=new Map,this.transactionIdsByTarget=new Map}publishPrepared(e){const t=this.preparedScenes.get(e.sceneIndex);t&&t.instanceId===e.instanceId&&t.revision>e.revision||this.preparedScenes.set(e.sceneIndex,At(e))}invalidatePrepared(e){const t=this.preparedScenes.get(e.sceneIndex);t?.instanceId===e.instanceId&&t.revision===e.revision&&this.preparedScenes.delete(e.sceneIndex)}getPrepared(e){return this.preparedScenes.get(e)??null}beginTransaction(e,t,n){const r=this.transactionIdsByTarget.get(e),i=r?this.activeTransactions.get(r):void 0;if(i){const e=function(e,t,n){const r=Dt(n);return Object.freeze({...e,phase:t,releaseSeed:Object.freeze({progressRatio:r,elapsedMs:a(e.mapping,e.registrySnapshot.timelineDuration,100*r)})})}(i,t,n);return this.activeTransactions.set(i.transactionId,e),e}const o=this.preparedScenes.get(e);if(!o)return null;const s=function(e,t,n){return function(e,t,n,r){const i=Dt(r),o=e.registrySnapshot.timelineDuration;return Object.freeze({transactionId:t,targetSceneIndex:e.sceneIndex,targetInstanceId:e.instanceId,targetRevision:e.revision,phase:n,mapping:e.mapping,registrySnapshot:e.registrySnapshot,enterVariantsByAnimateId:e.enterVariantsByAnimateId,releaseSeed:Object.freeze({progressRatio:i,elapsedMs:a(e.mapping,o,100*i)})})}(e,Symbol(`drag-transaction:${e.sceneIndex}:${e.revision}`),t,n)}(o,t,n);return this.activeTransactions.set(s.transactionId,s),this.transactionIdsByTarget.set(e,s.transactionId),s}getTransaction(e){return this.activeTransactions.get(e)??null}getTransactionForTarget(e){const t=this.transactionIdsByTarget.get(e);return t?this.activeTransactions.get(t)??null:null}releaseTransaction(e){const t=this.activeTransactions.get(e);t&&(this.activeTransactions.delete(e),this.transactionIdsByTarget.get(t.targetSceneIndex)===e&&this.transactionIdsByTarget.delete(t.targetSceneIndex))}clear(){this.preparedScenes.clear(),this.activeTransactions.clear(),this.transactionIdsByTarget.clear()}},Ct=d.createContext(null),Tt=new Set(["children","sceneId","layout","stack","transition","assets","drag","scroll","callbacks","runtimeMode","runtimeDirection","isActive","sceneIndex","totalScenes","currentSceneIndex","sceneRuntime","dragRuntime","scrollRuntime","onDragGestureEnd","onDragReset","onActivationComplete","onDragProgressChange","onRenderProgressChange","onDragTimelineProgressChange","onSharedElapsedMsChange","onDraggingChange","onSharedTimelineDurationChange","onDragRelease","onScrollProgressChange","onScrollDirectionChange","onScrollingChange","onScrollCommit","onScrollReset","onSceneChange","mode","slideDirection","slideDuration","sceneTransitionDuration","enterAnimation","exitAnimation","exitDuration","sceneWidth","sceneHeight","sceneAnchor","sceneZIndex","sceneOverflow","sceneStackMode","scrollSpeed","scrollControlled","scrollCommitThreshold","scrollReleaseDuration","scrollLockToSingleScene","scrollEnterLength","scrollHoldLength","scrollExitLength","onVisibilityChange","preloadImages"]),Lt=d.forwardRef(function(e,t){const{children:n,className:r,style:a,onPointerDown:l,onPointerMove:u,onPointerUp:g,onPointerCancel:f}=e,{effectiveMode:m,effectiveDirection:h,isActive:p,sceneIndex:b,totalScenes:w,currentSceneIndex:E,globalDirection:R,globalSharedTimelineDurationMs:C,globalActivationToken:T,globalActivationKind:L,globalFirstSceneEnterGateKnown:z,globalFirstSceneEnterActive:N,globalFirstSceneEnterReady:F,globalViewportWidth:B,globalViewportHeight:j,globalDragProgress:$,globalRenderProgress:W,globalDragTimelineProgress:H,globalIsDragging:q,globalDragRelease:Y,globalScrollProgress:X,globalIsScrolling:U,globalScrollDirection:Z,globalScrollTransitionSnapshot:K,globalScrollBackdropActive:_,globalScrollTimelineState:G,globalScrollViewportOffset:J,resolvedSceneWidth:Q,resolvedSceneHeight:ee,resolvedSceneAnchor:te,resolvedSceneOverflow:ne,resolvedSceneZIndex:ie,effectiveSceneStackMode:ae,resolvedSceneTransitionDuration:se,resolvedEnterAnimation:ce,resolvedExitAnimation:le,sceneVisibilityCallback:ue,onVisibilityChange:de,onSceneChange:ge,dragRuntime:fe,onActivationComplete:me,onDragProgressChange:he,onRenderProgressChange:pe,onDragTimelineProgressChange:ve,onDraggingChange:Se,onSharedTimelineDurationChange:ye,onDragRelease:xe,onDragGestureEnd:be,onDragReset:we,slideDuration:Pe,compatFields:Ie}=function(e){const t=e.sceneRuntime?.mode??e.runtimeMode??e.mode??"drag";return{effectiveMode:t,effectiveDirection:e.sceneRuntime?.direction??e.runtimeDirection??e.slideDirection??"y",isActive:e.sceneRuntime?.isActive??e.isActive??!1,sceneIndex:e.sceneRuntime?.sceneIndex??e.sceneIndex??0,totalScenes:e.sceneRuntime?.totalScenes??e.totalScenes??1,currentSceneIndex:e.sceneRuntime?.currentSceneIndex??e.currentSceneIndex??0,globalDirection:e.sceneRuntime?.transitionDirection??null,globalIsSceneAnimating:e.sceneRuntime?.isSceneAnimating??!1,globalSharedTimelineDurationMs:e.sceneRuntime?.sharedTimelineDurationMs??0,globalActivationToken:e.sceneRuntime?.activationToken??0,globalActivationKind:e.sceneRuntime?.activationKind??null,globalFirstSceneEnterGateKnown:e.sceneRuntime?.firstSceneEnterGateKnown??!0,globalFirstSceneEnterActive:e.sceneRuntime?.firstSceneEnterActive??!1,globalFirstSceneEnterReady:e.sceneRuntime?.firstSceneEnterReady??!1,globalViewportWidth:e.sceneRuntime?.viewportWidth??0,globalViewportHeight:e.sceneRuntime?.viewportHeight??0,globalDragProgress:e.dragRuntime?.progress??0,globalRenderProgress:e.dragRuntime?.renderProgress??0,globalDragTimelineProgress:e.dragRuntime?.timelineProgress??0,globalIsDragging:e.dragRuntime?.isDragging??!1,globalDragRelease:e.dragRuntime?.release??null,globalScrollProgress:e.scrollRuntime?.progress??0,globalIsScrolling:e.scrollRuntime?.isScrolling??!1,globalScrollDirection:e.scrollRuntime?.direction??null,globalScrollTransitionSnapshot:e.scrollRuntime?.transitionSnapshot??null,globalScrollBackdropActive:e.scrollRuntime?.backdropActive??!1,globalScrollTimelineState:e.scrollRuntime?.timelineState??null,globalScrollActiveSceneIndex:e.scrollRuntime?.activeSceneIndex??0,globalScrollViewportOffset:e.scrollRuntime?.viewportOffset??0,resolvedSceneWidth:e.layout?.width??e.sceneWidth??"100vw",resolvedSceneHeight:e.layout?.height??e.sceneHeight??("scroll"===t?"auto":"100vh"),resolvedSceneAnchor:e.layout?.anchor??e.sceneAnchor??"top-left",resolvedSceneOverflow:e.layout?.overflow??e.sceneOverflow??"hidden",resolvedSceneZIndex:e.layout?.zIndex??e.sceneZIndex,effectiveSceneStackMode:e.layout?.overlap??e.sceneStackMode??("scroll"===t?"cover":"replace"),resolvedSceneTransitionDuration:e.sceneTransitionDuration??e.transition?.exitDuration??e.exitDuration??800,resolvedEnterAnimation:e.transition?.enterAnimation??e.enterAnimation,resolvedExitAnimation:e.transition?.exitAnimation??e.exitAnimation,sceneVisibilityCallback:e.callbacks?.onVisibilityChange,onVisibilityChange:e.onVisibilityChange,onSceneChange:e.onSceneChange,scrollCommitThreshold:e.scrollCommitThreshold??.42,scrollReleaseDuration:e.scrollReleaseDuration??220,scrollLockToSingleScene:e.scrollLockToSingleScene??!0,scrollRuntime:e.scrollRuntime,dragRuntime:e.dragRuntime,onActivationComplete:e.onActivationComplete,onDragProgressChange:e.onDragProgressChange,onRenderProgressChange:e.onRenderProgressChange,onDragTimelineProgressChange:e.onDragTimelineProgressChange,onSharedElapsedMsChange:e.onSharedElapsedMsChange,onDraggingChange:e.onDraggingChange,onSharedTimelineDurationChange:e.onSharedTimelineDurationChange,onDragRelease:e.onDragRelease,onDragGestureEnd:e.onDragGestureEnd,onDragReset:e.onDragReset,onScrollProgressChange:e.onScrollProgressChange,onScrollDirectionChange:e.onScrollDirectionChange,onScrollingChange:e.onScrollingChange,onScrollCommit:e.onScrollCommit,onScrollReset:e.onScrollReset,slideDuration:e.slideDuration??800,compatFields:[e.mode,e.slideDirection,e.scrollSpeed,e.scrollControlled,e.scrollCommitThreshold,e.scrollReleaseDuration,e.scrollLockToSingleScene,e.runtimeMode,e.runtimeDirection,e.isActive,e.sceneIndex,e.totalScenes,e.currentSceneIndex,e.onActivationComplete,e.onDragProgressChange,e.onRenderProgressChange,e.onDragTimelineProgressChange,e.onSharedElapsedMsChange,e.onDraggingChange,e.onSharedTimelineDurationChange,e.onDragGestureEnd,e.onDragReset,e.onScrollProgressChange,e.onScrollDirectionChange,e.onScrollingChange,e.onScrollCommit,e.onScrollReset,e.scrollRuntime,e.dragRuntime,e.sceneRuntime]}}(e),Me=e.scrollRuntime?.frameStore,Re=e.scrollRuntime?.sceneIndex??b,Ae=Ee(),ke=De(),Ce=ke?.reportError,Te=A(),[Le,Oe]=M(null),[Ve,ze]=M(null),Ne=I(0);I(null);const Fe=ut(ce),Be=ut(le),je=!!(fe||e.onDragProgressChange||e.onRenderProgressChange||e.onDragTimelineProgressChange||e.onDraggingChange||e.onSharedTimelineDurationChange||e.onDragGestureEnd||e.onDragReset),[$e,We]=M($),[He,qe]=M(W),[Ye,Xe]=M(H),[Ue,Ze]=M(q),[Ke,_e]=M(C),[Ge,Je]=M(Y),Qe=I(0),et=v(e=>{null!==e?(Qe.current+=1,Je({...e,token:Qe.current})):Je(null)},[]),tt=je?$:$e,nt=je?W:He,rt=je?H:Ye,it=je?q:Ue,at=je?C:Ke,ct=je?Y:Ge,lt=it,gt=k(tt),ft=fe?.renderProgressMotion??gt,mt=k(rt),ht=fe?.timelineProgressMotion??mt,vt=k(0),[Dt,kt]=M("initial"),Lt=b-E,[Ot,Vt]=M(!1),zt=I(Symbol(`scene:${b}`)),Nt=I(null),Ft=I(fe?.onPreparedInvalidated);Ft.current=fe?.onPreparedInvalidated;const[Bt,jt]=M(null),$t=P(()=>fe?.dragMappingConfig??s(void 0,e.drag),[fe?.dragMappingConfig,e.drag]),Wt=v((t,n,r)=>{if("drag"!==m)return;const i=At({sceneIndex:b,instanceId:zt.current,revision:n,enabled:!1!==e.drag?.enabled,mapping:$t,registrySnapshot:t,enterVariantsByAnimateId:r});Nt.current=i,jt(i),fe?.onPrepared?.(i)},[fe,m,$t,e.drag?.enabled,b]),{timelineDuration:Ht,beginPreparation:qt,registerAnimate:Yt,declareAnimateLane:Xt,unregisterAnimate:Ut,getCalculatedDelay:Zt,getTimelineDuration:Kt}=i({sceneIndex:b,baseDuration:"drag"===m?0:se,reportError:ke?.reportError,onStableSnapshot:Wt}),_t=I(!1);y(()=>{_t.current||d.Children.count(n)>0||(_t.current=!0,Ce?.({code:"EMPTY_SCENES",message:`Scene ${b} has no children; it renders an empty full-screen layer.`,context:{scope:"scene",sceneIndex:b}}))},[n,Ce,b]),y(()=>()=>{const e=Nt.current;e&&Ft.current?.({sceneIndex:e.sceneIndex,instanceId:e.instanceId,revision:e.revision})},[]);const Gt=I(null),Jt=v(e=>{Gt.current=e,"function"==typeof t?t(e):t&&(t.current=e)},[t]),[Qt,en]=M(null),tn=v(e=>{en(t=>t===e?t:e)},[]),nn=function({sceneId:e,sceneIndex:t,mode:n,scroll:r,elementRef:i}){const o=S(ot),a=x(),s=r?.zoneId??e??`scene-zone-${a}`,c=o?.registerZone,l=o?.unregisterZone,u=o?.setZoneElement,d=!!r;return y(()=>{if("scroll"===n&&d&&c&&l)return c(s,{sceneIndex:t}),()=>{l(s,t)}},[n,d,c,l,s,t]),y(()=>{if("scroll"===n&&d&&u)return u(s,t,i.current),()=>{u(s,t,null)}},[i,n,d,t,u,s]),"scroll"===n&&r?s:null}({sceneId:e.sceneId,sceneIndex:b,mode:m,scroll:e.scroll,elementRef:Gt});y(()=>{fe?.renderProgressMotion||gt.set(tt)},[tt,fe?.renderProgressMotion,gt]),y(()=>{fe?.timelineProgressMotion||mt.set(rt)},[rt,fe?.timelineProgressMotion,mt]),y(()=>{je&&(We($),qe(W),Xe(H),Ze(q),_e(C),Je(Y))},[je,$,W,H,q,C,Y]);const rn=v(e=>"drag"!==m?0:!je&&w<=1?Math.max(-1,Math.min(1,e)):0===E&&e<0||E===w-1&&e>0?0:Math.max(-1,Math.min(1,e)),[m,je,E,w]);y(()=>{},[Ae,b]),y(()=>{"scroll"!==m&&en(null)},[m]),y(()=>{const e=++Ne.current,t=()=>Ne.current===e,n=e=>{t()&&Ce?.(e)};return Oe(null),ze(null),"scroll"!==m?((Fe||Be)&&[Fe?"enterAnimation":null,Be?"exitAnimation":null].filter(Boolean).join(","),()=>{t()&&(Ne.current+=1)}):Fe||Be?((async()=>{const[e,r]=await Promise.all([re(Fe,`Scene ${b}`,"enter",n),re(Be,`Scene ${b}`,"exit",n)]);t()&&(Oe(e??null),ze(r??null))})(),()=>{t()&&(Ne.current+=1)}):()=>{t()&&(Ne.current+=1)}},[m,Ce,b,Fe,Be]);const on=function({slideMode:e,sceneState:t,isActive:n,sceneOffset:r,globalScrollProgress:i,globalScrollDirection:o,globalIsScrolling:a,globalScrollBackdropActive:s,hasExitAnimation:c,scrollTimelineState:l}){return P(()=>"drag"===e?"exiting"===t?"exiting":"entering"===t?"entering":n?"active":0===r?"inactive":"parked":"scroll"===e?l?"enter"===l.phase?"entering":"exit"===l.phase?c?"exiting":"covered":"hold"===l.phase?n?"active":"covered":"after"===l.phase?c?"parked":"covered":n?"active":s?"covered":0===r?"inactive":"parked":n&&a&&i>.001?c?"exiting":"covered":s?"covered":("forward"===o&&1===r||"backward"===o&&-1===r)&&i>.001?"entering":n?"active":0===r?"inactive":"parked":n?"active":"inactive",[e,t,n,r,i,o,a,s,c,l])}({slideMode:m,sceneState:Dt,isActive:p,sceneOffset:Lt,globalScrollProgress:X,globalScrollDirection:Z,globalIsScrolling:U,globalScrollBackdropActive:_,hasExitAnimation:!!le,scrollTimelineState:G}),an=P(()=>wt({effectiveMode:m,isActive:p,globalScrollTimelineState:G,hasExitAnimation:!!le}),[m,p,G,le]),sn=an>.001,cn=I(de),ln=I(ue);y(()=>{cn.current=de,ln.current=ue},[de,ue]),y(()=>{"scroll"===m&&Me||Pt({onVisibilityChange:cn.current,sceneVisibilityCallback:ln.current,sceneIndex:b,visible:sn,progress:an})},[m,b,sn,an,Me]),y(()=>{if("scroll"!==m||!Me)return;const e=()=>{const e=Me.getKeySnapshot(Re)??null,t=wt({effectiveMode:m,isActive:e?.isCurrent??p,globalScrollTimelineState:e?.timelineState??null,hasExitAnimation:!!le});Pt({onVisibilityChange:cn.current,sceneVisibilityCallback:ln.current,sceneIndex:b,visible:t>.001,progress:t})};return e(),Me.subscribeKey(Re,e)},[m,Me,p,le,b,ue,Re]),y(()=>{"drag"!==m||!p||((fe?.onSharedTimelineDurationChange??ye)?.(Kt()),je||_e(Kt()))},[m,p,Kt,Ht,fe,ye,Dt,je]);const un="drag"===m?F&&null!==Bt:F,dn=P(()=>({mode:m,isActive:p,isDragging:!1,dragProgressMotion:ft,runtimeState:on,sceneState:Dt,sceneOffset:Lt,activationToken:T,activationKind:L,firstSceneEnterGateKnown:0===b?z:void 0,firstSceneEnterActive:0===b?N:void 0,firstSceneEnterReady:0===b?un:void 0,sceneTransitionDuration:se,getTimelineDuration:Kt,beginPreparation:qt,registerAnimate:Yt,declareAnimateLane:Xt,unregisterAnimate:Ut,getCalculatedDelay:Zt,enterDuration:Pe}),[qt,Xt,m,un,Zt,L,T,N,z,Kt,p,ft,Yt,se,b,Lt,Dt,Pe,Ut,on]),gn=P(()=>({...dn,isDragging:lt,dragProgressMotion:ft,renderProgressMotion:ft,dragTransaction:fe?.transaction??null,preparedSnapshot:Bt,dragTimelineProgress:rt,sharedElapsedMotion:vt,renderProgress:nt,dragRelease:ct,sharedTimelineDurationMs:at,firstSceneEnterActive:N}),[ct,rt,nt,at,ft,fe?.transaction,vt,N,lt,Bt,dn]),fn="drag"===m?gn:dn;!function({slideMode:e,isActive:t,sceneOffset:n,sceneStackMode:r,controls:i,enterVariant:o,exitVariant:a,globalIsScrolling:s,globalScrollProgress:c,globalScrollDirection:l,globalScrollTransitionSnapshot:u,globalScrollBackdropActive:d,globalScrollTimelineState:g,scrollFrameStore:f,scrollFrameSceneIndex:m,setSceneState:h}){const p=I(null);p.current={slideMode:e,isActive:t,sceneOffset:n,sceneStackMode:r,controls:i,enterVariant:o,exitVariant:a,globalIsScrolling:s,globalScrollProgress:c,globalScrollDirection:l,globalScrollTransitionSnapshot:u,globalScrollBackdropActive:d,globalScrollTimelineState:g,setSceneState:h};const S=I(null),x=I(null),b=v(e=>{const t=p.current;if(!t||"scroll"!==t.slideMode)return;const n=null!==e,r=n?e.timelineState:t.globalScrollTimelineState,i=n?e.isCurrent:t.isActive,o=n?e.isScrolling:t.globalIsScrolling,a=n?e.isBackdropActive:t.globalScrollBackdropActive,s=n?e.scrollDirection:t.globalScrollDirection,c=n?e.progress:t.globalScrollProgress,l=t.globalScrollTransitionSnapshot?.direction??s,u="forward"===l&&1===t.sceneOffset||"backward"===l&&-1===t.sceneOffset,d=i&&o&&c>.001,g=!i&&"cover"===t.sceneStackMode&&a&&(0===t.sceneOffset||-1===t.sceneOffset),f=yt(t.enterVariant?.animate,St),m=yt(t.enterVariant?.initial,f),h=yt(t.exitVariant?.exit,f),v=e=>{S.current!==e&&(S.current=e,t.setSceneState(e))},y=(e,n,r)=>{const i=x.current;i&&i.kind===e&&i.progress===n&&i.enterVariant===t.enterVariant&&i.exitVariant===t.exitVariant&&i.controls===t.controls||(x.current={kind:e,progress:n,enterVariant:t.enterVariant,exitVariant:t.exitVariant,controls:t.controls},t.controls.set(r))};if(r){if("before"===r.phase)return v("initial"),void y("before",0,m);if("enter"===r.phase){const e=xt(r.enterProgress);return v("entering"),void y("enter",e,oe(m,f,e))}if("hold"===r.phase)return v("active"),void y("hold",1,f);if("exit"===r.phase){const e=xt(r.exitProgress);return v(t.exitVariant?.exit?"exiting":"active"),void y("exit",e,t.exitVariant?.exit?oe(f,h,e):f)}v(g?t.exitVariant?.exit?"exiting":"active":t.exitVariant?.exit?"exiting":i?"active":"initial"),y("after",1,t.exitVariant?.exit?h:f)}else if(u){v("entering");const e=xt(c);y("fallback-enter",e,oe(m,f,e))}else if(d||g){v(t.exitVariant?.exit?"exiting":"active");const e=xt(c);y("fallback-exit",e,t.exitVariant?.exit?oe(f,h,e):f)}else v(i?"active":"initial"),y(i?"fallback-active":"fallback-initial",i?1:0,i?f:m)},[]);y(()=>{if("scroll"===e){if(f&&"number"==typeof m){const e=()=>{b(f.getKeySnapshot(m)??null)};return e(),f.subscribeKey(m,e)}b(null)}},[b,o,a,d,l,c,g,u,s,t,n,r,m,f,e])}({slideMode:m,isActive:p,sceneOffset:Lt,sceneStackMode:ae,controls:Te,enterVariant:Le,exitVariant:Ve,globalIsScrolling:U,globalScrollProgress:X,globalScrollDirection:Z,globalScrollTransitionSnapshot:K,globalScrollBackdropActive:_,globalScrollTimelineState:G,scrollFrameStore:Me,scrollFrameSceneIndex:Re,setSceneState:kt});const mn=c({slideMode:m,isActive:p,sceneIndex:b,sceneOffset:Lt,globalDirection:R,globalRenderProgress:nt,renderProgressMotion:ft,globalIsDragging:it,candidateSuspended:fe?.candidateSuspended??!1,globalDragTimelineProgress:rt,dragTimelineProgressMotion:ht,dragRelease:ct,firstSceneEnterReady:F,elementElapsedMotion:vt,getTimelineDuration:Kt,timelineDurationState:Ht,dragTransaction:fe?.transaction??null,preparedSnapshot:Bt,requirePreparedSnapshot:je,dragMappingConfig:fe?.dragMappingConfig,takeoverSnapshot:fe?.takeoverSnapshot,onElementContinuationChange:fe?.onElementContinuationChange,onSettleComplete:fe?.onActivationComplete??me,onColdStartComplete:fe?.onActivationComplete??me}),{handleCandidateSuspend:hn,handleCandidateResume:pn,handleDragStart:vn,handlePan:Sn,handlePanEnd:yn}=o({slideMode:m,isActive:p,sceneIndex:b,currentSceneIndex:E,totalScenes:w,slideDirection:h,slideDuration:Pe,sceneTransitionDuration:se,sceneOffset:Lt,sceneState:Dt,globalDirection:R,globalRenderProgress:nt,globalIsDragging:it,globalDragProgress:tt,globalDragTimelineProgress:rt,controls:Te,dragProgressMotion:ft,setSceneState:kt,setIsAnimating:Vt,resolveDragProgress:rn,getTimelineDuration:Kt,onOwnershipRequest:fe?.onOwnershipRequest,onCandidateSuspensionChange:fe?.onCandidateSuspensionChange,takeoverSnapshot:fe?.takeoverSnapshot,onDragProgressChange:fe?.onProgressChange??he,onRenderProgressChange:fe?.onRenderProgressChange??pe,onDragTimelineProgressChange:fe?.onTimelineProgressChange??ve??(je?void 0:e=>mt.set(e)),onDraggingChange:fe?.onDraggingChange??Se??(je?void 0:Ze),onDragRelease:fe?.onRelease??xe??(je?void 0:et),renderLaneRef:fe?.renderLane,completeReleaseImmediately:!je,thresholdConfig:fe?.threshold,onDragEnd:fe?.onCommit??be??(je?void 0:(e,t,n,r)=>{We(0),qe(0),Xe(0),Ze(!1),_e(r??0),Je(null),mn.completeImmediately(),ge?.(e)}),onDragReset:fe?.onReset??we??(je?void 0:()=>{We(0),qe(0),Xe(0),Ze(!1),Je(null),mn.resetImmediately()})}),xn="drag"===m&&(p||!!fe?.renderLane?.current||!!ct),{onPointerDown:bn,onPointerMove:wn,onPointerUp:Pn,onPointerCancel:In,onFramerPanStart:Mn,onFramerPan:En,onFramerPanEnd:Rn}=function({enabled:e,axis:t,onCandidateStart:n,onCandidateEnd:r,onPointerSessionStart:i,onDragStart:o,onPan:a,onPanEnd:s,authoredPointerDown:c,authoredPointerMove:l,authoredPointerUp:u,authoredPointerCancel:d}){const g=function({enabled:e,axis:t,onCandidateStart:n,onCandidateEnd:r,onPointerSessionStart:i,onStart:o,onPan:a,onEnd:s}){const c=I(null),l=I(!1),u=I(0),d=I(null),g=I(null),f=I(n);f.current=n;const m=I(r);m.current=r;const h=I(i);h.current=i;const p=I(o);p.current=o;const S=I(a);S.current=a;const x=I(s);x.current=s;const b=v(()=>{g.current?.(),g.current=null},[]),w=v(()=>{null!==d.current&&(window.clearTimeout(d.current),d.current=null)},[]),P=v(e=>{const t=c.current;if(!t||t.pointerId!==e.pointerId)return;const n=t.target;b(),c.current=null,t.ownsGesture?(Et()-t.lastTime>100&&(t.velocityX=0,t.velocityY=0),n.releasePointerCapture?.(t.pointerId),x.current(e,Rt(t,e.clientX,e.clientY))):t.candidateSuspended&&m.current?.(),w();const r=u.current;l.current=!0;const i=window.setTimeout(()=>{d.current===i&&(d.current=null,u.current===r&&(l.current=!1))},0);d.current=i},[b,w]),M=v(t=>{if(!e||!1===t.isPrimary||void 0!==t.button&&0!==t.button||function(e){return e instanceof Element&&!!e.closest('a,button,input,textarea,select,option,summary,[contenteditable="true"],[data-cineview-ignore-drag]')}(t.target))return;const n=c.current;n&&(n.target.releasePointerCapture?.(n.pointerId),!n.ownsGesture&&n.candidateSuspended&&m.current?.()),b(),w(),u.current+=1;const r=t.currentTarget;h.current?.();const i=f.current?.()??!1;c.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,lastTime:Et(),velocityX:0,velocityY:0,target:r,ownsGesture:!1,candidateSuspended:i,rejectedDirections:new Set,panInfo:null},l.current=!0;const o=e=>{P(e)};window.addEventListener("pointerup",o),window.addEventListener("pointercancel",o),document.addEventListener("pointerup",o),document.addEventListener("pointercancel",o),g.current=()=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",o),document.removeEventListener("pointerup",o),document.removeEventListener("pointercancel",o)}},[b,w,e,P]),E=v(e=>{const n=c.current;if(!n||n.pointerId!==e.pointerId)return;const r=Et();if(!n.ownsGesture){const i="y"===t?e.clientY-n.startY:e.clientX-n.startX,o="y"===t?e.clientX-n.startX:e.clientY-n.startY;if(Math.abs(i)<1||Math.abs(i)<=Math.abs(o))return;const a=i<0?"forward":"backward";if(n.rejectedDirections.has(a))return;return n.candidateSuspended||(n.candidateSuspended=f.current?.()??!1),p.current(a)?(n.ownsGesture=!0,n.startX=e.clientX,n.startY=e.clientY,n.lastX=e.clientX,n.lastY=e.clientY,n.lastTime=r,n.velocityX=0,n.velocityY=0,n.target.setPointerCapture?.(n.pointerId),void(e.cancelable&&e.preventDefault())):(n.rejectedDirections.add(a),void(n.candidateSuspended&&(m.current?.(),n.candidateSuspended=!1)))}const i=Math.max(r-n.lastTime,1);n.velocityX=(e.clientX-n.lastX)/i*1e3,n.velocityY=(e.clientY-n.lastY)/i*1e3,S.current(e.nativeEvent,Rt(n,e.clientX,e.clientY)),n.lastX=e.clientX,n.lastY=e.clientY,n.lastTime=r,e.cancelable&&e.preventDefault()},[t]),R=v(e=>P(e.nativeEvent),[P]);return y(()=>()=>{const e=c.current;e&&!e.ownsGesture&&e.candidateSuspended&&m.current?.(),b(),w(),u.current+=1,c.current=null,l.current=!1},[b,w]),{onPointerDown:M,onPointerMove:E,onPointerUp:R,onPointerCancel:R,isActiveRef:l}}({enabled:e,axis:t,onCandidateStart:n,onCandidateEnd:r,onPointerSessionStart:i,onStart:o,onPan:a,onEnd:s}),{onPointerDown:f,onPointerMove:m,onPointerUp:h,onPointerCancel:p}=g,S=v(e=>{c?.(e),e.defaultPrevented||f(e)},[c,f]),x=v(e=>{l?.(e),e.defaultPrevented||m(e)},[l,m]),b=v(e=>{u?.(e),h(e)},[u,h]),w=v(e=>{d?.(e),p(e)},[d,p]),P=I({ownsGesture:!1,candidateSuspended:!1,baseline:0,rejectedDirections:new Set}),M=I(r);M.current=r;const E=v(e=>{const t=P.current;e&&!t.ownsGesture&&t.candidateSuspended&&M.current?.(),P.current={ownsGesture:!1,candidateSuspended:!1,baseline:0,rejectedDirections:new Set}},[]),R=v(()=>{g.isActiveRef.current?E(!0):(E(!0),i?.(),P.current={ownsGesture:!1,candidateSuspended:n?.()??!1,baseline:0,rejectedDirections:new Set})},[E,g.isActiveRef,n,i]),D=v((e,i)=>{if(g.isActiveRef.current)return void E(!0);const s=P.current,c="y"===t?i.offset.y:i.offset.x,l="y"===t?i.offset.x:i.offset.y;if(!s.ownsGesture){if(Math.abs(c)<1||Math.abs(c)<=Math.abs(l))return;const e=c<0?"forward":"backward";if(s.rejectedDirections.has(e))return;return s.candidateSuspended||(s.candidateSuspended=n?.()??!1),o(e)?(s.ownsGesture=!0,void(s.baseline=c)):(s.rejectedDirections.add(e),void(s.candidateSuspended&&(r?.(),s.candidateSuspended=!1)))}const u=c-s.baseline;a(e,{...i,offset:"y"===t?{x:i.offset.x,y:u}:{x:u,y:i.offset.y}})},[t,E,g.isActiveRef,r,n,o,a]),A=v((e,n)=>{if(g.isActiveRef.current)return void E(!0);const r=P.current;if(!r.ownsGesture)return void E(!0);const i=("y"===t?n.offset.y:n.offset.x)-r.baseline;s(e,{...n,offset:"y"===t?{x:n.offset.x,y:i}:{x:i,y:n.offset.y}}),E(!1)},[t,E,g.isActiveRef,s]);return y(()=>()=>E(!0),[E]),{onPointerDown:S,onPointerMove:x,onPointerUp:b,onPointerCancel:w,onFramerPanStart:R,onFramerPan:D,onFramerPanEnd:A}}({axis:h,enabled:xn,onCandidateStart:hn,onCandidateEnd:pn,onPointerSessionStart:fe?.onPointerSessionStart,onDragStart:vn,onPan:Sn,onPanEnd:yn,authoredPointerDown:l,authoredPointerMove:u,authoredPointerUp:g,authoredPointerCancel:f}),Dn=P(()=>"drag"===m?{opacity:1}:Le?Le.initial:{opacity:1},[Le,m]),An=P(()=>"drag"===m?"none":"translateZ(0)",[m]),kn=P(()=>function(e){switch(e){case"top-left":default:return{top:0,left:0};case"top-center":return{top:0,left:"50%",transform:"translateX(-50%)"};case"top-right":return{top:0,right:0};case"center-left":return{top:"50%",left:0,transform:"translateY(-50%)"};case"center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case"center-right":return{top:"50%",right:0,transform:"translateY(-50%)"};case"bottom-left":return{bottom:0,left:0};case"bottom-center":return{bottom:0,left:"50%",transform:"translateX(-50%)"};case"bottom-right":return{bottom:0,right:0}}}(te),[te]),Cn=P(()=>function(e){switch(e){case"top-right":case"center-right":case"bottom-right":return{marginLeft:"auto",marginRight:0};case"top-center":case"center":case"bottom-center":return{marginLeft:"auto",marginRight:"auto"};default:return{marginLeft:0,marginRight:"auto"}}}(te),[te]),Tn=P(()=>It({effectiveMode:m,effectiveDirection:h,globalScrollTimelineState:G,globalScrollViewportOffset:J,globalViewportWidth:B,globalViewportHeight:j}),[m,h,G,J,B,j]),Ln=!xn&&("covered"===on||"parked"===on||"inactive"===on),On=Ln?{"aria-hidden":!0}:void 0,Vn=Ln||!0===e.inert;y(()=>{const e=Gt.current;e&&(e.inert=Vn)},[Vn]);const zn=P(()=>({width:Q,height:ee,position:"scroll"===m?"relative":"absolute",overflow:ne,willChange:Ot||lt||U?"transform, opacity":"auto",contain:"drag"===m?"layout style":"layout style paint",transform:An,userSelect:"drag"===m&<?"none":void 0,WebkitUserSelect:"drag"===m&<?"none":void 0,touchAction:bt(m,h),zIndex:ie,pointerEvents:xn||"covered"!==on&&"parked"!==on&&"inactive"!==on?"auto":"none",..."scroll"===m?Cn:kn}),[Ot,lt,U,xn,An,m,h,Q,ee,ne,ie,on,Cn,kn]);return O(Ct.Provider,{value:b,children:O(dt.Provider,{value:fn,children:O(pt.Provider,{value:"scroll"===m?Qt:null,children:O(st.Provider,{value:"scroll"===m?nn:null,children:V(D.div,{ref:Jt,"data-cineview-scroll-zone":"scroll"===m?nn??e.sceneId??void 0:void 0,initial:Dn,animate:Te,...Object.fromEntries(Object.entries(e).filter(([e])=>!Tt.has(e))),className:r,style:{...a,...zn},...On,inert:Vn,onPanStart:"drag"===m?Mn:void 0,onPan:"drag"===m?En:void 0,onPanEnd:"drag"===m?Rn:void 0,onPointerDown:"drag"===m?bn:l,onPointerMove:"drag"===m?wn:u,onPointerUp:"drag"===m?Pn:g,onPointerCancel:"drag"===m?In:f,children:["scroll"===m?O(Mt,{sceneIndex:b,metrics:Tn,setHostRef:tn,frameStore:Me,direction:h,viewportWidth:B,viewportHeight:j}):null,n]})})})})})}),Ot=Object.assign(Lt,{cineViewScene:!0});Ot.displayName="Scene";var Vt=new Set(["width","minWidth","maxWidth","height","minHeight","maxHeight","top","bottom","left","right","inset","insetInline","insetInlineStart","insetInlineEnd","insetBlock","insetBlockStart","insetBlockEnd","margin","marginTop","marginBottom","marginLeft","marginRight","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd","borderWidth","borderTopWidth","borderBottomWidth","borderLeftWidth","borderRightWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","gap","columnGap","rowGap","fontSize","letterSpacing","outlineWidth","outlineOffset"]),zt=(e,t)=>{if(!e||!t)return e;let n=!1;const r={};return Object.entries(e).forEach(([e,i])=>{const o=((e,t,n)=>n&&"number"==typeof t&&Number.isFinite(t)&&!e.startsWith("--")&&Vt.has(e)?n.convert(t):t)(e,i,t);r[e]=o,n||(n=o!==i)}),n?r:e},Nt=m(function({width:e,height:t,children:n,style:r,className:i,...o},a){const s=Ee(),c=P(()=>{if(!s)return r;const n=zt(r,s),i=void 0!==e?s.convert(e):void 0,o=void 0!==t?s.convert(t):void 0;return{...n,...void 0!==e?{width:i}:{},...void 0!==t?{height:o}:{}}},[s,e,t,r]);return O("div",{ref:a,style:c,className:i,...o,children:n})});Nt.displayName="Container";var Ft=new Set,Bt=new Set;function jt(e){if(!e)return;const t=Ft.has(e);Ft.add(e),t||Bt.forEach(t=>t(e))}var $t=m(function({src:e,alt:t,width:n,height:r,style:i,loading:o,preload:a,...s},c){const l=Ee(),u=P(()=>"number"!=typeof n?n:l?.convert(n)??n,[l,n]),d=P(()=>"number"!=typeof r?r:l?.convert(r)??r,[l,r]),g=P(()=>zt(i,l),[l,i]),f="lazy"!==o&&(a??!0),m=o??(f?"eager":"lazy");return y(()=>{if(!f||!e||typeof window>"u"||(t=e).length>0&&Ft.has(t))return;var t;const n=new window.Image,r=()=>{jt(e)};return n.addEventListener("load",r),n.src=e,()=>{n.removeEventListener("load",r)}},[f,e]),O("img",{ref:c,...s,src:e,alt:t,width:u,height:d,style:g,loading:m})});$t.displayName="Image";var Wt=new Map,Ht=new Set,qt=new Map,Yt=new Set,Xt=new Map,Ut=0,Zt=/\.(mp4|webm|mov|m4v|ogv|ogg)(\?|#|$)/i;function Kt(e){return Zt.test(e)?"video":null}function _t(e){const t=Wt.get(e);if(t)return Gt(e),t.objectUrl}function Gt(e){const t=Wt.get(e);t&&(Wt.delete(e),Wt.set(e,t))}function Jt(e){typeof URL<"u"&&URL.revokeObjectURL&&URL.revokeObjectURL(e)}function Qt(e){for(const[t,n]of Wt){if(Ut<=134217728)break;t===e||(Xt.get(t)??0)>0||(Wt.delete(t),Ht.delete(t),Ut-=n.bytes,Jt(n.objectUrl))}}function en(e,t){if(!e||Ht.has(e))return Promise.resolve();const n=qt.get(e);if(n)return n;if(typeof fetch>"u")return Promise.reject(new Error("preloadMedia requires fetch (client-side only)"));if(!(t??Kt(e)))return Promise.reject(new Error(`Cannot determine media type: ${e} (pass explicit kind)`));const r=async function(e){const t=typeof AbortController<"u"?new AbortController:null,n=t?setTimeout(()=>t.abort(),3e4):null;try{const n=await fetch(e,t?{signal:t.signal}:void 0);if(!n.ok)throw new Error(`Failed to preload media: ${e} (HTTP ${n.status})`);const r=await n.blob();if(!r)throw new Error(`Invalid blob response for media: ${e}`);(function(e,t){const n=Wt.get(e);n&&(Ut-=n.bytes,Jt(n.objectUrl)),Wt.set(e,t),Ut+=t.bytes,Qt(e)})(e,{kind:"video",objectUrl:URL.createObjectURL(r),bytes:r.size}),function(e){const t=Ht.has(e);Ht.add(e),t||Yt.forEach(t=>t(e))}(e)}catch(n){if(t?.signal.aborted){const t=new Error(`Media preload timed out after 30000ms: ${e}`);throw t.cause=n,t}throw n}finally{null!==n&&clearTimeout(n)}}(e).finally(()=>{qt.delete(e)});return qt.set(e,r),r}var tn=1e-4;function nn(e,t,n){return Math.min(n,Math.max(t,e))}function rn(e,t){return function(e){return Number.isFinite(e)&&e>0}(e)?t?[Number.isFinite(t[0])?nn(t[0],0,e):0,Number.isFinite(t[1])?nn(t[1],0,e):e]:[0,e]:null}function on(e){return{activationId:e,status:"framework-scrub",activePlayRequestId:null,settledPlayRequestId:null,nextPlayRequestId:1,lastSeekTime:null,endpointLatched:!1,outgoingLatched:!1,frameworkPlayBlocked:!1,frameworkPausePending:!1}}function an(e,t=[]){return{state:e,commands:t}}function sn(e,t){return{...on(t),nextPlayRequestId:e.nextPlayRequestId}}function cn(e,t){switch(t.type){case"timeline-frame":return function(e,t){const{frame:n}=t;if("exiting"===n.phase||"exited"===n.phase){if(e.outgoingLatched)return an(e);const t="native-playback"===e.status||"play-pending"===e.status,n=null!==e.activePlayRequestId||null!==e.settledPlayRequestId;return an({...e,status:"framework-scrub",activePlayRequestId:null,lastSeekTime:null,outgoingLatched:!0,frameworkPlayBlocked:e.frameworkPlayBlocked||t||n,frameworkPausePending:t},t?[{type:"pause"}]:[])}if(!e.outgoingLatched&&!function(e){return"gesture"===e||"continuation"===e||"programmatic"===e||"scroll"===e||"visibility"===e}(n.source)||!function(e,t){return"ended"!==e.status&&"play-rejected"!==e.status||("gesture"===t.source||"scroll"===t.source||"visibility"===t.source)&&t.progress<.98}(e,n))return an(e);const r=function(e,t,n){const r=rn(t,n);if(!r)return null;const i=nn(Number.isFinite(e)?e:0,0,1);return r[0]+i*(r[1]-r[0])}(n.progress,t.duration,t.scrubRange);if(null===r)return an(e);if(function(e){return"native-playback"===e||"native-paused"===e||"play-pending"===e}(e.status)){if(!function(e,t){return!(e.endpointLatched&&t.progress>=.98)&&("scroll"===t.source||"visibility"===t.source||"gesture"===t.source&&t.progress<.98)}(e,n))return an(e);const t=[],i="native-playback"===e.status||"play-pending"===e.status;return i&&t.push({type:"pause"}),(null===e.lastSeekTime||Math.abs(e.lastSeekTime-r)>tn)&&t.push({type:"seek",time:r}),an({...e,status:"framework-scrub",activePlayRequestId:null,lastSeekTime:r,endpointLatched:!1,outgoingLatched:!1,frameworkPlayBlocked:!0,frameworkPausePending:i},t)}const i=[];if((null===e.lastSeekTime||Math.abs(e.lastSeekTime-r)>tn)&&i.push({type:"seek",time:r}),function(e,t){if(!e.scrubRange||t||e.frame.progress<.999)return!1;const n=rn(e.duration,e.scrubRange);return!!n&&n[1]<e.duration-tn}(t,e.endpointLatched)){const t=e.nextPlayRequestId;return i.push({type:"play",requestId:t}),an({...e,status:"play-pending",activePlayRequestId:t,settledPlayRequestId:null,nextPlayRequestId:t+1,lastSeekTime:r,endpointLatched:!0,outgoingLatched:!1,frameworkPlayBlocked:!1},i)}const o=!!(t.scrubRange&&n.progress>=.999),a=n.progress<.98;return an({...e,status:"framework-scrub",activePlayRequestId:null,lastSeekTime:r,endpointLatched:!!o||!a&&e.endpointLatched,outgoingLatched:!1},i)}(e,t);case"media-play":return t.activationId!==e.activationId?an(e):void 0!==t.requestId?e.activePlayRequestId===t.requestId||"native-playback"===e.status&&!e.frameworkPlayBlocked&&e.settledPlayRequestId===t.requestId?an({...e,status:"native-playback",activePlayRequestId:null,settledPlayRequestId:t.requestId,frameworkPausePending:!1,frameworkPlayBlocked:!1}):an({...e,frameworkPausePending:!0,frameworkPlayBlocked:!0},[{type:"pause"}]):e.frameworkPlayBlocked?an({...e,frameworkPausePending:!0},[{type:"pause"}]):an({...e,status:"native-playback",activePlayRequestId:null,settledPlayRequestId:null,frameworkPausePending:!1,frameworkPlayBlocked:!1});case"media-pause":return t.activationId!==e.activationId?an(e):e.frameworkPausePending?an({...e,frameworkPausePending:!1}):an({...e,status:"ended"===e.status?"ended":"native-paused",activePlayRequestId:null,settledPlayRequestId:"ended"===e.status?e.settledPlayRequestId:null,frameworkPlayBlocked:"ended"===e.status&&e.frameworkPlayBlocked});case"media-ended":return t.activationId!==e.activationId?an(e):an({...e,status:"ended",activePlayRequestId:null,endpointLatched:!0,frameworkPausePending:!1});case"play-resolved":return e.activePlayRequestId!==t.requestId?an(e):an({...e,status:"native-playback",activePlayRequestId:null,settledPlayRequestId:t.requestId,frameworkPlayBlocked:!1,frameworkPausePending:!1});case"play-rejected":return e.activePlayRequestId!==t.requestId?an(e):an({...e,status:"play-rejected",activePlayRequestId:null,settledPlayRequestId:null,frameworkPlayBlocked:!1,frameworkPausePending:!1});case"activate":return e.activationId===t.activationId?an(e):an(sn(e,t.activationId));case"reset":return an(sn(e,t.activationId))}}var ln=typeof document<"u"?w:y,un=!0,dn=m(function({src:e,progress:t,timelineFrame:n,scrubRange:r,width:i,height:o,style:a,"aria-label":s,preload:c=!0,poster:l,playbackRate:u,onEnded:d,onPlay:g,onPause:f,onTimeUpdate:m,onError:h,controlRef:p},S){const x=Ee(),b=I(null),[w,E]=M(()=>({src:e,url:_t(e)??null})),R=w.src===e?w.url:null,D=I([]),A=I(on(0)),k=I(0),C=I(void 0),T=I(0),L=I({src:e,objectUrl:R}),V=I(null),z=I(()=>{}),N=I(new WeakMap),F=I(null),B=I(null),j=v((e,t)=>{const n=V.current,r=T.current;if(n&&(n.video!==e||n.activationId!==t||n.generation!==r)&&(n.video.removeEventListener("loadstart",n.loadStart,un),n.video.removeEventListener("play",n.play,un),n.video.removeEventListener("pause",n.pause,un),n.video.removeEventListener("ended",n.ended,un),V.current=null),!e||V.current)return;const i=()=>k.current===t&&T.current===r,o=()=>i()&&F.current===r,a=()=>{i()&&(F.current=r)},s=e=>{N.current.set(e,{generation:r,activationId:t})},c=e=>{if(!o())return;const n=C.current,i=n?.generation===r&&n.activationId===t?n.requestId:void 0,a=A.current,c=void 0!==i&&(!a.frameworkPlayBlocked&&a.activePlayRequestId===i||"native-playback"===a.status&&!a.frameworkPlayBlocked&&a.settledPlayRequestId===i),l=void 0===i&&!a.frameworkPlayBlocked;void 0!==i&&(C.current=void 0),c||l?(s(e),z.current({type:"media-play",requestId:i,activationId:t})):z.current({type:"media-play",requestId:i,activationId:t})},l=e=>{o()&&(A.current.frameworkPausePending||(C.current=void 0),s(e),z.current({type:"media-pause",activationId:t}))},u=e=>{o()&&(s(e),z.current({type:"media-ended",activationId:t}))};e.addEventListener("loadstart",a,un),e.addEventListener("play",c,un),e.addEventListener("pause",l,un),e.addEventListener("ended",u,un),V.current={video:e,generation:r,activationId:t,loadStart:a,play:c,pause:l,ended:u}},[]),[$,W]=M(!1),[H,q]=M(0),[Y,X]=M(0),U=v((e=!0)=>{k.current+=1,A.current=cn(A.current,{type:"reset",activationId:k.current}).state,C.current=void 0,D.current=[],j(e?b.current:null,k.current)},[j]);y(()=>{const e={release:()=>{const e=b.current;W(!0),e&&(e.pause(),B.current=e.getAttribute("src"),e.removeAttribute("src"),e.load()),U(!1)},warmUp:()=>{const e=b.current;if(e&&!e.getAttribute("src")){const t=B.current;t&&(e.src=t,B.current=null)}W(!1),q(e=>e+1),U(!1)}};return p&&(p.current=e),()=>{p&&(p.current=null)}},[p,U]);const Z=v(e=>{e||j(null,k.current),b.current=e,e&&j(e,k.current),function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(S,e)},[j,S]),K=P(()=>"number"==typeof i?x?.convert(i)??i:i,[x,i]),_=P(()=>"number"==typeof o?x?.convert(o)??o:o,[x,o]),G=P(()=>zt(a,x??null),[x,a]);y(()=>{if(typeof window>"u"||!e)return void E({src:e,url:null});let t=!0,n=!1;const r=()=>{const t=function(e){const t=Wt.get(e);if(t)return Gt(e),Xt.set(e,(Xt.get(e)??0)+1),t.objectUrl}(e);return!!t&&(n=!0,E({src:e,url:t}),!0)};let i=()=>{};return r()||(E({src:e,url:null}),o=i=>{i===e&&t&&!n&&r()},Yt.add(o),i=()=>{Yt.delete(o)}),()=>{t=!1,i(),n&&function(e){const t=Xt.get(e)??0;t<=1?Xt.delete(e):Xt.set(e,t-1),Qt("")}(e)};var o},[e]),y(()=>{var t;typeof window>"u"||!e||!c||(t=e).length>0&&Ht.has(t)||en(e,"video").catch(()=>{})},[c,e]),y(()=>{W(!1),q(e=>e+1)},[e]),ln(()=>{const e=b.current;e&&(e.playbackRate=u??1)},[Y,R,u,$,e]);const J=v((e,t)=>{e.currentTime=t},[e]),Q=v(e=>{const t=b.current;if(!t)return;const n=cn(A.current,e);A.current=n.state,n.commands.forEach(e=>{switch(e.type){case"pause":return void t.pause();case"seek":return void J(t,e.time);case"play":{const n={requestId:e.requestId,generation:T.current,activationId:A.current.activationId,settled:!1};C.current=n;const r=t=>{if(C.current===n&&!n.settled){if(n.settled=!0,"play-rejected"===t&&(C.current=void 0),T.current!==n.generation||A.current.activationId!==n.activationId)return void(C.current=void 0);Q({type:t,requestId:e.requestId})}};let i;try{i=t.play()}catch{return void r("play-rejected")}return void Promise.resolve(i).then(()=>r("play-resolved"),()=>r("play-rejected"))}}})},[J]);ln(()=>{z.current=Q;const t=L.current;let n=!1;(t.src!==e||t.objectUrl!==R)&&(L.current={src:e,objectUrl:R},T.current+=1,F.current=null,U(),n=!0),!n&&b.current&&b.current.readyState>=1&&(F.current=T.current),j(b.current,k.current)},[j,Q,H,R,U,e]),y(()=>()=>j(null,k.current),[j]),y(()=>{if(!n)return;const e=b.current;if(!e||typeof window>"u")return;let t=n.get();const i=n=>{t=n;const i=A.current;if("entering"===n.phase&&("ended"===i.status||i.outgoingLatched))return k.current+=1,j(null,k.current),Q({type:"activate",activationId:k.current}),void X(e=>e+1);!Number.isFinite(e.duration)||e.duration<=0||Q({type:"timeline-frame",frame:n,duration:e.duration,scrubRange:r})},o=()=>i(t),a=n.on("change",i);return e.readyState>=1?o():e.addEventListener("loadedmetadata",o,{once:!0}),()=>{a(),e.removeEventListener("loadedmetadata",o)}},[j,Q,H,Y,R,r,n]),y(()=>{if(n)return;const e=b.current;if(!e||typeof window>"u")return;const r="object"==typeof t?t:null,i=t=>{const n=e.duration;!Number.isFinite(n)||n<=0||J(e,(t<0?0:t>1?1:t)*n)},o=()=>i(r?.get()??t),a=r?.on("change",i);return e.readyState>=1?o():e.addEventListener("loadedmetadata",o,{once:!0}),()=>{a?.(),e.removeEventListener("loadedmetadata",o)}},[H,R,t,J,n]);const ee=e=>{const t=N.current.get(e);return N.current.delete(e),!(!t||t.generation!==T.current||t.activationId!==k.current)},te=$&&w.src===e,ne=JSON.stringify([e,R,Y,te?"released":"active"]);return O("video",{ref:Z,src:(te?void 0:R??e)||void 0,muted:!0,playsInline:!0,preload:te?"none":c?"auto":R?"metadata":"none","aria-label":s,width:K,height:_,style:G,poster:l||void 0,onPlay:e=>{ee(e.nativeEvent)&&g?.(e)},onPause:e=>{ee(e.nativeEvent)&&f?.(e)},onEnded:e=>{ee(e.nativeEvent)&&d?.(e)},onTimeUpdate:m,onError:h},ne)});dn.displayName="VideoFrameRenderer";var gn={initial:{opacity:1},animate:{opacity:1}},fn=m(function({src:e,"aria-label":t,width:n,height:r,style:i,preload:o,poster:a,playbackRate:s,scrubRange:c,releaseOnLeave:l,onEnded:u,onPlay:d,onPause:g,onTimeUpdate:f,onError:m},h){const p=nt(),x=function(e,t){const n=I(null),r=nt(),i=S(st),o=function(e,t=!0){return function(e,t,n){const r=S(at),i=n(e?r?.zoneStates?.[e]??null:null),o=t&&e?r?.store:void 0,a=v(t=>o&&e?o.subscribeKey(e,t):()=>{},[o,e]),s=v(()=>n(o&&e?o.getKeySnapshot(e)??null:e?r?.zoneStates?.[e]??null:null),[n,o,r?.zoneStates,e]);return E(a,s,()=>i)}(e,t,v(e=>e?.approach??null,[]))}(e?i:null,!0===e),a=I(!1),s=I(!!e),c=r.progress;return y(()=>{a.current=!1},[t]),y(()=>{if(!e)return;const t=e=>{Math.abs(e)>1e-4&&(a.current=!0)};return t(c.get()),c.on("change",t)},[c,e]),y(()=>{const t=s.current;if(s.current=!!e,e){if(o){if("far"===o)return void(a.current&&n.current?.release());n.current?.warmUp()}}else t&&n.current?.warmUp()},[o,e]),n}(l,e);return O(dn,{ref:h,controlRef:x,src:e,progress:p.progress,timelineFrame:p.frame,"aria-label":t,width:n,height:r,style:i,preload:o,poster:a,playbackRate:s,scrubRange:c,onEnded:u,onPlay:d,onPause:g,onTimeUpdate:f,onError:m})}),mn=m(function({src:e,"aria-label":t,width:n,height:r,style:i,preload:o,poster:a,playbackRate:s,scrubRange:c,animateId:l,duration:u,enterAnimation:d,exitAnimation:g,timeline:f,visibility:m,releaseOnLeave:h,onEnded:p,onPlay:v,onPause:S,onTimeUpdate:y,onError:x},b){return O(mt,{animateId:l,enterAnimation:d??gn,exitAnimation:g,duration:{enter:u?.enter,exit:u?.exit},timeline:f,visibility:m,children:O(fn,{ref:b,src:e,"aria-label":t,width:n,height:r,style:i,preload:o,poster:a,playbackRate:s,scrubRange:c,releaseOnLeave:h,onEnded:p,onPlay:v,onPause:S,onTimeUpdate:y,onError:x})})});mn.displayName="AnimateVideo";var hn=mt,pn=vt,vn=Ot;function Sn(e){return Array.from(new Set(e.filter(e=>e.length>0)))}function yn(e,t,n,r){const i=Sn(e).filter(e=>!n.has(e)&&!r.has(e)),o=new Set(i);return{priorityBatch:i,backgroundBatch:Sn(t).filter(e=>!n.has(e)&&!r.has(e)&&!o.has(e))}}var xn=(e={})=>{const{priorityUrls:t=[],backgroundUrls:n=[],onProgress:r,onComplete:i,onError:o}=e,[a,s]=M(!1),[c,l]=M(0),[u,d]=M(0),[g,f]=M(t.length+n.length),[m,h]=M([]),[p,S]=M(new Map),[x,b]=M(!1),w=I([...t]),P=I([...n]),E=I(!1),R=I(new Map),D=I(0),A=I(null),k=I(new Set),C=I(new Set),T=I(0),L=I(0),O=I(r),V=I(i),z=I(o);y(()=>{O.current=r,V.current=i,z.current=o},[r,i,o]);const N=v((e,t)=>{const n=Sn(e).filter(e=>!k.current.has(e));if(0===n.length)return;const r=new Set(w.current),i=new Set(P.current),o=n.filter(e=>!r.has(e)&&!i.has(e));0!==o.length&&(t?w.current=[...w.current,...o]:P.current=[...P.current,...o])},[]);y(()=>{N(t,!0),N(n,!1),E.current||f(w.current.length+P.current.length)},[t,n,N]);const F=v((e,t)=>{const n=Kt(e);return n?en(e,n).then(()=>(jt(e),{url:e,success:!0})).catch(n=>{const r=n instanceof Error?n:new Error(String(n));return D.current===t&&z.current?.(e,r),{url:e,success:!1,error:r}}):new Promise(n=>{const r=new Image,i=new AbortController;R.current.set(e,i);let o=!1,a=null;const s=t=>{o||(o=!0,null!==a&&(clearTimeout(a),a=null),R.current.delete(e),n(t))};r.onload=()=>{jt(e),s({url:e,success:!0})},r.onerror=()=>{const n=new Error(`Failed to load image: ${e}`);D.current===t&&z.current?.(e,n),s({url:e,success:!1,error:n})},i.signal.addEventListener("abort",()=>{r.src="",s({url:e,success:!1,error:new Error("Image load aborted")})}),a=setTimeout(()=>{a=null,r.onload=null,r.onerror=null,r.src="";const n=new Error(`Image load timed out after 15000ms: ${e}`);D.current===t&&z.current?.(e,n),s({url:e,success:!1,error:n})},15e3),r.src=e})},[]),B=v((e,t)=>{const n=Math.max(t,0),r=n>0?Math.min(Math.max(e,0),n):0,i=n>0?Math.round(r/n*100):100;l(i),d(r),O.current?.(i)},[]),j=v(()=>{if(E.current)return A.current??Promise.resolve();const e=(async()=>{const e=D.current+1;D.current=e,E.current=!0,s(!0),l(0),d(0),h([]),S(new Map),b(!1),C.current=new Set,T.current=0,L.current=0;const t=yn(w.current,P.current,k.current,C.current),n=t.priorityBatch.length+t.backgroundBatch.length;if(L.current=n,f(n),0===n)return B(0,0),D.current===e&&(s(!1),b(!0)),E.current=!1,void V.current?.([]);const r=new Set(t.priorityBatch);let i=0===r.size;i&&b(!0);const o=[],a=new Map,c=()=>{const e=yn(w.current,P.current,k.current,C.current);return L.current=T.current+e.priorityBatch.length+e.backgroundBatch.length,f(L.current),e},u=(e,t)=>{o.push(t),C.current.add(e),T.current+=1,!t.success&&t.error?a.set(e,t.error):t.success&&k.current.add(e),B(T.current,L.current),i||(r.delete(e),0===r.size&&(i=!0,b(!0)))};for(;;){const{priorityBatch:t,backgroundBatch:n}=c();if(0===t.length&&0===n.length)break;if(await Promise.all(t.map(async t=>{const n=await F(t,e);D.current===e&&u(t,n)})),D.current!==e)return;const r=await Promise.all(n.map(async t=>({url:t,result:await F(t,e)})));if(D.current!==e)return;r.forEach(({url:e,result:t})=>{u(e,t)})}h(o),S(a),s(!1),E.current=!1,f(w.current.length+P.current.length),V.current?.(o)})();return A.current=e.finally(()=>{A.current===e&&(A.current=null)}),A.current},[F,B]),$=v(()=>{D.current+=1,R.current.forEach(e=>{e.abort()}),R.current.clear(),s(!1),l(0),d(0),f(w.current.length+P.current.length),h([]),S(new Map),b(!1),k.current.clear(),C.current.clear(),T.current=0,L.current=0,E.current=!1,A.current=null},[]),W=v((e,t=!1)=>{N(e,t);const{priorityBatch:n,backgroundBatch:r}=yn(w.current,P.current,k.current,C.current),i=E.current?T.current+n.length+r.length:n.length+r.length;E.current&&(L.current=i),f(i)},[N]);return y(()=>{const e=R.current;return()=>{D.current+=1,E.current=!1,A.current=null,e.forEach(e=>{e.abort()}),e.clear()}},[]),[{isLoading:a,progress:c,loadedCount:u,totalCount:g,results:m,errors:p,priorityComplete:x},{startPreload:j,reset:$,addUrls:W}]};function bn({enabled:e,hasFirstScene:t,priorityComplete:n,timeoutMs:r,preemptSignal:i=!1,emitRecoverableError:o,getPreloadCounts:a}){const[s,c]=M(()=>e),[l,u]=M(!1),[d,g]=M(0),[f,m]=M(null),h=I(!1),p=I(null),S=Math.max(0,r),x=I(o);x.current=o;const b=I(a);return b.current=a,y(()=>{if(!e||h.current||!t)return;const r=e=>{m(e),g(e=>e+1)};return n?(h.current=!0,u(!0),void r("ready")):(null===p.current&&(p.current=setTimeout(()=>{p.current=null,h.current=!0;const e=b.current();x.current("FIRST_SCENE_TIMEOUT",`First scene priority assets did not load within ${S}ms.`,{sceneIndex:0,timeoutMs:S,loadedCount:e.loadedCount,totalCount:e.totalCount})||(h.current=!0,u(!1),c(!1),r("static"))},S)),()=>{p.current&&(clearTimeout(p.current),p.current=null)})},[e,t,n,S]),y(()=>{i&&(h.current=!0,p.current&&(clearTimeout(p.current),p.current=null),u(!1),c(!1))},[i]),{firstSceneEnterActive:s,firstSceneEnterReady:l,firstSceneActivationToken:d,firstSceneActivationKind:f,handleComplete:v(()=>{c(!1)},[])}}function wn(e,t,n){return Math.min(n,Math.max(t,e))}function Pn(e,t){if(null!=e.key)return`key:${e.key}`;const{sceneId:n}=e.props;return void 0!==n?`scene:${n}`:`index:${t}`}function In(e,t,n,r){if(!(e instanceof Element)||0===r)return!1;const i="x"===n?"overflowX":"overflowY";let o=e;for(;o&&o!==t;){if(o instanceof HTMLElement){const e=window.getComputedStyle(o)[i],t="auto"===e||"scroll"===e||"overlay"===e,a="x"===n?o.scrollLeft:o.scrollTop,s=Math.max(("x"===n?o.scrollWidth:o.scrollHeight)-("x"===n?o.clientWidth:o.clientHeight),0);if(t&&s>1&&(r>0&&a<s-1||r<0&&a>1))return!0}o=o.parentElement}return!1}function Mn(e,t,n){const r=Math.max(.86*n,1);switch(e){case"PageDown":return r;case"PageUp":return-r;case" ":case"Spacebar":return t?-r:r;case"ArrowDown":return 80;case"ArrowUp":return-80;case"Home":return Number.NEGATIVE_INFINITY;case"End":return Number.POSITIVE_INFINITY;default:return 0}}function En(e,t){if(!(e instanceof Element))return!1;const n=e.tagName.toLowerCase();return!(" "!==t||!("button"===n||"summary"===n||"a"===n&&e.hasAttribute("href")||"button"===e.getAttribute("role")||"link"===e.getAttribute("role")))||"input"===n||"textarea"===n||"select"===n||!!(e instanceof HTMLElement&&e.isContentEditable)}function Rn(e){if(!h(e)||"string"==typeof e.type)return!1;let t=e.type;for(let e=0;e<6&&t;e+=1){if(("function"==typeof t||"object"==typeof t)&&null!==t&&!0===t.cineViewScene)return!0;if("object"==typeof t&&null!==t&&"type"in t)t=t.type;else{if("object"!=typeof t||null===t||!("render"in t))break;t=t.render}}return!1}function Dn(e){const t=e;return"number"==typeof t&&Number.isFinite(t)&&t>0?{designSize:t}:{designSize:750}}function An(e){return e.layout?.overlap??"cover"}function kn(e,t,n,r){const i="takeover"===r,o=e=>i?Math.max(e,1):e;if("number"==typeof e&&Number.isFinite(e)&&e>0)return i?null:e;if("string"!=typeof e)return null;const a=e.trim().toLowerCase();if(!a||"auto"===a)return null;const s=Number.parseFloat(a);return!Number.isFinite(s)||s<=0?null:a.endsWith("px")?i?null:s:a.endsWith("vh")?o(n*s/100):a.endsWith("vw")?o(t*s/100):null}function Cn(e,t,n){return kn(e,t,n,"takeover")}function Tn(e,t,n){const r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o="x"===n?t.scrollLeft:t.scrollTop;return"x"===n?r.left-i.left+o:r.top-i.top+o}function Ln({index:e,currentScene:t,totalScenes:n,direction:r,renderProgressMotion:i,style:o,sceneWrapperRefs:a,children:s}){const c=I(null);return ln(()=>{const o=i=>{const o=c.current;if(!o)return;let a=i;0===t&&i<0&&(a=0),t===n-1&&i>0&&(a=0);const s=100*(e-t-a);o.style.transform="y"===r?`translate3d(0, ${s}%, 0)`:`translate3d(${s}%, 0, 0)`};return o(i.get()),i.on("change",o)},[t,r,e,i,n]),O("div",{ref:t=>{c.current=t,a.current[e]=t},style:o,"data-scene-index":e,children:s})}var On=d.memo(function({scene:e,index:t,currentScene:n,totalScenes:r,mode:i,dragConfig:o,dragProgress:a,dragTimelineProgress:c,renderProgress:l,renderProgressMotion:u,timelineProgressMotion:g,isDragging:f,sharedTimelineDurationMs:m,dragRelease:h,sceneActivations:p,firstSceneEnterActive:v,firstSceneEnterReady:S,direction:y,isAnimating:x,viewportWidth:b,viewportHeight:w,sceneActions:P,sceneWrapperRefs:I,renderLaneRef:M,takeoverSnapshot:E,candidateSuspended:R,onCandidateSuspensionChange:D,onElementContinuationChange:A,onPointerSessionStart:k,dragTransaction:C,onPrepared:T,onPreparedInvalidated:L,onOwnershipRequest:V,onSceneChange:z,onDragProgressChange:N,onRenderProgressChange:F,onDragTimelineProgressChange:B,onDraggingChange:j,onSharedTimelineDurationChange:$,onDragRelease:W,onDragReset:H,onTransactionComplete:q,onFirstSceneEnterComplete:Y}){const X=t===n,U=e.props,Z=o?.direction??U.slideDirection??"y",K=s(o,U.drag),_={position:"absolute",inset:0,width:"100%",height:"100%"};if("drag"===i)_.visibility="visible",_.opacity=1,_.pointerEvents=X||f||x||null!==C?"auto":"none",_.contentVisibility="visible",_.transition="none",_.zIndex=X?10:1;else{const e=X||x&&"backward"===y&&(t===n||t===n+1)||x&&"forward"===y&&(t===n||t===n-1);_.visibility=e?"visible":"hidden",_.contentVisibility=e?"visible":"hidden",_.zIndex=x?"backward"===y?t===n+1?2:t===n?1:0:t===n?2:t===n-1?1:0:X?1:0}const G=C?.targetSceneIndex===t?C:null,J=d.useCallback(()=>{0===t&&v?Y():P.completeDragTransition(),"settling"===G?.phase&&q(G.transactionId)},[v,t,Y,q,P,G]),Q=d.useCallback(e=>{A(t,e)},[t,A]),ee=d.useMemo(()=>d.cloneElement(e,{sceneRuntime:{mode:i,direction:Z,isActive:X,sceneIndex:t,totalScenes:r,currentSceneIndex:n,transitionDirection:y,isSceneAnimating:x,sharedTimelineDurationMs:m,activationToken:p.get(t)?.token??0,activationKind:p.get(t)?.kind??null,viewportWidth:b,viewportHeight:w,firstSceneEnterActive:v&&0===t,firstSceneEnterReady:S&&0===t},dragRuntime:{progress:a,renderProgress:l,timelineProgress:c,renderProgressMotion:u,timelineProgressMotion:g,isDragging:f,release:h,threshold:o?.threshold,dragMappingConfig:K,transaction:G,onPrepared:T,onPreparedInvalidated:L,onOwnershipRequest:V,candidateSuspended:R,onCandidateSuspensionChange:D,takeoverSnapshot:E,onElementContinuationChange:Q,onPointerSessionStart:k,renderLane:M,onCommit:z,onReset:H,onActivationComplete:J,onTransactionComplete:q,onProgressChange:N,onRenderProgressChange:F,onTimelineProgressChange:B,onDraggingChange:j,onRelease:W,onSharedTimelineDurationChange:$},onSceneChange:z}),[e.type,e.key,i,Z,X,t,r,n,y,x,m,p,b,w,v,S,a,l,c,u,g,f,h,o,K,G,T,L,V,R,D,E,Q,k,M,z,H,J,q,N,F,B,j,W,$]);return"drag"===i?O(Ln,{index:t,currentScene:n,totalScenes:r,direction:Z,renderProgressMotion:u,style:_,sceneWrapperRefs:I,children:ee}):O("div",{ref:e=>{I.current[t]=e},style:_,"data-scene-index":t,children:ee})});function Vn({scenes:e,visibleSceneIndices:t,currentScene:n,totalScenes:r,mode:i,dragConfig:o,dragProgress:a,dragTimelineProgress:s,renderProgress:c,renderProgressMotion:l,timelineProgressMotion:u,isDragging:d,sharedTimelineDurationMs:g,dragRelease:f,sceneActivations:m,firstSceneEnterActive:h,firstSceneEnterReady:p,direction:v,isAnimating:S,viewportWidth:y,viewportHeight:x,sceneActions:b,sceneWrapperRefs:w,renderLaneRef:P,takeoverSnapshot:I,candidateSuspended:M,onCandidateSuspensionChange:E,onElementContinuationChange:R,onPointerSessionStart:D,dragTransaction:A,onPrepared:k,onPreparedInvalidated:C,onOwnershipRequest:T,onSceneChange:V,onDragProgressChange:z,onRenderProgressChange:N,onDragTimelineProgressChange:F,onDraggingChange:B,onSharedTimelineDurationChange:j,onDragRelease:$,onDragReset:W,onTransactionComplete:H,onFirstSceneEnterComplete:q}){return O(L,{children:e.map((e,L)=>t.has(L)?O(On,{scene:e,index:L,currentScene:n,totalScenes:r,mode:i,dragConfig:o,dragProgress:a,dragTimelineProgress:s,renderProgress:c,renderProgressMotion:l,timelineProgressMotion:u,isDragging:d,sharedTimelineDurationMs:g,dragRelease:f,sceneActivations:m,firstSceneEnterActive:h,firstSceneEnterReady:p,direction:v,isAnimating:S,viewportWidth:y,viewportHeight:x,sceneActions:b,sceneWrapperRefs:w,renderLaneRef:P,takeoverSnapshot:I,candidateSuspended:M,onCandidateSuspensionChange:E,onElementContinuationChange:R,onPointerSessionStart:D,dragTransaction:A,onPrepared:k,onPreparedInvalidated:C,onOwnershipRequest:T,onSceneChange:V,onDragProgressChange:z,onRenderProgressChange:N,onDragTimelineProgressChange:F,onDraggingChange:B,onSharedTimelineDurationChange:j,onDragRelease:$,onDragReset:W,onTransactionComplete:H,onFirstSceneEnterComplete:q},Pn(e,L)):null)})}function zn(e){return e.assets?.preloadImages??[]}function Nn(e,t,n={}){if(!t||0===t.length)return[];const r=n.includeZoneIds??!1,i=new Set,o=[],a=e=>{e&&zn(e.props).forEach(e=>{!e||i.has(e)||(i.add(e),o.push(e))})};return t.forEach(t=>{"number"!=typeof t?t&&e.forEach(e=>{e.props.sceneId!==t?r&&e.props.scroll?.zoneId===t&&a(e):a(e)}):Number.isInteger(t)&&t>=0&&t<e.length&&a(e[t])}),o}function Fn(e){return e?{common:{onReady:e.onReady,onLoadProgress:e.onLoadProgress,onSceneEnter:e.onSceneEnter,onSceneLeave:e.onSceneLeave,onError:e.onError},drag:{onDragStart:e.onDragStart,onDragProgress:e.onDragProgress,onDragBlocked:e.onDragBlocked,onDragEnd:e.onDragEnd,onDragCancel:e.onDragCancel},scroll:{onZoneEnter:e.onZoneEnter,onZoneLeave:e.onZoneLeave,onZoneProgress:e.onZoneProgress,onSceneVisibilityChange:e.onSceneVisibilityChange}}:{common:{},drag:{},scroll:{}}}var Bn="(prefers-reduced-motion: reduce)";function jn(){return typeof window<"u"&&"function"==typeof window.matchMedia&&window.matchMedia(Bn).matches}function $n(e){if(typeof window>"u"||"function"!=typeof window.matchMedia)return()=>{};const t=window.matchMedia(Bn);return"function"==typeof t.addEventListener?(t.addEventListener("change",e),()=>t.removeEventListener("change",e)):(t.addListener(e),()=>t.removeListener(e))}function Wn(){return E($n,jn,()=>!1)}function Hn(e,t,n){return Math.min(n,Math.max(t,e))}function qn(e){return e??"drag"}var Yn={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},Xn=m((e,t)=>{const{designWidth:n,mode:r,direction:i,transitionDuration:o,threshold:a,unit:c,scale:d,firstSceneTimeout:f,scrollbar:m,callbacks:h,monitor:p,children:S}=e,{designSize:x}=Dn(n),w=P(()=>({direction:i,transitionDuration:o,threshold:a,unit:c,scale:d,firstSceneTimeout:f}),[i,o,a,c,d,f]),E=I(null),R=I([]),D=I(0),A=I(null),C=I([]),T=I(null),L=I(new Set),[z,N]=P(()=>{const e=[];return g.forEach(S,t=>{Rn(t)&&e.push(t)}),[e,!1]},[S]),F=z.length,B=P(()=>qn(r),[r]),j=P(()=>Fn(h),[h]),$=I(j),W=I(!1),H=I(!1),[q,Y]=M(!1),X=I(new Set),U=I(new Set),Z=I(null),K=I(null),_=I(0),G=I(!1),J=I(new kt),[Q,ee]=M(null),te=I(null),ne=I(0),re=I(null),ie=I(new Set),oe=I(!1),ae=I(null),se=I(0),[ce,le]=M(()=>new Map),ue=v((e,t)=>{const n={token:++se.current,kind:t};le(t=>{const r=new Map(t);return r.set(e,n),r})},[]);y(()=>{$.current=j},[j]);const de=v((e,t,n)=>{$.current.common?.onError?.({code:e,message:t,context:n})},[]),ge=v((e,t,n)=>{let r=!1;return $.current.common?.onError?.({code:e,message:t,context:n,preventDefault:()=>{r=!0}}),r},[]),fe=v(e=>{$.current.common?.onLoadProgress?.(e)},[]);y(()=>{0===F&&de("EMPTY_SCENES","Cineview requires at least one Scene child.",{mode:B})},[de,B,F]),y(()=>{"drag"===B&&z.forEach((e,t)=>{const n=e.props;s(w,n.drag,({field:e,value:n})=>{const r=`${t}:${e}`;ie.current.has(r)||(ie.current.add(r),de("INVALID_DRAG_CONFIG",`Invalid drag ${e}; using the safe default.`,{sceneIndex:t,field:e,value:n}))});const r=n.drag?.enabled;if(void 0!==r&&"boolean"!=typeof r){const e=`${t}:enabled`;if(ie.current.has(e))return;ie.current.add(e),de("INVALID_DRAG_CONFIG","Invalid drag enabled flag; using true.",{sceneIndex:t,field:"enabled",value:r})}})},[de,w,B,z]);const[me,he]=M(0),[pe,ve]=M(0),Se=v((e,t)=>{A.current=e,j.common?.onSceneEnter?.({fromIndex:e,toIndex:t,direction:t>e?"forward":t<e?"backward":null})},[j]),ye=v((e,t)=>{const n=t??A.current??e;A.current=null,j.common?.onSceneLeave?.({fromIndex:n,toIndex:e,direction:n===e?null:e>n?"forward":e<n?"backward":null})},[j]),[xe,be]=(e=>{const{totalScenes:t,initialScene:n=0,mode:r="drag",onBeforeChange:i,onCommit:o,onAfterChange:a}=e,[s,c]=M(Math.max(0,Math.min(n,t-1))),[l,u]=M(!1),[d,g]=M(null),[f,m]=M(0),[h,p]=M(0),[S,x]=M(0),[b,w]=M(null),[P,E]=M(0),[R,D]=M(!1),[A,k]=M(!1),[C,T]=M(0),[L,O]=M(null),V=I(0),[z,N]=M(null),F=I(!1),B=I(s),j=I(null),$=I(!1),W=I(!1),H=I(null);B.current=s,y(()=>{const e=Math.max(t-1,0);B.current<=e||(c(e),F.current&&(u(!1),F.current=!1,g(null),H.current=null))},[t]);const q=v(()=>{j.current=null,$.current=!1,W.current=!1,m(0),p(0),T(0),O(null),g(null)},[]),Y=v(e=>{B.current=e,c(e),H.current=null,F.current=!1,u(!1),D(!1),E(0),q()},[q]),X=v(e=>{if(null===e)return W.current=!1,void O(null);W.current="settle"===e.mode,V.current+=1,O({...e,token:V.current})},[]),U=v(()=>s<t-1,[s,t]),Z=v(()=>s>0,[s]),K=v((e,n=!0)=>{if(!Number.isInteger(e)||e<0||e>=t)return;if(e===s)return;i?.(s,e);const l=e>s?"forward":"backward";g(l),c(e),o?.(e,s,"programmatic"),n?(u(!0),F.current=!0,H.current={fromScene:s,releaseToken:null},"drag"===r&&(V.current+=1,H.current.releaseToken=V.current,O({token:V.current,mode:"enter",direction:l,targetSceneIndex:e}))):(u(!1),F.current=!1,H.current=null,q(),a?.(e,s))},[s,t,r,i,o,a,q]),_=v(()=>{U()&&K(s+1)},[s,U,K]),G=v(()=>{Z()&&K(s-1)},[s,Z,K]),J=v(e=>{if(u(e),F.current=e,!e){const e=H.current;H.current=null,e?a?.(s,e.fromScene):a?.(s),g(null);const t=e?.releaseToken;null!=t&&O(e=>null!==e&&e.token===t?null:e)}},[s,a]),Q=v(()=>{W.current&&null!==j.current||(j.current=null,$.current=!1,W.current=!1,O(null)),m(0),p(0),E(0),D(!1),T(0)},[]),ee=v(()=>{j.current=null,$.current=!1,W.current=!1,O(null),g(null),p(0),T(0)},[]),te=v(()=>{x(0),w(null),k(!1),N(null)},[]),ne=v((e,n,r,s)=>{const l=B.current,d="forward"===e?l+1:l-1,f=Math.max(0,Math.min(n,1));return f.toFixed(3),d<0||d>=t?(Q(),g(null),u(!1),F.current=!1,!1):(i?.(l,d),g(e),p(f),j.current=l,c(d),o?.(d,l,"drag"),a?.(d,l),m(0),E(0),D(!1),u(!1),F.current=!1,f.toFixed(3),$.current&&q(),!0)},[q,a,i,o,Q,t]),re=v(()=>{null===j.current?W.current&&($.current=!0):q()},[q]),ie=v((e,n)=>{const r=B.current,o="forward"===e?r+1:r-1,s=Math.max(0,Math.min(n,1));if(s.toFixed(3),o<0||o>=t)return te(),g(null),u(!1),void(F.current=!1);i?.(r,o),g(e),w(e),x(s),N({fromScene:r,toScene:o,direction:e,progressRatio:s,startedAt:Date.now(),lastInputAt:Date.now(),isSettling:!1,settleDirection:null}),c(o),x(0),w(null),N(null),k(!1),u(!1),F.current=!1,a?.(o,r),s.toFixed(3)},[a,i,te,t]),oe=v(()=>{S.toFixed(3),x(0),w(null),N(null)},[S]);return[{currentScene:s,isAnimating:l,direction:d,dragProgress:f,dragTimelineProgress:h,scrollProgress:S,scrollDirection:b,renderProgress:P,isDragging:R,isScrolling:A,sharedTimelineDurationMs:C,dragRelease:L,scrollTransitionSnapshot:z},{reconcileSceneList:Y,goToScene:K,nextScene:_,prevScene:G,setAnimating:J,canGoNext:U,canGoPrev:Z,setDragProgress:m,setDragTimelineProgress:p,setScrollProgress:x,setScrollDirection:w,setScrollTransitionSnapshot:N,setRenderProgress:E,setIsDragging:D,setIsScrolling:k,setSharedTimelineDurationMs:T,setDragRelease:X,resetDragInteraction:Q,abortDragContinuation:ee,resetScrollInteraction:te,commitDragSceneChange:ne,completeDragTransition:re,commitScrollSceneChange:ie,clearScrollTransitionSnapshot:oe}]})({totalScenes:F,initialScene:0,mode:B,onBeforeChange:Se,onCommit:(e,t,n)=>{"drag"===B&&ue(e,"drag"===n?"commit":"programmatic")},onAfterChange:(e,t)=>{ye(e,t??D.current)}}),we=I(be);we.current=be;const{currentScene:Pe,isAnimating:Ie,direction:Ee,dragProgress:De,dragTimelineProgress:Ae,renderProgress:ke,isDragging:Ce,sharedTimelineDurationMs:Te,dragRelease:Le}=xe,Oe=P(()=>z.map(Pn),[z]),[Ve,ze]=M(Oe);if(Ve.length!==Oe.length||Ve.some((e,t)=>e!==Oe[t])){const e=Oe.indexOf(Ve[Pe]),t=e>=0?e:Hn(Pe,0,Math.max(0,F-1));ze(Oe),be.reconcileSceneList(t),le(e=>{const t=new Map;for(const[n,r]of e){const e=Oe.indexOf(Ve[n]);e>=0&&t.set(e,r)}return t})}const Ne=k(0),Fe=k(0),Be=Wn(),je=e.a11y?.label??"Scenes";D.current=Pe,C.current=z,ln(()=>{G.current&&(G.current=!1,Ne.set(0),Fe.set(0))},[Pe,Fe,Ne]);const $e=z[Pe],We=$e?function(e,t,n){return Math.max("drag"===t?n??e.sceneTransitionDuration??800:e.sceneTransitionDuration??800,0)}($e.props,B,o):0;y(()=>{if(!Ie||!C.current[Pe])return;const e=setTimeout(()=>{we.current.setAnimating(!1)},We),t=L.current;return t.add(e),()=>{clearTimeout(e),t.delete(e)}},[Ie,Pe,We]),y(()=>{if("drag"===B)return;W.current=!1,H.current=!1,Y(!1),X.current.clear(),U.current.clear(),ne.current=0,re.current=null;const e=te.current;e&&(J.current.releaseTransaction(e.transactionId),te.current=null,ee(null))},[B]);const He=v(e=>{if(!e)return null;const t=te.current,n=!t||t.transactionId!==e.transactionId||t.phase!==e.phase;return t&&t.transactionId!==e.transactionId&&J.current.releaseTransaction(t.transactionId),te.current=e,n&&ee(e),e},[]),qe=v(e=>{const t=te.current;!t||e&&t.transactionId!==e||(J.current.releaseTransaction(t.transactionId),te.current=null,ee(null))},[]),Ye=v(e=>{J.current.publishPrepared(e)},[]),Xe=v(e=>{J.current.invalidatePrepared(e)},[]),Ue=v((e,t)=>{t?X.current.add(e):X.current.delete(e)},[]),Ze=v(()=>{U.current.clear()},[]),Ke=v(e=>e?"drag"===B&&(null!==Z.current||X.current.size>0)&&(K.current={token:++_.current,sceneIndices:[...X.current],staleRatio:Fe.get(),baseRatio:null},H.current=!0,Y(!0),!0):(H.current=!1,Y(!1),null===K.current?.baseRatio&&(K.current=null),!1),[Fe,B]),_e=v(e=>{const t=te.current;!t||t.targetSceneIndex===e||(be.abortDragContinuation(),X.current.delete(t.targetSceneIndex))},[be]),Ge=v(e=>{if("drag"!==B)return!1;const t=H.current,n=W.current;if(n&&!t)return!1;const r=D.current,i=r+("forward"===e?1:-1);if(i<0||i>=F)t&&(_e(null),qe());else{if(!1===z[i]?.props?.drag?.enabled)return U.current.has(e)||(U.current.add(e),$.current.drag?.onDragBlocked?.({fromIndex:r,targetSceneIndex:i,direction:e})),!1;if(!J.current.getPrepared(i))return!1;const t=J.current.beginTransaction(i,"driving",0);if(!t||(_e(i),!He(t)))return!1}return H.current=!1,Y(!1),n||(W.current=!0,ne.current=0,re.current=null,$.current.drag?.onDragStart?.({sceneIndex:r,progress:0,direction:e})),!0},[_e,He,qe,B,z,F]),Je=v(e=>{if("drag"!==B||!W.current)return;const t=0===e?0:Hn(e,-1,1);if(t!==ne.current){if(ne.current=t,0!==t){const e=D.current+(t>0?1:-1);if(e>=0&&e<F){const n=J.current.beginTransaction(e,"driving",Math.abs(t));n&&(_e(e),He(n))}}$.current.drag?.onDragProgress?.({sceneIndex:D.current,progress:Math.abs(t),direction:t>0?"forward":t<0?"backward":null})}},[_e,He,B,F]),Qe=v(e=>{e||(K.current=null),be.setIsDragging(e)},[be]),et=v(e=>{"bounce"===e?.mode&&W.current?re.current={sceneIndex:D.current,signedProgress:ne.current}:"bounce"!==e?.mode&&(re.current=null),be.setDragRelease(e)},[be]);y(()=>{if("drag"===B){if(Le)return void He(J.current.beginTransaction(Le.targetSceneIndex,"settle"===Le.mode?"settling":"bounce"===Le.mode?"bouncing":"programmatic","enter"===Le.mode?0:Le.progressRatio??0));"driving"!==te.current?.phase&&qe()}},[He,Le,qe,B]);const tt=v(()=>{if("drag"===B&&W.current){const e=re.current??{sceneIndex:D.current,signedProgress:ne.current};W.current=!1,ne.current=0,re.current=null,$.current.drag?.onDragCancel?.({sceneIndex:e.sceneIndex,progress:Math.abs(e.signedProgress),direction:e.signedProgress>0?"forward":e.signedProgress<0?"backward":null})}"settling"!==te.current?.phase&&qe(),Ne.set(0),Fe.set(0),be.resetDragInteraction()},[Fe,qe,Ne,B,be]);y(()=>{const e=E.current;if(!e)return;const t=e.ownerDocument?.defaultView??window,n=()=>{const t=e.getBoundingClientRect(),n=t.width,r=t.height;n>0&&he(n),r>0&&ve(r)};T.current=n,n();const r=t.ResizeObserver??(typeof ResizeObserver<"u"?ResizeObserver:void 0),i=r?new r(()=>{n()}):null;return i?.observe(e),t.addEventListener("resize",n),()=>{T.current=null,i?.disconnect(),t.removeEventListener("resize",n)}},[]),y(()=>{if(!m||!1===m.enabled)return;const e=E.current?.ownerDocument??(typeof document<"u"?document:null);if(!e)return;const t="cineview-scrollbar-style";let n=e.getElementById(t);return n||(n=e.createElement("style"),n.id=t,e.head.appendChild(n)),n.textContent='\n [data-cineview-container="true"] {\n scrollbar-width: none;\n -ms-overflow-style: none;\n }\n [data-cineview-container="true"]::-webkit-scrollbar {\n width: 0;\n height: 0;\n display: none;\n }\n ',()=>{n&&n.parentNode&&n.parentNode.removeChild(n)}},[m]);const nt=Pe,{priorityImages:rt,backgroundImages:it}=P(()=>function(e,t,n){if("scroll"===n){const n=e[Hn(t,0,Math.max(e.length-1,0))],r=n?zn(n.props):[],i=new Set(r);return{priorityImages:r,backgroundImages:Array.from(new Set(e.flatMap(e=>zn(e.props).filter(e=>!i.has(e)))))}}const r=Hn(t,0,Math.max(e.length-1,0)),i=[],o=[];e.forEach((e,t)=>{const n=zn(e.props);t===r?i.push(...n):o.push(...n)});const a=new Set(i);return{priorityImages:Array.from(new Set(i)),backgroundImages:Array.from(new Set(o.filter(e=>!a.has(e))))}}(z,nt,B),[z,nt,B]),[ot,at]=xn({priorityUrls:rt,backgroundUrls:it,onProgress:fe,onError:(e,t)=>{de("IMAGE_LOAD_FAILED",t.message,{url:e})}}),st=I(at);st.current=at;const ct=I({loadedCount:0,totalCount:0});ct.current={loadedCount:ot.loadedCount,totalCount:ot.totalCount};const lt=Math.max(0,f??3e3),ut=v(()=>({loadedCount:ct.current.loadedCount,totalCount:ct.current.totalCount}),[]),{firstSceneEnterActive:dt,firstSceneEnterReady:gt,firstSceneActivationToken:ft,firstSceneActivationKind:mt,handleComplete:ht}=bn({enabled:z.length>0,hasFirstScene:!!z[0],priorityComplete:ot.priorityComplete,timeoutMs:lt,preemptSignal:Ce,emitRecoverableError:ge,getPreloadCounts:ut}),pt=I(0);y(()=>{"drag"!==B||ft<=pt.current||null===mt||(pt.current=ft,ue(0,mt))},[ue,mt,ft,B]),y(()=>{const e=L.current;return at.startPreload(),()=>{e.forEach(e=>{clearTimeout(e)}),e.clear()}},[t]),y(()=>{if(p)return u()},[p]),y(()=>{const e=`${rt.join("|")}::${it.join("|")}`;if(ae.current!==e){if(ae.current=e,at.addUrls(rt,!0),at.addUrls(it,!1),!oe.current)return void(oe.current=!0);ot.isLoading||at.startPreload()}},[rt,it,at,ot.isLoading]);const vt=P(()=>{const e=new Set;return e.add(Pe),"drag"===B&&(Pe>0&&e.add(Pe-1),Pe<F-1&&e.add(Pe+1)),e},[B,Pe,F]);!function({ref:e,currentSceneRef:t,scenesRef:n,sceneActionsRef:r,preloadActionsRef:i,measureViewportRef:o,resolvedCallbacksRef:a}){const s=v((e,i=!0)=>{const o=t.current;e>=0&&e<n.current.length&&e!==o&&a.current.drag?.onDragEnd?.({sceneIndex:o,targetSceneIndex:e,progress:1,direction:e>o?"forward":"backward",elapsedMs:0,timelineDurationMs:0}),r.current.goToScene(e,i)},[t,a,r,n]),c=v(()=>{o.current?.()},[o]),u=v(async e=>{const t=Nn(n.current,e,{includeZoneIds:!0});t.length>0&&i.current.addUrls(t,!0),await i.current.startPreload()},[i,n]),d=v(()=>t.current,[t]),g=v(()=>l.getMetrics(),[]),f=I(null);f.current||(f.current={goToScene:(e,t=!0)=>s(e,t),refreshLayout:()=>c(),preload:e=>u(e),getCurrentIndex:()=>d(),getPerformanceMetrics:()=>g()});const m=f.current;b(e,()=>m,[m]);const h=I(!1);y(()=>{h.current||(h.current=!0,a.current.common?.onReady?.(m))},[a,m])}({ref:t,currentSceneRef:D,scenesRef:C,sceneActionsRef:we,preloadActionsRef:st,measureViewportRef:T,resolvedCallbacksRef:$});const St=v((e,t,n,r)=>{const i=Pe,o="forward"===e?i+1:i-1;if("drag"!==B)return void("forward"===e?be.nextScene():be.prevScene());const a=te.current,s=a?.targetSceneIndex===o?a:null,c=s?s.releaseSeed.progressRatio:Math.max(0,Math.min(t??Fe.get(),1)),l=s?s.releaseSeed.elapsedMs:Math.max(0,n??0),u=s?s.registrySnapshot.timelineDuration:Math.max(0,r??0);W.current=!1,ne.current=0,re.current=null,$.current.drag?.onDragEnd?.({sceneIndex:i,targetSceneIndex:o,progress:c,direction:e,elapsedMs:l,timelineDurationMs:u}),G.current=!0,be.commitDragSceneChange(e,c,l,u)||(G.current=!1)},[be,Pe,Fe,B]);y(()=>{},[N,F]);const yt=v(e=>{if("drag"!==B||e.target!==e.currentTarget)return;const t=Math.max(0,C.current.length-1),n="x"===i?"ArrowRight":"ArrowDown",r="x"===i?"ArrowLeft":"ArrowUp";let o=null;if("PageDown"===e.key||e.key===n?o=D.current+1:"PageUp"===e.key||e.key===r?o=D.current-1:"Home"===e.key?o=0:"End"===e.key&&(o=t),null===o)return;e.preventDefault();const a=Math.max(0,Math.min(o,t));a!==D.current&&be.goToScene(a,!0)},[i,B,be]),xt=F>0?`${Pe+1} / ${F}`:"",bt=P(()=>({mode:B,scrollEnterMargin:void 0,scrollExitMargin:void 0,prefersReducedMotion:Be,reportError:e=>{de(e.code,e.message,e.context)}}),[B,de,Be]);return O(Me,{designSize:x,children:O(Re.Provider,{value:bt,children:V("div",{ref:E,style:{position:"relative",width:"100%",height:"100vh",minHeight:"100vh",overflowX:"hidden",overflowY:"hidden",background:"#0d1624"},className:"cineview-container","data-cineview-container":"true",role:"drag"===B?"region":void 0,"aria-roledescription":"drag"===B?"carousel":void 0,"aria-label":"drag"===B?je:void 0,tabIndex:"drag"===B?0:void 0,onKeyDown:"drag"===B?yt:void 0,children:[O("div",{style:{opacity:1,pointerEvents:"auto"},children:O(Vn,{scenes:z,visibleSceneIndices:vt,currentScene:Pe,totalScenes:F,mode:B,dragConfig:w,dragProgress:De,dragTimelineProgress:Ae,renderProgress:ke,renderProgressMotion:Ne,timelineProgressMotion:Fe,isDragging:Ce,sharedTimelineDurationMs:Te,dragRelease:Le,sceneActivations:ce,firstSceneEnterActive:dt,firstSceneEnterReady:gt,direction:Ee,isAnimating:Ie,viewportWidth:me,viewportHeight:pe,sceneActions:be,sceneWrapperRefs:R,renderLaneRef:Z,takeoverSnapshot:K,candidateSuspended:q,onCandidateSuspensionChange:Ke,onElementContinuationChange:Ue,onPointerSessionStart:Ze,dragTransaction:Q,onPrepared:Ye,onPreparedInvalidated:Xe,onOwnershipRequest:Ge,onTransactionComplete:qe,onSceneChange:St,onDragProgressChange:Je,onRenderProgressChange:void 0,onDragTimelineProgressChange:e=>Fe.set(e),onDraggingChange:Qe,onSharedTimelineDurationChange:be.setSharedTimelineDurationMs,onDragRelease:et,onDragReset:tt,onFirstSceneEnterComplete:ht})}),"drag"===B?O("div",{role:"status","aria-live":"polite",style:Yn,children:xt}):null]})})})});Xn.displayName="CineviewDrag";var Un=Xn;function Zn({direction:e,viewportSpan:t,scrollContentSpan:n,scrollOffset:r,scrollOffsetStore:i,isScrolling:o,config:a,onScrollToOffset:s}){const c=a.autoHide??!0,l=a.ariaLabel??"CineView scroll position",u=Math.max(a.width??6,4),d=Math.max(a.radius??999,0),g=Math.max(a.inset??0,0),f=a.trackColor??"transparent",m=a.thumbColor??"rgba(255, 255, 255, 0.28)",h=a.thumbHoverColor??m,[p,S]=M(!1),[x,b]=M(!1),w=I(null),P=I(null),E=Math.max(n-t,0),R=wn(i?.getSnapshot()??r,0,E),D=I(R);D.current=R;const A=E+t,k=E>1,C=Math.max(t-2*g,1),T=E>0?wn(t/Math.max(A,t)*C,Math.min(40,C),C):C,L=Math.max(C-T,0),V=E>0?wn(R/E*L,0,L):0;y(()=>{const t=()=>{const t=wn(i?.getSnapshot()??r,0,E);if(D.current=t,w.current?.setAttribute("aria-valuenow",String(Math.round(t))),!P.current)return;const n=E>0?wn(t/E*L,0,L):0;"x"===e?P.current.style.left=`${n}px`:P.current.style.top=`${n}px`};return t(),i?.subscribe(t)},[e,r,E,i,L]);const z=I(null);y(()=>{z.current?.()},[e,E,s,C,T]);const N=v(e=>{const n=Mn(e.key,e.shiftKey,t);0!==n&&(s(n===Number.POSITIVE_INFINITY?E:n===Number.NEGATIVE_INFINITY?0:wn(D.current+n,0,E)),e.preventDefault())},[E,s,t]),F=v(t=>{if(E<=0||typeof window>"u"||"mouse"===t.pointerType&&0!==t.button||!1===t.isPrimary||(t.preventDefault(),z.current))return;const n=t.currentTarget.getBoundingClientRect(),r="x"===e?n.width:n.height,i="x"===e?n.left:n.top,o="x"===e?t.clientX:t.clientY,a=E>0?wn(D.current/E*Math.max(r-T,0),0,Math.max(r-T,0)):0,c=o-i,l=c>=a&&c<=a+T,u=l?c-a:T/2,d=e=>{const t=Math.max(r-T,0),n=wn(e-i-u,0,t);s((t>0?n/t:0)*E)};if(d(o),!l)return;const g=t.pointerId,f=t=>{t.pointerId===g&&(t.preventDefault(),d("x"===e?t.clientX:t.clientY))},m=()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),z.current===m&&(z.current=null)};function h(e){e.pointerId===g&&m()}z.current=m,window.addEventListener("pointermove",f,{passive:!1}),window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h)},[e,E,s,T]);return y(()=>()=>{z.current?.()},[]),k?O("div",{"data-cineview-scrollbar-overlay":"true",style:{position:"absolute",inset:0,zIndex:80,pointerEvents:"none",opacity:c?o||p?1:0:1,transition:c?o?"opacity 0.08s ease-out":"opacity 0.5s ease-in 0.15s":"none"},children:O("div",{ref:w,role:"scrollbar","aria-label":l,"aria-orientation":"x"===e?"horizontal":"vertical","aria-valuemin":0,"aria-valuemax":Math.round(E),"aria-valuenow":Math.round(R),tabIndex:0,"data-cineview-scrollbar-rail":"true",onPointerDown:F,onKeyDown:N,onFocus:()=>S(!0),onBlur:()=>S(!1),style:"x"===e?{position:"absolute",left:g,bottom:g,width:C,height:u,borderRadius:d,background:f,boxShadow:"0 10px 24px rgba(53, 74, 116, 0.14)",pointerEvents:"auto",touchAction:"none",cursor:"pointer",outline:p?"2px solid rgba(24, 119, 242, 0.95)":"none",outlineOffset:2}:{position:"absolute",top:g,right:g,width:u,height:C,borderRadius:d,background:f,boxShadow:"0 10px 24px rgba(53, 74, 116, 0.14)",pointerEvents:"auto",touchAction:"none",cursor:"pointer",outline:p?"2px solid rgba(24, 119, 242, 0.95)":"none",outlineOffset:2},children:O("div",{ref:P,"data-cineview-scrollbar-thumb":"true",onPointerEnter:()=>b(!0),onPointerLeave:()=>b(!1),style:"x"===e?{position:"absolute",left:V,top:0,width:T,height:u,borderRadius:d,background:x?h:m,boxShadow:"0 10px 24px rgba(53, 74, 116, 0.16)",cursor:"grab"}:{position:"absolute",top:V,left:0,width:u,height:T,borderRadius:d,background:x?h:m,boxShadow:"0 10px 24px rgba(53, 74, 116, 0.16)",cursor:"grab"}})})}):null}function Kn(e,t){let n=e;const r=new Map;return{getSnapshot:()=>n,getKeySnapshot:e=>t(n,e),subscribeKey:(e,t)=>{const n=r.get(e)??new Set;return n.add(t),r.set(e,n),()=>{n.delete(t),0===n.size&&r.delete(e)}},setSnapshot:e=>{if(Object.is(n,e))return;const i=n;n=e,r.forEach((n,r)=>{Object.is(t(i,r),t(e,r))||n.forEach(e=>e())})}}}Zn.displayName="ScrollbarOverlay";var _n={sceneLayout:null,sceneZoneState:null,sceneTimelineState:null,isCurrent:!1,isBackdropActive:!1,visualViewportOffset:0,isScrolling:!1,scrollDirection:null,activeSceneIndex:0,viewportWidth:0,viewportHeight:0,firstSceneEnterGateKnown:!1,firstSceneEnterActive:!1,firstSceneEnterReady:!1,direction:"y",sceneCount:0,sceneSizing:"content",exposeTakeoverDebugData:!1,takeoverSceneSpan:null},Gn=p(function({child:e,store:t,frameStore:n,sceneIndex:r,setWrapperRef:i,scrollCallbacks:o}){const a=v(e=>t.subscribeKey(r,e),[r,t]),s=v(()=>t.getKeySnapshot(r)??_n,[r,t]),{sceneLayout:c,sceneZoneState:l,sceneTimelineState:u,isCurrent:g,isBackdropActive:f,visualViewportOffset:m,isScrolling:h,scrollDirection:p,activeSceneIndex:S,viewportWidth:y,viewportHeight:x,firstSceneEnterGateKnown:b,firstSceneEnterActive:w,firstSceneEnterReady:P,direction:M,sceneCount:R,sceneSizing:D,exposeTakeoverDebugData:A,takeoverSceneSpan:k}=E(a,s,s),C=!!e.props.scroll,T=I(null);ln(()=>{const e=T.current;if(!e)return;if(!A||!C||!n)return e.removeAttribute("data-cineview-takeover-progress-px"),void e.removeAttribute("data-cineview-takeover-viewport-offset");const t=()=>{const t=n.getKeySnapshot(r);e.setAttribute("data-cineview-takeover-progress-px",null==t?.zoneProgressPx?"":String(t.zoneProgressPx)),e.setAttribute("data-cineview-takeover-viewport-offset",t?String(t.visualViewportOffset):"")};return t(),n.subscribeKey(r,t)},[A,n,C,r]);const L=Math.max("x"===M?y:x,1),V="screen"===D&&!C,z=c?.flowSpan,N=c?.visualSpan??k??L,F=e.props.layout?.width??e.props.sceneWidth??"100vw",B=C?Math.max((N-L)/2,0):0,j=C?Math.max((L-N)/2,0):0,$=v(e=>i(r,e),[r,i]),W=d.useRef(e.props.callbacks);W.current=e.props.callbacks;const H=d.useMemo(()=>({get onVisibilityChange(){const e=W.current?.onVisibilityChange,t=o?.onSceneVisibilityChange;return n=>{e?.(n),t?.(n)}}}),[o?.onSceneVisibilityChange]),q=d.useRef(e.props.layout);q.current=e.props.layout;const Y=d.useMemo(()=>{const e=q.current;return C&&null!==k?{...e,..."x"===M?{width:k}:{height:k}}:"x"!==M||C?e:{...e,width:"auto"===F?"auto":"100%"}},[C,k,M,F]),X=d.useMemo(()=>({mode:"scroll",direction:M,isActive:g,sceneIndex:r,totalScenes:R,currentSceneIndex:S,transitionDirection:p,isSceneAnimating:h,sharedElapsedMs:0,sharedTimelineDurationMs:0,viewportWidth:y,viewportHeight:x,firstSceneEnterGateKnown:b,firstSceneEnterActive:w,firstSceneEnterReady:P}),[M,g,r,R,S,p,h,y,x,b,w,P]),U=d.useMemo(()=>({progress:u?.sceneProgress??0,isScrolling:h,direction:p,transitionSnapshot:null,backdropActive:f,timelineState:u,activeSceneIndex:S,viewportOffset:m,onProgressChange:void 0,onDirectionChange:void 0,onScrollingChange:void 0,onCommit:void 0,onReset:void 0,frameStore:n,sceneIndex:r}),[u,h,p,f,S,m,n,r]),Z=d.cloneElement(e,{layout:Y,callbacks:H,sceneRuntime:X,scrollRuntime:U});return O("div",{ref:$,"data-scene-index":r,style:{position:"relative",width:"x"===M?C&&"number"==typeof z?z:C?"100vw":F:"100%",flex:"x"===M?"0 0 auto":void 0,minHeight:"y"===M&&V?"100vh":void 0,minWidth:"x"===M&&V?"100vw":void 0,...C&&"number"==typeof z?"x"===M?{boxSizing:"border-box",paddingLeft:B}:{boxSizing:"border-box",paddingTop:B,height:z}:{}},children:C?O("div",{ref:T,"data-cineview-takeover-shell":r,...A?{"data-cineview-takeover-active-zone":l?.active?l.zoneId:"","data-cineview-takeover-total-distance-px":l?.totalBudgetPx??"","data-cineview-takeover-center-lock-offset":c?.centerLockOffset??"","data-cineview-takeover-segment-start":c?.segmentStart??"","data-cineview-takeover-segment-end":c?.segmentEnd??""}:{},style:"x"===M?{position:"sticky",left:j,width:N,maxWidth:"100vw",height:"100%",overflow:"hidden",zIndex:l?.active?30:void 0}:{position:"sticky",top:j,width:"100%",height:N,maxHeight:"100vh",overflow:"hidden",zIndex:l?.active?30:void 0},children:O("div",{"data-cineview-takeover-content":r,style:"x"===M?{width:N,height:"100%",transform:`translateX(${-B}px)`}:{width:"100%",height:N,transform:`translateY(${-B}px)`},children:Z})}):Z},e.key??`scene-${r}`)});function Jn({childrenArray:e,store:t,frameStore:n,setWrapperRef:r,scrollCallbacks:i}){let o=0;return O(L,{children:e.map((e,a)=>{if(!Rn(e))return O(d.Fragment,{children:e},`flow-${a}`);const s=o++;return O(Gn,{child:e,store:t,frameStore:n,sceneIndex:s,setWrapperRef:r,scrollCallbacks:i},e.key??`scene-${s}`)})})}function Qn(e){return Number.isFinite(e)?Math.max(0,e):0}function er(e,t,n){return Math.min(n,Math.max(t,e))}function tr(e,t,n,r){return void 0===e?t:n+(r-n)*er(e,0,1)}function nr(e,t,n,r,i,o){const a=n.get(e);if(a)return a;const s=t.get(e);if(!s){const t={animateId:e,startMs:0,enterStartMs:0,enterEndMs:0,exitStartMs:null,exitEndMs:null,totalEndMs:0,hasExit:!1};return n.set(e,t),t}if(r.has(e)){const t=[...r],o=t.indexOf(e);t.slice(o).forEach(e=>i.add(e));const a={animateId:e,startMs:Qn(s.delay),enterStartMs:Qn(s.delay),enterEndMs:Qn(s.delay)+Qn(s.enterDuration),exitStartMs:null,exitEndMs:null,totalEndMs:Qn(s.delay)+Qn(s.enterDuration),hasExit:!1};return n.set(e,a),a}r.add(e);let c=0;if(s.after){const a=nr(s.after,t,n,r,i,o);i.has(e)||(c=o.get(s.after)??a.enterEndMs)}const l=c+Qn(s.delay),u=Math.max(Qn(s.enterDuration),1),d=Qn(s.exitDuration),g=l+u,f=d>0,m=f?g+d:null,h={animateId:e,startMs:l,enterStartMs:l,enterEndMs:g,exitStartMs:f?g:null,exitEndMs:m,totalEndMs:m??g,hasExit:f};return n.set(e,h),r.delete(e),h}function rr(e){const t=new Map,n=new Set;let r=new Map,i=e;const o=[...e.values()].some(e=>void 0!==e.phase?.start||void 0!==e.phase?.end),a=()=>{i.forEach((e,o)=>{nr(o,i,t,new Set,n,r)})};a();let s,c=0;if(o){const o=function(e,t){const n=new Set;e.forEach((e,t)=>{[e.phase?.start,e.phase?.end].some(e=>void 0!==e&&!Number.isFinite(e))&&n.add(t)});const r=(e,t)=>e.map(e=>({...e,offset:e.offset+t})),i=(...e)=>{const t=new Map;return e.flat().forEach(e=>{(!t.has(e.fraction)||t.get(e.fraction).offset<e.offset)&&t.set(e.fraction,e)}),[...t.values()]};for(;;){const o=new Map,a=[],s=c=>{const l=o.get(c);if(l)return l;const u=e.get(c);if(!u)return[{fraction:0,offset:0}];const d=!!u.after&&!t.has(c),g=d?s(u.after):[{fraction:0,offset:0}],f=r(g,Qn(u.delay)),m=r(f,Math.max(Qn(u.enterDuration),1));a.push(...r(m,Qn(u.exitDuration)));const h=n.has(c)?void 0:u.phase;let p=m;if(void 0!==h?.start||void 0!==h?.end){const e=void 0===h.start?f:i([{fraction:er(h.start,0,1),offset:0,phaseId:c}],d?f:[]);p=i(void 0===h.end?m:[{fraction:er(h.end,0,1),offset:0,phaseId:c}],r(e,1)),a.push(...r(p,u.exitDuration>0?1:0))}return o.set(c,p),p};e.forEach((e,t)=>s(t));let c=0;const l=n.size;if(a.forEach(e=>{const t=e.fraction<1?e.offset/(1-e.fraction):0===e.offset?0:1/0;!Number.isFinite(t)&&e.phaseId?n.add(e.phaseId):c=Math.max(c,t)}),n.size!==l)continue;const u=new Map;return o.forEach((e,t)=>{u.set(t,e.reduce((e,t)=>Math.max(e,t.fraction*c+t.offset),0))}),{enterEnds:u,totalDurationMs:c,invalidPhaseIds:n}}}(e,n);c=o.totalDurationMs,r=o.enterEnds,s=o.invalidPhaseIds,s.size>0&&(i=new Map(e),s.forEach(t=>{i.set(t,{...e.get(t),phase:void 0})})),t.clear(),n.clear(),a()}t.forEach(e=>{c=Math.max(c,e.totalEndMs)});const l=c>0?Math.max(1*c,1):0,u={};return t.forEach((e,t)=>{const r=i.get(t),o=void 0!==r?.phase?.start||void 0!==r?.phase?.end,a={...e,startPx:1*e.startMs,enterStartPx:1*e.enterStartMs,enterEndPx:1*e.enterEndMs,exitStartPx:null===e.exitStartMs?null:1*e.exitStartMs,exitEndPx:null===e.exitEndMs?null:1*e.exitEndMs,totalEndPx:1*e.totalEndMs,phaseStartPx:0,phaseEndPx:0},s=a.enterStartPx,c=Math.max(a.enterEndPx,s+1),d=o?0:s,g=o?l:c,f=Math.max(tr(r?.phase?.start,s,d,g),r?.after&&!n.has(t)?s:0),m=Math.max(tr(r?.phase?.end,c,d,g),f+1);if(a.phaseStartPx=f,a.phaseEndPx=m,o)if(a.hasExit){const t=Qn((e.exitEndMs??e.totalEndMs)-(e.exitStartMs??e.enterEndMs)),n=1*Math.max(t,1);a.exitEndPx=l,a.exitStartPx=Math.max(m,l-n),a.totalEndPx=a.exitEndPx}else a.totalEndPx=m;u[t]=a}),{budgets:u,totalDurationMs:c,totalBudgetPx:l,...s?.size?{invalidPhaseIds:[...s]}:{}}}var ir=m(function({children:e,designWidth:t,direction:n,sceneSizing:r="content",enterMargin:i,exitMargin:o,scrollbar:a,callbacks:s,monitor:c,debug:f},m){const{designSize:h}=Dn(t),p=P(()=>{const e=Fn(s);return{common:e.common,drag:e.drag,scroll:e.scroll}},[s?.onReady,s?.onLoadProgress,s?.onSceneEnter,s?.onSceneLeave,s?.onError,s?.onDragStart,s?.onDragProgress,s?.onDragBlocked,s?.onDragEnd,s?.onDragCancel,s?.onZoneEnter,s?.onZoneLeave,s?.onZoneProgress,s?.onSceneVisibilityChange]),S=n??"y",x=I(null),w=I(0),E=I(function(){let e=0;const t=new Set;return{getSnapshot:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),setSnapshot:n=>{Object.is(e,n)||(e=n,t.forEach(e=>e()))}}}()),R=I(null),D=I(()=>{}),A=I(0),k=I(null),C=I([]),[T,L,z,N]=P(()=>{const t=new Map,n=[],r=[];let i=!1;return[g.toArray(e).map(e=>{if(i||(i=!1),!Rn(e))return e;const o=r.length,a=e;let s=a;if(a.props.scroll){const e=a.props.scroll.zoneId??a.props.sceneId;if(void 0!==e){const r=t.get(e);void 0===r?t.set(e,o):(n[o]=[e,r],s=d.cloneElement(a,{scroll:void 0}))}}return r.push(s),s}),r,n,i]},[e]);C.current=L;const{viewportSize:F,viewportSizeRef:B,getViewportSpan:j,updateViewportMetrics:$}=function({rootRef:e,direction:t}){const[n,r]=M({width:0,height:0}),i=I({width:0,height:0});return{viewportSize:n,viewportSizeRef:i,getViewportSpan:v(()=>{const n=e.current;return Math.max("x"===t?n?.clientWidth??i.current.width:n?.clientHeight??i.current.height,1)},[t,e]),updateViewportMetrics:v(()=>{const t=e.current;if(!t)return;const n=t.clientWidth,o=t.clientHeight;i.current={width:n,height:o},r(e=>e.width===n&&e.height===o?e:{width:n,height:o})},[e])}}({rootRef:x,direction:S}),{zoneRegistryRef:W,zoneStatesRef:H,timelineStoreRef:q,zoneRuntimeVersion:Y,getZoneIdForScene:X,getZoneDistance:U,zoneRuntimeValue:Z,zoneTimelineValue:K}=function({scrollOffsetRef:e,measureSceneLayoutsRef:t,updateSceneRenderSnapshotsRef:n,onError:r}){const i=I(r);i.current=r;const o=I(new WeakSet),a=I(new Map),s=I(new Map),c=I({}),l=I(Kn({},(e,t)=>e[t])),[u,d]=M(0),g=v(e=>{for(const[t,n]of a.current.entries())if(n.sceneIndex===e)return t;return null},[]),f=v(e=>{const t=g(e);return t?c.current[t]?.totalBudgetPx??0:0},[g]),m=v((t,r)=>{const i=c.current,o=r(i[t]);if(o){const e=i[t];if(e&&e.sceneIndex===o.sceneIndex&&e.progressPx===o.progressPx&&e.totalBudgetPx===o.totalBudgetPx&&e.active===o.active&&e.direction===o.direction&&e.approach===o.approach&&function(e,t){if(e.totalDurationMs!==t.totalDurationMs||e.totalBudgetPx!==t.totalBudgetPx||(e.invalidPhaseIds??[]).join("\0")!==(t.invalidPhaseIds??[]).join("\0"))return!1;const n=Object.keys(e.budgets);return n.length===Object.keys(t.budgets).length&&n.every(n=>{const r=e.budgets[n],i=t.budgets[n];return!!(r&&i&&function(e,t){return e.animateId===t.animateId&&e.startMs===t.startMs&&e.enterStartMs===t.enterStartMs&&e.enterEndMs===t.enterEndMs&&e.exitStartMs===t.exitStartMs&&e.exitEndMs===t.exitEndMs&&e.totalEndMs===t.totalEndMs&&e.startPx===t.startPx&&e.enterStartPx===t.enterStartPx&&e.enterEndPx===t.enterEndPx&&e.exitStartPx===t.exitStartPx&&e.exitEndPx===t.exitEndPx&&e.totalEndPx===t.totalEndPx&&e.phaseStartPx===t.phaseStartPx&&e.phaseEndPx===t.phaseEndPx&&e.hasExit===t.hasExit}(r,i))})}(e.sequence,o.sequence))return;c.current={...i,[t]:o}}else{if(!(t in i))return;const e={...i};delete e[t],c.current=e}l.current.setSnapshot(c.current),n.current(e.current)},[e,n]),h=v(e=>{const t=a.current.get(e);if(!t)return void m(e,()=>null);const n=s.current.get(e)??new Map,r=rr(n);r.invalidPhaseIds?.forEach(t=>{const r=n.get(t);if(!r||o.current.has(r))return;o.current.add(r);const a=`Animate "${t}" has an invalid timeline.phase in zone "${e}". Its phase cannot fit reachable entrance and exit intervals in a finite zone budget; using duration, delay and after instead.`;i.current?.({code:"INVALID_ANIMATION",message:a,context:{zoneId:e,animateId:t,field:"timeline.phase"}})}),m(e,n=>({zoneId:e,sceneIndex:t.sceneIndex,progressPx:Math.min(r.totalBudgetPx,Math.max(n?.progressPx??0,0)),totalBudgetPx:r.totalBudgetPx,active:n?.active??!1,direction:n?.direction??null,sequence:r,approach:n?.approach??"near"})),d(e=>e+1)},[m]);I(new Set);const p=v((e,t)=>{const n=a.current.get(e);if(!n||n.sceneIndex===t.sceneIndex){if(n)return void h(e);a.current.set(e,{...t,element:null}),h(e)}},[h]),S=v((e,t)=>{a.current.get(e)?.sceneIndex===t&&(a.current.delete(e),s.current.delete(e),m(e,()=>null),d(e=>e+1))},[m]),y=v((e,n,r)=>{const i=a.current.get(e);!i||i.sceneIndex!==n||(i.element=r,t.current?.())},[t]),x=v((e,t)=>{const n=s.current.get(e)??new Map;return n.set(t.animateId,t),s.current.set(e,n),h(e),t},[h]),b=v((e,t,n)=>{const r=s.current.get(e);!r||r.get(t)!==n||(r.delete(t),h(e))},[h]);return{zoneRegistryRef:a,zoneAnimationsRef:s,zoneStatesRef:c,timelineStoreRef:l,zoneRuntimeVersion:u,getZoneIdForScene:g,getZoneDistance:f,syncZoneState:m,recomputeZoneSequence:h,zoneRuntimeValue:P(()=>({registerZone:p,unregisterZone:S,setZoneElement:y,registerZoneAnimation:x,unregisterZoneAnimation:b}),[p,S,y,x,b]),zoneTimelineValue:P(()=>({store:l.current}),[])}}({scrollOffsetRef:w,measureSceneLayoutsRef:R,updateSceneRenderSnapshotsRef:D,onError:p.common?.onError}),{sceneLayoutsRef:_,sceneWrapperRefs:G,measureSceneLayouts:J,setSceneWrapperRef:Q}=function({rootRef:e,direction:t,scenes:n,sceneSizing:r,getViewportSpan:i,getZoneIdForScene:o,getZoneDistance:a,zoneRegistryRef:s,scrollOffsetRef:c,updateSceneRenderSnapshotsRef:l}){const u=I([]),d=I([]);return{sceneLayoutsRef:u,sceneWrapperRefs:d,measureSceneLayouts:v(()=>{const g=e.current;if(!g)return u.current;const f=i(),m=n.map((e,i)=>{const c=d.current[i],l=e.props,u=function(e){return{enterAnimation:e.transition?.enterAnimation??e.enterAnimation,exitAnimation:e.transition?.exitAnimation??e.exitAnimation,transitionDurationMs:e.sceneTransitionDuration??800,scrollEnterLength:e.scrollEnterLength,scrollExitLength:e.scrollExitLength}}(l),m=!!l.scroll,h=m?Cn("x"===t?l.layout?.width??l.sceneWidth:l.layout?.height??l.sceneHeight,g.clientWidth,g.clientHeight):null,p=o(i),v=p?s.current.get(p)?.element:null,S=m?h:function(e,t,n,r){return kn("x"===t?e.layout?.width??e.sceneWidth:e.layout?.height??e.sceneHeight,n,r,"declared")}(l,t,g.clientWidth,g.clientHeight),y="x"===t?Math.max(m?v?.offsetWidth??0:c?.offsetWidth??0,m?v?.clientWidth??0:c?.clientWidth??0,0):Math.max(m?v?.offsetHeight??0:c?.offsetHeight??0,m?v?.clientHeight??0:c?.clientHeight??0,0),x=m?Math.max(h??y,1):"screen"===r?Math.max(y,S??0,f,1):Math.max(y,S??0,1),b=m?a(i):0,w=m?Math.max(x,f)+b:x,P=c?Tn(c,g,t):0,I=P+w,M=Math.max(P+x/2-f/2,0),E=!!(u.enterAnimation&&i>0),R=!!(u.exitAnimation&&i<n.length-1),D=Math.max(0,u.scrollEnterLength??(E?u.transitionDurationMs:0)),A=Math.max(0,u.scrollExitLength??(R?u.transitionDurationMs:0)),k=Math.max(Math.min(w,f),1);return{sceneStart:P,sceneEnd:I,visualSpan:x,flowSpan:w,timelineDistancePx:b,centerLockOffset:M,segmentStart:M,segmentEnd:M+b,enterLength:Math.min(D,k),exitLength:Math.min(A,k),stackMode:An(l)}});return u.current=function(e,t){return e.length===t.length&&t.every((t,n)=>{const r=e[n];return r.sceneStart===t.sceneStart&&r.sceneEnd===t.sceneEnd&&r.visualSpan===t.visualSpan&&r.flowSpan===t.flowSpan&&r.timelineDistancePx===t.timelineDistancePx&&r.centerLockOffset===t.centerLockOffset&&r.segmentStart===t.segmentStart&&r.segmentEnd===t.segmentEnd&&r.enterLength===t.enterLength&&r.exitLength===t.exitLength&&r.stackMode===t.stackMode})}(u.current,m)?u.current:m,l.current(c.current),u.current},[t,i,a,o,e,r,n,c,l,s]),setSceneWrapperRef:v((e,t)=>{d.current[e]=t},[])}}({rootRef:x,direction:S,scenes:L,sceneSizing:r,getViewportSpan:j,getZoneIdForScene:X,getZoneDistance:U,zoneRegistryRef:W,scrollOffsetRef:w,updateSceneRenderSnapshotsRef:D}),ee=I(!1),te=void 0!==(se=f)?se:!(typeof window>"u"||!window.__CINEVIEW_SCROLL_DEBUG__),ne=P(()=>{const e=zn(L[0]?.props??{}),t=new Set(e);return{priorityImages:e,backgroundImages:Array.from(new Set(L.flatMap(e=>zn(e.props).filter(e=>!t.has(e)))))}},[L]),[re,ie]=xn({priorityUrls:ne.priorityImages,backgroundUrls:ne.backgroundImages,onProgress:p.common?.onLoadProgress}),oe=ie.startPreload,ae=I({loadedCount:0,totalCount:0});var se;ae.current={loadedCount:re.loadedCount,totalCount:re.totalCount};const ce=v((e,t,n)=>{let r=!1;return p.common?.onError?.({code:e,message:t,context:n,preventDefault:()=>{r=!0}}),r},[p.common]),le=Wn(),ue=L.length;y(()=>{0===ue&&ce("EMPTY_SCENES","Cineview requires at least one Scene child.",{mode:"scroll"})},[ce,ue]);const de=I(void 0);y(()=>{de.current!==z&&(de.current=z,z.forEach(([e,t],n)=>{ce("INVALID_COMPONENT_HIERARCHY",`Duplicate scroll zone id "${e}".`,{reason:"duplicate-scroll-zone",zoneId:e,ownerSceneIndex:t,rejectedSceneIndex:n})}))},[z,ce]);const ge=v(()=>({loadedCount:ae.current.loadedCount,totalCount:ae.current.totalCount}),[]),{firstSceneEnterActive:fe,firstSceneEnterReady:me}=bn({enabled:L.length>0,hasFirstScene:!!L[0],priorityComplete:re.priorityComplete,timeoutMs:3e3,emitRecoverableError:ce,getPreloadCounts:ge}),he=v(e=>Nn(L,e,{includeZoneIds:!0}),[L]);y(()=>{oe()},[ne,oe]);const{store:pe,frameStore:ve}=function({scenes:e,sceneLayoutsRef:t,timelineStoreRef:n,viewportSizeRef:r,activeSceneIndexRef:i,scrollDirectionRef:o,isScrollingStateRef:a,direction:s,sceneSizing:c,firstSceneEnterActive:l,firstSceneEnterReady:u,exposeTakeoverDebugData:d,scrollOffsetRef:g,updateSceneRenderSnapshotsRef:f}){const m=I(Kn([],(e,t)=>e[t])),h=I(function(){let e=[];const t=new Map,n=e=>{t.get(e)?.forEach(e=>e())};return{setSnapshot:t=>{const r=e;e=Array.from(t);const i=Math.max(r.length,e.length);for(let t=0;t<i;t+=1)Object.is(r[t],e[t])||n(t)},setKeySnapshot:(t,r)=>{Object.is(e[t],r)||(e[t]=r,n(t))},clearFrom:t=>{if(e.length<=t)return;const r=e.length;e.length=t;for(let e=t;e<r;e+=1)n(e)},getKeySnapshot:t=>e[t],subscribeKey:(e,n)=>{const r=t.get(e)??new Set;return r.add(n),t.set(e,r),()=>{r.delete(n),0===r.size&&t.delete(e)}}}}()),p=I(null),[S,x]=M(0),b=I(null),w=I([]),P=v(g=>{const f=n.current.getSnapshot(),v=t.current,S=r.current,y=Math.max("x"===s?S.width:S.height,1),P=i.current,I="cover"===v[P]?.stackMode&&P>0?P-1:null,M=m.current.getSnapshot(),E=b.current,R=a.current,D=o.current,A=null===E||E[0]!==e||E[1]!==v||E[6]!==S.width||E[7]!==S.height||E[10]!==s||E[11]!==c||E[12]!==d,k=new Set,C=t=>{null!==t&&t>=0&&t<e.length&&k.add(t)},T=e=>{C(e-1),C(e),C(e+1)};if(A){w.current.length=0;for(const e in f){const t=f[e];w.current[t.sceneIndex]=t}for(let t=0;t<e.length;t+=1)k.add(t)}else{const[,,e,t,n,r,i,o,a,c]=E;for(const t in f){const n=f[t],r=e[t];n!==r&&(r&&r.sceneIndex!==n.sceneIndex&&w.current[r.sceneIndex]===r&&(w.current[r.sceneIndex]=void 0),w.current[n.sceneIndex]=n,C(r?.sceneIndex??null),C(n.sceneIndex))}for(const t in e){if(t in f)continue;const n=e[t];w.current[n.sceneIndex]===n&&(w.current[n.sceneIndex]=void 0),C(n.sceneIndex)}const d=Math.max("x"===s?i:o,1);for(let e=0;e<v.length;e+=1){const n=v[e],r=g<n.sceneEnd&&g+y>n.sceneStart,i=t<n.sceneEnd&&t+d>n.sceneStart;(r||i)&&C(e)}T(n),T(P),C(r),C(I),(a!==l||c!==u)&&C(0)}const L=A?[]:M.slice();let O=A;const V=A?new Array(e.length):null;k.forEach(t=>{const n=e[t];if(!n)return;const r=v[t]??null,i=w.current[t]??null,o=!!n.props.scroll,a=t===P||!!i?.active,f=I===t,m=o&&i?.active&&r?r.centerLockOffset:g,p=o&&r?r.centerLockOffset:g,x=r?function(e,t,n){if(!e)return null;const r=Math.max(n,1),i=t,o=t+r,a=i+r/2,s=e.sceneStart+e.enterLength,c=e.sceneEnd-Math.max(e.exitLength,0);let l,u=0,d=0;o<=e.sceneStart?l="before":i>=e.sceneEnd?(l="after",u=e.enterLength>0?1:0,d=e.exitLength>0?1:0):e.enterLength>0&&i<s?(l="enter",u=wn((o-e.sceneStart)/Math.max(e.enterLength,1),0,1)):e.exitLength>0&&i>=c?(l="exit",d=wn((i-c)/Math.max(e.exitLength,1),0,1),u=e.enterLength>0?1:0):(l="hold",u=e.enterLength>0?1:0);const g=Math.max(e.sceneEnd-e.sceneStart,1);return{phase:l,enterProgress:u,exitProgress:d,sceneProgress:wn((a-e.sceneStart)/g,0,1),rangeStart:e.sceneStart,rangeEnd:e.sceneEnd,rangeLength:g,enterLength:e.enterLength,exitLength:e.exitLength}}(r,m,y):null,b=o?Cn("x"===s?n.props.layout?.width??n.props.sceneWidth:n.props.layout?.height??n.props.sceneHeight,S.width,S.height):null,E=a||f||"enter"===x?.phase||"hold"===x?.phase||"exit"===x?.phase,A={timelineState:x,progress:x?.sceneProgress??0,zoneProgressPx:i?.progressPx??null,visualViewportOffset:p,isCurrent:a,isBackdropActive:f,isScrolling:E&&R,scrollDirection:E&&R?D:null},k=h.current.getKeySnapshot(t),C=void 0!==k&&(k?.timelineState===A.timelineState||null!=k?.timelineState&&null!==A.timelineState&&k.timelineState.phase===A.timelineState.phase&&k.timelineState.enterProgress===A.timelineState.enterProgress&&k.timelineState.exitProgress===A.timelineState.exitProgress&&k.timelineState.sceneProgress===A.timelineState.sceneProgress&&k.timelineState.rangeStart===A.timelineState.rangeStart&&k.timelineState.rangeEnd===A.timelineState.rangeEnd&&k.timelineState.enterLength===A.timelineState.enterLength&&k.timelineState.exitLength===A.timelineState.exitLength)&&k.progress===A.progress&&k.zoneProgressPx===A.zoneProgressPx&&k.visualViewportOffset===A.visualViewportOffset&&k.isCurrent===A.isCurrent&&k.isBackdropActive===A.isBackdropActive&&k.isScrolling===A.isScrolling&&k.scrollDirection===A.scrollDirection;V?V[t]=A:C||h.current.setKeySnapshot(t,A);const T={sceneLayout:r,sceneZoneState:i,sceneTimelineState:x,isCurrent:a,isBackdropActive:f,visualViewportOffset:p,isScrolling:E&&R,scrollDirection:E&&R?D:null,activeSceneIndex:P,viewportWidth:S.width,viewportHeight:S.height,firstSceneEnterGateKnown:!0,firstSceneEnterActive:0===t&&l,firstSceneEnterReady:0===t&&u,direction:s,sceneCount:e.length,sceneSizing:c,exposeTakeoverDebugData:d,takeoverSceneSpan:b},z=M[t]??_n;!function(e,t){const n=e.sceneTimelineState,r=t.sceneTimelineState,i=n===r||null!==n&&null!==r&&n.phase===r.phase&&n.rangeStart===r.rangeStart&&n.rangeEnd===r.rangeEnd&&n.rangeLength===r.rangeLength&&n.enterLength===r.enterLength&&n.exitLength===r.exitLength,o=e.sceneZoneState,a=t.sceneZoneState;return e.sceneLayout===t.sceneLayout&&(o===a||null!==o&&null!==a&&o.zoneId===a.zoneId&&o.sceneIndex===a.sceneIndex&&o.totalBudgetPx===a.totalBudgetPx&&o.active===a.active&&o.direction===a.direction&&o.approach===a.approach&&o.sequence===a.sequence)&&i&&e.isCurrent===t.isCurrent&&e.isBackdropActive===t.isBackdropActive&&e.isScrolling===t.isScrolling&&e.scrollDirection===t.scrollDirection&&e.activeSceneIndex===t.activeSceneIndex&&e.viewportWidth===t.viewportWidth&&e.viewportHeight===t.viewportHeight&&e.firstSceneEnterGateKnown===t.firstSceneEnterGateKnown&&e.firstSceneEnterActive===t.firstSceneEnterActive&&e.firstSceneEnterReady===t.firstSceneEnterReady&&e.direction===t.direction&&e.sceneCount===t.sceneCount&&e.sceneSizing===t.sceneSizing&&e.exposeTakeoverDebugData===t.exposeTakeoverDebugData&&e.takeoverSceneSpan===t.takeoverSceneSpan}(z,T)?(L[t]=T,O=!0):L[t]=z}),L.length=e.length,O&&m.current.setSnapshot(L),V?(p.current=V,x(e=>e+1)):h.current.clearFrom(e.length),b.current=[e,v,f,g,P,I,S.width,S.height,l,u,s,c,d]},[i,s,d,l,u,a,t,c,e,o,n,r]);return f.current=P,ln(()=>{const e=p.current;e&&(p.current=null,h.current.setSnapshot(e))},[S]),y(()=>{P(g.current)},[g,P]),{store:m.current,frameStore:h.current,updateSceneRenderSnapshots:P}}({scenes:L,sceneLayoutsRef:_,timelineStoreRef:q,viewportSizeRef:B,activeSceneIndexRef:A,scrollDirectionRef:k,isScrollingStateRef:ee,direction:S,sceneSizing:r,firstSceneEnterActive:fe,firstSceneEnterReady:me,exposeTakeoverDebugData:te,scrollOffsetRef:w,updateSceneRenderSnapshotsRef:D});R.current=J;const{isScrolling:Se,scrollContentSpan:ye,syncNativeScrollState:xe,applyNativeScrollDelta:be,applyNativeScrollbarOffset:we,goToScrollZone:Pe,beginProgrammaticScroll:Ie}=function({rootRef:e,direction:t,getViewportSpan:n,updateViewportMetrics:r,measureSceneLayouts:i,sceneLayoutsRef:o,zoneRegistryRef:a,zoneStatesRef:s,timelineStoreRef:c,scrollOffsetRef:l,scrollOffsetStore:u,activeSceneIndexRef:d,scrollDirectionRef:g,isScrollingStateRef:f,updateSceneRenderSnapshotsRef:m,callbacks:h,zoneRuntimeVersion:p}){const S=I(null),x=I(!1),b=I(0),w=I(null),P=I({}),E=I({}),R=I(0),[D,A]=M(!1),[k,C]=M(1),T=I(1),L=v(()=>{const r=e.current;return r?Math.max(("x"===t?r.scrollWidth:r.scrollHeight)-n(),0):0},[t,n,e]),O=v(()=>o.current.filter(e=>e.segmentEnd-e.segmentStart>.5).map(e=>({segmentStart:e.segmentStart,segmentEnd:e.segmentEnd})).sort((e,t)=>e.segmentStart-t.segmentStart),[o]),V=v((e,t)=>function({currentOffset:e,deltaPx:t,maxNativeOffset:n,segments:r=[]}){if(0===t)return wn(e,0,n);const i=wn(e,0,n),o=t===Number.POSITIVE_INFINITY?n:t===Number.NEGATIVE_INFINITY?0:wn(i+t,0,n);if(0===r.length||Math.abs(o-i)<=.5)return o;if(o>i){const e=r.find(e=>i<e.segmentStart+.5&&o>e.segmentEnd+.5);if(e)return Math.min(e.segmentStart+1,e.segmentEnd);const t=r.find(e=>i>=e.segmentStart-.5&&i<e.segmentEnd-.5);return t&&o>t.segmentEnd+.5?t.segmentEnd:o}const a=[...r].reverse().find(e=>i>e.segmentEnd-.5&&o<e.segmentStart-.5);if(a)return Math.max(a.segmentEnd-1,a.segmentStart);const s=[...r].reverse().find(e=>i>e.segmentStart+.5&&i<=e.segmentEnd+.5);return s&&o<s.segmentStart-.5?s.segmentStart:o}({currentOffset:e,deltaPx:t,maxNativeOffset:L(),segments:O()}),[O,L]),z=v(n=>{const r=e.current;if(!r)return;const i=wn(n,0,L());"x"!==t?"function"==typeof r.scrollTo?r.scrollTo({top:i,behavior:"auto"}):r.scrollTop=i:"function"==typeof r.scrollTo?r.scrollTo({left:i,behavior:"auto"}):r.scrollLeft=i},[t,L,e]),N=v(e=>{w.current=wn(e,0,L())},[L]),F=v(()=>{if(null===w.current)return;w.current=null;const n=e.current;if(!n)return;const r=wn("x"===t?n.scrollLeft:n.scrollTop,0,L());z(r),b.current=r},[t,L,e,z]),B=v((e,t=n())=>{const r=o.current;if(0===r.length)return;const i=e+t/2;let a=0,s=Number.POSITIVE_INFINITY;for(let e=0;e<r.length;e+=1){const t=r[e];if(i>=t.sceneStart&&i<t.sceneEnd){a=e;break}const n=i<t.sceneStart?t.sceneStart-i:i-t.sceneEnd;n<s&&(s=n,a=e)}if(d.current===a)return;const c=R.current;if(d.current=a,m.current(e),c===a)return;const l=a>=c?"forward":"backward";h.common?.onSceneEnter?.({fromIndex:c,toIndex:a,direction:l}),h.common?.onSceneLeave?.({fromIndex:c,toIndex:a,direction:l}),R.current=a},[d,h.common,n,o,m]),j=v((e,t,r=n())=>{const i=P.current,l=s.current,u=r,d={};Object.entries(l).forEach(([n,r])=>{const i=o.current[r.sceneIndex];if(!i||r.totalBudgetPx<=0)return void(d[n]=0!==r.progressPx||r.active||null!==r.direction?{...r,progressPx:0,active:!1,direction:null}:r);const a=wn(e-i.segmentStart,0,r.totalBudgetPx),s=a<=.01?0:r.totalBudgetPx-a<=.01?r.totalBudgetPx:a,c=e>i.segmentStart+.5&&e<i.segmentEnd-.5&&s>.5&&s<r.totalBudgetPx-.5,l=function(e,t,n){return e<=0?"inside":"far"===n?e<=1*t?"near":"far":e>1.5*t?"far":"near"}(Math.max(i.segmentStart-e,e-i.segmentEnd,0),u,r.approach),g={...r,progressPx:s,active:c,direction:c?t:null,approach:l};d[n]=r.progressPx===g.progressPx&&r.active===g.active&&r.direction===g.direction&&r.approach===g.approach?r:g});const g=Object.entries(d);Object.keys(l).length===g.length&&g.every(([e,t])=>l[e]===t)||(s.current=d,c.current.setSnapshot(d)),m.current(e),P.current=d,Object.entries(d).forEach(([e,t])=>{const n=i[e],r=a.current.get(e);if(!r)return;const o=E.current[e],s=0===t.progressPx||t.progressPx===t.totalBudgetPx;(void 0===o||Math.abs(o-t.progressPx)>.5||s&&o!==t.progressPx)&&(E.current[e]=t.progressPx,h.scroll?.onZoneProgress?.({zoneId:e,sceneIndex:r.sceneIndex,progress:t.totalBudgetPx>0?wn(t.progressPx/t.totalBudgetPx,0,1):0})),!n?.active&&t.active?h.scroll?.onZoneEnter?.({zoneId:e,sceneIndex:r.sceneIndex}):n?.active&&!t.active&&h.scroll?.onZoneLeave?.({zoneId:e,sceneIndex:r.sceneIndex})})},[h.scroll,n,o,c,m,a,s]),$=v((o=!1)=>{const a=e.current;if(!a)return;const s="x"===t?a.scrollLeft:a.scrollTop;if(o&&x.current&&null===w.current&&Math.abs(s-b.current)<=.01)return;o&&(x.current||(r(),i()),x.current=!0);const c=b.current,d=w.current;let h;null!==d?(h=wn(s,0,L()),Math.abs(h-d)<=1&&(w.current=null)):(h=V(c,s-c),Math.abs(h-s)>.5&&z(h));const p=Math.abs(h-c)<=.5?g.current:h>c?"forward":"backward";b.current=h,l.current=h,u.setSnapshot(h),g.current=p,o&&(f.current=!0,A(e=>e||!0),null!==S.current&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{f.current=!1,A(!1),x.current=!1,S.current=null,m.current(l.current)},120));const v=n(),y=Math.max("x"===t?a.scrollWidth:a.scrollHeight,v);j(h,p,v),B(h,v),Math.abs(T.current-y)>.5&&(T.current=y,C(y))},[t,L,n,f,i,V,e,g,l,u,z,j,B,m,r]),W=v(n=>{const r=e.current;if(!r||0===n)return!1;F();const i="x"===t?r.scrollLeft:r.scrollTop,o=V(i,n);return!(Math.abs(o-i)<=.5||(z(o),$(!0),0))},[F,t,V,e,z,$]),H=v(n=>{F();const r=e.current,i=r?"x"===t?r.scrollLeft:r.scrollTop:l.current;z(V(i,n-i)),$(!0)},[F,t,V,e,l,z,$]),q=v((n,r)=>{const i=e.current,a=s.current[n],c=a?o.current[a.sceneIndex]:null;if(i&&c){if(!1!==r?.animated)return N(c.centerLockOffset),void i.scrollTo({top:"x"===t?void 0:c.centerLockOffset,left:"x"===t?c.centerLockOffset:void 0,behavior:"smooth"});i.scrollTo({top:"x"===t?void 0:c.centerLockOffset,left:"x"===t?c.centerLockOffset:void 0,behavior:"auto"}),b.current=c.centerLockOffset,l.current=c.centerLockOffset,u.setSnapshot(c.centerLockOffset),j(c.centerLockOffset,null),B(c.centerLockOffset)}},[N,t,e,o,l,u,j,B,s]);return function({rootRef:e,direction:t,getViewportSpan:n,applyNativeScrollDelta:r}){const i=I(null);y(()=>{const o=e.current;if(!o)return;const a=e=>e instanceof Element&&e.closest('[data-cineview-container="true"]')===o,s=e=>{if(e.defaultPrevented||!a(e.target))return;const i=function(e,t,n){return Number.isFinite(e)&&0!==e?1===t?18*e:2===t?e*Math.max(n,1):e:0}("x"===t?e.deltaX:e.deltaY,e.deltaMode,n());0!==i&&(In(e.target,o,t,i)||r(i)&&e.cancelable&&e.preventDefault())},c=e=>{if(!a(e.target))return;const t=e.touches[0];t&&(i.current={x:t.clientX,y:t.clientY})},l=e=>{const n=e.touches[0];if(!n||!i.current)return;if(e.defaultPrevented||!a(e.target))return void(i.current={x:n.clientX,y:n.clientY});const s=function(e){return Number.isFinite(e)?e:0}("x"===t?i.current.x-n.clientX:i.current.y-n.clientY);if(In(e.target,o,t,s))i.current={x:n.clientX,y:n.clientY};else if(0!==s){const t=r(s);i.current={x:n.clientX,y:n.clientY},t&&e.cancelable&&e.preventDefault()}},u=()=>{i.current=null};return o.addEventListener("wheel",s,{capture:!0,passive:!1}),o.addEventListener("touchstart",c,{passive:!0}),o.addEventListener("touchmove",l,{passive:!1}),o.addEventListener("touchend",u),o.addEventListener("touchcancel",u),()=>{o.removeEventListener("wheel",s,{capture:!0}),o.removeEventListener("touchstart",c),o.removeEventListener("touchmove",l),o.removeEventListener("touchend",u),o.removeEventListener("touchcancel",u),i.current=null}},[r,t,n,e]),y(()=>{if(typeof window>"u")return;const e=e=>{if(e.defaultPrevented||function(e){return En(e.target,e.key)}(e))return;const t=Mn(e.key,e.shiftKey,n());if(0===t)return;const i=document.activeElement;(i===document.body||i===document.documentElement)&&r(t)&&e.cancelable&&e.preventDefault()};return window.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0)}},[r,n])}({rootRef:e,direction:t,getViewportSpan:n,applyNativeScrollDelta:W}),y(()=>()=>{null!==S.current&&(window.clearTimeout(S.current),S.current=null),w.current=null},[]),y(()=>{r(),i(),$()},[i,$,r,p]),y(()=>{if(typeof window>"u")return;const e=()=>{r(),i(),$()};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[i,$,r]),{isScrolling:D,scrollContentSpan:k,syncNativeScrollState:$,applyNativeScrollDelta:W,applyNativeScrollbarOffset:H,goToScrollZone:q,beginProgrammaticScroll:N}}({rootRef:x,direction:S,getViewportSpan:j,updateViewportMetrics:$,measureSceneLayouts:J,sceneLayoutsRef:_,zoneRegistryRef:W,zoneStatesRef:H,timelineStoreRef:q,scrollOffsetRef:w,scrollOffsetStore:E.current,activeSceneIndexRef:A,scrollDirectionRef:k,isScrollingStateRef:ee,updateSceneRenderSnapshotsRef:D,callbacks:p,zoneRuntimeVersion:Y}),Ee=I(!1),De=I(null),Ae=v(()=>{Ee.current=!1,$(),J(),xe()},[J,xe,$]);y(()=>{if(typeof ResizeObserver>"u")return;const e=new ResizeObserver(()=>{null===De.current&&(De.current=window.requestAnimationFrame(()=>{De.current=null,ee.current?Ee.current=!0:Ae()}))});return G.current.forEach(t=>{t&&e.observe(t)}),()=>{null!==De.current&&(window.cancelAnimationFrame(De.current),De.current=null),e.disconnect()}},[Ae,G,L]),y(()=>{Se||!Ee.current||Ae()},[Se,Ae]),y(()=>{if(c)return u()},[c]),y(()=>{},[N]);const ke=I(null),Ce=v((e,t=!0)=>{if(e<0||e>=C.current.length)return;const n=x.current,r=G.current[e];if(!n||!r)return;const i=Tn(r,n,S);Ie(i),n.scrollTo({top:"x"===S?void 0:i,left:"x"===S?i:void 0,behavior:t?"smooth":"auto"})},[Ie,S,G]),Te=v(()=>{$(),J(),xe()},[J,xe,$]),Le=v(async e=>{const t=he(e);t.length>0&&ie.addUrls(t,!0),await oe()},[ie,he,oe]);ke.current||(ke.current={goToScene:(e,t=!0)=>Ce(e,t),goToZone:(e,t)=>Pe(e,t),refreshLayout:()=>Te(),preload:e=>Le(e),getCurrentIndex:()=>A.current,getPerformanceMetrics:()=>l.getMetrics()});const Oe=ke.current,Ve=I(!1);y(()=>{Ve.current||(Ve.current=!0,p.common?.onReady?.(Oe))},[p.common,Oe]),b(m,()=>Oe,[Oe]);const ze="object"==typeof a?a:{},Ne=ze.autoHide??!0,Fe="object"==typeof a&&!1!==a.enabled,Be={position:"relative",width:"100%",height:"100vh",minHeight:"100vh",overflowX:"x"===S?"scroll":"hidden",overflowY:"x"===S?"hidden":"scroll",overscrollBehavior:"contain",WebkitOverflowScrolling:"touch",scrollbarGutter:Fe?"auto":"stable",background:"#ffffff"},je=P(()=>({mode:"scroll",scrollEnterMargin:i,scrollExitMargin:o,prefersReducedMotion:le,reportError:e=>{p.common?.onError?.({...e,code:e.code})}}),[i,o,p.common,le]);return O(Me,{designSize:h,children:O(Re.Provider,{value:je,children:O(ot.Provider,{value:Z,children:V(at.Provider,{value:K,children:[Fe&&O("style",{children:'\n [data-cineview-container="true"] {\n scrollbar-width: none;\n -ms-overflow-style: none;\n }\n [data-cineview-container="true"]::-webkit-scrollbar {\n width: 0;\n height: 0;\n display: none;\n }\n '}),"x"===S&&O("style",{children:'[data-cineview-scroll-stream="x"] > * { flex-shrink: 0; }'}),V("div",{style:{position:"relative",width:"100%",height:"100vh",minHeight:"100vh"},children:[O("div",{ref:x,style:Be,className:"cineview-container","data-cineview-container":"true","data-cineview-scrollbar-autohide":String(Ne),tabIndex:0,onScroll:()=>xe(!0),onKeyDownCapture:e=>{if(e.defaultPrevented||!(e.target instanceof Element)||e.target.closest('[data-cineview-container="true"]')!==e.currentTarget||En(e.target,e.key))return;const t=Mn(e.key,e.shiftKey,j());0!==t&&!In(e.target,e.currentTarget,S,t)&&be(t)&&e.preventDefault()},children:O("div",{"data-cineview-scroll-stream":S,style:"x"===S?{display:"flex",flexDirection:"row",alignItems:"stretch",width:"100%"}:void 0,children:O(Jn,{childrenArray:T,store:pe,frameStore:ve,setWrapperRef:Q,scrollCallbacks:p.scroll})})}),Fe&&O(Zn,{direction:S,scrollContentSpan:ye,viewportSpan:Math.max("x"===S?F.width:F.height,1),scrollOffset:w.current,scrollOffsetStore:E.current,isScrolling:Se,config:ze,onScrollToOffset:we})]})]})})})})});ir.displayName="DirectScrollCineview";var or=ir,ar=m((e,t)=>"scroll"===qn(e.mode)?O(or,{...e,ref:t}):O(Un,{...e,ref:t}));ar.displayName="Cineview";var sr=ar;export{hn as Animate,mn as AnimateVideo,sr as Cineview,Nt as Container,$t as Image,pn as Position,vn as Scene,nt as useAnimateTimeline};
|
|
2
|
+
//# sourceMappingURL=cineview.es.mjs.map
|