@cyca/react-timeline-editor 0.2.2-alpha.4 → 0.2.3-alpha.1

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