@cyca/react-timeline-editor 0.2.3-alpha.2 → 0.2.3-alpha.3
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/react-timeline-editor.cjs +4 -4
- package/dist/react-timeline-editor.js +629 -628
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=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(A);var Nt={exports:{}},Ct={};var vn;function xr(){if(vn)return Ct;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 Ct.Fragment=e,Ct.jsx=t,Ct.jsxs=t,Ct}var Tt={};var bn;function Cr(){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 _:return"Profiler";case S:return"StrictMode";case x:return"Suspense";case R:return"SuspenseList";case P: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 v:return"Portal";case y:return d.displayName||"Context";case w:return(d._context.displayName||"Context")+".Consumer";case C:var T=d.render;return d=d.displayName,d||(d=T.displayName||T.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case W:return T=d.displayName||null,T!==null?T:n(d.type)||"Memo";case L:T=d._payload,d=d._init;try{return n(d(T))}catch{}}return null}function e(d){return""+d}function t(d){try{e(d);var T=!1}catch{T=!0}if(T){T=console;var V=T.error,B=typeof Symbol=="function"&&Symbol.toStringTag&&d[Symbol.toStringTag]||d.constructor.name||"Object";return V.call(T,"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 T=n(d);return T?"<"+T+">":"<...>"}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 T=Object.getOwnPropertyDescriptor(d,"key").get;if(T&&T.isReactWarning)return!1}return d.key!==void 0}function c(d,T){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)",T))}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,T,V,B,J,Y){var U=V.ref;return d={$$typeof:b,type:d,key:T,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,T,V,B,J,Y){var U=T.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(T,"key")){U=n(d);var O=Object.keys(T).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} />`,B,U,O,U),me[U+B]=!0)}if(U=null,V!==void 0&&(t(V),U=""+V),i(
|
|
6
|
+
<%s key={someKey} {...props} />`,B,U,O,U),me[U+B]=!0)}if(U=null,V!==void 0&&(t(V),U=""+V),i(T)&&(t(T.key),U=""+T.key),"key"in T){V={};for(var N in T)N!=="key"&&(V[N]=T[N])}else V=T;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===b}var m=A,b=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),y=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),P=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,D=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=D(r(o)),me={};Tt.Fragment=g,Tt.jsx=function(d,T,V){var B=1e4>H.recentlyCreatedOwnerStacks++;return l(d,T,V,!1,B?Error("react-stack-top-frame"):ue,B?D(r(d)):fe)},Tt.jsxs=function(d,T,V){var B=1e4>H.recentlyCreatedOwnerStacks++;return l(d,T,V,!0,B?Error("react-stack-top-frame"):ue,B?D(r(d)):fe)}})()),Tt}var _n;function Tr(){return _n||(_n=1,process.env.NODE_ENV==="production"?Nt.exports=xr():Nt.exports=Cr()),Nt.exports}var E=Tr();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=A.__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=A.__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)}})()),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`,`
|
|
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,Cn=10;function Hr(n){const e=ze.c(7),t=A.useRef(Number.MIN_SAFE_INTEGER),r=A.useRef(Number.MAX_SAFE_INTEGER),s=A.useRef(kt),o=A.useRef(void 0);let i;e[0]!==n?(i=()=>{if(n?.current){const{left:v,width:g}=n.current.getBoundingClientRect();t.current=v,r.current=v+g}},e[0]=n,e[1]=i):i=e[1];const c=i;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(v,g)=>{if(v.clientX>=r.current||v.clientX<=t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const S=Math.abs(v.clientX>=r.current?v.clientX-r.current:v.clientX-t.current);s.current=Math.min(Number((S/Cn).toFixed(0))*kt,xn);const w=(v.clientX>=r.current?1:-1)*s.current,y=()=>{g&&g(w),o.current=requestAnimationFrame(y)};return o.current=requestAnimationFrame(y),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[2]=a):a=e[2];const u=a;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=(v,g,S)=>{if(v.clientX>=r.current||v.clientX<t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const _=Math.abs(v.clientX>=r.current?v.clientX-r.current:v.clientX-t.current);s.current=Math.min(Number((_/Cn).toFixed(0))*kt,xn);const y=(v.clientX>=r.current?1:-1)*s.current,C=()=>{S&&S(y),o.current=requestAnimationFrame(C)};return o.current=requestAnimationFrame(C),!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 b;return e[5]!==c?(b={initAutoScroll:c,dealDragAutoScroll:u,dealResizeAutoScroll:h,stopAutoScroll:m},e[5]=c,e[6]=b):b=e[6],b}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 Tn(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?-Tn(e-n,t-e,r)+e:n>t?+Tn(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 x=t._delta.map(Math.abs);he.addTo(t._distance,x)}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[x,R]=h;f[0]=l[0]!==!1?x-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,b=t._active&&!t._blocked||t.active;b&&(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[v,g]=t.offset,[[S,_],[w,y]]=t._bounds;t.overflow=[v<S?-1:v>_?1:0,g<w?-1:g>y?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 C=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=Yr(t._bounds,t.offset,C),t.delta=he.sub(t.offset,m),this.computeMovement(),b&&(!t.last||o>cs)){t.delta=he.sub(t.offset,m);const x=t.delta.map(Math.abs);he.addTo(t.distance,x),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&o>0&&(t.velocity=[x[0]/o,x[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,b]=r.swipe.distance,v=r.swipe.duration;if(t.elapsedTime<v){const g=Math.abs(c/t.timeDelta),S=Math.abs(a/t.timeDelta);g>h&&Math.abs(u)>m&&(t.swipe[0]=Math.sign(c)),S>f&&Math.abs(l)>b&&(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 Cs(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,o;for(o=0;o<r.length;o++)s=r[o],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}function Ts(n,e){if(n==null)return{};var t=Cs(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=Ts(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=A.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 A.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=A.useRef(null),c=A.useRef(void 0),a=A.useRef(void 0),u=A.useRef(void 0),l=A.useRef(void 0),h=A.useRef(void 0),f=A.useRef(null),m=A.useRef(null);A.useEffect(()=>{c.current=s,a.current=o},[s,o]);const b=A.useEffectEvent(()=>{i.current&&(t&&c.current&&(u.current=new sn(i.current,v=>{const{active:g,delta:S,xy:_,event:w,first:y,last:C}=v,x=w?.target;if(x&&(x===f.current||x===m.current||f.current&&f.current.contains(x)||m.current&&m.current.contains(x)))return;const R={target:i.current,dx:S[0],dy:S[1],clientX:_[0],clientY:_[1]};y?c.current?.onstart?.(R):C?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,v=>{const{active:g,delta:S,xy:_,first:w,last:y}=v,C={target:i.current,dx:S[0],dy:0,clientX:_[0],clientY:_[1],edges:{left:!0},deltaRect:{left:S[0]}};y?a.current?.onend?.(C):w?a.current?.onstart?.(C):g&&a.current?.onmove?.(C)},{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,v=>{const{active:g,delta:S,xy:_,first:w,last:y}=v,C={target:i.current,dx:S[0],dy:0,clientX:_[0],clientY:_[1],edges:{right:!0},deltaRect:{right:S[0]}};y?a.current?.onend?.(C):w?a.current?.onstart?.(C):g&&a.current?.onmove?.(C)},{pointer:{capture:!0},threshold:0}))))});return A.useEffect(()=>{if(!i.current)return;u.current?.destroy(),l.current?.destroy(),h.current?.destroy();const v={target:i.current,unset:()=>{u.current?.destroy(),l.current?.destroy(),h.current?.destroy()}};e&&(e.current=v),b()},[t,r,e]),sr({children:n,ref:i,draggable:!1,style:{...t&&{touchAction:"none"}}})},or=A.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:b,onResize:v,onResizeEnd:g,onDragStart:S,onDragEnd:_,onDrag:w,parentRef:y,autoScroll:C}=n,x=c===void 0?Gt:c,R=a===void 0?cn:a,W=u===void 0?Vs:u,L=l===void 0?!0:l,P=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=C===void 0?!0:C,D=A.useRef(void 0),I=A.useRef(0),K=A.useRef(!1),{initAutoScroll:ue,stopAutoScroll:fe,dealDragAutoScroll:me,dealResizeAutoScroll:d}=Hr(y);let T,V;t[2]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{const k=D.current;return()=>{k?.unset()}},V=[],t[2]=T,t[3]=V):(T=t[2],V=t[3]),A.useEffect(T,V);let B;t[4]===Symbol.for("react.memo_cache_sentinel")?(B=(k,Z)=>{const X=Z===void 0?!0:Z;if(!D.current||!D.current.target)return;X&&(I.current=0);const z=D.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(!D.current||!D.current.target)return;X&&(I.current=0);const z=D.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(!D.current?.target)return 0;const k=D.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(!D.current?.target)return 0;const k=D.current.target;return parseFloat(k?.dataset?.width||"0")},t[7]=$):$=t[7];const Zt=$;let rt,Fe;t[8]!==i?(rt=()=>{if(!D.current?.target)return;const k=D.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]),A.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]),A.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],A.useImperativeHandle(e,Ve);let Pe;t[15]!==ue||t[16]!==S?(Pe=()=>{I.current=0,K.current=!1,ue(),S&&S()},t[15]=ue,t[16]=S,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]!==w||t[23]!==x?(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-x)%R!==0&&(G=x+R*Math.round((G-x)/R)),K.current=!1),I.current=I.current%ne,G<W().left?G=W().left:G+X>W().right&&(G=W().right-X),w&&w({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]=w,t[23]=x,t[24]=Oe):Oe=t[24];const st=Oe;let ot;t[25]!==q||t[26]!==me||t[27]!==st||t[28]!==y?(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&&y?.current&&!me(k,se=>{if(!y?.current||!D.current?.target)return;y.current.scrollLeft=y.current.scrollLeft+se;const ee=D.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]=y,t[29]=ot):ot=t[29];const Ue=ot;let be;t[30]!==_||t[31]!==fe?(be=k=>{I.current=0,K.current=!1,fe();const Z=k.target,{left:X,width:z}=Z.dataset;_&&_({left:parseFloat(X||"0"),width:parseFloat(z||"0")})},t[30]=_,t[31]=fe,t[32]=be):be=t[32];const $e=be;let Le;t[33]!==ue||t[34]!==b?(Le=k=>{I.current=0,K.current=!1,ue();const Z=k.edges?.right?"right":"left";b&&b(Z)},t[33]=ue,t[34]=b,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]!==v||t[41]!==x?(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-x)%R!==0&&(j=x+R*Math.round((j-x)/R)),K.current=!1),I.current=I.current%re;const Q=z+X;j<W().left&&(j=W().left);const ce=Q-j;if(v&&v("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-x)%R!==0&&(Q=x+R*Math.round((Q-x)/R),j=Q-z),K.current=!1}if(I.current=I.current%re,z+j>W().right&&(j=W().right-z),v&&v("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]=v,t[41]=x,t[42]=Me):Me=t[42];const ye=Me;let Ne;t[43]!==q||t[44]!==d||t[45]!==y||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&&y?.current&&!d(k,X,ee=>{if(!y?.current||!D.current?.target)return;y.current.scrollLeft=y.current.scrollLeft+ee;const Q=D.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]=y,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 Ce;t[60]!==o||t[61]!==He||t[62]!==i?(Ce=sr({children:He,style:{left:o,width:i}}),t[60]=o,t[61]=He,t[62]=i,t[63]=Ce):Ce=t[63];let ke;return t[64]!==P||t[65]!==L||t[66]!==Ee||t[67]!==xe||t[68]!==Ce?(ke=E.jsx(Fs,{interactRef:D,draggable:P,resizable:L,draggableOptions:Ee,resizableOptions:xe,children:Ce}),t[64]=P,t[65]=L,t[66]=Ee,t[67]=xe,t[68]=Ce,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:b,setScaleCount:v,onActionMoveStart:g,onActionMoving:S,onActionMoveEnd:_,onActionResizeStart:w,onActionResizeEnd:y,onActionResizing:C,dragLineData:x,setEditorData:R,onClickAction:W,onClickActionOnly:L,onDoubleClickAction:P,onContextMenuAction:M,getActionRender:H,handleTime:F,scrollContainerRef:q}=n,D=A.useRef(null),I=A.useRef(!1),{id:K,maxEnd:ue,minStart:fe,end:me,start:d,selected:T,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=b??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]=A.useState(null),be=ot??st,$e=N/Zt;let Le;e[16]!==J||e[17]!==o||e[18]!==Y||e[19]!==U||e[20]!==T?(Le=de($s("action",U&&"action-movable",T&&"action-selected",Y&&"action-flexible",o[J]&&`action-effect-${J}`)),e[16]=J,e[17]=o,e[18]=Y,e[19]=U,e[20]=T,e[21]=Le):Le=e[21];const Ke=Le;let Me;e[22]!==N||e[23]!==$||e[24]!==m||e[25]!==v?(Me=(pe,ge)=>{const oe=kr(pe+ge,{startLeft:$,scaleCount:m,scaleWidth:N});oe!==m&&v(oe)},e[22]=N,e[23]=$,e[24]=m,e[25]=v,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]!==S||e[34]!==r||e[35]!==O||e[36]!==N||e[37]!==$?(Ie=pe=>{const{left:ge,width:oe}=pe;if(I.current=!0,S){const{start:le,end:ie}=At({left:ge,width:oe},{scaleWidth:N,scale:O,startLeft:$});if(S({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]=S,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]!==_||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),_&&_({action:Xe,row:r,start:le,end:ie}),Ue(null))},e[39]=t,e[40]=K,e[41]=_,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]!==w||e[50]!==r?(He=pe=>{w&&w({action:s,row:r,dir:pe})},e[48]=s,e[49]=w,e[50]=r,e[51]=He):He=e[51];const Ce=He;let ke;e[52]!==s||e[53]!==ye||e[54]!==C||e[55]!==r||e[56]!==O||e[57]!==N||e[58]!==$?(ke=(pe,ge)=>{const{left:oe,width:le}=ge;if(I.current=!0,C){const{start:ie,end:ae}=At({left:oe,width:le},{scaleWidth:N,scale:O,startLeft:$});if(C({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]=C,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]!==y||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),y&&y({action:Ge,row:r,start:ie,end:ae,dir:pe}),Ue(null))},e[60]=t,e[61]=K,e[62]=y,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]!==x.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]!==Ce||e[82]!==k||e[83]!==F||e[84]!==Re||e[85]!==U||e[86]!==W||e[87]!==L||e[88]!==M||e[89]!==P||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=D,_e=q,We=$,it=be.left,ct=be.width,at=h&&$e||cn,lt=h?Math.max(($e||cn)/2,an):an,ut=x.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=Ce,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]!==P||e[147]!==r?(G=ie=>{if(P){const ae=F(ie);P(ie,{row:r,action:s,time:ae})}},e[144]=s,e[145]=F,e[146]=P,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]=x.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]=Ce,e[82]=k,e[83]=F,e[84]=Re,e[85]=U,e[86]=W,e[87]=L,e[88]=M,e[89]=P,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,v)=>r[v]!==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 b=Math.round((Date.now()-l)*100)/100,v=Math.round((Date.now()-m)*100)/100,g=v/16,S=(_,w)=>{for(_=String(_);_.length<w;)_=" "+_;return _};console.info(`%c⏱ ${S(v,5)} /${S(b,5)} ms`,`
|
|
11
11
|
font-size: .6rem;
|
|
12
12
|
font-weight: bold;
|
|
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;
|
|
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,b=c.get(h),v=typeof b=="number"?b:this.options.estimateSize(l),g=m+v,S=f?f.lane:l%this.options.lanes;u[l]={index:l,start:m,size:v,end:g,key:h,lane:S}}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(),b=this.getOffsetForIndex(t,f);if(!b){console.warn("Failed to get offset for index:",t);return}Bs(b[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,b=_=>{if(!i.current)return 0;const y=_.currentTarget.getBoundingClientRect(),x=_.clientX-y.x;return tt(x,{startLeft:m,scale:h,scaleWidth:f})},v=A.useMemo(()=>(e?.actions?[...e.actions]:[]).sort((_,w)=>_.start-w.start),[e]),g=A.useCallback(_=>v[_]?.id??_,[v]),S=cr({horizontal:!0,count:v.length,getItemKey:g,getScrollElement:()=>i.current,estimateSize:_=>{if(!v[_])return 0;let{width:w}=dn({start:v[_].start,end:v[_].end},{startLeft:m,scale:h,scaleWidth:f});return w},overscan:3});return A.useLayoutEffect(()=>{S.measure()},[u,c,S]),E.jsx("div",{className:`${de(...l)} ${(e?.classNames||[]).join(" ")}`,style:t,onClick:_=>{if(e&&r){const w=b(_);r(_,{row:e,time:w})}},onDoubleClick:_=>{if(e&&s){const w=b(_);s(_,{row:e,time:w})}},onContextMenu:_=>{if(e&&o){const w=b(_);o(_,{row:e,time:w})}},children:e&&S.getVirtualItems().map(_=>{const w=v[_.index];if(!w)throw new Error("Action not found");return E.jsx(Hs,{...n,handleTime:b,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]=A.useState(e),s=oo,o=so;let i;n[1]===Symbol.for("react.memo_cache_sentinel")?(i=m=>{const{movePositions:b,assistPositions:v}=m;r({isMoving:!0,movePositions:b||[],assistPositions:v||[]})},n[1]=i):i=n[1];const c=i;let a;n[2]===Symbol.for("react.memo_cache_sentinel")?(a=m=>{const{movePositions:b,assistPositions:v}=m;r(g=>({...g,movePositions:b||g.movePositions,assistPositions:v||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=P=>{if(t.dragLine){const M=t.getAssistDragLineActionIds&&t.getAssistDragLineActionIds({action:P.action,row:P.row,editorData:t.editorData}),H=t.scaleWidth??160,F=t.scale??1,q=t.startLeft??20,D=t.hideCursor??!1,I=je(t.cursorTime,{scaleWidth:H,scale:F,startLeft:q}),K=a({editorData:t.editorData,assistActionIds:M,action:P.action,row:P.row,scale:F,scaleWidth:H,startLeft:q,hideCursor:D,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=P=>{if(t.dragLine){const M=t.scaleWidth??160,H=t.scale??1,F=t.startLeft??20,q=u({...P,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,b=t.rowHeight??32,v=t.scaleWidth??160,g=t.startLeft??20,S=Math.max(t.scaleCount*v+g,t.timelineWidth);let _;if(e[14]!==S||e[15]!==b||e[16]!==c||e[17]!==s||e[18]!==h||e[19]!==m||e[20]!==t){const P=[];let M=0;for(let H=0;H<t.editorData.length;H++){const F=t.editorData[H];if(!F)continue;const q=F.rowHeight||b;P.push(A.createElement(no,{...t,key:F.id,rowData:F,dragLineData:s,scrollContainerRef:t.scrollElementRef,style:{position:"absolute",top:0,left:0,width:S,height:`${q}px`,transform:`translateY(${M}px)`},onActionMoveStart:D=>(h(D),t.onActionMoveStart&&t.onActionMoveStart(D)),onActionResizeStart:D=>(h(D),t.onActionResizeStart&&t.onActionResizeStart(D)),onActionMoving:D=>(m(D),t.onActionMoving&&t.onActionMoving(D)),onActionResizing:D=>(m(D),t.onActionResizing&&t.onActionResizing(D)),onActionResizeEnd:D=>(c(),t.onActionResizeEnd&&t.onActionResizeEnd(D)),onActionMoveEnd:D=>(c(),t.onActionMoveEnd&&t.onActionMoveEnd(D))})),M=M+q}_=[M,P],e[14]=S,e[15]=b,e[16]=c,e[17]=s,e[18]=h,e[19]=m,e[20]=t,e[21]=_}else _=e[21];const[w,y]=_,C=`0, ${t.startLeft??20}px`,x=`${t.startLeft??20}px, ${t.scaleWidth??160}px`;let R;e[22]!==S||e[23]!==C||e[24]!==x||e[25]!==w?(R={width:S,height:w,position:"relative",backgroundPositionX:C,backgroundSize:x},e[22]=S,e[23]=C,e[24]=x,e[25]=w,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]!==y||e[32]!==R||e[33]!==W?(L=E.jsxs("div",{ref:r,style:R,className:"timeline-editor-edit-area",children:[y,W]}),e[30]=r,e[31]=y,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,b=(f?l/u:l)*(m-1)+h,g=cr({horizontal:!0,count:m,getScrollElement:()=>i.current,estimateSize:S=>{switch(S){case 0:return h;default:return f?l/u:l}},overscan:10});return A.useEffect(()=>g.measure(),[e,t,g]),E.jsx("div",{style:{width:`${b}px`},className:de("time-area"),onClick:S=>{const _=t??20,w=e??160,y=o??1,C=s??1/0,x=S.currentTarget.getBoundingClientRect(),R=S.clientX-x.x,W=Math.max(R,_);if(W>C*w+_)return;const L=tt(W,{startLeft:_,scale:y,scaleWidth:w});c&&c(L,S),!S.defaultPrevented&&a({time:L})},children:g.getVirtualItems().map(S=>{const _=S.index,w=n??1,y=o??1,C=f?_%w===0:!0,x=[de("time-unit"),de(C?"time-unit-big":"time-unit-small")],R=(f?_/w:_)*y;return E.jsx("div",{"data-index":S.index,style:{width:`${S.size}px`,transform:`translateX(${S.start}px)`},className:x.join(" "),children:C&&E.jsx("div",{className:de("time-unit-scale"),children:R})},S.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]=A.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],A.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:b}=n,v=A.useRef(null),g=A.useRef(void 0);let S,_;e[0]!==r||e[1]!==c||e[2]!==i||e[3]!==o?(S=()=>{if(typeof g.current>"u"&&v.current){const d=o??20,T=i??160,V=c??1;v.current.updateLeft(je(r,{startLeft:d,scaleWidth:T,scale:V}))}},_=[r,o,i,c],e[0]=r,e[1]=c,e[2]=i,e[3]=o,e[4]=S,e[5]=_):(S=e[4],_=e[5]),A.useEffect(S,_);const w=o??20,y=i??160,C=c??1,x=h??1/0,R=(u??0)>0,W=u??1,L=R?a*(u??1)+1:a,P=o??20,M=(R?y/W:y)*(L-1)+P;let H;e[6]!==w||e[7]!==x||e[8]!==l||e[9]!==M||e[10]!==y?(H=()=>({left:0,right:Math.min(M,x*y+w-(l.current?.scrollLeft??0))}),e[6]=w,e[7]=x,e[8]=l,e[9]=M,e[10]=y,e[11]=H):H=e[11];const F=!t;let q;e[12]!==r||e[13]!==w||e[14]!==f||e[15]!==C||e[16]!==y?(q=()=>{f&&f(r),g.current=je(r,{startLeft:w,scaleWidth:y,scale:C}),v.current?.updateLeft(g.current)},e[12]=r,e[13]=w,e[14]=f,e[15]=C,e[16]=y,e[17]=q):q=e[17];let D;e[18]!==w||e[19]!==b||e[20]!==C||e[21]!==s||e[22]!==y?(D=()=>{if(typeof g.current<"u"){const d=tt(g.current,{startLeft:w,scale:C,scaleWidth:y});s({time:d}),b&&b(d)}g.current=void 0},e[18]=w,e[19]=b,e[20]=C,e[21]=s,e[22]=y,e[23]=D):D=e[23];let I;e[24]!==w||e[25]!==m||e[26]!==C||e[27]!==l||e[28]!==s||e[29]!==y?(I=(d,T)=>{const{left:V}=d,B=T===void 0?0:T,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<w-J&&(g.current=w-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<w-J?g.current=w-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"){v.current?.updateLeft(g.current);const O=tt(g.current+J,{startLeft:w,scale:C,scaleWidth:y});s({time:O}),m&&m(O)}return!1},e[24]=w,e[25]=m,e[26]=C,e[27]=l,e[28]=s,e[29]=y,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]!==w||e[35]!==l||e[36]!==H||e[37]!==F||e[38]!==q||e[39]!==D||e[40]!==I?(me=E.jsx(or,{start:w,ref:v,parentRef:l,getBounds:H,autoScroll:!0,enableDragging:F,enableResizing:!1,onDragStart:q,onDragEnd:D,onDrag:I,children:fe}),e[34]=w,e[35]=l,e[36]=H,e[37]=F,e[38]=q,e[39]=D,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(Co);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=To(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 Co(n){return p.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===xo}function To(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,...b}=h,v=f?.[n]?.[a]||c,g=p.useMemo(()=>b,Object.values(b));return E.jsx(v.Provider,{value:g,children:m})};u.displayName=o+"Provider";function l(h,f){const m=f?.[n]?.[a]||c,b=p.useContext(m);if(b)return b;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 v=jt(r.current).includes(CSS.escape(m.animationName));if(m.target===e&&v&&(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,b]=p.useState(null),[v,g]=p.useState(null),[S,_]=p.useState(0),[w,y]=p.useState(0),[C,x]=p.useState(!1),[R,W]=p.useState(!1),L=nt(e,M=>a(M)),P=ko(s);return E.jsx(zo,{scope:t,type:r,dir:P,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:l,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:b,scrollbarXEnabled:C,onScrollbarXEnabledChange:x,scrollbarY:v,onScrollbarYChange:g,scrollbarYEnabled:R,onScrollbarYEnabledChange:W,onCornerWidthChange:_,onCornerHeightChange:y,children:E.jsx(Ot.div,{dir:P,...i,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":w+"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 Te="ScrollAreaScrollbar",mr=p.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Se(Te,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=Te;var Fo=p.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Se(Te,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(Te,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(Te,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(Te,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(Te,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(Te,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(Te),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(Te,t),[b,v]=p.useState(null),g=nt(e,L=>v(L)),S=p.useRef(null),_=p.useRef(""),w=m.viewport,y=r.content-r.viewport,C=Qe(l),x=Qe(a),R=Jt(h,10);function W(L){if(S.current){const P=L.clientX-S.current.left,M=L.clientY-S.current.top;u({x:P,y:M})}}return p.useEffect(()=>{const L=P=>{const M=P.target;b?.contains(M)&&C(P,y)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[w,b,y,C]),p.useEffect(x,[r,x]),xt(b,R),xt(m.content,R),E.jsx(Ho,{scope:t,scrollbar:b,hasThumb:s,onThumbChange:Qe(o),onThumbPointerUp:Qe(i),onThumbPositionChange:x,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),S.current=b.getBoundingClientRect(),_.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 P=L.target;P.hasPointerCapture(L.pointerId)&&P.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=_.current,m.viewport&&(m.viewport.style.scrollBehavior=""),S.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(),b=h.clientX-m.left,v=h.clientY-m.top;i.onThumbPointerDown({x:b,y:v})}),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=A.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 b=A.useRef(null),[v,g]=A.useState(s),[S,_]=A.useState(ln),[w,y]=A.useState(Ar),C=A.useCallback(P=>{const M=Math.min(h,Math.max(l,P));_(M)},[h,l]);A.useLayoutEffect(()=>{C(Ir(s,{scale:c})),g(s)},[s,l,h,c,C]);const x=P=>{f?.(P)},R=P=>{let{left:M,time:H}=P;return typeof H<"u"?(y(H),!0):typeof M<"u"?(y(tt(M,{startLeft:u,scale:c,scaleWidth:a})),!0):!1};A.useImperativeHandle(e,()=>({get target(){return b.current},set time(P){R({time:P})},get time(){return w},setScrollLeft:P=>{b.current&&(b.current.scrollLeft=P)},setScrollTop:P=>{b.current&&(b.current.scrollTop=P)}}));const{width:W,height:L}=So(b);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:b,onScroll:P=>{m?.(P.currentTarget)},children:[E.jsx(co,{...t,setCursor:R,scaleCount:S,scrollElementRef:b}),E.jsx(io,{...t,scrollElementRef:b,timelineWidth:W,timelineHeight:L,disableDrag:i,editorData:v,cursorTime:w,scaleCount:S,setScaleCount:C,setEditorData:x}),!o&&E.jsx(yo,{...t,timelineWidth:W,height:L,scaleCount:S,setScaleCount:C,setCursor:R,cursorTime:w,editorData:v,scrollElementRef:b})]}),E.jsx(Yn,{orientation:"horizontal"}),E.jsx(Yn,{orientation:"vertical"}),E.jsx(Jo,{})]})});exports.Timeline=Zo;
|