@cyca/react-timeline-editor 0.2.3-alpha.8 → 0.2.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-Do2XgyZc.js +77 -0
- package/dist/index-HslTC57T.cjs +1 -0
- package/dist/react-timeline-editor.cjs +4 -4
- package/dist/react-timeline-editor.js +1160 -1213
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +107 -0
- package/dist/utils.js +10 -0
- package/package.json +6 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),C=require("./index-HslTC57T.cjs"),fr=require("react-dom");function dr(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const g=dr(k);var Nt={exports:{}},At={};var ln;function hr(){if(ln)return At;ln=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:n,type:r,key:i,ref:s!==void 0?s:null,props:o}}return At.Fragment=e,At.jsx=t,At.jsxs=t,At}var Ct={};var un;function mr(){return un||(un=1,process.env.NODE_ENV!=="production"&&(function(){function n(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===F?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case p:return"Fragment";case b:return"Profiler";case R:return"StrictMode";case D:return"Suspense";case L:return"SuspenseList";case j:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case v:return"Portal";case S:return f.displayName||"Context";case _:return(f._context.displayName||"Context")+".Consumer";case P:var y=f.render;return f=f.displayName,f||(f=y.displayName||y.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case H:return y=f.displayName||null,y!==null?y:n(f.type)||"Memo";case M:y=f._payload,f=f._init;try{return n(f(y))}catch{}}return null}function e(f){return""+f}function t(f){try{e(f);var y=!1}catch{y=!0}if(y){y=console;var I=y.error,Y=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return I.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Y),e(f)}}function r(f){if(f===p)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===M)return"<...>";try{var y=n(f);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function s(){var f=G.A;return f===null?null:f.getOwner()}function o(){return Error("react-stack-top-frame")}function i(f){if(x.call(f,"key")){var y=Object.getOwnPropertyDescriptor(f,"key").get;if(y&&y.isReactWarning)return!1}return f.key!==void 0}function c(f,y){function I(){E||(E=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",y))}I.isReactWarning=!0,Object.defineProperty(f,"key",{get:I,configurable:!0})}function a(){var f=n(this.type);return A[f]||(A[f]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),f=this.props.ref,f!==void 0?f:null}function u(f,y,I,Y,te,q){var X=I.ref;return f={$$typeof:w,type:f,key:y,props:I,_owner:Y},(X!==void 0?X:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:a}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function l(f,y,I,Y,te,q){var X=y.children;if(X!==void 0)if(Y)if(U(X)){for(Y=0;Y<X.length;Y++)h(X[Y]);Object.freeze&&Object.freeze(X)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(X);if(x.call(y,"key")){X=n(f);var O=Object.keys(y).filter(function(B){return B!=="key"});Y=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",ne[X+Y]||(O=0<O.length?"{"+O.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,
|
|
6
|
+
<%s key={someKey} {...props} />`,Y,X,O,X),ne[X+Y]=!0)}if(X=null,I!==void 0&&(t(I),X=""+I),i(y)&&(t(y.key),X=""+y.key),"key"in y){I={};for(var z in y)z!=="key"&&(I[z]=y[z])}else I=y;return X&&c(I,typeof f=="function"?f.displayName||f.name||"Unknown":f),u(f,X,I,s(),te,q)}function h(f){d(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===M&&(f._payload.status==="fulfilled"?d(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function d(f){return typeof f=="object"&&f!==null&&f.$$typeof===w}var m=k,w=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),S=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),G=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,x=Object.prototype.hasOwnProperty,U=Array.isArray,W=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(f){return f()}};var E,A={},N=m.react_stack_bottom_frame.bind(m,o)(),ee=W(r(o)),ne={};Ct.Fragment=p,Ct.jsx=function(f,y,I){var Y=1e4>G.recentlyCreatedOwnerStacks++;return l(f,y,I,!1,Y?Error("react-stack-top-frame"):N,Y?W(r(f)):ee)},Ct.jsxs=function(f,y,I){var Y=1e4>G.recentlyCreatedOwnerStacks++;return l(f,y,I,!0,Y?Error("react-stack-top-frame"):N,Y?W(r(f)):ee)}})()),Ct}var fn;function pr(){return fn||(fn=1,process.env.NODE_ENV==="production"?Nt.exports=hr():Nt.exports=mr()),Nt.exports}var T=pr();const qt={trace:0,debug:1,info:2,warn:3,error:4,silent:5},gr=["trace","debug","info","warn","error"];var vr=class Wn{s;ls=new Map;lvl;def;n;r;c=console;e;trace;debug;info;warn;error;constructor(e,t,r,s){this.s=e,this.e=t,this.n=r,this.r=s,this.bindMethods()}noop=()=>{};bindMethods(){gr.forEach(e=>{const t=this.e.bind(this.c,e,this.n);Object.defineProperty(this,e,{get:()=>qt[e]>=qt[this.currentLevel()]?t:this.noop,configurable:!0})})}storageKey(){return this.n?`loglevel:${String(this.n)}`:"loglevel"}currentLevel(){if(this.lvl)return this.lvl;const e=this.s.get(this.storageKey());return e&&e in qt?(this.lvl=e,this.lvl):this.def?this.def:this.r?this.r.currentLevel():"trace"}setLevel(e){return this.lvl=e,this.s.set(this.storageKey(),e),this}setDefaultLevel(e){return this.s.get(this.storageKey())||(this.def=e),this}resetLevel(){return this.lvl=void 0,this.s.del(this.storageKey()),this}getLogger(e){if(!e)throw new Error("Logger name required");if(!this.ls.has(e)){const t=new Wn(this.s,this.e,e,this.r||this);this.ls.set(e,zn(t))}return this.ls.get(e)}getLoggers(){const e={};return this.ls.forEach((t,r)=>{e[String(r)]=t}),e}use(e){this.c=e,this.bindMethods()}};function zn(n){return new Proxy(n,{get(e,t,r){if(t in e)return Reflect.get(e,t,r);const s=e.c[t];return typeof s=="function"?s.bind(e.c):s}})}var br=class{get(n){return localStorage.getItem(n)}set(n,e){localStorage.setItem(n,e)}del(n){localStorage.removeItem(n)}};const _r={trace:"#95bdb7",debug:"#ad95b8",info:"#b6bd73",warn:"#88a1bb",error:"#bf6c69"},dn={info:"⚡️",success:"✔",warn:"▲",error:"✖",log:"●",trace:"◔",debug:"◌"},Sr={bind(n,e,t){const r=t?`${dn[e]} ${String(t)}:`:`${dn[e]}`;return(n[e]||n.log).bind(n,`%c${r}%c`,`color: ${_r[e]}; font-weight: bold;`,"color: inherit")}},qe=zn(new vr(new br,Sr));function wr(n){let{editorData:e=[],effects:t={},scale:r=C.DEFAULT_SCALE,scaleSplitCount:s=C.DEFAULT_SCALE_SPLIT_COUNT,scaleWidth:o=C.DEFAULT_SCALE_WIDTH,startLeft:i=C.DEFAULT_START_LEFT,minScaleCount:c,maxScaleCount:a=1/0,rowHeight:u=C.DEFAULT_ROW_HEIGHT}=n;r<=0&&(qe.error("Error: scale must be greater than 0!"),r=C.DEFAULT_SCALE),s<=0&&(qe.warn("Warning: scaleSplitCount cannot be less than 1!"),s=1),o<=0&&(qe.warn("Warning: scaleWidth must be greater than 0!"),o=C.DEFAULT_SCALE_WIDTH),i<0&&(qe.warn("Warning: startLeft cannot be less than 0!"),i=0),c&&typeof c=="number"&&(c<1&&(qe.warn("Warning: minScaleCount must be greater than 1!"),c=C.MIN_SCALE_COUNT),c=parseInt(c+""),a<c&&(qe.warn("Warning: maxScaleCount cannot be less than minScaleCount!"),a=c)),a=a===1/0?1/0:parseInt(a+""),u<=0&&(qe.warn("Warning: rowHeight must be greater than 0!"),u=C.DEFAULT_ROW_HEIGHT);const l={...n};return delete l.style,{...l,editorData:e,effects:t,scale:r,scaleSplitCount:s,scaleWidth:o,startLeft:i,minScaleCount:c,maxScaleCount:a,rowHeight:u}}var It={exports:{}},Kt={};var hn;function Er(){if(hn)return Kt;hn=1;var n=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;return Kt.c=function(e){return n.H.useMemoCache(e)},Kt}var Jt={};var mn;function yr(){return mn||(mn=1,process.env.NODE_ENV!=="production"&&(function(){var n=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;Jt.c=function(e){var t=n.H;return t===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
7
7
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
8
8
|
2. You might be breaking the Rules of Hooks
|
|
9
9
|
3. You might have more than one copy of React in the same app
|
|
10
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),t.useMemoCache(e)}})()),nn}var An;function Vr(){return An||(An=1,process.env.NODE_ENV==="production"?Wt.exports=jr():Wt.exports=Fr()),Wt.exports}var De=Vr();function Ur(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.map(function(r){return r.split(" ").map(function(s){return s?""+n+s:""}).join(" ")}).join(" ")}function fe(...n){return Ur(`${an}-`,...n)}const $r=n=>{const e=De.c(11),{isMoving:t,movePositions:r,assistPositions:s}=n;let o,i;if(e[0]!==t||e[1]!==r||e[2]!==s){const a=r===void 0?[]:r;let u;e[5]!==s?(u=s===void 0?[]:s,e[5]=s,e[6]=u):u=e[6];const l=u;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=fe("snap-line-container"),e[7]=o):o=e[7],i=t&&a.filter(h=>l.includes(h)).map(Hr),e[0]=t,e[1]=r,e[2]=s,e[3]=o,e[4]=i}else o=e[3],i=e[4];let c;return e[8]!==o||e[9]!==i?(c=x.jsx("div",{className:o,children:i}),e[8]=o,e[9]=i,e[10]=c):c=e[10],c};function Hr(n,e){return x.jsx("div",{className:fe("snap-line"),style:{left:n}},e)}const zt=1,Tn=10,Pn=10;function Br(n){const e=De.c(7),t=I.useRef(Number.MIN_SAFE_INTEGER),r=I.useRef(Number.MAX_SAFE_INTEGER),s=I.useRef(zt),o=I.useRef(void 0);let i;e[0]!==n?(i=()=>{if(n?.current){const{left:v,width:m}=n.current.getBoundingClientRect();t.current=v,r.current=v+m}},e[0]=n,e[1]=i):i=e[1];const c=i;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(v,m)=>{if(v.clientX>=r.current||v.clientX<=t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const E=Math.abs(v.clientX>=r.current?v.clientX-r.current:v.clientX-t.current);s.current=Math.min(Number((E/Pn).toFixed(0))*zt,Tn);const S=(v.clientX>=r.current?1:-1)*s.current,w=()=>{m&&m(S),o.current=requestAnimationFrame(w)};return o.current=requestAnimationFrame(w),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[2]=a):a=e[2];const u=a;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=(v,m,E)=>{if(v.clientX>=r.current||v.clientX<t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const b=Math.abs(v.clientX>=r.current?v.clientX-r.current:v.clientX-t.current);s.current=Math.min(Number((b/Pn).toFixed(0))*zt,Tn);const w=(v.clientX>=r.current?1:-1)*s.current,T=()=>{E&&E(w),o.current=requestAnimationFrame(T)};return o.current=requestAnimationFrame(T),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[3]=l):l=e[3];const h=l;let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{t.current=Number.MIN_SAFE_INTEGER,r.current=Number.MAX_SAFE_INTEGER,s.current=zt,o.current!==void 0&&cancelAnimationFrame(o.current)},e[4]=f):f=e[4];const p=f;let _;return e[5]!==c?(_={initAutoScroll:c,dealDragAutoScroll:u,dealResizeAutoScroll:h,stopAutoScroll:p},e[5]=c,e[6]=_):_=e[6],_}function Yr(n,e,t){return Math.max(e,Math.min(n,t))}const de={toVector(n,e){return n===void 0&&(n=e),Array.isArray(n)?n:[n,n]},add(n,e){return[n[0]+e[0],n[1]+e[1]]},sub(n,e){return[n[0]-e[0],n[1]-e[1]]},addTo(n,e){n[0]+=e[0],n[1]+=e[1]},subTo(n,e){n[0]-=e[0],n[1]-=e[1]}};function Dn(n,e,t){return e===0||Math.abs(e)===1/0?Math.pow(n,t*5):n*e*t/(e+t*n)}function Ln(n,e,t,r=.15){return r===0?Yr(n,e,t):n<e?-Dn(e-n,t-e,r)+e:n>t?+Dn(n-t,t-e,r)+t:n}function Xr(n,[e,t],[r,s]){const[[o,i],[c,a]]=n;return[Ln(e,o,i,r),Ln(t,c,a,s)]}function Gr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Kr(n){var e=Gr(n,"string");return typeof e=="symbol"?e:String(e)}function Se(n,e,t){return e=Kr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function On(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,r)}return t}function ne(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?On(Object(t),!0).forEach(function(r){Se(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):On(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}const Qn={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function Mn(n){return n?n[0].toUpperCase()+n.slice(1):""}const qr=["enter","leave"];function Jr(n=!1,e){return n&&!qr.includes(e)}function Zr(n,e="",t=!1){const r=Qn[n],s=r&&r[e]||e;return"on"+Mn(n)+Mn(s)+(Jr(t,s)?"Capture":"")}const Qr=["gotpointercapture","lostpointercapture"];function es(n){let e=n.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const r=Qr.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(r);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:t}}function ts(n,e=""){const t=Qn[n],r=t&&t[e]||e;return n+r}function qt(n){return"touches"in n}function er(n){return qt(n)?"touch":"pointerType"in n?n.pointerType:"mouse"}function ns(n){return Array.from(n.touches).filter(e=>{var t,r;return e.target===n.currentTarget||((t=n.currentTarget)===null||t===void 0||(r=t.contains)===null||r===void 0?void 0:r.call(t,e.target))})}function rs(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function tr(n){return qt(n)?rs(n)[0]:n}function ss(n){return ns(n).map(e=>e.identifier)}function rn(n){const e=tr(n);return qt(n)?e.identifier:e.pointerId}function Nn(n){const e=tr(n);return[e.clientX,e.clientY]}function os(n){const e={};if("buttons"in n&&(e.buttons=n.buttons),"shiftKey"in n){const{shiftKey:t,altKey:r,metaKey:s,ctrlKey:o}=n;Object.assign(e,{shiftKey:t,altKey:r,metaKey:s,ctrlKey:o})}return e}function Yt(n,...e){return typeof n=="function"?n(...e):n}function is(){}function cs(...n){return n.length===0?is:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function In(n,e){return Object.assign({},e,n||{})}const as=32;class ls{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:r,args:s}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=s,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?Yt(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:r,shared:s}=this;t.args=this.args;let o=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,s.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,s.locked=!!document.pointerLockElement,Object.assign(s,os(e)),s.down=s.pressed=s.buttons%2===1||s.touches>0,o=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const P=t._delta.map(Math.abs);de.addTo(t._distance,P)}this.axisIntent&&this.axisIntent(e);const[i,c]=t._movement,[a,u]=r.threshold,{_step:l,values:h}=t;if(r.hasCustomTransform?(l[0]===!1&&(l[0]=Math.abs(i)>=a&&h[0]),l[1]===!1&&(l[1]=Math.abs(c)>=u&&h[1])):(l[0]===!1&&(l[0]=Math.abs(i)>=a&&Math.sign(i)*a),l[1]===!1&&(l[1]=Math.abs(c)>=u&&Math.sign(c)*u)),t.intentional=l[0]!==!1||l[1]!==!1,!t.intentional)return;const f=[0,0];if(r.hasCustomTransform){const[P,D]=h;f[0]=l[0]!==!1?P-l[0]:0,f[1]=l[1]!==!1?D-l[1]:0}else f[0]=l[0]!==!1?i-l[0]:0,f[1]=l[1]!==!1?c-l[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const p=t.offset,_=t._active&&!t._blocked||t.active;_&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=s[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=Yt(r.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[v,m]=t.offset,[[E,b],[S,w]]=t._bounds;t.overflow=[v<E?-1:v>b?1:0,m<S?-1:m>w?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const T=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=Xr(t._bounds,t.offset,T),t.delta=de.sub(t.offset,p),this.computeMovement(),_&&(!t.last||o>as)){t.delta=de.sub(t.offset,p);const P=t.delta.map(Math.abs);de.addTo(t.distance,P),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&o>0&&(t.velocity=[P[0]/o,P[1]/o],t.timeDelta=o)}}emit(){const e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const s=this.handler(ne(ne(ne({},t),e),{},{[this.aliasKey]:e.values}));s!==void 0&&(e.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function us([n,e],t){const r=Math.abs(n),s=Math.abs(e);if(r>s&&r>t)return"x";if(s>r&&s>t)return"y"}class fs extends ls{constructor(...e){super(...e),Se(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=de.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=de.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,r=this.config;if(!t.axis&&e){const s=typeof r.axisThreshold=="object"?r.axisThreshold[er(e)]:r.axisThreshold;t.axis=us(t._movement,s)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const kn=n=>n,Wn=.15,mn={enabled(n=!0){return n},eventOptions(n,e,t){return ne(ne({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[Wn,Wn];case!1:return[0,0];default:return de.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return de.toVector(n)},transform(n,e,t){const r=n||t.shared.transform;if(this.hasCustomTransform=!!r,process.env.NODE_ENV==="development"){const s=r||kn;return o=>{const i=s(o);return(!isFinite(i[0])||!isFinite(i[1]))&&console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${i[0]},${[1]}]`),i}}return r||kn},threshold(n){return de.toVector(n,0)}};process.env.NODE_ENV==="development"&&Object.assign(mn,{domTarget(n){if(n!==void 0)throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");return NaN},lockDirection(n){if(n!==void 0)throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");return NaN},initial(n){if(n!==void 0)throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");return NaN}});const ds=0,Lt=ne(ne({},mn),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=ds){return n},bounds(n={}){if(typeof n=="function")return o=>Lt.bounds(n(o));if("current"in n)return()=>n.current;if(typeof HTMLElement=="function"&&n instanceof HTMLElement)return n;const{left:e=-1/0,right:t=1/0,top:r=-1/0,bottom:s=1/0}=n;return[[e,t],[r,s]]}}),zn={ArrowRight:(n,e=1)=>[n*e,0],ArrowLeft:(n,e=1)=>[-1*n*e,0],ArrowUp:(n,e=1)=>[0,-1*n*e],ArrowDown:(n,e=1)=>[0,n*e]};class hs extends fs{constructor(...e){super(...e),Se(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),s={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=Lt.bounds(s)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const s=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(s&&s.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=rn(e),r._pointerActive=!0,this.computeValues(Nn(e)),this.computeInitial(),t.preventScrollAxis&&er(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,r=this.config;if(!t._pointerActive)return;const s=rn(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;const o=Nn(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=de.sub(o,t._values),this.computeValues(o)),de.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{process.env.NODE_ENV==="development"&&console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.")}const t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;const s=rn(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=t._distance;if(t.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{const[c,a]=t._delta,[u,l]=t._movement,[h,f]=r.swipe.velocity,[p,_]=r.swipe.distance,v=r.swipe.duration;if(t.elapsedTime<v){const m=Math.abs(c/t.timeDelta),E=Math.abs(a/t.timeDelta);m>h&&Math.abs(u)>p&&(t.swipe[0]=Math.sign(c)),E>f&&Math.abs(l)>_&&(t.swipe[1]=Math.sign(a))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,r=t.device;if(process.env.NODE_ENV==="development")try{if(r==="pointer"&&t.preventScrollDelay===void 0){const s="uv"in e?e.sourceEvent.currentTarget:e.currentTarget;window.getComputedStyle(s).touchAction==="auto"&&console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.",s)}}catch{}t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,ms(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=zn[e.key];if(t){const r=this.state,s=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,s),r._keyboardActive=!0,de.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in zn&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function ms(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const Ot=typeof window<"u"&&window.document&&window.document.createElement;function nr(){return Ot&&"ontouchstart"in window}function ps(){return nr()||Ot&&window.navigator.maxTouchPoints>1}function gs(){return Ot&&"onpointerdown"in window}function vs(){return Ot&&"exitPointerLock"in window.document}function bs(){try{return"constructor"in GestureEvent}catch{return!1}}const we={isBrowser:Ot,gesture:bs(),touch:nr(),touchscreen:ps(),pointer:gs(),pointerLock:vs()},Ss=250,_s=180,ws=.5,Es=50,ys=250,Rs=10,jn={mouse:0,touch:0,pen:8},rr=ne(ne({},Lt),{},{device(n,e,{pointer:{touch:t=!1,lock:r=!1,mouse:s=!1}={}}){return this.pointerLock=r&&we.pointerLock,we.touch&&t?"touch":this.pointerLock?"mouse":we.pointer&&!s?"pointer":we.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?Ss:void 0,!(!we.touchscreen||t===!1))return n||(t!==void 0?"y":void 0)},pointerCapture(n,e,{pointer:{capture:t=!0,buttons:r=1,keys:s=!0}={}}){return this.pointerButtons=r,this.keys=s,!this.pointerLock&&this.device==="pointer"&&t},threshold(n,e,{filterTaps:t=!1,tapsThreshold:r=3,axis:s=void 0}){const o=de.toVector(n,t?r:s?1:0);return this.filterTaps=t,this.tapsThreshold=r,o},swipe({velocity:n=ws,distance:e=Es,duration:t=ys}={}){return{velocity:this.transform(de.toVector(n)),distance:this.transform(de.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return _s;case!1:return 0;default:return n}},axisThreshold(n){return n?ne(ne({},jn),n):jn},keyboardDisplacement(n=Rs){return n}});process.env.NODE_ENV==="development"&&Object.assign(rr,{useTouch(n){if(n!==void 0)throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");return NaN},experimental_preventWindowScrollY(n){if(n!==void 0)throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");return NaN},swipeVelocity(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");return NaN},swipeDistance(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");return NaN},swipeDuration(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");return NaN}});ne(ne({},mn),{},{device(n,e,{shared:t,pointer:{touch:r=!1}={}}){if(t.target&&!we.touch&&we.gesture)return"gesture";if(we.touch&&r)return"touch";if(we.touchscreen){if(we.pointer)return"pointer";if(we.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:r={}}){const s=i=>{const c=In(Yt(t,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=In(Yt(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof t!="function"&&typeof r!="function"?[s(),o()]:i=>[s(i),o(i)]},threshold(n,e,t){return this.lockDirection=t.axis==="lock",de.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}});ne(ne({},Lt),{},{mouseOnly:(n=!0)=>n});ne(ne({},Lt),{},{mouseOnly:(n=!0)=>n});const sr=new Map,fn=new Map;function xs(n){sr.set(n.key,n.engine),fn.set(n.key,n.resolver)}const Cs={key:"drag",engine:hs,resolver:rr};function As(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,o;for(o=0;o<r.length;o++)s=r[o],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}function Ts(n,e){if(n==null)return{};var t=As(n,e),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(s=0;s<o.length;s++)r=o[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}const Ps={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=we.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},Ds=["target","eventOptions","window","enabled","transform"];function Ft(n={},e){const t={};for(const[r,s]of Object.entries(e))switch(typeof s){case"function":if(process.env.NODE_ENV==="development"){const o=s.call(t,n[r],r,n);Number.isNaN(o)||(t[r]=o)}else t[r]=s.call(t,n[r],r,n);break;case"object":t[r]=Ft(n[r],s);break;case"boolean":s&&(t[r]=n[r]);break}return t}function Ls(n,e,t={}){const r=n,{target:s,eventOptions:o,window:i,enabled:c,transform:a}=r,u=Ts(r,Ds);if(t.shared=Ft({target:s,eventOptions:o,window:i,enabled:c,transform:a},Ps),e){const l=fn.get(e);t[e]=Ft(ne({shared:t.shared},u),l)}else for(const l in u){const h=fn.get(l);if(h)t[l]=Ft(ne({shared:t.shared},u[l]),h);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(l)){if(l==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${l}\` was used. Please read the documentation for further information.`)}}return t}class or{constructor(e,t){Se(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,s,o){const i=this._listeners,c=ts(t,r),a=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=ne(ne({},a),o);e.addEventListener(c,s,u);const l=()=>{e.removeEventListener(c,s,u),i.delete(l)};return i.add(l),l}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Os{constructor(){Se(this,"_timeouts",new Map)}add(e,t,r=140,...s){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...s))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class Ms{constructor(e){Se(this,"gestures",new Set),Se(this,"_targetEventStore",new or(this)),Se(this,"gestureEventStores",{}),Se(this,"gestureTimeoutStores",{}),Se(this,"handlers",{}),Se(this,"config",{}),Se(this,"pointerIds",new Set),Se(this,"touchIds",new Set),Se(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Ns(this,e)}setEventIds(e){if(qt(e))return this.touchIds=new Set(ss(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=Ls(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,r={};let s;if(!(t.target&&(s=t.target(),!s))){if(t.enabled){for(const i of this.gestures){const c=this.config[i],a=Fn(r,c.eventOptions,!!s);if(c.enabled){const u=sr.get(i);new u(this,e,i).bind(a)}}const o=Fn(r,t.eventOptions,!!s);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](ne(ne({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=cs(...r[o]);if(!s)return r;for(const o in r){const{device:i,capture:c,passive:a}=es(o);this._targetEventStore.add(s,i,"",r[o],{capture:c,passive:a})}}}}function yt(n,e){n.gestures.add(e),n.gestureEventStores[e]=new or(n,e),n.gestureTimeoutStores[e]=new Os}function Ns(n,e){e.drag&&yt(n,"drag"),e.wheel&&yt(n,"wheel"),e.scroll&&yt(n,"scroll"),e.move&&yt(n,"move"),e.pinch&&yt(n,"pinch"),e.hover&&yt(n,"hover")}const Fn=(n,e,t)=>(r,s,o,i={},c=!1)=>{var a,u;const l=(a=i.capture)!==null&&a!==void 0?a:e.capture,h=(u=i.passive)!==null&&u!==void 0?u:e.passive;let f=c?r:Zr(r,s,l);t&&h&&(f+="Passive"),n[f]=n[f]||[],n[f].push(o)};function Is(n,e={},t,r){const s=I.useMemo(()=>new Ms(n),[]);if(s.applyHandlers(n,r),s.applyConfig(e,t),I.useEffect(s.effect.bind(s)),I.useEffect(()=>s.clean.bind(s),[]),e.target===void 0)return s.bind.bind(s)}function sn(n,e){return xs(Cs),Is({drag:n},e||{},"drag")}function Vn(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function ir(...n){return e=>{let t=!1;const r=n.map(s=>{const o=Vn(s,e);return!t&&typeof o=="function"&&(t=!0),o});if(t)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Vn(n[s],null)}}}}function Qe(...n){return g.useCallback(ir(...n),n)}function cr(n){const e=Ws(n),t=g.forwardRef((r,s)=>{const{children:o,...i}=r,c=g.Children.toArray(o),a=c.find(js);if(a){const u=a.props.children,l=c.map(h=>h===a?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:h);return x.jsx(e,{...i,ref:s,children:g.isValidElement(u)?g.cloneElement(u,void 0,l):null})}return x.jsx(e,{...i,ref:s,children:o})});return t.displayName=`${n}.Slot`,t}var ks=cr("Slot");function Ws(n){const e=g.forwardRef((t,r)=>{const{children:s,...o}=t;if(g.isValidElement(s)){const i=Vs(s),c=Fs(o,s.props);return s.type!==g.Fragment&&(c.ref=r?ir(r,i):i),g.cloneElement(s,c)}return g.Children.count(s)>1?g.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var zs=Symbol("radix.slottable");function js(n){return g.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===zs}function Fs(n,e){const t={...e};for(const r in e){const s=n[r],o=e[r];/^on[A-Z]/.test(r)?s&&o?t[r]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(t[r]=s):r==="style"?t[r]={...s,...o}:r==="className"&&(t[r]=[s,o].filter(Boolean).join(" "))}return{...n,...t}}function Vs(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Us=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mt=Us.reduce((n,e)=>{const t=cr(`Primitive.${e}`),r=g.forwardRef((s,o)=>{const{asChild:i,...c}=s,a=i?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(a,{...c,ref:o})});return r.displayName=`Primitive.${e}`,{...n,[e]:r}},{});function $s(n,e=[]){let t=[];function r(o,i){const c=g.createContext(i),a=t.length;t=[...t,i];const u=h=>{const{scope:f,children:p,..._}=h,v=f?.[n]?.[a]||c,m=g.useMemo(()=>_,Object.values(_));return x.jsx(v.Provider,{value:m,children:p})};u.displayName=o+"Provider";function l(h,f){const p=f?.[n]?.[a]||c,_=g.useContext(p);if(_)return _;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[u,l]}const s=()=>{const o=t.map(i=>g.createContext(i));return function(c){const a=c?.[n]||o;return g.useMemo(()=>({[`__scope${n}`]:{...c,[n]:a}}),[c,a])}};return s.scopeName=n,[r,Hs(s,...e)]}function Hs(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:a,scopeName:u})=>{const h=a(o)[`__scope${u}`];return{...c,...h}},{});return g.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return t.scopeName=e.scopeName,t}function Ze(n,e,{checkForDefaultPrevented:t=!0}={}){return function(s){if(n?.(s),t===!1||!s.defaultPrevented)return e?.(s)}}var dn=globalThis?.document?g.useLayoutEffect:()=>{};function Bs(n,e){return g.useReducer((t,r)=>e[t][r]??t,n)}var Nt=n=>{const{present:e,children:t}=n,r=Ys(e),s=typeof t=="function"?t({present:r.isPresent}):g.Children.only(t),o=Qe(r.ref,Xs(s));return typeof t=="function"||r.isPresent?g.cloneElement(s,{ref:o}):null};Nt.displayName="Presence";function Ys(n){const[e,t]=g.useState(),r=g.useRef(null),s=g.useRef(n),o=g.useRef("none"),i=n?"mounted":"unmounted",[c,a]=Bs(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=jt(r.current);o.current=c==="mounted"?u:"none"},[c]),dn(()=>{const u=r.current,l=s.current;if(l!==n){const f=o.current,p=jt(u);n?a("MOUNT"):p==="none"||u?.display==="none"?a("UNMOUNT"):a(l&&f!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=n}},[n,a]),dn(()=>{if(e){let u;const l=e.ownerDocument.defaultView??window,h=p=>{const v=jt(r.current).includes(CSS.escape(p.animationName));if(p.target===e&&v&&(a("ANIMATION_END"),!s.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",u=l.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},f=p=>{p.target===e&&(o.current=jt(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{l.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:g.useCallback(u=>{r.current=u?getComputedStyle(u):null,t(u)},[])}}function jt(n){return n?.animationName||"none"}function Xs(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Gs=g.createContext(void 0);function Ks(n){const e=g.useContext(Gs);return n||e||"ltr"}function Je(n){const e=g.useRef(n);return g.useEffect(()=>{e.current=n}),g.useMemo(()=>(...t)=>e.current?.(...t),[])}function qs(n,[e,t]){return Math.min(t,Math.max(e,n))}function Js(n,e){return g.useReducer((t,r)=>e[t][r]??t,n)}var pn="ScrollArea",[ar]=$s(pn),[Zs,Ee]=ar(pn),lr=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[c,a]=g.useState(null),[u,l]=g.useState(null),[h,f]=g.useState(null),[p,_]=g.useState(null),[v,m]=g.useState(null),[E,b]=g.useState(0),[S,w]=g.useState(0),[T,P]=g.useState(!1),[D,B]=g.useState(!1),O=Qe(e,z=>a(z)),F=Ks(s);return x.jsx(Zs,{scope:t,type:r,dir:F,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:l,content:h,onContentChange:f,scrollbarX:p,onScrollbarXChange:_,scrollbarXEnabled:T,onScrollbarXEnabledChange:P,scrollbarY:v,onScrollbarYChange:m,scrollbarYEnabled:D,onScrollbarYEnabledChange:B,onCornerWidthChange:b,onCornerHeightChange:w,children:x.jsx(Mt.div,{dir:F,...i,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":S+"px",...n.style}})})});lr.displayName=pn;var ur="ScrollAreaViewport",fr=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=Ee(ur,t),c=g.useRef(null),a=Qe(e,c,i.onViewportChange);return x.jsxs(x.Fragment,{children:[x.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),x.jsx(Mt.div,{"data-radix-scroll-area-viewport":"",...o,ref:a,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:x.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});fr.displayName=ur;var Le="ScrollAreaScrollbar",dr=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ee(Le,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,c=n.orientation==="horizontal";return g.useEffect(()=>(c?o(!0):i(!0),()=>{c?o(!1):i(!1)}),[c,o,i]),s.type==="hover"?x.jsx(Qs,{...r,ref:e,forceMount:t}):s.type==="scroll"?x.jsx(eo,{...r,ref:e,forceMount:t}):s.type==="auto"?x.jsx(hr,{...r,ref:e,forceMount:t}):s.type==="always"?x.jsx(gn,{...r,ref:e}):null});dr.displayName=Le;var Qs=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ee(Le,n.__scopeScrollArea),[o,i]=g.useState(!1);return g.useEffect(()=>{const c=s.scrollArea;let a=0;if(c){const u=()=>{window.clearTimeout(a),i(!0)},l=()=>{a=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",l),()=>{window.clearTimeout(a),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",l)}}},[s.scrollArea,s.scrollHideDelay]),x.jsx(Nt,{present:t||o,children:x.jsx(hr,{"data-state":o?"visible":"hidden",...r,ref:e})})}),eo=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ee(Le,n.__scopeScrollArea),o=n.orientation==="horizontal",i=Zt(()=>a("SCROLL_END"),100),[c,a]=Js("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>a("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,s.scrollHideDelay,a]),g.useEffect(()=>{const u=s.viewport,l=o?"scrollLeft":"scrollTop";if(u){let h=u[l];const f=()=>{const p=u[l];h!==p&&(a("SCROLL"),i()),h=p};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,o,a,i]),x.jsx(Nt,{present:t||c!=="hidden",children:x.jsx(gn,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Ze(n.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:Ze(n.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),hr=g.forwardRef((n,e)=>{const t=Ee(Le,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=g.useState(!1),c=n.orientation==="horizontal",a=Zt(()=>{if(t.viewport){const u=t.viewport.offsetWidth<t.viewport.scrollWidth,l=t.viewport.offsetHeight<t.viewport.scrollHeight;i(c?u:l)}},10);return Ct(t.viewport,a),Ct(t.content,a),x.jsx(Nt,{present:r||o,children:x.jsx(gn,{"data-state":o?"visible":"hidden",...s,ref:e})})}),gn=g.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=Ee(Le,n.__scopeScrollArea),o=g.useRef(null),i=g.useRef(0),[c,a]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=br(c.viewport,c.content),l={...r,sizes:c,onSizesChange:a,hasThumb:u>0&&u<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,p){return io(f,i.current,c,p)}return t==="horizontal"?x.jsx(to,{...l,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollLeft,p=Un(f,c,s.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=h(f,s.dir))}}):t==="vertical"?x.jsx(no,{...l,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollTop,p=Un(f,c);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=h(f))}}):null}),to=g.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=Ee(Le,n.__scopeScrollArea),[i,c]=g.useState(),a=g.useRef(null),u=Qe(e,a,o.onScrollbarXChange);return g.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),x.jsx(pr,{"data-orientation":"horizontal",...s,ref:u,sizes:t,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Jt(t)+"px",...n.style},onThumbPointerDown:l=>n.onThumbPointerDown(l.x),onDragScroll:l=>n.onDragScroll(l.x),onWheelScroll:(l,h)=>{if(o.viewport){const f=o.viewport.scrollLeft+l.deltaX;n.onWheelScroll(f),_r(f,h)&&l.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:Gt(i.paddingLeft),paddingEnd:Gt(i.paddingRight)}})}})}),no=g.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=Ee(Le,n.__scopeScrollArea),[i,c]=g.useState(),a=g.useRef(null),u=Qe(e,a,o.onScrollbarYChange);return g.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),x.jsx(pr,{"data-orientation":"vertical",...s,ref:u,sizes:t,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Jt(t)+"px",...n.style},onThumbPointerDown:l=>n.onThumbPointerDown(l.y),onDragScroll:l=>n.onDragScroll(l.y),onWheelScroll:(l,h)=>{if(o.viewport){const f=o.viewport.scrollTop+l.deltaY;n.onWheelScroll(f),_r(f,h)&&l.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:Gt(i.paddingTop),paddingEnd:Gt(i.paddingBottom)}})}})}),[ro,mr]=ar(Le),pr=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:a,onDragScroll:u,onWheelScroll:l,onResize:h,...f}=n,p=Ee(Le,t),[_,v]=g.useState(null),m=Qe(e,O=>v(O)),E=g.useRef(null),b=g.useRef(""),S=p.viewport,w=r.content-r.viewport,T=Je(l),P=Je(a),D=Zt(h,10);function B(O){if(E.current){const F=O.clientX-E.current.left,z=O.clientY-E.current.top;u({x:F,y:z})}}return g.useEffect(()=>{const O=F=>{const z=F.target;_?.contains(z)&&T(F,w)};return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[S,_,w,T]),g.useEffect(P,[r,P]),Ct(_,D),Ct(p.content,D),x.jsx(ro,{scope:t,scrollbar:_,hasThumb:s,onThumbChange:Je(o),onThumbPointerUp:Je(i),onThumbPositionChange:P,onThumbPointerDown:Je(c),children:x.jsx(Mt.div,{...f,ref:m,style:{position:"absolute",...f.style},onPointerDown:Ze(n.onPointerDown,O=>{O.button===0&&(O.target.setPointerCapture(O.pointerId),E.current=_.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),B(O))}),onPointerMove:Ze(n.onPointerMove,B),onPointerUp:Ze(n.onPointerUp,O=>{const F=O.target;F.hasPointerCapture(O.pointerId)&&F.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),E.current=null})})})}),Xt="ScrollAreaThumb",gr=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=mr(Xt,n.__scopeScrollArea);return x.jsx(Nt,{present:t||s.hasThumb,children:x.jsx(so,{ref:e,...r})})}),so=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=Ee(Xt,t),i=mr(Xt,t),{onThumbPositionChange:c}=i,a=Qe(e,h=>i.onThumbChange(h)),u=g.useRef(void 0),l=Zt(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const h=o.viewport;if(h){const f=()=>{if(l(),!u.current){const p=co(h,c);u.current=p,c()}};return c(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[o.viewport,l,c]),x.jsx(Mt.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ze(n.onPointerDownCapture,h=>{const p=h.target.getBoundingClientRect(),_=h.clientX-p.left,v=h.clientY-p.top;i.onThumbPointerDown({x:_,y:v})}),onPointerUp:Ze(n.onPointerUp,i.onThumbPointerUp)})});gr.displayName=Xt;var vn="ScrollAreaCorner",vr=g.forwardRef((n,e)=>{const t=Ee(vn,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?x.jsx(oo,{...n,ref:e}):null});vr.displayName=vn;var oo=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=Ee(vn,t),[o,i]=g.useState(0),[c,a]=g.useState(0),u=!!(o&&c);return Ct(s.scrollbarX,()=>{const l=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(l),a(l)}),Ct(s.scrollbarY,()=>{const l=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(l),i(l)}),u?x.jsx(Mt.div,{...r,ref:e,style:{width:o,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function Gt(n){return n?parseInt(n,10):0}function br(n,e){const t=n/e;return isNaN(t)?0:t}function Jt(n){const e=br(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function io(n,e,t,r="ltr"){const s=Jt(t),o=s/2,i=e||o,c=s-i,a=t.scrollbar.paddingStart+i,u=t.scrollbar.size-t.scrollbar.paddingEnd-c,l=t.content-t.viewport,h=r==="ltr"?[0,l]:[l*-1,0];return Sr([a,u],h)(n)}function Un(n,e,t="ltr"){const r=Jt(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,i=e.content-e.viewport,c=o-r,a=t==="ltr"?[0,i]:[i*-1,0],u=qs(n,a);return Sr([0,i],[0,c])(u)}function Sr(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function _r(n,e){return n>0&&n<e}var co=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return(function s(){const o={left:n.scrollLeft,top:n.scrollTop},i=t.left!==o.left,c=t.top!==o.top;(i||c)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function Zt(n,e){const t=Je(n),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Ct(n,e){const t=Je(e);dn(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var ao=lr,lo=fr,uo=vr;const on=(n,e,t,r,s)=>({target:n,dx:e[0],dy:e[1],clientX:t[0],clientY:t[1],...r&&{edges:r},...s&&{deltaRect:s}}),fo=(n,e,t)=>n?n===e||n===t||(e?.contains(n)??!1)||(t?.contains(n)??!1):!1,ho=n=>{const e=De.c(34),{children:t,style:r,draggable:s,resizable:o,draggableOptions:i,resizableOptions:c,ref:a}=n,u=I.useRef(void 0),l=I.useRef(void 0),h=I.useRef(null),f=I.useRef(null),p=I.useRef(void 0),_=I.useRef(void 0);let v,m;e[0]!==i||e[1]!==a||e[2]!==c?(v=()=>{if(u.current=i,l.current=c,!a?.current)return;const y=c?.edges?.left,A=c?.edges?.right;y&&y!==p.current&&(p.current=y,h.current=a.current.querySelector(y)),A&&A!==_.current&&(_.current=A,f.current=a.current.querySelector(A))},m=[i,a,c],e[0]=i,e[1]=a,e[2]=c,e[3]=v,e[4]=m):(v=e[3],m=e[4]),I.useEffect(v,m);let E;e[5]!==a?(E=y=>{const{active:A,delta:M,xy:Q,event:te,first:d,last:R}=y,N=a?.current;if(!N||fo(te?.target,h.current,f.current))return;const H=on(N,M,Q);d?u.current?.onstart?.(H):R?u.current?.onend?.(H):A&&u.current?.onmove?.(H)},e[5]=a,e[6]=E):E=e[6];const b=i?.lockAxis==="x"?"x":void 0;let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S={capture:!0},e[7]=S):S=e[7];let w;e[8]!==s||e[9]!==a||e[10]!==b?(w={enabled:s,axis:b,pointer:S,target:a,threshold:0},e[8]=s,e[9]=a,e[10]=b,e[11]=w):w=e[11],sn(E,w);let T;e[12]!==a?(T=y=>{const{active:A,delta:M,xy:Q,first:te,last:d}=y,R=a?.current;if(!R)return;const N=on(R,M,Q,{left:!0},{left:M[0]});te?l.current?.onstart?.(N):d?l.current?.onend?.(N):A&&l.current?.onmove?.(N)},e[12]=a,e[13]=T):T=e[13];let P;e[14]===Symbol.for("react.memo_cache_sentinel")?(P={capture:!0},e[14]=P):P=e[14];let D;e[15]!==o?(D={enabled:o,target:h,pointer:P,threshold:0},e[15]=o,e[16]=D):D=e[16],sn(T,D);let B;e[17]!==a?(B=y=>{const{active:A,delta:M,xy:Q,first:te,last:d}=y,R=a?.current;if(!R)return;const N=on(R,M,Q,{right:!0},{right:M[0]});te?l.current?.onstart?.(N):d?l.current?.onend?.(N):A&&l.current?.onmove?.(N)},e[17]=a,e[18]=B):B=e[18];let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O={capture:!0},e[19]=O):O=e[19];let F;e[20]!==o?(F={enabled:o,target:f,pointer:O,threshold:0},e[20]=o,e[21]=F):F=e[21],sn(B,F);let z,X;e[22]!==a?(z=()=>{const y=a?.current;if(!y)return;const A=l.current?.edges?.left,M=l.current?.edges?.right;A&&(h.current=y.querySelector(A)),M&&(f.current=y.querySelector(M))},X=[a],e[22]=a,e[23]=z,e[24]=X):(z=e[23],X=e[24]),I.useLayoutEffect(z,X);let C;e[25]!==s?(C=s?{touchAction:"none"}:{},e[25]=s,e[26]=C):C=e[26];let j;e[27]!==r||e[28]!==C?(j={...C,...r},e[27]=r,e[28]=C,e[29]=j):j=e[29];let k;return e[30]!==t||e[31]!==a||e[32]!==j?(k=x.jsx(ks,{ref:a,style:j,draggable:!1,children:t}),e[30]=t,e[31]=a,e[32]=j,e[33]=k):k=e[33],k},be=(n,e=0)=>n?parseFloat(n):e,cn=(n,e,t,r=Number.MAX_SAFE_INTEGER)=>{let s=n,o=r;for(const i of e){const c=Math.abs(i-n);c<t&&c<o&&(s=i,o=c)}return{snap:s,minDis:o}},wr=I.forwardRef((n,e)=>{const t=De.c(68),{children:r,edges:s,left:o,width:i,start:c,grid:a,getBounds:u,enableResizing:l,enableDragging:h,snapDistance:f,snapPositions:p,onResizeStart:_,onResize:v,onResizeEnd:m,onDragStart:E,onDragEnd:b,onDrag:S,parentRef:w,autoScroll:T}=n,P=c===void 0?Kt:c,D=a===void 0?ln:a,B=u===void 0?mo:u,O=l===void 0?!0:l,F=h===void 0?!0:h,z=f===void 0?un:f;let X;t[0]!==p?(X=p===void 0?[]:p,t[0]=p,t[1]=X):X=t[1];const C=X,j=T===void 0?!0:T,k=I.useRef(null),y=I.useRef(0),A=I.useRef(!1),{initAutoScroll:M,stopAutoScroll:Q,dealDragAutoScroll:te,dealResizeAutoScroll:d}=Br(w);let R;t[2]===Symbol.for("react.memo_cache_sentinel")?(R=(U,J)=>{const K=J===void 0?!0:J;if(!k.current)return;K&&(y.current=0);const q=k.current;q.style.left=`${U}px`,q.dataset.left=String(U)},t[2]=R):R=t[2];const N=R;let H;t[3]===Symbol.for("react.memo_cache_sentinel")?(H=(U,J)=>{const K=J===void 0?!0:J;if(!k.current)return;K&&(y.current=0);const q=k.current;q.style.width=`${U}px`,q.dataset.width=String(U)},t[3]=H):H=t[3];const ee=H;let G;t[4]===Symbol.for("react.memo_cache_sentinel")?(G=()=>k.current?be(k.current.dataset.left):0,t[4]=G):G=t[4];const Y=G;let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=()=>k.current?be(k.current.dataset.width):0,t[5]=L):L=t[5];const W=L;let $,et;t[6]!==i?($=()=>{if(!k.current)return;const U=k.current;ee(typeof i>"u"?U.offsetWidth:i,!1)},et=[i],t[6]=i,t[7]=$,t[8]=et):($=t[7],et=t[8]),I.useEffect($,et);let tt,ze;t[9]!==o?(tt=()=>{N(o||0,!1)},ze=[o],t[9]=o,t[10]=tt,t[11]=ze):(tt=t[10],ze=t[11]),I.useEffect(tt,ze);let Oe;t[12]===Symbol.for("react.memo_cache_sentinel")?(Oe=()=>({updateLeft:U=>N(U||0,!1),updateWidth:U=>ee(U,!1),getLeft:Y,getWidth:W}),t[12]=Oe):Oe=t[12],I.useImperativeHandle(e,Oe);let xe;t[13]!==M||t[14]!==E?(xe=()=>{y.current=0,A.current=!1,M(),E?.()},t[13]=M,t[14]=E,t[15]=xe):xe=t[15];const Ge=xe;let Me;t[16]!==B||t[17]!==D||t[18]!==S||t[19]!==z||t[20]!==C||t[21]!==P?(Me=U=>{const{preLeft:J,preWidth:K,scrollDelta:q}=U;q&&(y.current=y.current+q);const he=A.current?z:D;if(Math.abs(y.current)<he)return;const me=Math.trunc(y.current/he);let Z=J+me*he;const se=y.current>0,V=se?Z+K:Z,{snap:re}=cn(V,C,z);if(re!==V)A.current=!0,Z=se?re-K:re;else{const ae=Z-P;ae%D!==0&&(Z=P+D*Math.round(ae/D)),A.current=!1}y.current=y.current%he;const oe=B();Z<oe.left?Z=oe.left:Z+K>oe.right&&(Z=oe.right-K),!(S&&S({lastLeft:J,left:Z,lastWidth:K,width:K},q)===!1)&&N(Z,!1)},t[16]=B,t[17]=D,t[18]=S,t[19]=z,t[20]=C,t[21]=P,t[22]=Me):Me=t[22];const Ce=Me;let Ne;t[23]!==j||t[24]!==te||t[25]!==Ce||t[26]!==w?(Ne=U=>{const J=U.target,K=be(J.dataset.left),q=be(J.dataset.width);y.current=y.current+U.dx,!(j&&w?.current&&!te(U,Z=>{if(!w?.current||!k.current)return;w.current.scrollLeft=w.current.scrollLeft+Z;const se=k.current,V=be(se.dataset.left),re=be(se.dataset.width);Ce({preLeft:V,preWidth:re,scrollDelta:Z})}))&&Ce({preLeft:K,preWidth:q})},t[23]=j,t[24]=te,t[25]=Ce,t[26]=w,t[27]=Ne):Ne=t[27];const At=Ne;let nt;t[28]!==b||t[29]!==Q?(nt=U=>{y.current=0,A.current=!1,Q();const J=U.target;b?.({left:be(J.dataset.left),width:be(J.dataset.width)})},t[28]=b,t[29]=Q,t[30]=nt):nt=t[30];const je=nt;let _e;t[31]!==M||t[32]!==_?(_e=U=>{y.current=0,A.current=!1,M();const J=U.edges?.right?"right":"left";_?.(J)},t[31]=M,t[32]=_,t[33]=_e):_e=t[33];const Fe=_e;let Ie;t[34]!==B||t[35]!==D||t[36]!==v||t[37]!==z||t[38]!==C||t[39]!==P?(Ie=U=>{const{dir:J,preWidth:K,preLeft:q,scrollDelta:he}=U;he&&(y.current=y.current+he);const me=A.current?z:D;if(Math.abs(y.current)<me)return;const Z=B();if(J==="left"){const se=Math.trunc(y.current/me);let V=q+se*me;const{snap:re}=cn(V,C,z);if(re!==V)A.current=!0,V=re;else{const pe=V-P;pe%D!==0&&(V=P+D*Math.round(pe/D)),A.current=!1}y.current=y.current%me,V<Z.left&&(V=Z.left);const oe=q+K,ae=oe-V;if(V>=oe||v&&v("left",{lastLeft:q,lastWidth:K,left:V,width:ae})===!1)return;N(V,!1),ee(ae,!1)}else{const se=Math.trunc(y.current/me);let V=K+se*me;const re=q+V,{snap:oe}=cn(re,C,z);if(oe!==re)A.current=!0,V=oe-q;else{let ae=q+V;const pe=ae-P;pe%D!==0&&(ae=P+D*Math.round(pe/D),V=ae-q),A.current=!1}if(y.current=y.current%me,q+V>Z.right&&(V=Z.right-q),V<=0||v&&v("right",{lastLeft:q,lastWidth:K,left:q,width:V})===!1)return;ee(V,!1)}},t[34]=B,t[35]=D,t[36]=v,t[37]=z,t[38]=C,t[39]=P,t[40]=Ie):Ie=t[40];const Ve=Ie;let ke;t[41]!==j||t[42]!==d||t[43]!==w||t[44]!==Ve?(ke=U=>{const J=U.target,K=U.edges?.left?"left":"right",q=be(J.dataset.left),he=be(J.dataset.width);y.current=y.current+(K==="left"?U.deltaRect?.left||0:U.deltaRect?.right||0),!(j&&w?.current&&!d(U,K,se=>{if(!w?.current||!k.current)return;w.current.scrollLeft=w.current.scrollLeft+se;const V=k.current,re=be(V.dataset.left),oe=be(V.dataset.width);Ve({preLeft:re,preWidth:oe,dir:K,scrollDelta:se})}))&&Ve({preLeft:q,preWidth:he,dir:K})},t[41]=j,t[42]=d,t[43]=w,t[44]=Ve,t[45]=ke):ke=t[45];const Ae=ke;let We;t[46]!==m||t[47]!==Q?(We=U=>{y.current=0,A.current=!1,Q();const J=U.target,K=U.edges?.right?"right":"left";m?.(K,{left:be(J.dataset.left),width:be(J.dataset.width)})},t[46]=m,t[47]=Q,t[48]=We):We=t[48];const Ke=We;let ye;t[49]!==o||t[50]!==i?(ye={left:o,width:i},t[49]=o,t[50]=i,t[51]=ye):ye=t[51];let Te;t[52]!==At||t[53]!==Ge||t[54]!==je?(Te={lockAxis:"x",onmove:At,onstart:Ge,onend:je,cursorChecker:po},t[52]=At,t[53]=Ge,t[54]=je,t[55]=Te):Te=t[55];let Re;t[56]!==s||t[57]!==Ae||t[58]!==Fe||t[59]!==Ke?(Re={axis:"x",invert:"none",edges:s,onmove:Ae,onstart:Fe,onend:Ke},t[56]=s,t[57]=Ae,t[58]=Fe,t[59]=Ke,t[60]=Re):Re=t[60];let Ue;return t[61]!==r||t[62]!==F||t[63]!==O||t[64]!==ye||t[65]!==Te||t[66]!==Re?(Ue=x.jsx(ho,{style:ye,ref:k,draggable:F,resizable:O,draggableOptions:Te,resizableOptions:Re,children:r}),t[61]=r,t[62]=F,t[63]=O,t[64]=ye,t[65]=Te,t[66]=Re,t[67]=Ue):Ue=t[67],Ue});function mo(){return{left:Number.MIN_SAFE_INTEGER,right:Number.MAX_SAFE_INTEGER}}function po(){return""}function go(){let n=0,e,t="",r=arguments.length;for(;n<r;n++)(e=arguments[n])&&typeof e=="string"&&(t+=(t&&" ")+e);return t}const vo=n=>{const e=De.c(191),{editorData:t,row:r,action:s,effects:o,rowHeight:i,scale:c,scaleWidth:a,scaleSplitCount:u,startLeft:l,gridSnap:h,disableDrag:f,scaleCount:p,maxScaleCount:_,setScaleCount:v,onActionMoveStart:m,onActionMoving:E,onActionMoveEnd:b,onActionResizeStart:S,onActionResizeEnd:w,onActionResizing:T,snapData:P,setEditorData:D,onClickAction:B,onClickActionOnly:O,onDoubleClickAction:F,onContextMenuAction:z,getActionRender:X,handleTime:C,scrollContainerRef:j}=n,k=I.useRef(null),y=I.useRef(!1),{id:A,maxEnd:M,minStart:Q,end:te,start:d,selected:R,flexible:N,movable:H,effectId:ee}=s,G=N===void 0?!0:N,Y=H===void 0?!0:H,L=c??Ht,W=a??Bt,$=l??Kt,et=u??Kn,tt=_??Number.MAX_SAFE_INTEGER,ze=Q||0;let Oe;e[0]!==L||e[1]!==W||e[2]!==$||e[3]!==ze?(Oe=Pe(ze,{startLeft:$,scale:L,scaleWidth:W}),e[0]=L,e[1]=W,e[2]=$,e[3]=ze,e[4]=Oe):Oe=e[4];const xe=Oe,Ge=M||Number.MAX_VALUE;let Me;e[5]!==L||e[6]!==W||e[7]!==$||e[8]!==Ge?(Me=Pe(Ge,{startLeft:$,scale:L,scaleWidth:W}),e[5]=L,e[6]=W,e[7]=$,e[8]=Ge,e[9]=Me):Me=e[9];const Ce=Math.min(tt*W+$,Me);let Ne;e[10]!==te||e[11]!==L||e[12]!==W||e[13]!==$||e[14]!==d?(Ne=hn({start:d,end:te},{startLeft:$,scale:L,scaleWidth:W}),e[10]=te,e[11]=L,e[12]=W,e[13]=$,e[14]=d,e[15]=Ne):Ne=e[15];const At=Ne,[nt,je]=I.useState(null),_e=nt??At,Fe=W/et;let Ie;e[16]!==ee||e[17]!==o||e[18]!==G||e[19]!==Y||e[20]!==R?(Ie=fe(go("action",Y&&"action-movable",R&&"action-selected",G&&"action-flexible",o[ee]&&`action-effect-${ee}`)),e[16]=ee,e[17]=o,e[18]=G,e[19]=Y,e[20]=R,e[21]=Ie):Ie=e[21];const Ve=Ie;let ke;e[22]!==W||e[23]!==$||e[24]!==p||e[25]!==v?(ke=(ge,ve)=>{const ie=Wr(ge+ve,{startLeft:$,scaleCount:p,scaleWidth:W});ie!==p&&v(ie)},e[22]=W,e[23]=$,e[24]=p,e[25]=v,e[26]=ke):ke=e[26];const Ae=ke;let We;e[27]!==s||e[28]!==m||e[29]!==r?(We=()=>{m&&m({action:s,row:r})},e[27]=s,e[28]=m,e[29]=r,e[30]=We):We=e[30];const Ke=We;let ye;e[31]!==s||e[32]!==Ae||e[33]!==E||e[34]!==r||e[35]!==L||e[36]!==W||e[37]!==$?(ye=ge=>{const{left:ve,width:ie}=ge;if(y.current=!0,E){const{start:ue,end:ce}=Dt({left:ve,width:ie},{scaleWidth:W,scale:L,startLeft:$});if(E({action:s,row:r,start:ue,end:ce})===!1)return!1}je({left:ve,width:ie}),Ae(ve,ie)},e[31]=s,e[32]=Ae,e[33]=E,e[34]=r,e[35]=L,e[36]=W,e[37]=$,e[38]=ye):ye=e[38];const Te=ye;let Re;e[39]!==t||e[40]!==A||e[41]!==b||e[42]!==r||e[43]!==L||e[44]!==W||e[45]!==$||e[46]!==D?(Re=ge=>{const{left:ve,width:ie}=ge,{start:ue,end:ce}=Dt({left:ve,width:ie},{scaleWidth:W,scale:L,startLeft:$}),le=t.find(Ye=>Ye.id===r.id);if(!le)return;const Be=le.actions.find(Ye=>Ye.id===A);Be&&(Be.start=ue,Be.end=ce,D(t),b&&b({action:Be,row:r,start:ue,end:ce}),je(null))},e[39]=t,e[40]=A,e[41]=b,e[42]=r,e[43]=L,e[44]=W,e[45]=$,e[46]=D,e[47]=Re):Re=e[47];const Ue=Re;let U;e[48]!==s||e[49]!==S||e[50]!==r?(U=ge=>{S&&S({action:s,row:r,dir:ge})},e[48]=s,e[49]=S,e[50]=r,e[51]=U):U=e[51];const J=U;let K;e[52]!==s||e[53]!==Ae||e[54]!==T||e[55]!==r||e[56]!==L||e[57]!==W||e[58]!==$?(K=(ge,ve)=>{const{left:ie,width:ue}=ve;if(y.current=!0,T){const{start:ce,end:le}=Dt({left:ie,width:ue},{scaleWidth:W,scale:L,startLeft:$});if(T({action:s,row:r,start:ce,end:le,dir:ge})===!1)return!1}je({left:ie,width:ue}),Ae(ie,ue)},e[52]=s,e[53]=Ae,e[54]=T,e[55]=r,e[56]=L,e[57]=W,e[58]=$,e[59]=K):K=e[59];const q=K;let he;e[60]!==t||e[61]!==A||e[62]!==w||e[63]!==r||e[64]!==L||e[65]!==W||e[66]!==$||e[67]!==D?(he=(ge,ve)=>{const{left:ie,width:ue}=ve,{start:ce,end:le}=Dt({left:ie,width:ue},{scaleWidth:W,scale:L,startLeft:$}),Be=t.find(Qt=>Qt.id===r.id);if(!Be)return;const Ye=Be.actions.find(Qt=>Qt.id===A);Ye&&(Ye.start=ce,Ye.end=le,D(t),w&&w({action:Ye,row:r,start:ce,end:le,dir:ge}),je(null))},e[60]=t,e[61]=A,e[62]=w,e[63]=r,e[64]=L,e[65]=W,e[66]=$,e[67]=D,e[68]=he):he=e[68];const me=he;let Z,se,V,re,oe,ae,pe,rt,st,ot,it,ct,at,lt,ut,ft,$e,He,dt,ht,mt,pt,gt,vt,bt,St;if(e[69]!==s||e[70]!==Ve||e[71]!==f||e[72]!==G||e[73]!==X||e[74]!==Fe||e[75]!==h||e[76]!==Te||e[77]!==Ue||e[78]!==Ke||e[79]!==me||e[80]!==J||e[81]!==q||e[82]!==C||e[83]!==xe||e[84]!==Y||e[85]!==B||e[86]!==O||e[87]!==z||e[88]!==F||e[89]!==Ce||e[90]!==r||e[91]!==i||e[92]!==L||e[93]!==W||e[94]!==$||e[95]!==j||e[96]!==P.assistPositions||e[97]!==_e.left||e[98]!==_e.width){const ge={...s,...Dt({left:_e.left,width:_e.width},{startLeft:$,scaleWidth:W,scale:L})},ve={...r,actions:[...r.actions]};r.actions.includes(s)&&(ve.actions[r.actions.indexOf(s)]=ge),Z=wr,st=k,ot=j,it=$,ct=_e.left,at=_e.width,lt=h&&Fe||ln,ut=h?Math.max((Fe||ln)/2,un):un,ft=P.assistPositions,e[125]!==xe||e[126]!==Ce?($e=()=>({left:xe,right:Ce}),e[125]=xe,e[126]=Ce,e[127]=$e):$e=e[127];let ie;e[128]!==f||e[129]!==G?(ie=!f&&G&&`.${fe("action-left-stretch")}`,e[128]=f,e[129]=G,e[130]=ie):ie=e[130];let ue;e[131]!==f||e[132]!==G?(ue=!f&&G&&`.${fe("action-right-stretch")}`,e[131]=f,e[132]=G,e[133]=ue):ue=e[133],e[134]!==ie||e[135]!==ue?(He={left:ie,right:ue},e[134]=ie,e[135]=ue,e[136]=He):He=e[136],dt=!f&&Y,ht=!f&&G,mt=Ke,pt=Te,gt=Ue,vt=J,bt=q,St=me,e[137]===Symbol.for("react.memo_cache_sentinel")?(se=()=>{y.current=!1},e[137]=se):se=e[137],e[138]!==s||e[139]!==C||e[140]!==B||e[141]!==O||e[142]!==r?(V=ce=>{let le;B&&(le=C(ce),B(ce,{row:r,action:s,time:le})),!y.current&&O&&(le===void 0&&(le=C(ce)),O(ce,{row:r,action:s,time:le}))},e[138]=s,e[139]=C,e[140]=B,e[141]=O,e[142]=r,e[143]=V):V=e[143],e[144]!==s||e[145]!==C||e[146]!==F||e[147]!==r?(re=ce=>{if(F){const le=C(ce);F(ce,{row:r,action:s,time:le})}},e[144]=s,e[145]=C,e[146]=F,e[147]=r,e[148]=re):re=e[148],e[149]!==s||e[150]!==C||e[151]!==z||e[152]!==r?(oe=ce=>{if(z){const le=C(ce);z(ce,{row:r,action:s,time:le})}},e[149]=s,e[150]=C,e[151]=z,e[152]=r,e[153]=oe):oe=e[153],ae=Ve,e[154]!==i?(pe={height:i},e[154]=i,e[155]=pe):pe=e[155],rt=X&&X(ge,ve),e[69]=s,e[70]=Ve,e[71]=f,e[72]=G,e[73]=X,e[74]=Fe,e[75]=h,e[76]=Te,e[77]=Ue,e[78]=Ke,e[79]=me,e[80]=J,e[81]=q,e[82]=C,e[83]=xe,e[84]=Y,e[85]=B,e[86]=O,e[87]=z,e[88]=F,e[89]=Ce,e[90]=r,e[91]=i,e[92]=L,e[93]=W,e[94]=$,e[95]=j,e[96]=P.assistPositions,e[97]=_e.left,e[98]=_e.width,e[99]=Z,e[100]=se,e[101]=V,e[102]=re,e[103]=oe,e[104]=ae,e[105]=pe,e[106]=rt,e[107]=st,e[108]=ot,e[109]=it,e[110]=ct,e[111]=at,e[112]=lt,e[113]=ut,e[114]=ft,e[115]=$e,e[116]=He,e[117]=dt,e[118]=ht,e[119]=mt,e[120]=pt,e[121]=gt,e[122]=vt,e[123]=bt,e[124]=St}else Z=e[99],se=e[100],V=e[101],re=e[102],oe=e[103],ae=e[104],pe=e[105],rt=e[106],st=e[107],ot=e[108],it=e[109],ct=e[110],at=e[111],lt=e[112],ut=e[113],ft=e[114],$e=e[115],He=e[116],dt=e[117],ht=e[118],mt=e[119],pt=e[120],gt=e[121],vt=e[122],bt=e[123],St=e[124];let _t;e[156]!==G?(_t=G&&x.jsx("div",{className:fe("action-left-stretch"),style:{touchAction:"none"}}),e[156]=G,e[157]=_t):_t=e[157];let wt;e[158]!==G?(wt=G&&x.jsx("div",{className:fe("action-right-stretch"),style:{touchAction:"none"}}),e[158]=G,e[159]=wt):wt=e[159];let Et;e[160]!==se||e[161]!==V||e[162]!==re||e[163]!==oe||e[164]!==ae||e[165]!==pe||e[166]!==rt||e[167]!==_t||e[168]!==wt?(Et=x.jsxs("div",{onMouseDown:se,onClick:V,onDoubleClick:re,onContextMenu:oe,className:ae,style:pe,children:[rt,_t,wt]}),e[160]=se,e[161]=V,e[162]=re,e[163]=oe,e[164]=ae,e[165]=pe,e[166]=rt,e[167]=_t,e[168]=wt,e[169]=Et):Et=e[169];let It;return e[170]!==Z||e[171]!==st||e[172]!==ot||e[173]!==it||e[174]!==ct||e[175]!==at||e[176]!==lt||e[177]!==ut||e[178]!==ft||e[179]!==$e||e[180]!==He||e[181]!==dt||e[182]!==ht||e[183]!==mt||e[184]!==pt||e[185]!==gt||e[186]!==vt||e[187]!==bt||e[188]!==St||e[189]!==Et?(It=x.jsx(Z,{ref:st,parentRef:ot,start:it,left:ct,width:at,grid:lt,snapDistance:ut,snapPositions:ft,getBounds:$e,edges:He,enableDragging:dt,enableResizing:ht,onDragStart:mt,onDrag:pt,onDragEnd:gt,onResizeStart:vt,onResize:bt,onResizeEnd:St,children:Et}),e[170]=Z,e[171]=st,e[172]=ot,e[173]=it,e[174]=ct,e[175]=at,e[176]=lt,e[177]=ut,e[178]=ft,e[179]=$e,e[180]=He,e[181]=dt,e[182]=ht,e[183]=mt,e[184]=pt,e[185]=gt,e[186]=vt,e[187]=bt,e[188]=St,e[189]=Et,e[190]=It):It=e[190],It};function Rt(n,e,t){let r=t.initialDeps??[],s;function o(){var i,c,a,u;let l;t.key&&((i=t.debug)!=null&&i.call(t))&&(l=Date.now());const h=n();if(!(h.length!==r.length||h.some((_,v)=>r[v]!==_)))return s;r=h;let p;if(t.key&&((c=t.debug)!=null&&c.call(t))&&(p=Date.now()),s=e(...h),t.key&&((a=t.debug)!=null&&a.call(t))){const _=Math.round((Date.now()-l)*100)/100,v=Math.round((Date.now()-p)*100)/100,m=v/16,E=(b,S)=>{for(b=String(b);b.length<S;)b=" "+b;return b};console.info(`%c⏱ ${E(v,5)} /${E(_,5)} ms`,`
|
|
10
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),t.useMemoCache(e)}})()),Jt}var pn;function Tr(){return pn||(pn=1,process.env.NODE_ENV==="production"?It.exports=Er():It.exports=yr()),It.exports}var Pe=Tr();function Rr(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.map(function(r){return r.split(" ").map(function(s){return s?""+n+s:""}).join(" ")}).join(" ")}function de(...n){return Rr(`${C.PREFIX}-`,...n)}const xr=n=>{const e=Pe.c(11),{isMoving:t,movePositions:r,assistPositions:s}=n;let o,i;if(e[0]!==t||e[1]!==r||e[2]!==s){const a=r===void 0?[]:r;let u;e[5]!==s?(u=s===void 0?[]:s,e[5]=s,e[6]=u):u=e[6];const l=u;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=de("snap-line-container"),e[7]=o):o=e[7],i=t&&a.filter(h=>l.includes(h)).map(Ar),e[0]=t,e[1]=r,e[2]=s,e[3]=o,e[4]=i}else o=e[3],i=e[4];let c;return e[8]!==o||e[9]!==i?(c=T.jsx("div",{className:o,children:i}),e[8]=o,e[9]=i,e[10]=c):c=e[10],c};function Ar(n,e){return T.jsx("div",{className:de("snap-line"),style:{left:n}},e)}const kt=1,gn=10,vn=10;function Cr(n){const e=Pe.c(7),t=k.useRef(Number.MIN_SAFE_INTEGER),r=k.useRef(Number.MAX_SAFE_INTEGER),s=k.useRef(kt),o=k.useRef(void 0);let i;e[0]!==n?(i=()=>{if(n?.current){const{left:v,width:p}=n.current.getBoundingClientRect();t.current=v,r.current=v+p}},e[0]=n,e[1]=i):i=e[1];const c=i;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(v,p)=>{if(v.clientX>=r.current||v.clientX<=t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const R=Math.abs(v.clientX>=r.current?v.clientX-r.current:v.clientX-t.current);s.current=Math.min(Number((R/vn).toFixed(0))*kt,gn);const _=(v.clientX>=r.current?1:-1)*s.current,S=()=>{p&&p(_),o.current=requestAnimationFrame(S)};return o.current=requestAnimationFrame(S),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[2]=a):a=e[2];const u=a;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=(v,p,R)=>{if(v.clientX>=r.current||v.clientX<t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const b=Math.abs(v.clientX>=r.current?v.clientX-r.current:v.clientX-t.current);s.current=Math.min(Number((b/vn).toFixed(0))*kt,gn);const S=(v.clientX>=r.current?1:-1)*s.current,P=()=>{R&&R(S),o.current=requestAnimationFrame(P)};return o.current=requestAnimationFrame(P),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[3]=l):l=e[3];const h=l;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{t.current=Number.MIN_SAFE_INTEGER,r.current=Number.MAX_SAFE_INTEGER,s.current=kt,o.current!==void 0&&cancelAnimationFrame(o.current)},e[4]=d):d=e[4];const m=d;let w;return e[5]!==c?(w={initAutoScroll:c,dealDragAutoScroll:u,dealResizeAutoScroll:h,stopAutoScroll:m},e[5]=c,e[6]=w):w=e[6],w}function Dr(n,e,t){return Math.max(e,Math.min(n,t))}const he={toVector(n,e){return n===void 0&&(n=e),Array.isArray(n)?n:[n,n]},add(n,e){return[n[0]+e[0],n[1]+e[1]]},sub(n,e){return[n[0]-e[0],n[1]-e[1]]},addTo(n,e){n[0]+=e[0],n[1]+=e[1]},subTo(n,e){n[0]-=e[0],n[1]-=e[1]}};function bn(n,e,t){return e===0||Math.abs(e)===1/0?Math.pow(n,t*5):n*e*t/(e+t*n)}function _n(n,e,t,r=.15){return r===0?Dr(n,e,t):n<e?-bn(e-n,t-e,r)+e:n>t?+bn(n-t,t-e,r)+t:n}function Pr(n,[e,t],[r,s]){const[[o,i],[c,a]]=n;return[_n(e,o,i,r),_n(t,c,a,s)]}function Lr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Or(n){var e=Lr(n,"string");return typeof e=="symbol"?e:String(e)}function Se(n,e,t){return e=Or(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sn(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,r)}return t}function re(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sn(Object(t),!0).forEach(function(r){Se(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Sn(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}const jn={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function wn(n){return n?n[0].toUpperCase()+n.slice(1):""}const Mr=["enter","leave"];function Nr(n=!1,e){return n&&!Mr.includes(e)}function Ir(n,e="",t=!1){const r=jn[n],s=r&&r[e]||e;return"on"+wn(n)+wn(s)+(Nr(t,s)?"Capture":"")}const kr=["gotpointercapture","lostpointercapture"];function Wr(n){let e=n.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const r=kr.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(r);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:t}}function zr(n,e=""){const t=jn[n],r=t&&t[e]||e;return n+r}function Bt(n){return"touches"in n}function Fn(n){return Bt(n)?"touch":"pointerType"in n?n.pointerType:"mouse"}function jr(n){return Array.from(n.touches).filter(e=>{var t,r;return e.target===n.currentTarget||((t=n.currentTarget)===null||t===void 0||(r=t.contains)===null||r===void 0?void 0:r.call(t,e.target))})}function Fr(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function Un(n){return Bt(n)?Fr(n)[0]:n}function Ur(n){return jr(n).map(e=>e.identifier)}function Zt(n){const e=Un(n);return Bt(n)?e.identifier:e.pointerId}function En(n){const e=Un(n);return[e.clientX,e.clientY]}function Vr(n){const e={};if("buttons"in n&&(e.buttons=n.buttons),"shiftKey"in n){const{shiftKey:t,altKey:r,metaKey:s,ctrlKey:o}=n;Object.assign(e,{shiftKey:t,altKey:r,metaKey:s,ctrlKey:o})}return e}function Vt(n,...e){return typeof n=="function"?n(...e):n}function $r(){}function Hr(...n){return n.length===0?$r:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function yn(n,e){return Object.assign({},e,n||{})}const Br=32;class Yr{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:r,args:s}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=s,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?Vt(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:r,shared:s}=this;t.args=this.args;let o=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,s.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,s.locked=!!document.pointerLockElement,Object.assign(s,Vr(e)),s.down=s.pressed=s.buttons%2===1||s.touches>0,o=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const D=t._delta.map(Math.abs);he.addTo(t._distance,D)}this.axisIntent&&this.axisIntent(e);const[i,c]=t._movement,[a,u]=r.threshold,{_step:l,values:h}=t;if(r.hasCustomTransform?(l[0]===!1&&(l[0]=Math.abs(i)>=a&&h[0]),l[1]===!1&&(l[1]=Math.abs(c)>=u&&h[1])):(l[0]===!1&&(l[0]=Math.abs(i)>=a&&Math.sign(i)*a),l[1]===!1&&(l[1]=Math.abs(c)>=u&&Math.sign(c)*u)),t.intentional=l[0]!==!1||l[1]!==!1,!t.intentional)return;const d=[0,0];if(r.hasCustomTransform){const[D,L]=h;d[0]=l[0]!==!1?D-l[0]:0,d[1]=l[1]!==!1?L-l[1]:0}else d[0]=l[0]!==!1?i-l[0]:0,d[1]=l[1]!==!1?c-l[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(d);const m=t.offset,w=t._active&&!t._blocked||t.active;w&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=s[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=Vt(r.bounds,t)),this.setup&&this.setup()),t.movement=d,this.computeOffset()));const[v,p]=t.offset,[[R,b],[_,S]]=t._bounds;t.overflow=[v<R?-1:v>b?1:0,p<_?-1:p>S?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const P=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=Pr(t._bounds,t.offset,P),t.delta=he.sub(t.offset,m),this.computeMovement(),w&&(!t.last||o>Br)){t.delta=he.sub(t.offset,m);const D=t.delta.map(Math.abs);he.addTo(t.distance,D),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&o>0&&(t.velocity=[D[0]/o,D[1]/o],t.timeDelta=o)}}emit(){const e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const s=this.handler(re(re(re({},t),e),{},{[this.aliasKey]:e.values}));s!==void 0&&(e.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function Xr([n,e],t){const r=Math.abs(n),s=Math.abs(e);if(r>s&&r>t)return"x";if(s>r&&s>t)return"y"}class Gr extends Yr{constructor(...e){super(...e),Se(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=he.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=he.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,r=this.config;if(!t.axis&&e){const s=typeof r.axisThreshold=="object"?r.axisThreshold[Fn(e)]:r.axisThreshold;t.axis=Xr(t._movement,s)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Tn=n=>n,Rn=.15,sn={enabled(n=!0){return n},eventOptions(n,e,t){return re(re({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[Rn,Rn];case!1:return[0,0];default:return he.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return he.toVector(n)},transform(n,e,t){const r=n||t.shared.transform;if(this.hasCustomTransform=!!r,process.env.NODE_ENV==="development"){const s=r||Tn;return o=>{const i=s(o);return(!isFinite(i[0])||!isFinite(i[1]))&&console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${i[0]},${[1]}]`),i}}return r||Tn},threshold(n){return he.toVector(n,0)}};process.env.NODE_ENV==="development"&&Object.assign(sn,{domTarget(n){if(n!==void 0)throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");return NaN},lockDirection(n){if(n!==void 0)throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");return NaN},initial(n){if(n!==void 0)throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");return NaN}});const qr=0,Dt=re(re({},sn),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=qr){return n},bounds(n={}){if(typeof n=="function")return o=>Dt.bounds(n(o));if("current"in n)return()=>n.current;if(typeof HTMLElement=="function"&&n instanceof HTMLElement)return n;const{left:e=-1/0,right:t=1/0,top:r=-1/0,bottom:s=1/0}=n;return[[e,t],[r,s]]}}),xn={ArrowRight:(n,e=1)=>[n*e,0],ArrowLeft:(n,e=1)=>[-1*n*e,0],ArrowUp:(n,e=1)=>[0,-1*n*e],ArrowDown:(n,e=1)=>[0,n*e]};class Kr extends Gr{constructor(...e){super(...e),Se(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),s={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=Dt.bounds(s)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const s=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(s&&s.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=Zt(e),r._pointerActive=!0,this.computeValues(En(e)),this.computeInitial(),t.preventScrollAxis&&Fn(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,r=this.config;if(!t._pointerActive)return;const s=Zt(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;const o=En(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=he.sub(o,t._values),this.computeValues(o)),he.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{process.env.NODE_ENV==="development"&&console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.")}const t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;const s=Zt(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=t._distance;if(t.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{const[c,a]=t._delta,[u,l]=t._movement,[h,d]=r.swipe.velocity,[m,w]=r.swipe.distance,v=r.swipe.duration;if(t.elapsedTime<v){const p=Math.abs(c/t.timeDelta),R=Math.abs(a/t.timeDelta);p>h&&Math.abs(u)>m&&(t.swipe[0]=Math.sign(c)),R>d&&Math.abs(l)>w&&(t.swipe[1]=Math.sign(a))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,r=t.device;if(process.env.NODE_ENV==="development")try{if(r==="pointer"&&t.preventScrollDelay===void 0){const s="uv"in e?e.sourceEvent.currentTarget:e.currentTarget;window.getComputedStyle(s).touchAction==="auto"&&console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.",s)}}catch{}t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,Jr(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=xn[e.key];if(t){const r=this.state,s=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,s),r._keyboardActive=!0,he.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in xn&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function Jr(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const Pt=typeof window<"u"&&window.document&&window.document.createElement;function Vn(){return Pt&&"ontouchstart"in window}function Zr(){return Vn()||Pt&&window.navigator.maxTouchPoints>1}function Qr(){return Pt&&"onpointerdown"in window}function es(){return Pt&&"exitPointerLock"in window.document}function ts(){try{return"constructor"in GestureEvent}catch{return!1}}const Ee={isBrowser:Pt,gesture:ts(),touch:Vn(),touchscreen:Zr(),pointer:Qr(),pointerLock:es()},ns=250,rs=180,ss=.5,os=50,is=250,cs=10,An={mouse:0,touch:0,pen:8},$n=re(re({},Dt),{},{device(n,e,{pointer:{touch:t=!1,lock:r=!1,mouse:s=!1}={}}){return this.pointerLock=r&&Ee.pointerLock,Ee.touch&&t?"touch":this.pointerLock?"mouse":Ee.pointer&&!s?"pointer":Ee.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?ns:void 0,!(!Ee.touchscreen||t===!1))return n||(t!==void 0?"y":void 0)},pointerCapture(n,e,{pointer:{capture:t=!0,buttons:r=1,keys:s=!0}={}}){return this.pointerButtons=r,this.keys=s,!this.pointerLock&&this.device==="pointer"&&t},threshold(n,e,{filterTaps:t=!1,tapsThreshold:r=3,axis:s=void 0}){const o=he.toVector(n,t?r:s?1:0);return this.filterTaps=t,this.tapsThreshold=r,o},swipe({velocity:n=ss,distance:e=os,duration:t=is}={}){return{velocity:this.transform(he.toVector(n)),distance:this.transform(he.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return rs;case!1:return 0;default:return n}},axisThreshold(n){return n?re(re({},An),n):An},keyboardDisplacement(n=cs){return n}});process.env.NODE_ENV==="development"&&Object.assign($n,{useTouch(n){if(n!==void 0)throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");return NaN},experimental_preventWindowScrollY(n){if(n!==void 0)throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");return NaN},swipeVelocity(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");return NaN},swipeDistance(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");return NaN},swipeDuration(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");return NaN}});re(re({},sn),{},{device(n,e,{shared:t,pointer:{touch:r=!1}={}}){if(t.target&&!Ee.touch&&Ee.gesture)return"gesture";if(Ee.touch&&r)return"touch";if(Ee.touchscreen){if(Ee.pointer)return"pointer";if(Ee.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:r={}}){const s=i=>{const c=yn(Vt(t,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=yn(Vt(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof t!="function"&&typeof r!="function"?[s(),o()]:i=>[s(i),o(i)]},threshold(n,e,t){return this.lockDirection=t.axis==="lock",he.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}});re(re({},Dt),{},{mouseOnly:(n=!0)=>n});re(re({},Dt),{},{mouseOnly:(n=!0)=>n});const Hn=new Map,nn=new Map;function as(n){Hn.set(n.key,n.engine),nn.set(n.key,n.resolver)}const ls={key:"drag",engine:Kr,resolver:$n};function us(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,o;for(o=0;o<r.length;o++)s=r[o],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}function fs(n,e){if(n==null)return{};var t=us(n,e),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(s=0;s<o.length;s++)r=o[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}const ds={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=Ee.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},hs=["target","eventOptions","window","enabled","transform"];function zt(n={},e){const t={};for(const[r,s]of Object.entries(e))switch(typeof s){case"function":if(process.env.NODE_ENV==="development"){const o=s.call(t,n[r],r,n);Number.isNaN(o)||(t[r]=o)}else t[r]=s.call(t,n[r],r,n);break;case"object":t[r]=zt(n[r],s);break;case"boolean":s&&(t[r]=n[r]);break}return t}function ms(n,e,t={}){const r=n,{target:s,eventOptions:o,window:i,enabled:c,transform:a}=r,u=fs(r,hs);if(t.shared=zt({target:s,eventOptions:o,window:i,enabled:c,transform:a},ds),e){const l=nn.get(e);t[e]=zt(re({shared:t.shared},u),l)}else for(const l in u){const h=nn.get(l);if(h)t[l]=zt(re({shared:t.shared},u[l]),h);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(l)){if(l==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${l}\` was used. Please read the documentation for further information.`)}}return t}class Bn{constructor(e,t){Se(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,s,o){const i=this._listeners,c=zr(t,r),a=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=re(re({},a),o);e.addEventListener(c,s,u);const l=()=>{e.removeEventListener(c,s,u),i.delete(l)};return i.add(l),l}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class ps{constructor(){Se(this,"_timeouts",new Map)}add(e,t,r=140,...s){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...s))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class gs{constructor(e){Se(this,"gestures",new Set),Se(this,"_targetEventStore",new Bn(this)),Se(this,"gestureEventStores",{}),Se(this,"gestureTimeoutStores",{}),Se(this,"handlers",{}),Se(this,"config",{}),Se(this,"pointerIds",new Set),Se(this,"touchIds",new Set),Se(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),vs(this,e)}setEventIds(e){if(Bt(e))return this.touchIds=new Set(Ur(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=ms(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,r={};let s;if(!(t.target&&(s=t.target(),!s))){if(t.enabled){for(const i of this.gestures){const c=this.config[i],a=Cn(r,c.eventOptions,!!s);if(c.enabled){const u=Hn.get(i);new u(this,e,i).bind(a)}}const o=Cn(r,t.eventOptions,!!s);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](re(re({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=Hr(...r[o]);if(!s)return r;for(const o in r){const{device:i,capture:c,passive:a}=Wr(o);this._targetEventStore.add(s,i,"",r[o],{capture:c,passive:a})}}}}function Et(n,e){n.gestures.add(e),n.gestureEventStores[e]=new Bn(n,e),n.gestureTimeoutStores[e]=new ps}function vs(n,e){e.drag&&Et(n,"drag"),e.wheel&&Et(n,"wheel"),e.scroll&&Et(n,"scroll"),e.move&&Et(n,"move"),e.pinch&&Et(n,"pinch"),e.hover&&Et(n,"hover")}const Cn=(n,e,t)=>(r,s,o,i={},c=!1)=>{var a,u;const l=(a=i.capture)!==null&&a!==void 0?a:e.capture,h=(u=i.passive)!==null&&u!==void 0?u:e.passive;let d=c?r:Ir(r,s,l);t&&h&&(d+="Passive"),n[d]=n[d]||[],n[d].push(o)};function bs(n,e={},t,r){const s=k.useMemo(()=>new gs(n),[]);if(s.applyHandlers(n,r),s.applyConfig(e,t),k.useEffect(s.effect.bind(s)),k.useEffect(()=>s.clean.bind(s),[]),e.target===void 0)return s.bind.bind(s)}function Qt(n,e){return as(ls),bs({drag:n},e||{},"drag")}function Dn(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function Yn(...n){return e=>{let t=!1;const r=n.map(s=>{const o=Dn(s,e);return!t&&typeof o=="function"&&(t=!0),o});if(t)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Dn(n[s],null)}}}}function Ze(...n){return g.useCallback(Yn(...n),n)}function Xn(n){const e=Ss(n),t=g.forwardRef((r,s)=>{const{children:o,...i}=r,c=g.Children.toArray(o),a=c.find(Es);if(a){const u=a.props.children,l=c.map(h=>h===a?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:h);return T.jsx(e,{...i,ref:s,children:g.isValidElement(u)?g.cloneElement(u,void 0,l):null})}return T.jsx(e,{...i,ref:s,children:o})});return t.displayName=`${n}.Slot`,t}var _s=Xn("Slot");function Ss(n){const e=g.forwardRef((t,r)=>{const{children:s,...o}=t;if(g.isValidElement(s)){const i=Ts(s),c=ys(o,s.props);return s.type!==g.Fragment&&(c.ref=r?Yn(r,i):i),g.cloneElement(s,c)}return g.Children.count(s)>1?g.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var ws=Symbol("radix.slottable");function Es(n){return g.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===ws}function ys(n,e){const t={...e};for(const r in e){const s=n[r],o=e[r];/^on[A-Z]/.test(r)?s&&o?t[r]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(t[r]=s):r==="style"?t[r]={...s,...o}:r==="className"&&(t[r]=[s,o].filter(Boolean).join(" "))}return{...n,...t}}function Ts(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Rs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lt=Rs.reduce((n,e)=>{const t=Xn(`Primitive.${e}`),r=g.forwardRef((s,o)=>{const{asChild:i,...c}=s,a=i?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(a,{...c,ref:o})});return r.displayName=`Primitive.${e}`,{...n,[e]:r}},{});function xs(n,e=[]){let t=[];function r(o,i){const c=g.createContext(i),a=t.length;t=[...t,i];const u=h=>{const{scope:d,children:m,...w}=h,v=d?.[n]?.[a]||c,p=g.useMemo(()=>w,Object.values(w));return T.jsx(v.Provider,{value:p,children:m})};u.displayName=o+"Provider";function l(h,d){const m=d?.[n]?.[a]||c,w=g.useContext(m);if(w)return w;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[u,l]}const s=()=>{const o=t.map(i=>g.createContext(i));return function(c){const a=c?.[n]||o;return g.useMemo(()=>({[`__scope${n}`]:{...c,[n]:a}}),[c,a])}};return s.scopeName=n,[r,As(s,...e)]}function As(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:a,scopeName:u})=>{const h=a(o)[`__scope${u}`];return{...c,...h}},{});return g.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return t.scopeName=e.scopeName,t}function Je(n,e,{checkForDefaultPrevented:t=!0}={}){return function(s){if(n?.(s),t===!1||!s.defaultPrevented)return e?.(s)}}var rn=globalThis?.document?g.useLayoutEffect:()=>{};function Cs(n,e){return g.useReducer((t,r)=>e[t][r]??t,n)}var Ot=n=>{const{present:e,children:t}=n,r=Ds(e),s=typeof t=="function"?t({present:r.isPresent}):g.Children.only(t),o=Ze(r.ref,Ps(s));return typeof t=="function"||r.isPresent?g.cloneElement(s,{ref:o}):null};Ot.displayName="Presence";function Ds(n){const[e,t]=g.useState(),r=g.useRef(null),s=g.useRef(n),o=g.useRef("none"),i=n?"mounted":"unmounted",[c,a]=Cs(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=Wt(r.current);o.current=c==="mounted"?u:"none"},[c]),rn(()=>{const u=r.current,l=s.current;if(l!==n){const d=o.current,m=Wt(u);n?a("MOUNT"):m==="none"||u?.display==="none"?a("UNMOUNT"):a(l&&d!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=n}},[n,a]),rn(()=>{if(e){let u;const l=e.ownerDocument.defaultView??window,h=m=>{const v=Wt(r.current).includes(CSS.escape(m.animationName));if(m.target===e&&v&&(a("ANIMATION_END"),!s.current)){const p=e.style.animationFillMode;e.style.animationFillMode="forwards",u=l.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=p)})}},d=m=>{m.target===e&&(o.current=Wt(r.current))};return e.addEventListener("animationstart",d),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{l.clearTimeout(u),e.removeEventListener("animationstart",d),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:g.useCallback(u=>{r.current=u?getComputedStyle(u):null,t(u)},[])}}function Wt(n){return n?.animationName||"none"}function Ps(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Ls=g.createContext(void 0);function Os(n){const e=g.useContext(Ls);return n||e||"ltr"}function Ke(n){const e=g.useRef(n);return g.useEffect(()=>{e.current=n}),g.useMemo(()=>(...t)=>e.current?.(...t),[])}function Ms(n,[e,t]){return Math.min(t,Math.max(e,n))}function Ns(n,e){return g.useReducer((t,r)=>e[t][r]??t,n)}var on="ScrollArea",[Gn]=xs(on),[Is,ye]=Gn(on),qn=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[c,a]=g.useState(null),[u,l]=g.useState(null),[h,d]=g.useState(null),[m,w]=g.useState(null),[v,p]=g.useState(null),[R,b]=g.useState(0),[_,S]=g.useState(0),[P,D]=g.useState(!1),[L,H]=g.useState(!1),M=Ze(e,F=>a(F)),j=Os(s);return T.jsx(Is,{scope:t,type:r,dir:j,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:l,content:h,onContentChange:d,scrollbarX:m,onScrollbarXChange:w,scrollbarXEnabled:P,onScrollbarXEnabledChange:D,scrollbarY:v,onScrollbarYChange:p,scrollbarYEnabled:L,onScrollbarYEnabledChange:H,onCornerWidthChange:b,onCornerHeightChange:S,children:T.jsx(Lt.div,{dir:j,...i,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":R+"px","--radix-scroll-area-corner-height":_+"px",...n.style}})})});qn.displayName=on;var Kn="ScrollAreaViewport",Jn=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=ye(Kn,t),c=g.useRef(null),a=Ze(e,c,i.onViewportChange);return T.jsxs(T.Fragment,{children:[T.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),T.jsx(Lt.div,{"data-radix-scroll-area-viewport":"",...o,ref:a,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:T.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Jn.displayName=Kn;var Le="ScrollAreaScrollbar",Zn=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=ye(Le,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,c=n.orientation==="horizontal";return g.useEffect(()=>(c?o(!0):i(!0),()=>{c?o(!1):i(!1)}),[c,o,i]),s.type==="hover"?T.jsx(ks,{...r,ref:e,forceMount:t}):s.type==="scroll"?T.jsx(Ws,{...r,ref:e,forceMount:t}):s.type==="auto"?T.jsx(Qn,{...r,ref:e,forceMount:t}):s.type==="always"?T.jsx(cn,{...r,ref:e}):null});Zn.displayName=Le;var ks=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=ye(Le,n.__scopeScrollArea),[o,i]=g.useState(!1);return g.useEffect(()=>{const c=s.scrollArea;let a=0;if(c){const u=()=>{window.clearTimeout(a),i(!0)},l=()=>{a=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",l),()=>{window.clearTimeout(a),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",l)}}},[s.scrollArea,s.scrollHideDelay]),T.jsx(Ot,{present:t||o,children:T.jsx(Qn,{"data-state":o?"visible":"hidden",...r,ref:e})})}),Ws=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=ye(Le,n.__scopeScrollArea),o=n.orientation==="horizontal",i=Xt(()=>a("SCROLL_END"),100),[c,a]=Ns("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>a("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,s.scrollHideDelay,a]),g.useEffect(()=>{const u=s.viewport,l=o?"scrollLeft":"scrollTop";if(u){let h=u[l];const d=()=>{const m=u[l];h!==m&&(a("SCROLL"),i()),h=m};return u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[s.viewport,o,a,i]),T.jsx(Ot,{present:t||c!=="hidden",children:T.jsx(cn,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Je(n.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:Je(n.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),Qn=g.forwardRef((n,e)=>{const t=ye(Le,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=g.useState(!1),c=n.orientation==="horizontal",a=Xt(()=>{if(t.viewport){const u=t.viewport.offsetWidth<t.viewport.scrollWidth,l=t.viewport.offsetHeight<t.viewport.scrollHeight;i(c?u:l)}},10);return Rt(t.viewport,a),Rt(t.content,a),T.jsx(Ot,{present:r||o,children:T.jsx(cn,{"data-state":o?"visible":"hidden",...s,ref:e})})}),cn=g.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=ye(Le,n.__scopeScrollArea),o=g.useRef(null),i=g.useRef(0),[c,a]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=sr(c.viewport,c.content),l={...r,sizes:c,onSizesChange:a,hasThumb:u>0&&u<1,onThumbChange:d=>o.current=d,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:d=>i.current=d};function h(d,m){return $s(d,i.current,c,m)}return t==="horizontal"?T.jsx(zs,{...l,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const d=s.viewport.scrollLeft,m=Pn(d,c,s.dir);o.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:d=>{s.viewport&&(s.viewport.scrollLeft=d)},onDragScroll:d=>{s.viewport&&(s.viewport.scrollLeft=h(d,s.dir))}}):t==="vertical"?T.jsx(js,{...l,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const d=s.viewport.scrollTop,m=Pn(d,c);o.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:d=>{s.viewport&&(s.viewport.scrollTop=d)},onDragScroll:d=>{s.viewport&&(s.viewport.scrollTop=h(d))}}):null}),zs=g.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=ye(Le,n.__scopeScrollArea),[i,c]=g.useState(),a=g.useRef(null),u=Ze(e,a,o.onScrollbarXChange);return g.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),T.jsx(tr,{"data-orientation":"horizontal",...s,ref:u,sizes:t,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Yt(t)+"px",...n.style},onThumbPointerDown:l=>n.onThumbPointerDown(l.x),onDragScroll:l=>n.onDragScroll(l.x),onWheelScroll:(l,h)=>{if(o.viewport){const d=o.viewport.scrollLeft+l.deltaX;n.onWheelScroll(d),ir(d,h)&&l.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:Ht(i.paddingLeft),paddingEnd:Ht(i.paddingRight)}})}})}),js=g.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=ye(Le,n.__scopeScrollArea),[i,c]=g.useState(),a=g.useRef(null),u=Ze(e,a,o.onScrollbarYChange);return g.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),T.jsx(tr,{"data-orientation":"vertical",...s,ref:u,sizes:t,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Yt(t)+"px",...n.style},onThumbPointerDown:l=>n.onThumbPointerDown(l.y),onDragScroll:l=>n.onDragScroll(l.y),onWheelScroll:(l,h)=>{if(o.viewport){const d=o.viewport.scrollTop+l.deltaY;n.onWheelScroll(d),ir(d,h)&&l.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:Ht(i.paddingTop),paddingEnd:Ht(i.paddingBottom)}})}})}),[Fs,er]=Gn(Le),tr=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:a,onDragScroll:u,onWheelScroll:l,onResize:h,...d}=n,m=ye(Le,t),[w,v]=g.useState(null),p=Ze(e,M=>v(M)),R=g.useRef(null),b=g.useRef(""),_=m.viewport,S=r.content-r.viewport,P=Ke(l),D=Ke(a),L=Xt(h,10);function H(M){if(R.current){const j=M.clientX-R.current.left,F=M.clientY-R.current.top;u({x:j,y:F})}}return g.useEffect(()=>{const M=j=>{const F=j.target;w?.contains(F)&&P(j,S)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[_,w,S,P]),g.useEffect(D,[r,D]),Rt(w,L),Rt(m.content,L),T.jsx(Fs,{scope:t,scrollbar:w,hasThumb:s,onThumbChange:Ke(o),onThumbPointerUp:Ke(i),onThumbPositionChange:D,onThumbPointerDown:Ke(c),children:T.jsx(Lt.div,{...d,ref:p,style:{position:"absolute",...d.style},onPointerDown:Je(n.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),R.current=w.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),H(M))}),onPointerMove:Je(n.onPointerMove,H),onPointerUp:Je(n.onPointerUp,M=>{const j=M.target;j.hasPointerCapture(M.pointerId)&&j.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=b.current,m.viewport&&(m.viewport.style.scrollBehavior=""),R.current=null})})})}),$t="ScrollAreaThumb",nr=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=er($t,n.__scopeScrollArea);return T.jsx(Ot,{present:t||s.hasThumb,children:T.jsx(Us,{ref:e,...r})})}),Us=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=ye($t,t),i=er($t,t),{onThumbPositionChange:c}=i,a=Ze(e,h=>i.onThumbChange(h)),u=g.useRef(void 0),l=Xt(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const h=o.viewport;if(h){const d=()=>{if(l(),!u.current){const m=Hs(h,c);u.current=m,c()}};return c(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[o.viewport,l,c]),T.jsx(Lt.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Je(n.onPointerDownCapture,h=>{const m=h.target.getBoundingClientRect(),w=h.clientX-m.left,v=h.clientY-m.top;i.onThumbPointerDown({x:w,y:v})}),onPointerUp:Je(n.onPointerUp,i.onThumbPointerUp)})});nr.displayName=$t;var an="ScrollAreaCorner",rr=g.forwardRef((n,e)=>{const t=ye(an,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?T.jsx(Vs,{...n,ref:e}):null});rr.displayName=an;var Vs=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=ye(an,t),[o,i]=g.useState(0),[c,a]=g.useState(0),u=!!(o&&c);return Rt(s.scrollbarX,()=>{const l=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(l),a(l)}),Rt(s.scrollbarY,()=>{const l=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(l),i(l)}),u?T.jsx(Lt.div,{...r,ref:e,style:{width:o,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function Ht(n){return n?parseInt(n,10):0}function sr(n,e){const t=n/e;return isNaN(t)?0:t}function Yt(n){const e=sr(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function $s(n,e,t,r="ltr"){const s=Yt(t),o=s/2,i=e||o,c=s-i,a=t.scrollbar.paddingStart+i,u=t.scrollbar.size-t.scrollbar.paddingEnd-c,l=t.content-t.viewport,h=r==="ltr"?[0,l]:[l*-1,0];return or([a,u],h)(n)}function Pn(n,e,t="ltr"){const r=Yt(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,i=e.content-e.viewport,c=o-r,a=t==="ltr"?[0,i]:[i*-1,0],u=Ms(n,a);return or([0,i],[0,c])(u)}function or(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function ir(n,e){return n>0&&n<e}var Hs=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return(function s(){const o={left:n.scrollLeft,top:n.scrollTop},i=t.left!==o.left,c=t.top!==o.top;(i||c)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function Xt(n,e){const t=Ke(n),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Rt(n,e){const t=Ke(e);rn(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var Bs=qn,Ys=Jn,Xs=rr;const en=(n,e,t,r,s)=>({target:n,dx:e[0],dy:e[1],clientX:t[0],clientY:t[1],...r&&{edges:r},...s&&{deltaRect:s}}),Gs=(n,e,t)=>n?n===e||n===t||(e?.contains(n)??!1)||(t?.contains(n)??!1):!1,qs=n=>{const e=Pe.c(34),{children:t,style:r,draggable:s,resizable:o,draggableOptions:i,resizableOptions:c,ref:a}=n,u=k.useRef(void 0),l=k.useRef(void 0),h=k.useRef(null),d=k.useRef(null),m=k.useRef(void 0),w=k.useRef(void 0);let v,p;e[0]!==i||e[1]!==a||e[2]!==c?(v=()=>{if(u.current=i,l.current=c,!a?.current)return;const E=c?.edges?.left,A=c?.edges?.right;E&&E!==m.current&&(m.current=E,h.current=a.current.querySelector(E)),A&&A!==w.current&&(w.current=A,d.current=a.current.querySelector(A))},p=[i,a,c],e[0]=i,e[1]=a,e[2]=c,e[3]=v,e[4]=p):(v=e[3],p=e[4]),k.useEffect(v,p);let R;e[5]!==a?(R=E=>{const{active:A,delta:N,xy:ee,event:ne,first:f,last:y}=E,I=a?.current;if(!I||Gs(ne?.target,h.current,d.current))return;const Y=en(I,N,ee);f?u.current?.onstart?.(Y):y?u.current?.onend?.(Y):A&&u.current?.onmove?.(Y)},e[5]=a,e[6]=R):R=e[6];const b=i?.lockAxis==="x"?"x":void 0;let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_={capture:!0},e[7]=_):_=e[7];let S;e[8]!==s||e[9]!==a||e[10]!==b?(S={enabled:s,axis:b,pointer:_,target:a,threshold:0},e[8]=s,e[9]=a,e[10]=b,e[11]=S):S=e[11],Qt(R,S);let P;e[12]!==a?(P=E=>{const{active:A,delta:N,xy:ee,first:ne,last:f}=E,y=a?.current;if(!y)return;const I=en(y,N,ee,{left:!0},{left:N[0]});ne?l.current?.onstart?.(I):f?l.current?.onend?.(I):A&&l.current?.onmove?.(I)},e[12]=a,e[13]=P):P=e[13];let D;e[14]===Symbol.for("react.memo_cache_sentinel")?(D={capture:!0},e[14]=D):D=e[14];let L;e[15]!==o?(L={enabled:o,target:h,pointer:D,threshold:0},e[15]=o,e[16]=L):L=e[16],Qt(P,L);let H;e[17]!==a?(H=E=>{const{active:A,delta:N,xy:ee,first:ne,last:f}=E,y=a?.current;if(!y)return;const I=en(y,N,ee,{right:!0},{right:N[0]});ne?l.current?.onstart?.(I):f?l.current?.onend?.(I):A&&l.current?.onmove?.(I)},e[17]=a,e[18]=H):H=e[18];let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M={capture:!0},e[19]=M):M=e[19];let j;e[20]!==o?(j={enabled:o,target:d,pointer:M,threshold:0},e[20]=o,e[21]=j):j=e[21],Qt(H,j);let F,G;e[22]!==a?(F=()=>{const E=a?.current;if(!E)return;const A=l.current?.edges?.left,N=l.current?.edges?.right;A&&(h.current=E.querySelector(A)),N&&(d.current=E.querySelector(N))},G=[a],e[22]=a,e[23]=F,e[24]=G):(F=e[23],G=e[24]),k.useLayoutEffect(F,G);let x;e[25]!==s?(x=s?{touchAction:"none"}:{},e[25]=s,e[26]=x):x=e[26];let U;e[27]!==r||e[28]!==x?(U={...x,...r},e[27]=r,e[28]=x,e[29]=U):U=e[29];let W;return e[30]!==t||e[31]!==a||e[32]!==U?(W=T.jsx(_s,{ref:a,style:U,draggable:!1,children:t}),e[30]=t,e[31]=a,e[32]=U,e[33]=W):W=e[33],W},_e=(n,e=0)=>n?parseFloat(n):e,tn=(n,e,t,r=Number.MAX_SAFE_INTEGER)=>{let s=n,o=r;for(const i of e){const c=Math.abs(i-n);c<t&&c<o&&(s=i,o=c)}return{snap:s,minDis:o}},cr=k.forwardRef((n,e)=>{const t=Pe.c(68),{children:r,edges:s,left:o,width:i,start:c,grid:a,getBounds:u,enableResizing:l,enableDragging:h,snapDistance:d,snapPositions:m,onResizeStart:w,onResize:v,onResizeEnd:p,onDragStart:R,onDragEnd:b,onDrag:_,parentRef:S,autoScroll:P}=n,D=c===void 0?C.DEFAULT_START_LEFT:c,L=a===void 0?C.DEFAULT_MOVE_GRID:a,H=u===void 0?Ks:u,M=l===void 0?!0:l,j=h===void 0?!0:h,F=d===void 0?C.DEFAULT_SNAP_DISTANCE:d;let G;t[0]!==m?(G=m===void 0?[]:m,t[0]=m,t[1]=G):G=t[1];const x=G,U=P===void 0?!0:P,W=k.useRef(null),E=k.useRef(0),A=k.useRef(!1),{initAutoScroll:N,stopAutoScroll:ee,dealDragAutoScroll:ne,dealResizeAutoScroll:f}=Cr(S);let y;t[2]===Symbol.for("react.memo_cache_sentinel")?(y=($,Z)=>{const K=Z===void 0?!0:Z;if(!W.current)return;K&&(E.current=0);const J=W.current;J.style.left=`${$}px`,J.dataset.left=String($)},t[2]=y):y=t[2];const I=y;let Y;t[3]===Symbol.for("react.memo_cache_sentinel")?(Y=($,Z)=>{const K=Z===void 0?!0:Z;if(!W.current)return;K&&(E.current=0);const J=W.current;J.style.width=`${$}px`,J.dataset.width=String($)},t[3]=Y):Y=t[3];const te=Y;let q;t[4]===Symbol.for("react.memo_cache_sentinel")?(q=()=>W.current?_e(W.current.dataset.left):0,t[4]=q):q=t[4];const X=q;let O;t[5]===Symbol.for("react.memo_cache_sentinel")?(O=()=>W.current?_e(W.current.dataset.width):0,t[5]=O):O=t[5];const z=O;let B,Qe;t[6]!==i?(B=()=>{if(!W.current)return;const $=W.current;te(typeof i>"u"?$.offsetWidth:i,!1)},Qe=[i],t[6]=i,t[7]=B,t[8]=Qe):(B=t[7],Qe=t[8]),k.useEffect(B,Qe);let et,ze;t[9]!==o?(et=()=>{I(o||0,!1)},ze=[o],t[9]=o,t[10]=et,t[11]=ze):(et=t[10],ze=t[11]),k.useEffect(et,ze);let Oe;t[12]===Symbol.for("react.memo_cache_sentinel")?(Oe=()=>({updateLeft:$=>I($||0,!1),updateWidth:$=>te($,!1),getLeft:X,getWidth:z}),t[12]=Oe):Oe=t[12],k.useImperativeHandle(e,Oe);let xe;t[13]!==N||t[14]!==R?(xe=()=>{E.current=0,A.current=!1,N(),R?.()},t[13]=N,t[14]=R,t[15]=xe):xe=t[15];const Xe=xe;let Me;t[16]!==H||t[17]!==L||t[18]!==_||t[19]!==F||t[20]!==x||t[21]!==D?(Me=$=>{const{preLeft:Z,preWidth:K,scrollDelta:J}=$;J&&(E.current=E.current+J);const me=A.current?F:L;if(Math.abs(E.current)<me)return;const pe=Math.trunc(E.current/me);let Q=Z+pe*me;const oe=E.current>0,V=oe?Q+K:Q,{snap:se}=tn(V,x,F);if(se!==V)A.current=!0,Q=oe?se-K:se;else{const le=Q-D;le%L!==0&&(Q=D+L*Math.round(le/L)),A.current=!1}E.current=E.current%me;const ie=H();Q<ie.left?Q=ie.left:Q+K>ie.right&&(Q=ie.right-K),!(_&&_({lastLeft:Z,left:Q,lastWidth:K,width:K},J)===!1)&&I(Q,!1)},t[16]=H,t[17]=L,t[18]=_,t[19]=F,t[20]=x,t[21]=D,t[22]=Me):Me=t[22];const Ae=Me;let Ne;t[23]!==U||t[24]!==ne||t[25]!==Ae||t[26]!==S?(Ne=$=>{const Z=$.target,K=_e(Z.dataset.left),J=_e(Z.dataset.width);E.current=E.current+$.dx,!(U&&S?.current&&!ne($,Q=>{if(!S?.current||!W.current)return;S.current.scrollLeft=S.current.scrollLeft+Q;const oe=W.current,V=_e(oe.dataset.left),se=_e(oe.dataset.width);Ae({preLeft:V,preWidth:se,scrollDelta:Q})}))&&Ae({preLeft:K,preWidth:J})},t[23]=U,t[24]=ne,t[25]=Ae,t[26]=S,t[27]=Ne):Ne=t[27];const xt=Ne;let tt;t[28]!==b||t[29]!==ee?(tt=$=>{E.current=0,A.current=!1,ee();const Z=$.target;b?.({left:_e(Z.dataset.left),width:_e(Z.dataset.width)})},t[28]=b,t[29]=ee,t[30]=tt):tt=t[30];const je=tt;let we;t[31]!==N||t[32]!==w?(we=$=>{E.current=0,A.current=!1,N();const Z=$.edges?.right?"right":"left";w?.(Z)},t[31]=N,t[32]=w,t[33]=we):we=t[33];const Fe=we;let Ie;t[34]!==H||t[35]!==L||t[36]!==v||t[37]!==F||t[38]!==x||t[39]!==D?(Ie=$=>{const{dir:Z,preWidth:K,preLeft:J,scrollDelta:me}=$;me&&(E.current=E.current+me);const pe=A.current?F:L;if(Math.abs(E.current)<pe)return;const Q=H();if(Z==="left"){const oe=Math.trunc(E.current/pe);let V=J+oe*pe;const{snap:se}=tn(V,x,F);if(se!==V)A.current=!0,V=se;else{const ge=V-D;ge%L!==0&&(V=D+L*Math.round(ge/L)),A.current=!1}E.current=E.current%pe,V<Q.left&&(V=Q.left);const ie=J+K,le=ie-V;if(V>=ie||v&&v("left",{lastLeft:J,lastWidth:K,left:V,width:le})===!1)return;I(V,!1),te(le,!1)}else{const oe=Math.trunc(E.current/pe);let V=K+oe*pe;const se=J+V,{snap:ie}=tn(se,x,F);if(ie!==se)A.current=!0,V=ie-J;else{let le=J+V;const ge=le-D;ge%L!==0&&(le=D+L*Math.round(ge/L),V=le-J),A.current=!1}if(E.current=E.current%pe,J+V>Q.right&&(V=Q.right-J),V<=0||v&&v("right",{lastLeft:J,lastWidth:K,left:J,width:V})===!1)return;te(V,!1)}},t[34]=H,t[35]=L,t[36]=v,t[37]=F,t[38]=x,t[39]=D,t[40]=Ie):Ie=t[40];const Ue=Ie;let ke;t[41]!==U||t[42]!==f||t[43]!==S||t[44]!==Ue?(ke=$=>{const Z=$.target,K=$.edges?.left?"left":"right",J=_e(Z.dataset.left),me=_e(Z.dataset.width);E.current=E.current+(K==="left"?$.deltaRect?.left||0:$.deltaRect?.right||0),!(U&&S?.current&&!f($,K,oe=>{if(!S?.current||!W.current)return;S.current.scrollLeft=S.current.scrollLeft+oe;const V=W.current,se=_e(V.dataset.left),ie=_e(V.dataset.width);Ue({preLeft:se,preWidth:ie,dir:K,scrollDelta:oe})}))&&Ue({preLeft:J,preWidth:me,dir:K})},t[41]=U,t[42]=f,t[43]=S,t[44]=Ue,t[45]=ke):ke=t[45];const Ce=ke;let We;t[46]!==p||t[47]!==ee?(We=$=>{E.current=0,A.current=!1,ee();const Z=$.target,K=$.edges?.right?"right":"left";p?.(K,{left:_e(Z.dataset.left),width:_e(Z.dataset.width)})},t[46]=p,t[47]=ee,t[48]=We):We=t[48];const Ge=We;let Te;t[49]!==o||t[50]!==i?(Te={left:o,width:i},t[49]=o,t[50]=i,t[51]=Te):Te=t[51];let De;t[52]!==xt||t[53]!==Xe||t[54]!==je?(De={lockAxis:"x",onmove:xt,onstart:Xe,onend:je,cursorChecker:Js},t[52]=xt,t[53]=Xe,t[54]=je,t[55]=De):De=t[55];let Re;t[56]!==s||t[57]!==Ce||t[58]!==Fe||t[59]!==Ge?(Re={axis:"x",invert:"none",edges:s,onmove:Ce,onstart:Fe,onend:Ge},t[56]=s,t[57]=Ce,t[58]=Fe,t[59]=Ge,t[60]=Re):Re=t[60];let Ve;return t[61]!==r||t[62]!==j||t[63]!==M||t[64]!==Te||t[65]!==De||t[66]!==Re?(Ve=T.jsx(qs,{style:Te,ref:W,draggable:j,resizable:M,draggableOptions:De,resizableOptions:Re,children:r}),t[61]=r,t[62]=j,t[63]=M,t[64]=Te,t[65]=De,t[66]=Re,t[67]=Ve):Ve=t[67],Ve});function Ks(){return{left:Number.MIN_SAFE_INTEGER,right:Number.MAX_SAFE_INTEGER}}function Js(){return""}function Zs(){let n=0,e,t="",r=arguments.length;for(;n<r;n++)(e=arguments[n])&&typeof e=="string"&&(t+=(t&&" ")+e);return t}const Qs=n=>{const e=Pe.c(191),{editorData:t,row:r,action:s,effects:o,rowHeight:i,scale:c,scaleWidth:a,scaleSplitCount:u,startLeft:l,gridSnap:h,disableDrag:d,scaleCount:m,maxScaleCount:w,setScaleCount:v,onActionMoveStart:p,onActionMoving:R,onActionMoveEnd:b,onActionResizeStart:_,onActionResizeEnd:S,onActionResizing:P,snapData:D,setEditorData:L,onClickAction:H,onClickActionOnly:M,onDoubleClickAction:j,onContextMenuAction:F,getActionRender:G,handleTime:x,scrollContainerRef:U}=n,W=k.useRef(null),E=k.useRef(!1),{id:A,maxEnd:N,minStart:ee,end:ne,start:f,selected:y,flexible:I,movable:Y,effectId:te}=s,q=I===void 0?!0:I,X=Y===void 0?!0:Y,O=c??C.DEFAULT_SCALE,z=a??C.DEFAULT_SCALE_WIDTH,B=l??C.DEFAULT_START_LEFT,Qe=u??C.DEFAULT_SCALE_SPLIT_COUNT,et=w??Number.MAX_SAFE_INTEGER,ze=ee||0;let Oe;e[0]!==O||e[1]!==z||e[2]!==B||e[3]!==ze?(Oe=C.parserTimeToPixel(ze,{startLeft:B,scale:O,scaleWidth:z}),e[0]=O,e[1]=z,e[2]=B,e[3]=ze,e[4]=Oe):Oe=e[4];const xe=Oe,Xe=N||Number.MAX_VALUE;let Me;e[5]!==O||e[6]!==z||e[7]!==B||e[8]!==Xe?(Me=C.parserTimeToPixel(Xe,{startLeft:B,scale:O,scaleWidth:z}),e[5]=O,e[6]=z,e[7]=B,e[8]=Xe,e[9]=Me):Me=e[9];const Ae=Math.min(et*z+B,Me);let Ne;e[10]!==ne||e[11]!==O||e[12]!==z||e[13]!==B||e[14]!==f?(Ne=C.parserTimeToTransform({start:f,end:ne},{startLeft:B,scale:O,scaleWidth:z}),e[10]=ne,e[11]=O,e[12]=z,e[13]=B,e[14]=f,e[15]=Ne):Ne=e[15];const xt=Ne,[tt,je]=k.useState(null),we=tt??xt,Fe=z/Qe;let Ie;e[16]!==te||e[17]!==o||e[18]!==q||e[19]!==X||e[20]!==y?(Ie=de(Zs("action",X&&"action-movable",y&&"action-selected",q&&"action-flexible",o[te]&&`action-effect-${te}`)),e[16]=te,e[17]=o,e[18]=q,e[19]=X,e[20]=y,e[21]=Ie):Ie=e[21];const Ue=Ie;let ke;e[22]!==z||e[23]!==B||e[24]!==m||e[25]!==v?(ke=(ve,be)=>{console.log("handleScaleCount",ve,be);const ce=C.getScaleCountByPixel(ve+be,{startLeft:B,scaleCount:m,scaleWidth:z});ce!==m&&v(ce)},e[22]=z,e[23]=B,e[24]=m,e[25]=v,e[26]=ke):ke=e[26];const Ce=ke;let We;e[27]!==s||e[28]!==p||e[29]!==r?(We=()=>{p&&p({action:s,row:r})},e[27]=s,e[28]=p,e[29]=r,e[30]=We):We=e[30];const Ge=We;let Te;e[31]!==s||e[32]!==Ce||e[33]!==R||e[34]!==r||e[35]!==O||e[36]!==z||e[37]!==B?(Te=ve=>{const{left:be,width:ce}=ve;if(E.current=!0,R){const{start:fe,end:ae}=C.parserTransformToTime({left:be,width:ce},{scaleWidth:z,scale:O,startLeft:B});if(R({action:s,row:r,start:fe,end:ae})===!1)return!1}je({left:be,width:ce}),Ce(be,ce)},e[31]=s,e[32]=Ce,e[33]=R,e[34]=r,e[35]=O,e[36]=z,e[37]=B,e[38]=Te):Te=e[38];const De=Te;let Re;e[39]!==t||e[40]!==A||e[41]!==b||e[42]!==r||e[43]!==O||e[44]!==z||e[45]!==B||e[46]!==L?(Re=ve=>{const{left:be,width:ce}=ve,{start:fe,end:ae}=C.parserTransformToTime({left:be,width:ce},{scaleWidth:z,scale:O,startLeft:B}),ue=t.find(Ye=>Ye.id===r.id);if(!ue)return;const Be=ue.actions.find(Ye=>Ye.id===A);Be&&(Be.start=fe,Be.end=ae,L(t),b&&b({action:Be,row:r,start:fe,end:ae}),je(null))},e[39]=t,e[40]=A,e[41]=b,e[42]=r,e[43]=O,e[44]=z,e[45]=B,e[46]=L,e[47]=Re):Re=e[47];const Ve=Re;let $;e[48]!==s||e[49]!==_||e[50]!==r?($=ve=>{_&&_({action:s,row:r,dir:ve})},e[48]=s,e[49]=_,e[50]=r,e[51]=$):$=e[51];const Z=$;let K;e[52]!==s||e[53]!==Ce||e[54]!==P||e[55]!==r||e[56]!==O||e[57]!==z||e[58]!==B?(K=(ve,be)=>{const{left:ce,width:fe}=be;if(E.current=!0,P){const{start:ae,end:ue}=C.parserTransformToTime({left:ce,width:fe},{scaleWidth:z,scale:O,startLeft:B});if(P({action:s,row:r,start:ae,end:ue,dir:ve})===!1)return!1}je({left:ce,width:fe}),Ce(ce,fe)},e[52]=s,e[53]=Ce,e[54]=P,e[55]=r,e[56]=O,e[57]=z,e[58]=B,e[59]=K):K=e[59];const J=K;let me;e[60]!==t||e[61]!==A||e[62]!==S||e[63]!==r||e[64]!==O||e[65]!==z||e[66]!==B||e[67]!==L?(me=(ve,be)=>{const{left:ce,width:fe}=be,{start:ae,end:ue}=C.parserTransformToTime({left:ce,width:fe},{scaleWidth:z,scale:O,startLeft:B}),Be=t.find(Gt=>Gt.id===r.id);if(!Be)return;const Ye=Be.actions.find(Gt=>Gt.id===A);Ye&&(Ye.start=ae,Ye.end=ue,L(t),S&&S({action:Ye,row:r,start:ae,end:ue,dir:ve}),je(null))},e[60]=t,e[61]=A,e[62]=S,e[63]=r,e[64]=O,e[65]=z,e[66]=B,e[67]=L,e[68]=me):me=e[68];const pe=me;let Q,oe,V,se,ie,le,ge,nt,rt,st,ot,it,ct,at,lt,ut,$e,He,ft,dt,ht,mt,pt,gt,vt,bt;if(e[69]!==s||e[70]!==Ue||e[71]!==d||e[72]!==q||e[73]!==G||e[74]!==Fe||e[75]!==h||e[76]!==De||e[77]!==Ve||e[78]!==Ge||e[79]!==pe||e[80]!==Z||e[81]!==J||e[82]!==x||e[83]!==xe||e[84]!==X||e[85]!==H||e[86]!==M||e[87]!==F||e[88]!==j||e[89]!==Ae||e[90]!==r||e[91]!==i||e[92]!==O||e[93]!==z||e[94]!==B||e[95]!==U||e[96]!==D.assistPositions||e[97]!==we.left||e[98]!==we.width){const ve={...s,...C.parserTransformToTime({left:we.left,width:we.width},{startLeft:B,scaleWidth:z,scale:O})},be={...r,actions:[...r.actions]};r.actions.includes(s)&&(be.actions[r.actions.indexOf(s)]=ve),Q=cr,rt=W,st=U,ot=B,it=we.left,ct=we.width,at=h&&Fe||C.DEFAULT_MOVE_GRID,lt=h?Math.max((Fe||C.DEFAULT_MOVE_GRID)/2,C.DEFAULT_SNAP_DISTANCE):C.DEFAULT_SNAP_DISTANCE,ut=D.assistPositions,e[125]!==xe||e[126]!==Ae?($e=()=>({left:xe,right:Ae}),e[125]=xe,e[126]=Ae,e[127]=$e):$e=e[127];let ce;e[128]!==d||e[129]!==q?(ce=!d&&q&&`.${de("action-left-stretch")}`,e[128]=d,e[129]=q,e[130]=ce):ce=e[130];let fe;e[131]!==d||e[132]!==q?(fe=!d&&q&&`.${de("action-right-stretch")}`,e[131]=d,e[132]=q,e[133]=fe):fe=e[133],e[134]!==ce||e[135]!==fe?(He={left:ce,right:fe},e[134]=ce,e[135]=fe,e[136]=He):He=e[136],ft=!d&&X,dt=!d&&q,ht=Ge,mt=De,pt=Ve,gt=Z,vt=J,bt=pe,e[137]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>{E.current=!1},e[137]=oe):oe=e[137],e[138]!==s||e[139]!==x||e[140]!==H||e[141]!==M||e[142]!==r?(V=ae=>{let ue;H&&(ue=x(ae),H(ae,{row:r,action:s,time:ue})),!E.current&&M&&(ue===void 0&&(ue=x(ae)),M(ae,{row:r,action:s,time:ue}))},e[138]=s,e[139]=x,e[140]=H,e[141]=M,e[142]=r,e[143]=V):V=e[143],e[144]!==s||e[145]!==x||e[146]!==j||e[147]!==r?(se=ae=>{if(j){const ue=x(ae);j(ae,{row:r,action:s,time:ue})}},e[144]=s,e[145]=x,e[146]=j,e[147]=r,e[148]=se):se=e[148],e[149]!==s||e[150]!==x||e[151]!==F||e[152]!==r?(ie=ae=>{if(F){const ue=x(ae);F(ae,{row:r,action:s,time:ue})}},e[149]=s,e[150]=x,e[151]=F,e[152]=r,e[153]=ie):ie=e[153],le=Ue,e[154]!==i?(ge={height:i},e[154]=i,e[155]=ge):ge=e[155],nt=G&&G(ve,be),e[69]=s,e[70]=Ue,e[71]=d,e[72]=q,e[73]=G,e[74]=Fe,e[75]=h,e[76]=De,e[77]=Ve,e[78]=Ge,e[79]=pe,e[80]=Z,e[81]=J,e[82]=x,e[83]=xe,e[84]=X,e[85]=H,e[86]=M,e[87]=F,e[88]=j,e[89]=Ae,e[90]=r,e[91]=i,e[92]=O,e[93]=z,e[94]=B,e[95]=U,e[96]=D.assistPositions,e[97]=we.left,e[98]=we.width,e[99]=Q,e[100]=oe,e[101]=V,e[102]=se,e[103]=ie,e[104]=le,e[105]=ge,e[106]=nt,e[107]=rt,e[108]=st,e[109]=ot,e[110]=it,e[111]=ct,e[112]=at,e[113]=lt,e[114]=ut,e[115]=$e,e[116]=He,e[117]=ft,e[118]=dt,e[119]=ht,e[120]=mt,e[121]=pt,e[122]=gt,e[123]=vt,e[124]=bt}else Q=e[99],oe=e[100],V=e[101],se=e[102],ie=e[103],le=e[104],ge=e[105],nt=e[106],rt=e[107],st=e[108],ot=e[109],it=e[110],ct=e[111],at=e[112],lt=e[113],ut=e[114],$e=e[115],He=e[116],ft=e[117],dt=e[118],ht=e[119],mt=e[120],pt=e[121],gt=e[122],vt=e[123],bt=e[124];let _t;e[156]!==q?(_t=q&&T.jsx("div",{className:de("action-left-stretch"),style:{touchAction:"none"}}),e[156]=q,e[157]=_t):_t=e[157];let St;e[158]!==q?(St=q&&T.jsx("div",{className:de("action-right-stretch"),style:{touchAction:"none"}}),e[158]=q,e[159]=St):St=e[159];let wt;e[160]!==oe||e[161]!==V||e[162]!==se||e[163]!==ie||e[164]!==le||e[165]!==ge||e[166]!==nt||e[167]!==_t||e[168]!==St?(wt=T.jsxs("div",{onMouseDown:oe,onClick:V,onDoubleClick:se,onContextMenu:ie,className:le,style:ge,children:[nt,_t,St]}),e[160]=oe,e[161]=V,e[162]=se,e[163]=ie,e[164]=le,e[165]=ge,e[166]=nt,e[167]=_t,e[168]=St,e[169]=wt):wt=e[169];let Mt;return e[170]!==Q||e[171]!==rt||e[172]!==st||e[173]!==ot||e[174]!==it||e[175]!==ct||e[176]!==at||e[177]!==lt||e[178]!==ut||e[179]!==$e||e[180]!==He||e[181]!==ft||e[182]!==dt||e[183]!==ht||e[184]!==mt||e[185]!==pt||e[186]!==gt||e[187]!==vt||e[188]!==bt||e[189]!==wt?(Mt=T.jsx(Q,{ref:rt,parentRef:st,start:ot,left:it,width:ct,grid:at,snapDistance:lt,snapPositions:ut,getBounds:$e,edges:He,enableDragging:ft,enableResizing:dt,onDragStart:ht,onDrag:mt,onDragEnd:pt,onResizeStart:gt,onResize:vt,onResizeEnd:bt,children:wt}),e[170]=Q,e[171]=rt,e[172]=st,e[173]=ot,e[174]=it,e[175]=ct,e[176]=at,e[177]=lt,e[178]=ut,e[179]=$e,e[180]=He,e[181]=ft,e[182]=dt,e[183]=ht,e[184]=mt,e[185]=pt,e[186]=gt,e[187]=vt,e[188]=bt,e[189]=wt,e[190]=Mt):Mt=e[190],Mt};function yt(n,e,t){let r=t.initialDeps??[],s;function o(){var i,c,a,u;let l;t.key&&((i=t.debug)!=null&&i.call(t))&&(l=Date.now());const h=n();if(!(h.length!==r.length||h.some((w,v)=>r[v]!==w)))return s;r=h;let m;if(t.key&&((c=t.debug)!=null&&c.call(t))&&(m=Date.now()),s=e(...h),t.key&&((a=t.debug)!=null&&a.call(t))){const w=Math.round((Date.now()-l)*100)/100,v=Math.round((Date.now()-m)*100)/100,p=v/16,R=(b,_)=>{for(b=String(b);b.length<_;)b=" "+b;return b};console.info(`%c⏱ ${R(v,5)} /${R(w,5)} ms`,`
|
|
11
11
|
font-size: .6rem;
|
|
12
12
|
font-weight: bold;
|
|
13
|
-
color: hsl(${Math.max(0,Math.min(120-120*m,120))}deg 100% 31%);`,t?.key)}return(u=t?.onChange)==null||u.call(t,s),s}return o.updateDeps=i=>{r=i},o}function $n(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const bo=(n,e)=>Math.abs(n-e)<1.01,So=(n,e,t)=>{let r;return function(...s){n.clearTimeout(r),r=n.setTimeout(()=>e.apply(this,s),t)}},Hn=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},_o=n=>n,wo=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),r=[];for(let s=e;s<=t;s++)r.push(s);return r},Eo=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;const s=i=>{const{width:c,height:a}=i;e({width:Math.round(c),height:Math.round(a)})};if(s(Hn(t)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const c=()=>{const a=i[0];if(a?.borderBoxSize){const u=a.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(Hn(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Bn={passive:!0},Yn=typeof window>"u"?!0:"onscrollend"in window,yo=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;let s=0;const o=n.options.useScrollendEvent&&Yn?()=>{}:So(r,()=>{e(s,!1)},n.options.isScrollingResetDelay),i=l=>()=>{const{horizontal:h,isRtl:f}=n.options;s=h?t.scrollLeft*(f&&-1||1):t.scrollTop,o(),e(s,l)},c=i(!0),a=i(!1);a(),t.addEventListener("scroll",c,Bn);const u=n.options.useScrollendEvent&&Yn;return u&&t.addEventListener("scrollend",a,Bn),()=>{t.removeEventListener("scroll",c),u&&t.removeEventListener("scrollend",a)}},Ro=(n,e,t)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},xo=(n,{adjustments:e=0,behavior:t},r)=>{var s,o;const i=n+e;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:t})};class Co{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:_o,rangeExtractor:wo,onChange:()=>{},measureElement:Ro,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=Rt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const s=new Map,o=new Map;for(let i=r-1;i>=0;i--){const c=t[i];if(s.has(c.lane))continue;const a=o.get(c.lane);if(a==null||c.end>a.end?o.set(c.lane,c):c.end<a.end&&s.set(c.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,c)=>i.end===c.end?i.index-c.index:i.end-c.end)[0]:void 0},this.getMeasurementOptions=Rt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,r,s,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=Rt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(l=>{this.itemSizeCache.set(l.key,l.size)}));const a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,a);for(let l=a;l<t;l++){const h=o(l),f=this.options.lanes===1?u[l-1]:this.getFurthestMeasurement(u,l),p=f?f.end+this.options.gap:r+s,_=c.get(h),v=typeof _=="number"?_:this.options.estimateSize(l),m=p+v,E=f?f.lane:l%this.options.lanes;u[l]={index:l,start:p,size:v,end:m,key:h,lane:E}}return this.measurementsCache=u,u},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Rt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,o)=>this.range=t.length>0&&r>0?Ao({measurements:t,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Rt(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,o,i)=>o===null||i===null?[]:t({startIndex:o,endIndex:i,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{const s=this.indexFromElement(t),o=this.measurementsCache[s];if(!o)return;const i=o.key,c=this.elementsCache.get(i);c!==t&&(c&&this.observer.unobserve(c),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const s=this.measurementsCache[t];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,i=r-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,i,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=Rt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let o=0,i=t.length;o<i;o++){const c=t[o],a=r[c];s.push(a)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return $n(r[Er(0,r.length-1,s=>$n(r[s]).start,t)])},this.getOffsetForAlignment=(t,r,s=0)=>{const o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=t>=i+o?"end":"start"),r==="center"?t+=(s-o)/2:r==="end"&&(t-=o);const c=this.getTotalSize()+this.options.scrollMargin-o;return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.measurementsCache[t];if(!s)return;const o=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];const c=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(t,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1));let o=0;const i=10,c=u=>{if(!this.targetWindow)return;const l=this.getOffsetForIndex(t,u);if(!l){console.warn("Failed to get offset for index:",t);return}const[h,f]=l;this._scrollToOffset(h,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const p=this.getScrollOffset(),_=this.getOffsetForIndex(t,f);if(!_){console.warn("Failed to get offset for index:",t);return}bo(_[0],p)||a(f)})},a=u=>{this.targetWindow&&(o++,o<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",o,i),this.targetWindow.requestAnimationFrame(()=>c(u))):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};c(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&o.some(c=>c===null);){const c=r[i];o[c.lane]===null&&(o[c.lane]=c.end),i--}s=Math.max(...o.filter(c=>c!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const Er=(n,e,t,r)=>{for(;n<=e;){const s=(n+e)/2|0,o=t(s);if(o<r)n=s+1;else if(o>r)e=s-1;else return s}return n>0?n-1:0};function Ao({measurements:n,outerSize:e,scrollOffset:t,lanes:r}){const s=n.length-1,o=a=>n[a].start;if(n.length<=r)return{startIndex:0,endIndex:s};let i=Er(0,s,o,t),c=i;if(r===1)for(;c<s&&n[c].end<t+e;)c++;else if(r>1){const a=Array(r).fill(0);for(;c<s&&a.some(l=>l<t+e);){const l=n[c];a[l.lane]=l.end,c++}const u=Array(r).fill(t+e);for(;i>=0&&u.some(l=>l>=t);){const l=n[i];u[l.lane]=l.start,i--}i=Math.max(0,i-i%r),c=Math.min(s,c+(r-1-c%r))}return{startIndex:i,endIndex:c}}const Xn=typeof document<"u"?g.useLayoutEffect:g.useEffect;function To(n){const e=g.useReducer(()=>({}),{})[1],t={...n,onChange:(s,o)=>{var i;o?xr.flushSync(e):e(),(i=n.onChange)==null||i.call(n,s,o)}},[r]=g.useState(()=>new Co(t));return r.setOptions(t),Xn(()=>r._didMount(),[]),Xn(()=>r._willUpdate()),r}function yr(n){return To({observeElementRect:Eo,observeElementOffset:yo,scrollToFn:xo,...n})}const Po=n=>{const{rowData:e,style:t={},onClickRow:r,onDoubleClickRow:s,onContextMenuRow:o,scrollContainerRef:i,startLeft:c,scale:a,scaleWidth:u}=n,l=["edit-row"];e?.selected&&l.push("edit-row-selected");const h=a??Ht,f=u??Bt,p=c??Kt,_=b=>{if(!i.current)return 0;const w=b.currentTarget.getBoundingClientRect(),P=b.clientX-w.x;return Xe(P,{startLeft:p,scale:h,scaleWidth:f})},v=I.useMemo(()=>(e?.actions?[...e.actions]:[]).sort((b,S)=>b.start-S.start),[e]),m=I.useCallback(b=>v[b]?.id??b,[v]),E=yr({horizontal:!0,count:v.length,getItemKey:m,getScrollElement:()=>i.current,estimateSize:b=>{if(!v[b])return 0;let S=b>0?v[b-1].end:0,w=v[b].end;if(S>w)return 0;let{width:T}=hn({start:S,end:w},{startLeft:p,scale:h,scaleWidth:f});return T},overscan:5});return I.useLayoutEffect(()=>{E.measure()},[u,c,E]),x.jsx("div",{className:`${fe(...l)} ${(e?.classNames||[]).join(" ")}`,style:t,onClick:b=>{if(e&&r){const S=_(b);r(b,{row:e,time:S})}},onDoubleClick:b=>{if(e&&s){const S=_(b);s(b,{row:e,time:S})}},onContextMenu:b=>{if(e&&o){const S=_(b);o(b,{row:e,time:S})}},children:e&&E.getVirtualItems().map(b=>{const S=v[b.index];if(!S)throw new Error("Action not found");return x.jsx(vo,{...n,handleTime:_,row:e,action:S},S.id)})})};function Do(){const n=De.c(7);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e={isMoving:!1,movePositions:[],assistPositions:[]},n[0]=e):e=n[0];const[t,r]=I.useState(e),s=I.useRef(null),o=Oo,i=Lo;let c;n[1]===Symbol.for("react.memo_cache_sentinel")?(c=m=>{const{movePositions:E,assistPositions:b,action:S,row:w,assistActionIds:T}=m;s.current={action:S,row:w,assistActionIds:T},r({isMoving:!0,movePositions:E||[],assistPositions:b||[]})},n[1]=c):c=n[1];const a=c;let u;n[2]===Symbol.for("react.memo_cache_sentinel")?(u=m=>{const{movePositions:E,assistPositions:b}=m;r(S=>({...S,movePositions:E||S.movePositions,assistPositions:b||S.assistPositions}))},n[2]=u):u=n[2];const l=u;let h;n[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{s.current=null,r({isMoving:!1,movePositions:[],assistPositions:[]})},n[3]=h):h=n[3];const f=h;let p;n[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>s.current,n[4]=p):p=n[4];const _=p;let v;return n[5]!==t?(v={initSnap:a,updateSnap:l,disposeSnap:f,snapData:t,getActiveDragState:_,defaultGetAssistPosition:o,defaultGetMovePosition:i},n[5]=t,n[6]=v):v=n[6],v}function Lo(n){const{start:e,end:t,dir:r,scale:s,scaleWidth:o,startLeft:i}=n,{left:c,width:a}=hn({start:e,end:t},{startLeft:i,scaleWidth:o,scale:s});return r?r==="right"?[c+a]:[c]:[c,c+a]}function Oo(n){const{editorData:e,assistActionIds:t,action:r,row:s,scale:o,scaleWidth:i,startLeft:c,cursorLeft:a,hideCursor:u}=n,l=[];t?e.forEach(f=>{f.actions.forEach(p=>{t.includes(p.id)&&l.push(p)})}):e.forEach(f=>{f.id!==s.id?l.push(...f.actions):f.actions.forEach(p=>{p.id!==r.id&&l.push(p)})});const h=zr(l,{startLeft:c,scale:o,scaleWidth:i});return u||h.push(a),h}const Mo=n=>{const e=De.c(50);let t,r;e[0]!==n?({ref:r,...t}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const{snapData:s,initSnap:o,updateSnap:i,disposeSnap:c,getActiveDragState:a,defaultGetAssistPosition:u,defaultGetMovePosition:l}=Do();let h;e[3]!==u||e[4]!==a||e[5]!==t.cursorTime||e[6]!==t.editorData||e[7]!==t.hideCursor||e[8]!==t.scale||e[9]!==t.scaleWidth||e[10]!==t.snap||e[11]!==t.startLeft||e[12]!==s.isMoving||e[13]!==i?(h=()=>{const C=a();if(t.snap&&C&&s.isMoving){const j=t.scaleWidth??160,k=t.scale??1,y=t.startLeft??20,A=t.hideCursor??!1,M=Pe(t.cursorTime,{scaleWidth:j,scale:k,startLeft:y}),Q=u({editorData:t.editorData,assistActionIds:C.assistActionIds,action:C.action,row:C.row,scale:k,scaleWidth:j,startLeft:y,hideCursor:A,cursorLeft:M});i({assistPositions:Q})}else!t.snap&&s.isMoving&&i({assistPositions:[]})},e[3]=u,e[4]=a,e[5]=t.cursorTime,e[6]=t.editorData,e[7]=t.hideCursor,e[8]=t.scale,e[9]=t.scaleWidth,e[10]=t.snap,e[11]=t.startLeft,e[12]=s.isMoving,e[13]=i,e[14]=h):h=e[14];let f;e[15]!==t.snap||e[16]!==s.isMoving?(f=[t.snap,s.isMoving],e[15]=t.snap,e[16]=s.isMoving,e[17]=f):f=e[17],I.useEffect(h,f);let p;e[18]!==u||e[19]!==o||e[20]!==t?(p=C=>{const j=t.getAssistDragLineActionIds&&t.getAssistDragLineActionIds({action:C.action,row:C.row,editorData:t.editorData});if(t.snap){const k=t.scaleWidth??160,y=t.scale??1,A=t.startLeft??20,M=t.hideCursor??!1,Q=Pe(t.cursorTime,{scaleWidth:k,scale:y,startLeft:A}),te=u({editorData:t.editorData,assistActionIds:j,action:C.action,row:C.row,scale:y,scaleWidth:k,startLeft:A,hideCursor:M,cursorLeft:Q});o({assistPositions:te,action:C.action,row:C.row,assistActionIds:j})}else o({assistPositions:[],action:C.action,row:C.row,assistActionIds:j})},e[18]=u,e[19]=o,e[20]=t,e[21]=p):p=e[21];const _=p;let v;e[22]!==l||e[23]!==t.scale||e[24]!==t.scaleWidth||e[25]!==t.snap||e[26]!==t.startLeft||e[27]!==i?(v=C=>{if(t.snap){const j=t.scaleWidth??160,k=t.scale??1,y=t.startLeft??20,A=l({...C,startLeft:y,scaleWidth:j,scale:k});i({movePositions:A})}},e[22]=l,e[23]=t.scale,e[24]=t.scaleWidth,e[25]=t.snap,e[26]=t.startLeft,e[27]=i,e[28]=v):v=e[28];const m=v,E=t.rowHeight??32,b=t.scaleWidth??160,S=t.startLeft??20,w=Math.max(t.scaleCount*b+S,t.timelineWidth);let T;if(e[29]!==w||e[30]!==E||e[31]!==c||e[32]!==_||e[33]!==m||e[34]!==t||e[35]!==s){const C=[];let j=0;for(let k=0;k<t.editorData.length;k++){const y=t.editorData[k];if(!y)continue;const A=y.rowHeight||E;C.push(I.createElement(Po,{...t,key:y.id,rowData:y,snapData:s,scrollContainerRef:t.scrollElementRef,style:{position:"absolute",top:0,left:0,width:w,height:`${A}px`,transform:`translateY(${j}px)`},onActionMoveStart:M=>(_(M),t.onActionMoveStart&&t.onActionMoveStart(M)),onActionResizeStart:M=>(_(M),t.onActionResizeStart&&t.onActionResizeStart(M)),onActionMoving:M=>(m(M),t.onActionMoving&&t.onActionMoving(M)),onActionResizing:M=>(m(M),t.onActionResizing&&t.onActionResizing(M)),onActionResizeEnd:M=>(c(),t.onActionResizeEnd&&t.onActionResizeEnd(M)),onActionMoveEnd:M=>(c(),t.onActionMoveEnd&&t.onActionMoveEnd(M))})),j=j+A}T=[j,C],e[29]=w,e[30]=E,e[31]=c,e[32]=_,e[33]=m,e[34]=t,e[35]=s,e[36]=T}else T=e[36];const[P,D]=T,B=`0, ${t.startLeft??20}px`,O=`${t.startLeft??20}px, ${t.scaleWidth??160}px`;let F;e[37]!==w||e[38]!==B||e[39]!==O||e[40]!==P?(F={width:w,height:P,position:"relative",backgroundPositionX:B,backgroundSize:O},e[37]=w,e[38]=B,e[39]=O,e[40]=P,e[41]=F):F=e[41];let z;e[42]!==t.snap||e[43]!==s?(z=t.snap&&x.jsx($r,{...s}),e[42]=t.snap,e[43]=s,e[44]=z):z=e[44];let X;return e[45]!==r||e[46]!==D||e[47]!==F||e[48]!==z?(X=x.jsxs("div",{ref:r,style:F,className:"timeline-editor-edit-area",children:[D,z]}),e[45]=r,e[46]=D,e[47]=F,e[48]=z,e[49]=X):X=e[49],X};function No({scaleSplitCount:n,scaleWidth:e,startLeft:t,scaleCount:r,maxScaleCount:s,scale:o,scrollElementRef:i,onClickTimeArea:c,setCursor:a}){const u=n??1,l=e??160,h=t??20,f=(n??0)>0,p=f?r*(n??1)+1:r,_=(f?l/u:l)*(p-1)+h,m=yr({horizontal:!0,count:p,getScrollElement:()=>i.current,estimateSize:E=>{switch(E){case 0:return h;default:return f?l/u:l}},overscan:10});return I.useEffect(()=>m.measure(),[e,t,m]),x.jsx("div",{style:{width:`${_}px`},className:fe("time-area"),onClick:E=>{const b=t??20,S=e??160,w=o??1,T=s??1/0,P=E.currentTarget.getBoundingClientRect(),D=E.clientX-P.x,B=Math.max(D,b);if(B>T*S+b)return;const O=Xe(B,{startLeft:b,scale:w,scaleWidth:S});c&&c(O,E),!E.defaultPrevented&&a({time:O})},children:m.getVirtualItems().map(E=>{const b=E.index,S=n??1,w=o??1,T=f?b%S===0:!0,P=[fe("time-unit"),fe(T?"time-unit-big":"time-unit-small")],D=(f?b/S:b)*w;return x.jsx("div",{"data-index":E.index,style:{width:`${E.size}px`,transform:`translateX(${E.start}px)`},className:P.join(" "),children:T&&x.jsx("div",{className:fe("time-unit-scale"),children:D})},E.key)})})}function Io(n){return typeof n=="object"&&n!==null}function ko(n,e,t){if(n instanceof EventTarget)return[n];if(typeof n=="string"){const s=document.querySelectorAll(n);return s?Array.from(s):[]}return Array.from(n)}function Wo(n){return Io(n)&&"ownerSVGElement"in n}const Vt=new WeakMap;let Ut;const Rr=(n,e,t)=>(r,s)=>s&&s[0]?s[0][n+"Size"]:Wo(r)&&"getBBox"in r?r.getBBox()[e]:r[t],zo=Rr("inline","width","offsetWidth"),jo=Rr("block","height","offsetHeight");function Fo({target:n,borderBoxSize:e}){Vt.get(n)?.forEach(t=>{t(n,{get width(){return zo(n,e)},get height(){return jo(n,e)}})})}function Vo(n){n.forEach(Fo)}function Uo(){typeof ResizeObserver>"u"||(Ut=new ResizeObserver(Vo))}function $o(n,e){Ut||Uo();const t=ko(n);return t.forEach(r=>{let s=Vt.get(r);s||(s=new Set,Vt.set(r,s)),s.add(e),Ut?.observe(r)}),()=>{t.forEach(r=>{const s=Vt.get(r);s?.delete(e),s?.size||Ut?.unobserve(r)})}}const $t=new Set;let xt;function Ho(){xt=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};$t.forEach(e=>e(n))},window.addEventListener("resize",xt)}function Bo(n){return $t.add(n),xt||Ho(),()=>{$t.delete(n),!$t.size&&typeof xt=="function"&&(window.removeEventListener("resize",xt),xt=void 0)}}function Yo(n,e){return typeof n=="function"?Bo(n):$o(n,e)}function Xo(n){const e=De.c(4),{elementRef:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={width:0,height:0},e[0]=r):r=e[0];const[s,o]=I.useState(r);let i,c;return e[1]!==t?(i=()=>{t.current&&Yo(t.current,(a,u)=>{o({width:u.width,height:u.height})})},c=[t],e[1]=t,e[2]=i,e[3]=c):(i=e[2],c=e[3]),I.useLayoutEffect(i,c),s}const Go=n=>{const e=De.c(42),{disableDrag:t,cursorTime:r,setCursor:s,startLeft:o,scaleWidth:i,scale:c,scaleCount:a,scaleSplitCount:u,scrollElementRef:l,maxScaleCount:h,onCursorDragStart:f,onCursorDrag:p,onCursorDragEnd:_}=n,v=I.useRef(null),m=I.useRef(void 0);let E,b;e[0]!==r||e[1]!==c||e[2]!==i||e[3]!==o?(E=()=>{if(typeof m.current>"u"&&v.current){const d=o??20,R=i??160,N=c??1;v.current.updateLeft(Pe(r,{startLeft:d,scaleWidth:R,scale:N}))}},b=[r,o,i,c],e[0]=r,e[1]=c,e[2]=i,e[3]=o,e[4]=E,e[5]=b):(E=e[4],b=e[5]),I.useEffect(E,b);const S=o??20,w=i??160,T=c??1,P=h??1/0,D=(u??0)>0,B=u??1,O=D?a*(u??1)+1:a,F=o??20,z=(D?w/B:w)*(O-1)+F;let X;e[6]!==S||e[7]!==P||e[8]!==l||e[9]!==z||e[10]!==w?(X=()=>({left:0,right:Math.min(z,P*w+S-(l.current?.scrollLeft??0))}),e[6]=S,e[7]=P,e[8]=l,e[9]=z,e[10]=w,e[11]=X):X=e[11];const C=!t;let j;e[12]!==r||e[13]!==S||e[14]!==f||e[15]!==T||e[16]!==w?(j=()=>{const d=v.current?.getLeft()??Pe(r,{startLeft:S,scaleWidth:w,scale:T});m.current=d;const R=Xe(d,{startLeft:S,scale:T,scaleWidth:w});f&&f(R),v.current?.updateLeft(d)},e[12]=r,e[13]=S,e[14]=f,e[15]=T,e[16]=w,e[17]=j):j=e[17];let k;e[18]!==S||e[19]!==_||e[20]!==T||e[21]!==s||e[22]!==w?(k=()=>{if(typeof m.current<"u"){const d=Xe(m.current,{startLeft:S,scale:T,scaleWidth:w});s({time:d}),_&&_(d)}m.current=void 0},e[18]=S,e[19]=_,e[20]=T,e[21]=s,e[22]=w,e[23]=k):k=e[23];let y;e[24]!==S||e[25]!==p||e[26]!==T||e[27]!==l||e[28]!==s||e[29]!==w?(y=(d,R)=>{const{left:N}=d,H=R===void 0?0:R,ee=l.current?.scrollLeft??0,G=l.current,Y=G?.clientWidth??0;if(H!==0)if(typeof m.current<"u"){m.current=m.current+H;const L=ee,W=ee+Y;m.current<L+10?m.current=L+10:m.current>W-10&&(m.current=W-10),m.current<S-ee&&(m.current=S-ee)}else{m.current=N+H;const L=ee,W=ee+Y;m.current<L+10?m.current=L+10:m.current>W-10&&(m.current=W-10)}else if(N<S-ee?m.current=S-ee:m.current=N,G&&Y>0){const L=ee,W=ee+Y;m.current<L+10?m.current=L+10:m.current>W-10&&(m.current=W-10)}if(typeof m.current<"u"){v.current?.updateLeft(m.current);const L=Xe(m.current,{startLeft:S,scale:T,scaleWidth:w});s({time:L}),p&&p(L)}return!1},e[24]=S,e[25]=p,e[26]=T,e[27]=l,e[28]=s,e[29]=w,e[30]=y):y=e[30];let A,M;e[31]===Symbol.for("react.memo_cache_sentinel")?(A=fe("cursor"),M=fe("cursor-top"),e[31]=A,e[32]=M):(A=e[31],M=e[32]);let Q;e[33]===Symbol.for("react.memo_cache_sentinel")?(Q=x.jsxs("div",{className:A,children:[x.jsx("svg",{className:M,width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",children:x.jsx("path",{d:"M0 1C0 0.447715 0.447715 0 1 0H7C7.55228 0 8 0.447715 8 1V9.38197C8 9.76074 7.786 10.107 7.44721 10.2764L4.44721 11.7764C4.16569 11.9172 3.83431 11.9172 3.55279 11.7764L0.552786 10.2764C0.214002 10.107 0 9.76074 0 9.38197V1Z",fill:"currentColor"})}),x.jsx("div",{className:fe("cursor-area")})]}),e[33]=Q):Q=e[33];let te;return e[34]!==S||e[35]!==l||e[36]!==X||e[37]!==C||e[38]!==j||e[39]!==k||e[40]!==y?(te=x.jsx(wr,{start:S,ref:v,parentRef:l,getBounds:X,autoScroll:!0,enableDragging:C,enableResizing:!1,onDragStart:j,onDragEnd:k,onDrag:y,children:Q}),e[34]=S,e[35]=l,e[36]=X,e[37]=C,e[38]=j,e[39]=k,e[40]=y,e[41]=te):te=e[41],te};function Gn(n){const e=De.c(9);let t,r,s;e[0]!==n?({className:t,orientation:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const o=s===void 0?"vertical":s;let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=x.jsx(gr,{"data-slot":"scroll-area-thumb"}),e[4]=i):i=e[4];let c;return e[5]!==t||e[6]!==o||e[7]!==r?(c=x.jsx(dr,{"data-slot":"scroll-area-scrollbar",orientation:o,className:t,...r,children:i}),e[5]=t,e[6]=o,e[7]=r,e[8]=c):c=e[8],c}function Ko({ref:n,...e}){const t=Ir(e),r=I.useRef(null),s=Math.min(t.maxScaleCount,Math.max(t.minScaleCount,kr(t.editorData,{scale:t.scale}))),[o,i]=I.useState(s),c=Math.max(s,o),[a,u]=I.useState(wn),l=I.useRef(wn),{width:h,height:f}=Xo({elementRef:r}),p=m=>{i(Math.min(t.maxScaleCount,Math.max(t.minScaleCount,m)))},_=m=>{t.onChange?.(m)},v=m=>{let{left:E,time:b}=m;return typeof b<"u"?(u(b),l.current=b,!0):typeof E<"u"?(u(l.current=Xe(E,{startLeft:t.startLeft,scale:t.scale,scaleWidth:t.scaleWidth})),!0):!1};return I.useImperativeHandle(n,()=>({get target(){return r.current},set time(m){v({time:m})},get time(){return l.current},setScrollLeft:m=>{r.current&&(r.current.scrollLeft=m)},setScrollTop:m=>{r.current&&(r.current.scrollTop=m)}})),x.jsxs(ao,{style:t.style,className:`${an} ${t.disableDrag?an+"-disable":""}`,"data-slot":"scroll-area",children:[x.jsxs(lo,{"data-slot":"scroll-area-viewport",ref:r,onScroll:m=>{t.onScroll?.(m.currentTarget)},children:[x.jsx(No,{...t,setCursor:v,scaleCount:c,scrollElementRef:r}),x.jsx(Mo,{...t,scrollElementRef:r,timelineWidth:h,timelineHeight:f,disableDrag:t.disableDrag,editorData:t.editorData,cursorTime:a,scaleCount:c,setScaleCount:p,setEditorData:_}),!t.hideCursor&&x.jsx(Go,{...t,timelineWidth:h,height:f,scaleCount:c,setScaleCount:p,setCursor:v,cursorTime:a,editorData:t.editorData,scrollElementRef:r})]}),x.jsx(Gn,{orientation:"horizontal"}),x.jsx(Gn,{orientation:"vertical"}),x.jsx(uo,{})]})}exports.Timeline=Ko;
|
|
13
|
+
color: hsl(${Math.max(0,Math.min(120-120*p,120))}deg 100% 31%);`,t?.key)}return(u=t?.onChange)==null||u.call(t,s),s}return o.updateDeps=i=>{r=i},o}function Ln(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const eo=(n,e)=>Math.abs(n-e)<1.01,to=(n,e,t)=>{let r;return function(...s){n.clearTimeout(r),r=n.setTimeout(()=>e.apply(this,s),t)}},On=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},no=n=>n,ro=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),r=[];for(let s=e;s<=t;s++)r.push(s);return r},so=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;const s=i=>{const{width:c,height:a}=i;e({width:Math.round(c),height:Math.round(a)})};if(s(On(t)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const c=()=>{const a=i[0];if(a?.borderBoxSize){const u=a.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(On(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Mn={passive:!0},Nn=typeof window>"u"?!0:"onscrollend"in window,oo=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;let s=0;const o=n.options.useScrollendEvent&&Nn?()=>{}:to(r,()=>{e(s,!1)},n.options.isScrollingResetDelay),i=l=>()=>{const{horizontal:h,isRtl:d}=n.options;s=h?t.scrollLeft*(d&&-1||1):t.scrollTop,o(),e(s,l)},c=i(!0),a=i(!1);a(),t.addEventListener("scroll",c,Mn);const u=n.options.useScrollendEvent&&Nn;return u&&t.addEventListener("scrollend",a,Mn),()=>{t.removeEventListener("scroll",c),u&&t.removeEventListener("scrollend",a)}},io=(n,e,t)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},co=(n,{adjustments:e=0,behavior:t},r)=>{var s,o;const i=n+e;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:t})};class ao{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:no,rangeExtractor:ro,onChange:()=>{},measureElement:io,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=yt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const s=new Map,o=new Map;for(let i=r-1;i>=0;i--){const c=t[i];if(s.has(c.lane))continue;const a=o.get(c.lane);if(a==null||c.end>a.end?o.set(c.lane,c):c.end<a.end&&s.set(c.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,c)=>i.end===c.end?i.index-c.index:i.end-c.end)[0]:void 0},this.getMeasurementOptions=yt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,r,s,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=yt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(l=>{this.itemSizeCache.set(l.key,l.size)}));const a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,a);for(let l=a;l<t;l++){const h=o(l),d=this.options.lanes===1?u[l-1]:this.getFurthestMeasurement(u,l),m=d?d.end+this.options.gap:r+s,w=c.get(h),v=typeof w=="number"?w:this.options.estimateSize(l),p=m+v,R=d?d.lane:l%this.options.lanes;u[l]={index:l,start:m,size:v,end:p,key:h,lane:R}}return this.measurementsCache=u,u},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=yt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,o)=>this.range=t.length>0&&r>0?lo({measurements:t,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=yt(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,o,i)=>o===null||i===null?[]:t({startIndex:o,endIndex:i,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{const s=this.indexFromElement(t),o=this.measurementsCache[s];if(!o)return;const i=o.key,c=this.elementsCache.get(i);c!==t&&(c&&this.observer.unobserve(c),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const s=this.measurementsCache[t];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,i=r-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,i,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=yt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let o=0,i=t.length;o<i;o++){const c=t[o],a=r[c];s.push(a)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return Ln(r[ar(0,r.length-1,s=>Ln(r[s]).start,t)])},this.getOffsetForAlignment=(t,r,s=0)=>{const o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=t>=i+o?"end":"start"),r==="center"?t+=(s-o)/2:r==="end"&&(t-=o);const c=this.getTotalSize()+this.options.scrollMargin-o;return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.measurementsCache[t];if(!s)return;const o=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];const c=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(t,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1));let o=0;const i=10,c=u=>{if(!this.targetWindow)return;const l=this.getOffsetForIndex(t,u);if(!l){console.warn("Failed to get offset for index:",t);return}const[h,d]=l;this._scrollToOffset(h,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),w=this.getOffsetForIndex(t,d);if(!w){console.warn("Failed to get offset for index:",t);return}eo(w[0],m)||a(d)})},a=u=>{this.targetWindow&&(o++,o<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",o,i),this.targetWindow.requestAnimationFrame(()=>c(u))):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};c(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&o.some(c=>c===null);){const c=r[i];o[c.lane]===null&&(o[c.lane]=c.end),i--}s=Math.max(...o.filter(c=>c!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const ar=(n,e,t,r)=>{for(;n<=e;){const s=(n+e)/2|0,o=t(s);if(o<r)n=s+1;else if(o>r)e=s-1;else return s}return n>0?n-1:0};function lo({measurements:n,outerSize:e,scrollOffset:t,lanes:r}){const s=n.length-1,o=a=>n[a].start;if(n.length<=r)return{startIndex:0,endIndex:s};let i=ar(0,s,o,t),c=i;if(r===1)for(;c<s&&n[c].end<t+e;)c++;else if(r>1){const a=Array(r).fill(0);for(;c<s&&a.some(l=>l<t+e);){const l=n[c];a[l.lane]=l.end,c++}const u=Array(r).fill(t+e);for(;i>=0&&u.some(l=>l>=t);){const l=n[i];u[l.lane]=l.start,i--}i=Math.max(0,i-i%r),c=Math.min(s,c+(r-1-c%r))}return{startIndex:i,endIndex:c}}const In=typeof document<"u"?g.useLayoutEffect:g.useEffect;function uo(n){const e=g.useReducer(()=>({}),{})[1],t={...n,onChange:(s,o)=>{var i;o?fr.flushSync(e):e(),(i=n.onChange)==null||i.call(n,s,o)}},[r]=g.useState(()=>new ao(t));return r.setOptions(t),In(()=>r._didMount(),[]),In(()=>r._willUpdate()),r}function lr(n){return uo({observeElementRect:so,observeElementOffset:oo,scrollToFn:co,...n})}const fo=n=>{const{rowData:e,style:t={},onClickRow:r,onDoubleClickRow:s,onContextMenuRow:o,scrollContainerRef:i,startLeft:c,scale:a,scaleWidth:u}=n,l=["edit-row"];e?.selected&&l.push("edit-row-selected");const h=a??C.DEFAULT_SCALE,d=u??C.DEFAULT_SCALE_WIDTH,m=c??C.DEFAULT_START_LEFT,w=b=>{if(!i.current)return 0;const S=b.currentTarget.getBoundingClientRect(),D=b.clientX-S.x;return C.parserPixelToTime(D,{startLeft:m,scale:h,scaleWidth:d})},v=k.useMemo(()=>(e?.actions?[...e.actions]:[]).sort((b,_)=>b.start-_.start),[e]),p=k.useCallback(b=>v[b]?.id??b,[v]),R=lr({horizontal:!0,count:v.length,getItemKey:p,getScrollElement:()=>i.current,estimateSize:b=>{if(!v[b])return 0;let _=b>0?v[b-1].end:0,S=v[b].end;if(_>S)return 0;let{width:P}=C.parserTimeToTransform({start:_,end:S},{startLeft:m,scale:h,scaleWidth:d});return P},overscan:5});return k.useLayoutEffect(()=>{R.measure()},[u,c,R]),T.jsx("div",{className:`${de(...l)} ${(e?.classNames||[]).join(" ")}`,style:t,onClick:b=>{if(e&&r){const _=w(b);r(b,{row:e,time:_})}},onDoubleClick:b=>{if(e&&s){const _=w(b);s(b,{row:e,time:_})}},onContextMenu:b=>{if(e&&o){const _=w(b);o(b,{row:e,time:_})}},children:e&&R.getVirtualItems().map(b=>{const _=v[b.index];if(!_)throw new Error("Action not found");return T.jsx(Qs,{...n,handleTime:w,row:e,action:_},_.id)})})};function ho(){const n=Pe.c(7);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e={isMoving:!1,movePositions:[],assistPositions:[]},n[0]=e):e=n[0];const[t,r]=k.useState(e),s=k.useRef(null),o=po,i=mo;let c;n[1]===Symbol.for("react.memo_cache_sentinel")?(c=p=>{const{movePositions:R,assistPositions:b,action:_,row:S,assistActionIds:P}=p;s.current={action:_,row:S,assistActionIds:P},r({isMoving:!0,movePositions:R||[],assistPositions:b||[]})},n[1]=c):c=n[1];const a=c;let u;n[2]===Symbol.for("react.memo_cache_sentinel")?(u=p=>{const{movePositions:R,assistPositions:b}=p;r(_=>({..._,movePositions:R||_.movePositions,assistPositions:b||_.assistPositions}))},n[2]=u):u=n[2];const l=u;let h;n[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{s.current=null,r({isMoving:!1,movePositions:[],assistPositions:[]})},n[3]=h):h=n[3];const d=h;let m;n[4]===Symbol.for("react.memo_cache_sentinel")?(m=()=>s.current,n[4]=m):m=n[4];const w=m;let v;return n[5]!==t?(v={initSnap:a,updateSnap:l,disposeSnap:d,snapData:t,getActiveDragState:w,defaultGetAssistPosition:o,defaultGetMovePosition:i},n[5]=t,n[6]=v):v=n[6],v}function mo(n){const{start:e,end:t,dir:r,scale:s,scaleWidth:o,startLeft:i}=n,{left:c,width:a}=C.parserTimeToTransform({start:e,end:t},{startLeft:i,scaleWidth:o,scale:s});return r?r==="right"?[c+a]:[c]:[c,c+a]}function po(n){const{editorData:e,assistActionIds:t,action:r,row:s,scale:o,scaleWidth:i,startLeft:c,cursorLeft:a,hideCursor:u}=n,l=[];t?e.forEach(d=>{d.actions.forEach(m=>{t.includes(m.id)&&l.push(m)})}):e.forEach(d=>{d.id!==s.id?l.push(...d.actions):d.actions.forEach(m=>{m.id!==r.id&&l.push(m)})});const h=C.parserActionsToPositions(l,{startLeft:c,scale:o,scaleWidth:i});return u||h.push(a),h}const go=n=>{const e=Pe.c(50);let t,r;e[0]!==n?({ref:r,...t}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const{snapData:s,initSnap:o,updateSnap:i,disposeSnap:c,getActiveDragState:a,defaultGetAssistPosition:u,defaultGetMovePosition:l}=ho();let h;e[3]!==u||e[4]!==a||e[5]!==t.cursorTime||e[6]!==t.editorData||e[7]!==t.hideCursor||e[8]!==t.scale||e[9]!==t.scaleWidth||e[10]!==t.snap||e[11]!==t.startLeft||e[12]!==s.isMoving||e[13]!==i?(h=()=>{const x=a();if(t.snap&&x&&s.isMoving){const U=t.scaleWidth??160,W=t.scale??1,E=t.startLeft??20,A=t.hideCursor??!1,N=C.parserTimeToPixel(t.cursorTime,{scaleWidth:U,scale:W,startLeft:E}),ee=u({editorData:t.editorData,assistActionIds:x.assistActionIds,action:x.action,row:x.row,scale:W,scaleWidth:U,startLeft:E,hideCursor:A,cursorLeft:N});i({assistPositions:ee})}else!t.snap&&s.isMoving&&i({assistPositions:[]})},e[3]=u,e[4]=a,e[5]=t.cursorTime,e[6]=t.editorData,e[7]=t.hideCursor,e[8]=t.scale,e[9]=t.scaleWidth,e[10]=t.snap,e[11]=t.startLeft,e[12]=s.isMoving,e[13]=i,e[14]=h):h=e[14];let d;e[15]!==t.snap||e[16]!==s.isMoving?(d=[t.snap,s.isMoving],e[15]=t.snap,e[16]=s.isMoving,e[17]=d):d=e[17],k.useEffect(h,d);let m;e[18]!==u||e[19]!==o||e[20]!==t?(m=x=>{const U=t.getAssistDragLineActionIds&&t.getAssistDragLineActionIds({action:x.action,row:x.row,editorData:t.editorData});if(t.snap){const W=t.scaleWidth??160,E=t.scale??1,A=t.startLeft??20,N=t.hideCursor??!1,ee=C.parserTimeToPixel(t.cursorTime,{scaleWidth:W,scale:E,startLeft:A}),ne=u({editorData:t.editorData,assistActionIds:U,action:x.action,row:x.row,scale:E,scaleWidth:W,startLeft:A,hideCursor:N,cursorLeft:ee});o({assistPositions:ne,action:x.action,row:x.row,assistActionIds:U})}else o({assistPositions:[],action:x.action,row:x.row,assistActionIds:U})},e[18]=u,e[19]=o,e[20]=t,e[21]=m):m=e[21];const w=m;let v;e[22]!==l||e[23]!==t.scale||e[24]!==t.scaleWidth||e[25]!==t.snap||e[26]!==t.startLeft||e[27]!==i?(v=x=>{if(t.snap){const U=t.scaleWidth??160,W=t.scale??1,E=t.startLeft??20,A=l({...x,startLeft:E,scaleWidth:U,scale:W});i({movePositions:A})}},e[22]=l,e[23]=t.scale,e[24]=t.scaleWidth,e[25]=t.snap,e[26]=t.startLeft,e[27]=i,e[28]=v):v=e[28];const p=v,R=t.rowHeight??32,b=t.scaleWidth??160,_=t.startLeft??20,S=Math.max(t.scaleCount*b+_,t.timelineWidth);let P;if(e[29]!==S||e[30]!==R||e[31]!==c||e[32]!==w||e[33]!==p||e[34]!==t||e[35]!==s){const x=[];let U=0;for(let W=0;W<t.editorData.length;W++){const E=t.editorData[W];if(!E)continue;const A=E.rowHeight||R;x.push(k.createElement(fo,{...t,key:E.id,rowData:E,snapData:s,scrollContainerRef:t.scrollElementRef,style:{position:"absolute",top:0,left:0,width:S,height:`${A}px`,transform:`translateY(${U}px)`},onActionMoveStart:N=>(w(N),t.onActionMoveStart&&t.onActionMoveStart(N)),onActionResizeStart:N=>(w(N),t.onActionResizeStart&&t.onActionResizeStart(N)),onActionMoving:N=>(p(N),t.onActionMoving&&t.onActionMoving(N)),onActionResizing:N=>(p(N),t.onActionResizing&&t.onActionResizing(N)),onActionResizeEnd:N=>(c(),t.onActionResizeEnd&&t.onActionResizeEnd(N)),onActionMoveEnd:N=>(c(),t.onActionMoveEnd&&t.onActionMoveEnd(N))})),U=U+A}P=[U,x],e[29]=S,e[30]=R,e[31]=c,e[32]=w,e[33]=p,e[34]=t,e[35]=s,e[36]=P}else P=e[36];const[D,L]=P,H=`0, ${t.startLeft??20}px`,M=`${t.startLeft??20}px, ${t.scaleWidth??160}px`;let j;e[37]!==S||e[38]!==H||e[39]!==M||e[40]!==D?(j={width:S,height:D,position:"relative",backgroundPositionX:H,backgroundSize:M},e[37]=S,e[38]=H,e[39]=M,e[40]=D,e[41]=j):j=e[41];let F;e[42]!==t.snap||e[43]!==s?(F=t.snap&&T.jsx(xr,{...s}),e[42]=t.snap,e[43]=s,e[44]=F):F=e[44];let G;return e[45]!==r||e[46]!==L||e[47]!==j||e[48]!==F?(G=T.jsxs("div",{ref:r,style:j,className:"timeline-editor-edit-area",children:[L,F]}),e[45]=r,e[46]=L,e[47]=j,e[48]=F,e[49]=G):G=e[49],G};function vo({scaleSplitCount:n,scaleWidth:e,startLeft:t,scaleCount:r,maxScaleCount:s,scale:o,scrollElementRef:i,onClickTimeArea:c,setCursor:a,getScaleRender:u}){const l=n??1,h=e??160,d=t??20,m=(n??0)>0,w=m?r*(n??1)+1:r,v=(m?h/l:h)*(w-1)+d,R=lr({horizontal:!0,count:w,getScrollElement:()=>i.current,estimateSize:b=>{switch(b){case 0:return d;default:return m?h/l:h}},overscan:10});return k.useEffect(()=>R.measure(),[e,t,R]),T.jsx("div",{style:{width:`${v}px`},className:de("time-area"),onClick:b=>{const _=t??20,S=e??160,P=o??1,D=s??1/0,L=b.currentTarget.getBoundingClientRect(),H=b.clientX-L.x,M=Math.max(H,_);if(M>D*S+_)return;const j=C.parserPixelToTime(M,{startLeft:_,scale:P,scaleWidth:S});c&&c(j,b),!b.defaultPrevented&&a({time:j})},children:R.getVirtualItems().map(b=>{const _=b.index,S=n??1,P=o??1,D=m?_%S===0:!0,L=[de("time-unit"),de(D?"time-unit-big":"time-unit-small")],H=(m?_/S:_)*P;return T.jsx("div",{"data-index":b.index,style:{width:`${b.size}px`,transform:`translateX(${b.start}px)`},className:L.join(" "),children:D&&T.jsx("div",{className:de("time-unit-scale"),children:u?.(H)??H})},b.key)})})}function bo(n){return typeof n=="object"&&n!==null}function _o(n,e,t){if(n instanceof EventTarget)return[n];if(typeof n=="string"){const s=document.querySelectorAll(n);return s?Array.from(s):[]}return Array.from(n)}function So(n){return bo(n)&&"ownerSVGElement"in n}const jt=new WeakMap;let Ft;const ur=(n,e,t)=>(r,s)=>s&&s[0]?s[0][n+"Size"]:So(r)&&"getBBox"in r?r.getBBox()[e]:r[t],wo=ur("inline","width","offsetWidth"),Eo=ur("block","height","offsetHeight");function yo({target:n,borderBoxSize:e}){jt.get(n)?.forEach(t=>{t(n,{get width(){return wo(n,e)},get height(){return Eo(n,e)}})})}function To(n){n.forEach(yo)}function Ro(){typeof ResizeObserver>"u"||(Ft=new ResizeObserver(To))}function xo(n,e){Ft||Ro();const t=_o(n);return t.forEach(r=>{let s=jt.get(r);s||(s=new Set,jt.set(r,s)),s.add(e),Ft?.observe(r)}),()=>{t.forEach(r=>{const s=jt.get(r);s?.delete(e),s?.size||Ft?.unobserve(r)})}}const Ut=new Set;let Tt;function Ao(){Tt=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ut.forEach(e=>e(n))},window.addEventListener("resize",Tt)}function Co(n){return Ut.add(n),Tt||Ao(),()=>{Ut.delete(n),!Ut.size&&typeof Tt=="function"&&(window.removeEventListener("resize",Tt),Tt=void 0)}}function Do(n,e){return typeof n=="function"?Co(n):xo(n,e)}function Po(n){const e=Pe.c(4),{elementRef:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={width:0,height:0},e[0]=r):r=e[0];const[s,o]=k.useState(r);let i,c;return e[1]!==t?(i=()=>{t.current&&Do(t.current,(a,u)=>{o({width:u.width,height:u.height})})},c=[t],e[1]=t,e[2]=i,e[3]=c):(i=e[2],c=e[3]),k.useLayoutEffect(i,c),s}const Lo=n=>{const e=Pe.c(42),{disableDrag:t,cursorTime:r,setCursor:s,startLeft:o,scaleWidth:i,scale:c,scaleCount:a,scaleSplitCount:u,scrollElementRef:l,maxScaleCount:h,onCursorDragStart:d,onCursorDrag:m,onCursorDragEnd:w}=n,v=k.useRef(null),p=k.useRef(void 0);let R,b;e[0]!==r||e[1]!==c||e[2]!==i||e[3]!==o?(R=()=>{if(typeof p.current>"u"&&v.current){const f=o??20,y=i??160,I=c??1;v.current.updateLeft(C.parserTimeToPixel(r,{startLeft:f,scaleWidth:y,scale:I}))}},b=[r,o,i,c],e[0]=r,e[1]=c,e[2]=i,e[3]=o,e[4]=R,e[5]=b):(R=e[4],b=e[5]),k.useEffect(R,b);const _=o??20,S=i??160,P=c??1,D=h??1/0,L=(u??0)>0,H=u??1,M=L?a*(u??1)+1:a,j=o??20,F=(L?S/H:S)*(M-1)+j;let G;e[6]!==_||e[7]!==D||e[8]!==l||e[9]!==F||e[10]!==S?(G=()=>({left:0,right:Math.min(F,D*S+_-(l.current?.scrollLeft??0))}),e[6]=_,e[7]=D,e[8]=l,e[9]=F,e[10]=S,e[11]=G):G=e[11];const x=!t;let U;e[12]!==r||e[13]!==_||e[14]!==d||e[15]!==P||e[16]!==S?(U=()=>{const f=v.current?.getLeft()??C.parserTimeToPixel(r,{startLeft:_,scaleWidth:S,scale:P});p.current=f;const y=C.parserPixelToTime(f,{startLeft:_,scale:P,scaleWidth:S});d&&d(y),v.current?.updateLeft(f)},e[12]=r,e[13]=_,e[14]=d,e[15]=P,e[16]=S,e[17]=U):U=e[17];let W;e[18]!==_||e[19]!==w||e[20]!==P||e[21]!==s||e[22]!==S?(W=()=>{if(typeof p.current<"u"){const f=C.parserPixelToTime(p.current,{startLeft:_,scale:P,scaleWidth:S});s({time:f}),w&&w(f)}p.current=void 0},e[18]=_,e[19]=w,e[20]=P,e[21]=s,e[22]=S,e[23]=W):W=e[23];let E;e[24]!==_||e[25]!==m||e[26]!==P||e[27]!==l||e[28]!==s||e[29]!==S?(E=(f,y)=>{const{left:I}=f,Y=y===void 0?0:y,te=l.current?.scrollLeft??0,q=l.current,X=q?.clientWidth??0;if(Y!==0)if(typeof p.current<"u"){p.current=p.current+Y;const O=te,z=te+X;p.current<O+10?p.current=O+10:p.current>z-10&&(p.current=z-10),p.current<_-te&&(p.current=_-te)}else{p.current=I+Y;const O=te,z=te+X;p.current<O+10?p.current=O+10:p.current>z-10&&(p.current=z-10)}else if(I<_-te?p.current=_-te:p.current=I,q&&X>0){const O=te,z=te+X;p.current<O+10?p.current=O+10:p.current>z-10&&(p.current=z-10)}if(typeof p.current<"u"){v.current?.updateLeft(p.current);const O=C.parserPixelToTime(p.current,{startLeft:_,scale:P,scaleWidth:S});s({time:O}),m&&m(O)}return!1},e[24]=_,e[25]=m,e[26]=P,e[27]=l,e[28]=s,e[29]=S,e[30]=E):E=e[30];let A,N;e[31]===Symbol.for("react.memo_cache_sentinel")?(A=de("cursor"),N=de("cursor-top"),e[31]=A,e[32]=N):(A=e[31],N=e[32]);let ee;e[33]===Symbol.for("react.memo_cache_sentinel")?(ee=T.jsxs("div",{className:A,children:[T.jsx("svg",{className:N,width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",children:T.jsx("path",{d:"M0 1C0 0.447715 0.447715 0 1 0H7C7.55228 0 8 0.447715 8 1V9.38197C8 9.76074 7.786 10.107 7.44721 10.2764L4.44721 11.7764C4.16569 11.9172 3.83431 11.9172 3.55279 11.7764L0.552786 10.2764C0.214002 10.107 0 9.76074 0 9.38197V1Z",fill:"currentColor"})}),T.jsx("div",{className:de("cursor-area")})]}),e[33]=ee):ee=e[33];let ne;return e[34]!==_||e[35]!==l||e[36]!==G||e[37]!==x||e[38]!==U||e[39]!==W||e[40]!==E?(ne=T.jsx(cr,{start:_,ref:v,parentRef:l,getBounds:G,autoScroll:!0,enableDragging:x,enableResizing:!1,onDragStart:U,onDragEnd:W,onDrag:E,children:ee}),e[34]=_,e[35]=l,e[36]=G,e[37]=x,e[38]=U,e[39]=W,e[40]=E,e[41]=ne):ne=e[41],ne};function kn(n){const e=Pe.c(9);let t,r,s;e[0]!==n?({className:t,orientation:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const o=s===void 0?"vertical":s;let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=T.jsx(nr,{"data-slot":"scroll-area-thumb"}),e[4]=i):i=e[4];let c;return e[5]!==t||e[6]!==o||e[7]!==r?(c=T.jsx(Zn,{"data-slot":"scroll-area-scrollbar",orientation:o,className:t,...r,children:i}),e[5]=t,e[6]=o,e[7]=r,e[8]=c):c=e[8],c}function Oo({ref:n,...e}){const t=wr(e),r=k.useRef(null),{width:s,height:o}=Po({elementRef:r}),i=Math.min(t.maxScaleCount,t.minScaleCount??Math.max(C.getScaleCountByRows(t.editorData,{scale:t.scale,pad:.2}),Math.ceil((s-t.startLeft)/t.scaleWidth))),[c,a]=k.useState(i),u=Math.max(i,c),[l,h]=k.useState(C.START_CURSOR_TIME),d=k.useRef(C.START_CURSOR_TIME),m=p=>{a(Math.min(t.maxScaleCount,Math.max(i,p)))},w=p=>{t.onChange?.(p)},v=p=>{let{left:R,time:b}=p;return typeof b<"u"?(h(b),d.current=b,!0):typeof R<"u"?(h(d.current=C.parserPixelToTime(R,{startLeft:t.startLeft,scale:t.scale,scaleWidth:t.scaleWidth})),!0):!1};return k.useImperativeHandle(n,()=>({get target(){return r.current},set time(p){v({time:p})},get time(){return d.current},setScrollLeft:p=>{r.current&&(r.current.scrollLeft=p)},setScrollTop:p=>{r.current&&(r.current.scrollTop=p)}})),T.jsxs(Bs,{style:t.style,className:`${C.PREFIX} ${t.disableDrag?C.PREFIX+"-disable":""}`,"data-slot":"scroll-area",children:[T.jsxs(Ys,{"data-slot":"scroll-area-viewport",ref:r,onScroll:p=>{t.onScroll?.(p.currentTarget)},children:[T.jsx(vo,{...t,setCursor:v,scaleCount:u,scrollElementRef:r}),T.jsx(go,{...t,scrollElementRef:r,timelineWidth:s,timelineHeight:o,disableDrag:t.disableDrag,editorData:t.editorData,cursorTime:l,scaleCount:u,setScaleCount:m,setEditorData:w}),!t.hideCursor&&T.jsx(Lo,{...t,timelineWidth:s,height:o,scaleCount:u,setScaleCount:m,setCursor:v,cursorTime:l,editorData:t.editorData,scrollElementRef:r})]}),T.jsx(kn,{orientation:"horizontal"}),T.jsx(kn,{orientation:"vertical"}),T.jsx(Xs,{})]})}exports.Timeline=Oo;
|