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