@kteneyck/cesium-timeline-react 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cesium-timeline-react.js +765 -740
- package/dist/cesium-timeline-react.umd.cjs +4 -4
- package/dist/index.d.ts +10 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(q,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("react"),require("cesium"),require("@kteneyck/cesium-timeline-core")):typeof define=="function"&&define.amd?define(["exports","react","cesium","@kteneyck/cesium-timeline-core"],r):(q=typeof globalThis<"u"?globalThis:q||self,r(q.CesiumTimelineReact={},q.React,q.Cesium,q.CesiumTimelineCore))})(this,(function(q,r,Xt,y){"use strict";function Yt(v){const _=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(v){for(const O in v)if(O!=="default"){const u=Object.getOwnPropertyDescriptor(v,O);Object.defineProperty(_,O,u.get?u:{enumerable:!0,get:()=>v[O]})}}return _.default=v,Object.freeze(_)}const A=Yt(Xt);var Rt={exports:{}},xt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Ct;function zt(){if(Ct)return xt;Ct=1;var v=Symbol.for("react.transitional.element"),_=Symbol.for("react.fragment");function O(u,T,j){var P=null;if(j!==void 0&&(P=""+j),T.key!==void 0&&(P=""+T.key),"key"in T){j={};for(var J in T)J!=="key"&&(j[J]=T[J])}else j=T;return T=j.ref,{$$typeof:v,type:u,key:P,ref:T!==void 0?T:null,props:j}}return xt.Fragment=_,xt.jsx=O,xt.jsxs=O,xt}var vt={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var kt;function Wt(){return kt||(kt=1,process.env.NODE_ENV!=="production"&&(function(){function v(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ct?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case H:return"Fragment";case d:return"Profiler";case et:return"StrictMode";case f:return"Suspense";case w:return"SuspenseList";case nt:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case tt:return"Portal";case U:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case z:var h=e.render;return e=e.displayName,e||(e=h.displayName||h.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case k:return h=e.displayName||null,h!==null?h:v(e.type)||"Memo";case S:h=e._payload,e=e._init;try{return v(e(h))}catch{}}return null}function _(e){return""+e}function O(e){try{_(e);var h=!1}catch{h=!0}if(h){h=console;var b=h.error,D=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return b.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",D),_(e)}}function u(e){if(e===H)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===S)return"<...>";try{var h=v(e);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function T(){var e=N.A;return e===null?null:e.getOwner()}function j(){return Error("react-stack-top-frame")}function P(e){if(V.call(e,"key")){var h=Object.getOwnPropertyDescriptor(e,"key").get;if(h&&h.isReactWarning)return!1}return e.key!==void 0}function J(e,h){function b(){l||(l=!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)",h))}b.isReactWarning=!0,Object.defineProperty(e,"key",{get:b,configurable:!0})}function W(){var e=v(this.type);return I[e]||(I[e]=!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.")),e=this.props.ref,e!==void 0?e:null}function C(e,h,b,D,lt,ut){var M=b.ref;return e={$$typeof:$,type:e,key:h,props:b,_owner:D},(M!==void 0?M:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:W}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:lt}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ut}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function G(e,h,b,D,lt,ut){var M=h.children;if(M!==void 0)if(D)if(X(M)){for(D=0;D<M.length;D++)B(M[D]);Object.freeze&&Object.freeze(M)}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 B(M);if(V.call(h,"key")){M=v(e);var at=Object.keys(h).filter(function(bt){return bt!=="key"});D=0<at.length?"{key: someKey, "+at.join(": ..., ")+": ...}":"{key: someKey}",ot[M+D]||(at=0<at.length?"{"+at.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,L,O,ut,O),it[O+L]=!0)}if(O=null,w!==void 0&&(S(w),O=""+w),V(f)&&(S(f.key),O=""+f.key),"key"in f){w={};for(var Q in f)Q!=="key"&&(w[Q]=f[Q])}else w=f;return O&&N(w,typeof e=="function"?e.displayName||e.name||"Unknown":e),A(e,O,w,R(),nt,ft)}function rt(e){$(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===Y&&(e._payload.status==="fulfilled"?$(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function $(e){return typeof e=="object"&&e!==null&&e.$$typeof===K}var tt=o,K=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),p=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),lt=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),z=Symbol.for("react.client.reference"),I=tt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,a=Object.prototype.hasOwnProperty,X=Array.isArray,W=console.createTask?console.createTask:function(){return null};tt={react_stack_bottom_frame:function(e){return e()}};var ot,B={},F=tt.react_stack_bottom_frame.bind(tt,P)(),ct=W(i(P)),it={};vt.Fragment=k,vt.jsx=function(e,f,w){var L=1e4>I.recentlyCreatedOwnerStacks++;return U(e,f,w,!1,L?Error("react-stack-top-frame"):F,L?W(i(e)):ct)},vt.jsxs=function(e,f,w){var L=1e4>I.recentlyCreatedOwnerStacks++;return U(e,f,w,!0,L?Error("react-stack-top-frame"):F,L?W(i(e)):ct)}})()),vt}var Ct;function zt(){return Ct||(Ct=1,process.env.NODE_ENV==="production"?Et.exports=Xt():Et.exports=Yt()),Et.exports}var u=zt();const Wt=520,Bt=()=>u.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"0",width:"4",height:"16",rx:"1"}),u.jsx("rect",{x:"9",y:"0",width:"4",height:"16",rx:"1"})]}),St=()=>u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("polyline",{points:"3,5 7,9 11,5"})}),kt=()=>u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("polyline",{points:"3,9 7,5 11,9"})}),Lt=({currentTime:x,isPlaying:M,multiplier:S,dateTimeFormat:i,isLive:R,hasStartTime:P,hasEndTime:V,onPlayPause:N,onJumpToStart:H,onRewind:A,onFastForward:U,onJumpToEnd:rt,onJumpToLive:$,onResetSpeed:tt,onDateTimeClick:K,theme:v,swimLanesVisible:k,onToggleSwimLanes:C})=>{const Z=S<0,E=S>1,p=S===1,b=Math.abs(S),D=o.useRef(null),[T,lt]=o.useState(!1);o.useEffect(()=>{const a=D.current;if(!a)return;const X=new ResizeObserver(([W])=>{lt(W.contentRect.width<Wt)});return X.observe(a),()=>X.disconnect()},[]);const Y={background:"none",border:"1px solid transparent",cursor:"pointer",fontSize:"16px",padding:"0",display:"flex",alignItems:"center",justifyContent:"center",minWidth:"32px",width:"32px",height:"32px",borderRadius:"4px",transition:"background-color 0.15s, color 0.15s",fontFamily:"system-ui, -apple-system, sans-serif",flexShrink:0,lineHeight:1},G=a=>({...Y,color:a?v.buttonActiveColor:v.buttonColor,borderColor:a?`${v.buttonActiveColor}33`:"transparent"}),z=(a,X)=>{a.currentTarget.style.backgroundColor=X?`${v.buttonActiveColor}22`:v.buttonHoverColor+"44"},I=a=>{a.currentTarget.style.backgroundColor="transparent"};return u.jsxs("div",{ref:D,style:{display:T?"flex":"grid",gridTemplateColumns:T?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:v.controlBarBackground,borderBottom:`1px solid ${v.controlBarBorder}`,fontFamily:"system-ui, -apple-system, sans-serif"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[u.jsx("div",{onClick:K,title:K?"Click to jump to a date/time":void 0,style:{color:v.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:K?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:a=>{K&&(a.currentTarget.style.background=v.buttonHoverColor+"44")},onMouseLeave:a=>a.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:a,dateFormat:X}=y.splitForDisplay(i);return u.jsxs(u.Fragment,{children:[a&&u.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:y.formatDateTime(x,a)}),X&&u.jsx("div",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:v.buttonActiveColor},children:y.formatDateTime(x,X)})]})})()}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"},children:[u.jsx("button",{onClick:$,style:{...Y,fontSize:"11px",fontWeight:"bold",letterSpacing:"0.05em",width:"52px",minWidth:"52px",height:"20px",borderRadius:"3px",color:R?v.controlBarBackground:v.buttonActiveColor,backgroundColor:R?v.buttonActiveColor:"transparent",borderColor:v.buttonActiveColor,opacity:R?1:.55},onMouseEnter:a=>{a.currentTarget.style.opacity="1"},onMouseLeave:a=>{a.currentTarget.style.opacity=R?"1":"0.55"},title:R?"Currently live":"Jump to live (now)",children:R?"● LIVE":"LIVE"}),u.jsx("div",{style:{height:"20px",display:"flex",alignItems:"center"},children:!p&&u.jsx("button",{onClick:()=>tt(),style:{...Y,fontSize:"11px",color:v.buttonActiveColor,borderColor:`${v.buttonActiveColor}44`,width:"52px",minWidth:"52px",height:"20px"},onMouseEnter:a=>z(a,!0),onMouseLeave:I,title:"Reset to 1× speed",children:Z?`◀ ${b}×`:`${b}× ▶`})})]})]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...T?{flex:1,justifyContent:"center"}:{}},children:[P&&u.jsx("button",{onClick:H,style:G(!1),onMouseEnter:a=>z(a,!1),onMouseLeave:I,title:"Jump to start",children:"⏮"}),u.jsx("button",{onClick:A,style:{...G(Z),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>z(a,Z),onMouseLeave:I,title:Z?`Reverse ${b}× — click to speed up, press play to stop`:"Rewind",children:Z?u.jsxs(u.Fragment,{children:[u.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[b,"×"]}),"◀◀"]}):"◀◀"}),u.jsx("button",{onClick:()=>N(!M),style:{...Y,color:v.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${v.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:M?"0":"2px"},onMouseEnter:a=>z(a,!0),onMouseLeave:I,title:M?"Pause":Z?"Play (reset to 1×)":"Play",children:M?u.jsx(Bt,{}):"▶"}),u.jsx("button",{onClick:U,style:{...G(E),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>z(a,E),onMouseLeave:I,title:E?`${b}× speed — click to increase, click again at max to reset`:"Fast forward",children:E?u.jsxs(u.Fragment,{children:["▶▶",u.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[b,"×"]})]}):"▶▶"}),V&&u.jsx("button",{onClick:rt,style:G(!1),onMouseEnter:a=>z(a,!1),onMouseLeave:I,title:"Jump to end",children:"⏭"})]}),!T&&u.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:C!=null&&k!=null&&u.jsx("button",{onClick:C,style:{...Y,color:v.buttonActiveColor,borderColor:`${v.buttonActiveColor}33`},onMouseEnter:a=>z(a,k),onMouseLeave:I,title:k?"Collapse swim lanes":"Expand swim lanes",children:k?u.jsx(St,{}):u.jsx(kt,{})})}),T&&C!=null&&k!=null&&u.jsx("button",{onClick:C,style:{...Y,color:v.buttonActiveColor,borderColor:`${v.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:a=>z(a,k),onMouseLeave:I,title:k?"Collapse swim lanes":"Expand swim lanes",children:k?u.jsx(St,{}):u.jsx(kt,{})})]})},yt=o.forwardRef((x,M)=>{const{currentTime:S,defaultStartMs:i,defaultEndMs:R,theme:P,maxTicks:V,onTimeChange:N,onDragStart:H,onDragEnd:A,swimLanes:U,showSwimLanes:rt,onSwimLaneItemClick:$,onSwimLaneItemHover:tt,onSwimLaneItemDoubleClick:K,onSwimLaneItemContextMenu:v,onSwimLaneReorder:k}=x,C=o.useRef(null),Z=o.useRef(P),E=o.useRef(V),p=o.useRef(i),b=o.useRef(R),D=o.useRef(j.JulianDate.toDate(S).getTime());o.useEffect(()=>{Z.current=P},[P]),o.useEffect(()=>{E.current=V},[V]);const T=o.useRef(U??[]),lt=o.useRef(rt??(U!=null&&U.length>0)),Y=o.useRef(0),G=o.useRef(null),z=o.useRef(null),I=o.useRef($),a=o.useRef(tt),X=o.useRef(K),W=o.useRef(v),ot=o.useRef(k);o.useEffect(()=>{I.current=$},[$]),o.useEffect(()=>{a.current=tt},[tt]),o.useEffect(()=>{X.current=K},[K]),o.useEffect(()=>{W.current=v},[v]),o.useEffect(()=>{ot.current=k},[k]),o.useEffect(()=>{T.current=U??[],l()},[U]),o.useEffect(()=>{lt.current=rt??(U!=null&&U.length>0),l()},[rt,U]);const B=o.useRef(null),F=o.useRef(null),ct=o.useRef(!1),it=o.useRef(0),e=o.useRef("none"),f=o.useRef(0),w=o.useRef(0),L=o.useRef(0),nt=o.useRef("none"),ft=o.useRef(0),O=o.useRef(0),ut=(t,n)=>Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),Q=o.useCallback(()=>({startMs:p.current,endMs:b.current,currentMs:D.current,theme:Z.current,maxTicks:E.current,swimLanes:T.current,showSwimLanes:lt.current,scrollTop:Y.current,reorderState:z.current}),[]);o.useImperativeHandle(M,()=>({zoomTo(t,n,r){const c=Math.max(y.MIN_SPAN_MS,Math.min(y.MAX_SPAN_MS,n-t)),s=(t+n)/2;p.current=s-c/2,b.current=s+c/2,r!==void 0&&(D.current=r),l()},getVisibleRange(){return{startMs:p.current,endMs:b.current}},startFollow(t){if(it.current=t,F.current!==null)return;ct.current=!0;let n=performance.now();const r=()=>{const c=performance.now(),s=c-n;n=c;const h=s*it.current;p.current+=h,b.current+=h,D.current+=h,l(),F.current=requestAnimationFrame(r)};F.current=requestAnimationFrame(r)},stopFollow(){ct.current=!1,F.current!==null&&(cancelAnimationFrame(F.current),F.current=null)},correctFollow(t){if(!ct.current)return;const n=t-D.current;D.current=t,p.current+=n,b.current+=n},appendSwimLane(t){T.current=[...T.current,t],l()},updateSwimLane(t,n){T.current=T.current.map(r=>r.id===t?{...r,...n,id:r.id}:r),l()},removeSwimLane(t){T.current=T.current.filter(n=>n.id!==t),l()},reorderSwimLanes(t){const n=new Map(T.current.map(c=>[c.id,c])),r=[];for(const c of t){const s=n.get(c);s&&r.push(s)}T.current=r,l()}}));const l=o.useCallback(()=>{const t=C.current;if(!t)return;const n=t.getContext("2d");if(!n)return;const r=t.getBoundingClientRect(),c=r.width,s=r.height;if(c===0||s===0)return;const h=window.devicePixelRatio||1,m=Math.round(c*h),g=Math.round(s*h);(t.width!==m||t.height!==g)&&(t.width=m,t.height=g),n.save(),n.scale(h,h);const J=y.drawTimeline(n,c,s,Q());J!==Y.current&&(Y.current=J),n.restore()},[Q]);o.useLayoutEffect(()=>{l();const t=C.current;if(!t)return;const n=new ResizeObserver(()=>l());return n.observe(t),()=>n.disconnect()},[l]),o.useEffect(()=>{if(ct.current)return;const t=j.JulianDate.toDate(S).getTime();D.current!==t&&(D.current=t,l())},[S,l]);const ht=o.useCallback(t=>{if(B.current!==null)return;const n=()=>{const r=C.current,c=b.current-p.current,s=t*c*.01;if(p.current+=s,b.current+=s,r){const h=r.getBoundingClientRect(),m=Math.max(0,Math.min(h.width,w.current-h.left)),g=p.current+m/h.width*(b.current-p.current);D.current=g,N(j.JulianDate.fromDate(new Date(g)))}l(),B.current=requestAnimationFrame(n)};B.current=requestAnimationFrame(n)},[l,N]),at=o.useCallback(()=>{B.current!==null&&(cancelAnimationFrame(B.current),B.current=null)},[]),st=o.useCallback((t,n,r,c)=>y.hitTestSwimLane(t,n,r,c,Q()),[Q]),gt=o.useCallback((t,n,r)=>y.hitTestLaneLabel(t,n,r,Q()),[Q]),pt=o.useCallback((t,n)=>y.isInSwimLaneRegion(t,n,Q()),[Q]),Tt=o.useCallback(t=>{t.preventDefault();const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,c=t.clientY-n.top;if(t.button===0&&ot.current){const s=gt(r,c,n.height);if(s){const m=T.current.findIndex(g=>g.id===s.id);z.current={dragging:!0,dragLaneId:s.id,dragStartY:t.clientY,currentY:t.clientY,insertIndex:m},t.currentTarget.style.cursor="grabbing";return}}if(t.button===0&&pt(c,n.height)){const s=(D.current-p.current)/(b.current-p.current)*n.width;if(!(Math.abs(r-s)<=10)&&st(r,c,n.width,n.height)){L.current=performance.now();return}}if(t.button===0){e.current="scrub",w.current=t.clientX,t.currentTarget.style.cursor="grabbing",H==null||H();const s=p.current+r/n.width*(b.current-p.current);D.current=s,l(),N(j.JulianDate.fromDate(new Date(s)))}else if(t.button===1)e.current="slide",f.current=t.clientX;else if(t.button===2){if(W.current&&pt(c,n.height))return;e.current="zoom",f.current=t.clientX}},[l,N,H,gt,pt,st]);o.useEffect(()=>{const t=r=>{const c=z.current;if(c&&c.dragging){c.currentY=r.clientY;const g=C.current;if(g){const J=g.getBoundingClientRect(),q=r.clientY-J.top;let Rt=-Y.current;const _t=T.current;let Pt=_t.length;for(let wt=0;wt<_t.length;wt++){const Ft=_t[wt].height??y.DEFAULT_LANE_HEIGHT,Gt=Rt+Ft/2;if(q<Gt){Pt=wt;break}Rt+=Ft+y.LANE_GAP}c.insertIndex=Pt}l();return}if(e.current==="none")return;const s=C.current;if(!s)return;const h=s.getBoundingClientRect(),m=h.width;if(e.current==="scrub"){w.current=r.clientX;const g=r.clientX-h.left,J=m*.08;g<J?ht(-1):g>m-J?ht(1):at();const q=Math.max(0,Math.min(m,g)),dt=p.current+q/m*(b.current-p.current);D.current=dt,l(),N(j.JulianDate.fromDate(new Date(dt)))}else if(e.current==="slide"){const g=f.current-r.clientX;if(f.current=r.clientX,g!==0){const J=g/m*(b.current-p.current);p.current+=J,b.current+=J,l()}}else if(e.current==="zoom"){const g=f.current-r.clientX;f.current=r.clientX,g!==0&&mt(Math.pow(1.01,g))}},n=()=>{var c;const r=z.current;if(r&&r.dragging){const s=Math.abs(r.currentY-r.dragStartY),h=T.current,m=h.findIndex(g=>g.id===r.dragLaneId);if(s>5&&m>=0&&r.insertIndex!==m&&r.insertIndex!==m+1){const g=[...h],[J]=g.splice(m,1),q=r.insertIndex>m?r.insertIndex-1:r.insertIndex;g.splice(q,0,J),T.current=g,(c=ot.current)==null||c.call(ot,g.map(dt=>dt.id))}z.current=null,C.current&&(C.current.style.cursor="default"),l();return}at(),e.current="none",C.current&&(C.current.style.cursor="default"),A==null||A()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}},[l,N,A,ht,at]);const mt=o.useCallback(t=>{const n=y.zoomRange(p.current,b.current,t);p.current=n.startMs,b.current=n.endMs,l()},[l]),bt=o.useCallback(t=>{t.preventDefault();const n=C.current;if(!n)return;const r=n.getBoundingClientRect(),c=t.clientY-r.top,s=lt.current,h=T.current;if(s&&h.length>0){const m=Math.max(0,r.height-y.TICK_AREA_HEIGHT);if(c>=0&&c<m){let g=0;for(const q of h)g+=(q.height??y.DEFAULT_LANE_HEIGHT)+y.LANE_GAP;const J=Math.max(0,g-m);if(J>0){Y.current=Math.max(0,Math.min(J,Y.current+t.deltaY*y.SWIM_LANE_SCROLL_SPEED)),l();return}}}mt(Math.pow(1.05,t.deltaY>0?-1:1))},[mt,l]);o.useEffect(()=>{const t=C.current;if(t)return t.addEventListener("wheel",bt,{passive:!1}),()=>t.removeEventListener("wheel",bt)},[bt]),o.useEffect(()=>{const t=C.current;if(!t)return;const n=s=>{s.preventDefault();const h=t.getBoundingClientRect();if(s.touches.length===1){const m=s.touches[0].clientX-h.left,g=Math.max(0,Math.min(h.width,m)),J=p.current+g/h.width*(b.current-p.current);nt.current="scrub",ft.current=s.touches[0].clientX,w.current=s.touches[0].clientX,D.current=J,l(),H==null||H(),N(j.JulianDate.fromDate(new Date(J)))}else s.touches.length>=2&&(nt.current="pinch",O.current=ut(s.touches[0],s.touches[1]))},r=s=>{s.preventDefault();const h=t.getBoundingClientRect();if(nt.current==="scrub"&&s.touches.length>=1){const m=s.touches[0].clientX-h.left,g=h.width*.08;if(w.current=s.touches[0].clientX,m<g)ht(-1);else if(m>h.width-g)ht(1);else{at();const J=Math.max(0,Math.min(h.width,m)),q=p.current+J/h.width*(b.current-p.current);D.current=q,l(),N(j.JulianDate.fromDate(new Date(q)))}}else if(nt.current==="slide"&&s.touches.length>=1){const m=ft.current-s.touches[0].clientX;if(ft.current=s.touches[0].clientX,m!==0){const g=m/h.width*(b.current-p.current);p.current+=g,b.current+=g,l()}}else if(nt.current==="pinch"&&s.touches.length>=2){const m=ut(s.touches[0],s.touches[1]);m>0&&O.current>0&&mt(O.current/m),O.current=m}},c=s=>{at(),nt.current==="scrub"&&(A==null||A()),s.touches.length===0?nt.current="none":s.touches.length===1&&(nt.current="slide",ft.current=s.touches[0].clientX)};return t.addEventListener("touchstart",n,{passive:!1}),t.addEventListener("touchmove",r,{passive:!1}),t.addEventListener("touchend",c,{passive:!1}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",r),t.removeEventListener("touchend",c)}},[l,H,A,N,mt,ht,at]);const Mt=o.useCallback(t=>{var m,g,J;if(e.current!=="none")return;const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,c=t.clientY-n.top,s=(D.current-p.current)/(b.current-p.current)*n.width,h=Math.abs(r-s)<=10;if(pt(c,n.height)){const q=st(r,c,n.width,n.height),dt=G.current;if(q)t.currentTarget.style.cursor=h?"grab":"pointer",(!dt||dt.item.id!==q.item.id||dt.lane.id!==q.lane.id)&&(G.current=q,(m=a.current)==null||m.call(a,{laneId:q.lane.id,item:q.item,originalEvent:t.nativeEvent}),l());else if(dt&&(G.current=null,(g=a.current)==null||g.call(a,null),l()),h)t.currentTarget.style.cursor="grab";else{const Rt=gt(r,c,n.height);t.currentTarget.style.cursor=Rt&&ot.current?"grab":"default"}return}G.current&&(G.current=null,(J=a.current)==null||J.call(a,null),l()),t.currentTarget.style.cursor=h?"grab":"default"},[l,st,pt,gt]),Dt=o.useCallback(t=>{var m;if(performance.now()-L.current>300)return;const r=t.currentTarget.getBoundingClientRect(),c=t.clientX-r.left,s=t.clientY-r.top,h=st(c,s,r.width,r.height);h&&((m=I.current)==null||m.call(I,{laneId:h.lane.id,item:h.item,originalEvent:t.nativeEvent}))},[st]),d=o.useCallback(t=>{var h;const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,c=t.clientY-n.top,s=st(r,c,n.width,n.height);s&&((h=X.current)==null||h.call(X,{laneId:s.lane.id,item:s.item,originalEvent:t.nativeEvent}))},[st]),_=o.useCallback(t=>{const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,c=t.clientY-n.top,s=st(r,c,n.width,n.height);s&&W.current?(t.preventDefault(),W.current({laneId:s.lane.id,item:s.item,originalEvent:t.nativeEvent})):t.preventDefault()},[st]);return o.useEffect(()=>()=>{B.current!==null&&cancelAnimationFrame(B.current),F.current!==null&&cancelAnimationFrame(F.current)},[]),u.jsx("canvas",{ref:C,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:Tt,onMouseMove:Mt,onClick:Dt,onDoubleClick:d,onMouseLeave:()=>{var t;G.current&&(G.current=null,(t=a.current)==null||t.call(a,null),l()),e.current==="none"&&C.current&&(C.current.style.cursor="default")},onContextMenu:_})});yt.displayName="TimelineCanvas";const Ot=[2,4,8,16,32,100,1],It=[1,2,4,8,16,32,100],Ht=({startTime:x,endTime:M,currentTime:S,clock:i,onTimeChange:R,onPlayPause:P,onMultiplierChange:V,height:N,showControls:H=!0,enableDrag:A=!0,dateTimeFormat:U,onDateTimeClick:rt,jumpToTime:$,maxTicks:tt,ffSpeeds:K=Ot,rwSpeeds:v=It,theme:k,className:C,swimLanes:Z,showSwimLanes:E,onShowSwimLanesChange:p,swimLaneTransition:b="animated",onSwimLaneItemClick:D,onSwimLaneItemHover:T,onSwimLaneItemDoubleClick:lt,onSwimLaneItemContextMenu:Y,onSwimLaneReorder:G})=>{const z=()=>Date.now(),I=x?j.JulianDate.toDate(y.toJulianDate(x)).getTime():z()-432e5,a=M?j.JulianDate.toDate(y.toJulianDate(M)).getTime():z()+12*3600*1e3,[X,W]=o.useState(()=>y.toJulianDate(S??x??j.JulianDate.fromDate(new Date))),[ot,B]=o.useState((i==null?void 0:i.shouldAnimate)??!1),[F,ct]=o.useState((i==null?void 0:i.multiplier)??1),[it,e]=o.useState(E??!0);o.useEffect(()=>{E!=null&&e(E)},[E]);const f=()=>{const d=!it;e(d),p==null||p(d)},w=Z!=null&&Z.length>0,L=o.useRef(null),[nt,ft]=o.useState(0);o.useEffect(()=>{const d=L.current;if(!d)return;const _=new ResizeObserver(([t])=>ft(t.borderBoxSize[0].blockSize));return _.observe(d),()=>_.disconnect()},[H]);const ut=w&&!it?`${nt+y.TICK_AREA_HEIGHT}px`:N!=null?`${N}px`:"100%",Q=o.useRef(!1),l=o.useRef(null),ht={...y.defaultTheme,...k};o.useEffect(()=>{if(!i)return;const d=()=>{if(!Q.current){const _=j.JulianDate.clone(i.currentTime);if(W(_),B(i.shouldAnimate),ct(i.multiplier),l.current){const{startMs:t,endMs:n}=l.current.getVisibleRange(),r=n-t,c=j.JulianDate.toDate(_).getTime(),s=c-t;s<=r*.1?l.current.zoomTo(c-r*.1,c+r*.9,c):s>=r*.9&&l.current.zoomTo(c-r*.9,c+r*.1,c)}}};return i.onTick.addEventListener(d),()=>{i.onTick.removeEventListener(d)}},[i]),o.useEffect(()=>{if(i)return;const d=setInterval(()=>{if(Q.current)return;const _=j.JulianDate.fromDate(new Date);if(W(_),l.current){const{startMs:t,endMs:n}=l.current.getVisibleRange(),r=n-t,c=j.JulianDate.toDate(_).getTime(),s=c-t;s<=r*.1?l.current.zoomTo(c-r*.1,c+r*.9,c):s>=r*.9&&l.current.zoomTo(c-r*.9,c+r*.1,c)}},1e3);return()=>clearInterval(d)},[i]),o.useEffect(()=>{if(!$)return;const d=y.toJulianDate($);if(st(d),l.current){const{startMs:_,endMs:t}=l.current.getVisibleRange(),n=t-_,r=j.JulianDate.toDate(d).getTime();l.current.zoomTo(r-n/2,r+n/2)}},[$]);const at=(d,_=!0)=>{i&&(i.multiplier=d,_&&(i.shouldAnimate=!0)),ct(d),_&&B(!0),V==null||V(d)},st=d=>{W(d),i&&(i.currentTime=j.JulianDate.clone(d)),R==null||R(d)},gt=d=>{d&&F<0&&at(1,!1),i&&(i.shouldAnimate=d),B(d),P==null||P(d)},pt=()=>{const d=K.length>0?K:Ot,_=F>1?F:1,t=d.indexOf(_),n=d[t<0||t===d.length-1?0:t+1];at(n)},Tt=()=>{const d=v.length>0?v:It,_=F<0?Math.abs(F):0,t=d.indexOf(_),n=-d[t<0||t===d.length-1?0:t+1];at(n)},mt=()=>{var _;const d=y.toJulianDate(x??j.JulianDate.fromDate(new Date(I)));i&&(i.currentTime=j.JulianDate.clone(d)),W(d),(_=l.current)==null||_.zoomTo(I,a)},bt=()=>{var _;const d=y.toJulianDate(M??j.JulianDate.fromDate(new Date(a)));i&&(i.currentTime=j.JulianDate.clone(d)),W(d),(_=l.current)==null||_.zoomTo(I,a)},Mt=()=>{var t;const d=j.JulianDate.fromDate(new Date);i&&(i.currentTime=j.JulianDate.clone(d)),W(d),at(1);const _=Date.now();(t=l.current)==null||t.zoomTo(_-12*3600*1e3,_+12*3600*1e3)},Dt=Math.abs(j.JulianDate.toDate(X).getTime()-Date.now())<1e4;return u.jsxs("div",{className:C,style:{width:"100%",height:ut,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:b==="animated"?"height 0.2s ease":void 0},children:[H&&u.jsx("div",{ref:L,children:u.jsx(Lt,{currentTime:X,isPlaying:ot,multiplier:F,isLive:Dt,hasStartTime:x!=null,hasEndTime:M!=null,onPlayPause:gt,onJumpToStart:mt,onRewind:Tt,onFastForward:pt,onJumpToEnd:bt,onJumpToLive:Mt,onResetSpeed:()=>at(1),onDateTimeClick:rt,dateTimeFormat:U,theme:ht,swimLanesVisible:w?it:void 0,onToggleSwimLanes:w?f:void 0})}),A!==!1&&u.jsx(yt,{ref:l,currentTime:X,defaultStartMs:I,defaultEndMs:a,theme:ht,maxTicks:tt,onTimeChange:st,onDragStart:()=>{Q.current=!0},onDragEnd:()=>{Q.current=!1},swimLanes:Z,showSwimLanes:it,onSwimLaneItemClick:D,onSwimLaneItemHover:T,onSwimLaneItemDoubleClick:lt,onSwimLaneItemContextMenu:Y,onSwimLaneReorder:G})]})},Ut=({startTime:x,endTime:M,currentTime:S,width:i,height:R,tickInterval:P,showLabels:V,snapToTicks:N,enableDrag:H,theme:A,onTimeChange:U,onVisibleRangeChange:rt,onDragStart:$,onDragEnd:tt})=>{const K=o.useMemo(()=>y.generateTicks(x,M,P,i),[x,M,P,i]),v=o.useMemo(()=>y.timeToPosition(S,x,M,i),[S,x,M,i]),k=o.useRef(null),C=E=>{if(!H)return;const p=E.currentTarget.getBoundingClientRect(),b=E.clientX-p.left,D=Math.max(0,Math.min(i,b));if(!(Math.abs(D-v)<=10)){let B=D;N&&(B=y.snapToTick(D,K,10));const F=new Date(x).getTime(),ct=new Date(M).getTime();U(j.JulianDate.fromDate(new Date(F+B/i*(ct-F))));return}$==null||$();const lt=E.clientX,Y=new Date(S).getTime(),G=new Date(x).getTime(),I=(new Date(M).getTime()-G)/i;let a=0,X=!1;const W=B=>{a=B.clientX-lt,X=!0,k.current||(k.current=requestAnimationFrame(()=>{if(X){const F=Y+a*I;U(j.JulianDate.fromDate(new Date(F))),X=!1}k.current=null}))},ot=()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",ot),k.current!==null&&(cancelAnimationFrame(k.current),k.current=null),tt==null||tt()};document.addEventListener("mousemove",W),document.addEventListener("mouseup",ot)},Z=E=>{E.preventDefault();const p=E.shiftKey?E.deltaY:E.deltaX!==0?E.deltaX:E.deltaY;if(Math.abs(p)<1)return;const b=new Date(x).getTime(),D=new Date(M).getTime(),T=p/i*(D-b)*.5;rt==null||rt(j.JulianDate.fromDate(new Date(b+T)),j.JulianDate.fromDate(new Date(D+T)))};return u.jsxs("svg",{width:"100%",height:R,style:{backgroundColor:A.backgroundColor,display:"block",cursor:"default"},onMouseDown:C,onWheel:Z,children:[u.jsx("rect",{width:i,height:R,fill:A.backgroundColor}),K.map((E,p)=>u.jsxs("g",{children:[u.jsx("line",{x1:E.position,y1:R-(E.isMajor?A.majorTickHeight:A.minorTickHeight),x2:E.position,y2:R,stroke:E.isMajor?A.majorTickColor:A.tickColor,strokeWidth:"1"}),V&&E.isMajor&&E.label&&u.jsx("text",{x:E.position,y:R-A.majorTickHeight-5,textAnchor:"middle",fill:A.labelColor,fontSize:A.fontSize,fontFamily:"monospace",children:E.label})]},p)),u.jsx("line",{x1:v,y1:0,x2:v,y2:R,stroke:A.indicatorColor,strokeWidth:A.indicatorLineWidth,pointerEvents:"none"}),H&&u.jsx("rect",{x:Math.max(0,v-10),y:0,width:20,height:R,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),u.jsx("circle",{cx:v,cy:5,r:4,fill:A.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(et,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>y.TICK_AREA_HEIGHT}),et.Timeline=Ht,et.TimelineCanvas=yt,et.TimelineControls=Lt,et.TimelineSVG=Ut,Object.keys(y).forEach(x=>{x!=="default"&&!Object.prototype.hasOwnProperty.call(et,x)&&Object.defineProperty(et,x,{enumerable:!0,get:()=>y[x]})}),Object.defineProperty(et,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,D,M,at,M),ot[M+D]=!0)}if(M=null,b!==void 0&&(O(b),M=""+b),P(h)&&(O(h.key),M=""+h.key),"key"in h){b={};for(var it in h)it!=="key"&&(b[it]=h[it])}else b=h;return M&&J(b,typeof e=="function"?e.displayName||e.name||"Unknown":e),C(e,M,b,T(),lt,ut)}function B(e){st(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===S&&(e._payload.status==="fulfilled"?st(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function st(e){return typeof e=="object"&&e!==null&&e.$$typeof===$}var Z=r,$=Symbol.for("react.transitional.element"),tt=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),et=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),U=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),nt=Symbol.for("react.activity"),ct=Symbol.for("react.client.reference"),N=Z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,X=Array.isArray,R=console.createTask?console.createTask:function(){return null};Z={react_stack_bottom_frame:function(e){return e()}};var l,I={},L=Z.react_stack_bottom_frame.bind(Z,j)(),rt=R(u(j)),ot={};vt.Fragment=H,vt.jsx=function(e,h,b){var D=1e4>N.recentlyCreatedOwnerStacks++;return G(e,h,b,!1,D?Error("react-stack-top-frame"):L,D?R(u(e)):rt)},vt.jsxs=function(e,h,b){var D=1e4>N.recentlyCreatedOwnerStacks++;return G(e,h,b,!0,D?Error("react-stack-top-frame"):L,D?R(u(e)):rt)}})()),vt}var St;function Bt(){return St||(St=1,process.env.NODE_ENV==="production"?Rt.exports=zt():Rt.exports=Wt()),Rt.exports}var a=Bt();const Ht=520,Ut=()=>a.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:[a.jsx("rect",{x:"1",y:"0",width:"4",height:"16",rx:"1"}),a.jsx("rect",{x:"9",y:"0",width:"4",height:"16",rx:"1"})]}),Lt=()=>a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("polyline",{points:"3,5 7,9 11,5"})}),Ot=()=>a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("polyline",{points:"3,9 7,5 11,9"})}),It=({currentTime:v,isPlaying:_,multiplier:O,dateTimeFormat:u,timezone:T,isLive:j,hasStartTime:P,hasEndTime:J,showJumpToStart:W=!0,showJumpToEnd:C=!0,onPlayPause:G,onJumpToStart:B,onRewind:st,onFastForward:Z,onJumpToEnd:$,onJumpToLive:tt,onResetSpeed:H,onDateTimeClick:et,theme:d,swimLanesVisible:E,onToggleSwimLanes:U})=>{const z=O<0,f=O>1,w=O===1,k=Math.abs(O),S=r.useRef(null),[nt,ct]=r.useState(!1);r.useEffect(()=>{const l=S.current;if(!l)return;const I=new ResizeObserver(([L])=>{ct(L.contentRect.width<Ht)});return I.observe(l),()=>I.disconnect()},[]);const N={background:"none",border:"1px solid transparent",cursor:"pointer",fontSize:"16px",padding:"0",display:"flex",alignItems:"center",justifyContent:"center",minWidth:"32px",width:"32px",height:"32px",borderRadius:"4px",transition:"background-color 0.15s, color 0.15s",fontFamily:"system-ui, -apple-system, sans-serif",flexShrink:0,lineHeight:1},V=l=>({...N,color:l?d.buttonActiveColor:d.buttonColor,borderColor:l?`${d.buttonActiveColor}33`:"transparent"}),X=(l,I)=>{l.currentTarget.style.backgroundColor=I?`${d.buttonActiveColor}22`:d.buttonHoverColor+"44"},R=l=>{l.currentTarget.style.backgroundColor="transparent"};return a.jsxs("div",{ref:S,style:{display:nt?"flex":"grid",gridTemplateColumns:nt?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:d.controlBarBackground,borderBottom:`1px solid ${d.controlBarBorder}`,fontFamily:"system-ui, -apple-system, sans-serif"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[a.jsx("div",{onClick:et,title:et?"Click to jump to a date/time":void 0,style:{color:d.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:et?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:l=>{et&&(l.currentTarget.style.background=d.buttonHoverColor+"44")},onMouseLeave:l=>l.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:l,dateFormat:I}=y.splitForDisplay(u),L=y.getTimezoneAbbr(v,T);return a.jsxs(a.Fragment,{children:[l&&a.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:y.formatDateTime(v,l,T)}),I&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[a.jsx("span",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:d.buttonActiveColor},children:y.formatDateTime(v,I,T)}),L&&a.jsx("span",{style:{fontSize:"0.9em",color:d.labelColor,opacity:.7,fontWeight:"bold",letterSpacing:"0.04em"},children:L})]})]})})()}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"},children:[a.jsx("button",{onClick:tt,style:{...N,fontSize:"11px",fontWeight:"bold",letterSpacing:"0.05em",width:"52px",minWidth:"52px",height:"20px",borderRadius:"3px",color:j?d.controlBarBackground:d.buttonActiveColor,backgroundColor:j?d.buttonActiveColor:"transparent",borderColor:d.buttonActiveColor,opacity:j?1:.55},onMouseEnter:l=>{l.currentTarget.style.opacity="1"},onMouseLeave:l=>{l.currentTarget.style.opacity=j?"1":"0.55"},title:j?"Currently live":"Jump to live (now)",children:j?"● LIVE":"LIVE"}),a.jsx("div",{style:{height:"20px",display:"flex",alignItems:"center"},children:!w&&a.jsx("button",{onClick:()=>H(),style:{...N,fontSize:"11px",color:d.buttonActiveColor,borderColor:`${d.buttonActiveColor}44`,width:"52px",minWidth:"52px",height:"20px"},onMouseEnter:l=>X(l,!0),onMouseLeave:R,title:"Reset to 1× speed",children:z?`◀ ${k}×`:`${k}× ▶`})})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...nt?{flex:1,justifyContent:"center"}:{}},children:[W&&a.jsx("button",{onClick:P?B:void 0,disabled:!P,style:{...V(!1),opacity:P?1:.3,cursor:P?"pointer":"default"},onMouseEnter:P?l=>X(l,!1):void 0,onMouseLeave:P?R:void 0,title:P?"Jump to start":"No start time set",children:"⏮"}),a.jsx("button",{onClick:st,style:{...V(z),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:l=>X(l,z),onMouseLeave:R,title:z?`Reverse ${k}× — click to speed up, press play to stop`:"Rewind",children:z?a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[k,"×"]}),"◀◀"]}):"◀◀"}),a.jsx("button",{onClick:()=>G(!_),style:{...N,color:d.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${d.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:_?"0":"2px"},onMouseEnter:l=>X(l,!0),onMouseLeave:R,title:_?"Pause":z?"Play (reset to 1×)":"Play",children:_?a.jsx(Ut,{}):"▶"}),a.jsx("button",{onClick:Z,style:{...V(f),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:l=>X(l,f),onMouseLeave:R,title:f?`${k}× speed — click to increase, click again at max to reset`:"Fast forward",children:f?a.jsxs(a.Fragment,{children:["▶▶",a.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[k,"×"]})]}):"▶▶"}),C&&a.jsx("button",{onClick:J?$:void 0,disabled:!J,style:{...V(!1),opacity:J?1:.3,cursor:J?"pointer":"default"},onMouseEnter:J?l=>X(l,!1):void 0,onMouseLeave:J?R:void 0,title:J?"Jump to end":"No end time set",children:"⏭"})]}),!nt&&a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:U!=null&&E!=null&&a.jsx("button",{onClick:U,style:{...N,color:d.buttonActiveColor,borderColor:`${d.buttonActiveColor}33`},onMouseEnter:l=>X(l,E),onMouseLeave:R,title:E?"Collapse swim lanes":"Expand swim lanes",children:E?a.jsx(Lt,{}):a.jsx(Ot,{})})}),nt&&U!=null&&E!=null&&a.jsx("button",{onClick:U,style:{...N,color:d.buttonActiveColor,borderColor:`${d.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:l=>X(l,E),onMouseLeave:R,title:E?"Collapse swim lanes":"Expand swim lanes",children:E?a.jsx(Lt,{}):a.jsx(Ot,{})})]})},Mt=r.forwardRef((v,_)=>{const{currentTime:O,defaultStartMs:u,defaultEndMs:T,theme:j,maxTicks:P,timezone:J,onTimeChange:W,onDragStart:C,onDragEnd:G,swimLanes:B,showSwimLanes:st,onSwimLaneItemClick:Z,onSwimLaneItemHover:$,onSwimLaneItemDoubleClick:tt,onSwimLaneItemContextMenu:H,onSwimLaneReorder:et}=v,d=r.useRef(null),E=r.useRef(j),U=r.useRef(P),z=r.useRef(J),f=r.useRef(u),w=r.useRef(T),k=r.useRef(A.JulianDate.toDate(O).getTime());r.useEffect(()=>{E.current=j},[j]),r.useEffect(()=>{U.current=P},[P]),r.useEffect(()=>{z.current=J,m()},[J]);const S=r.useRef(B??[]),nt=r.useRef(st??(B!=null&&B.length>0)),ct=r.useRef(0),N=r.useRef(null),V=r.useRef(null),X=r.useRef(Z),R=r.useRef($),l=r.useRef(tt),I=r.useRef(H),L=r.useRef(et);r.useEffect(()=>{X.current=Z},[Z]),r.useEffect(()=>{R.current=$},[$]),r.useEffect(()=>{l.current=tt},[tt]),r.useEffect(()=>{I.current=H},[H]),r.useEffect(()=>{L.current=et},[et]),r.useEffect(()=>{S.current=B??[],m()},[B]),r.useEffect(()=>{nt.current=st??(B!=null&&B.length>0),m()},[st,B]);const rt=r.useRef(null),ot=r.useRef(null),e=r.useRef(!1),h=r.useRef(0),b=r.useRef("none"),D=r.useRef(0),lt=r.useRef(0),ut=r.useRef(0),M=r.useRef("none"),at=r.useRef(0),it=r.useRef(0),bt=(t,n)=>Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),ft=r.useCallback(()=>({startMs:f.current,endMs:w.current,currentMs:k.current,theme:E.current,maxTicks:U.current,timezone:z.current,swimLanes:S.current,showSwimLanes:nt.current,scrollTop:ct.current,reorderState:V.current}),[]);r.useImperativeHandle(_,()=>({zoomTo(t,n,s){const c=Math.max(y.MIN_SPAN_MS,Math.min(y.MAX_SPAN_MS,n-t)),o=(t+n)/2;f.current=o-c/2,w.current=o+c/2,s!==void 0&&(k.current=s),m()},getVisibleRange(){return{startMs:f.current,endMs:w.current}},startFollow(t){if(h.current=t,ot.current!==null)return;e.current=!0;let n=performance.now();const s=()=>{const c=performance.now(),o=c-n;n=c;const i=o*h.current;f.current+=i,w.current+=i,k.current+=i,m(),ot.current=requestAnimationFrame(s)};ot.current=requestAnimationFrame(s)},stopFollow(){e.current=!1,ot.current!==null&&(cancelAnimationFrame(ot.current),ot.current=null)},correctFollow(t){if(!e.current)return;const n=t-k.current;k.current=t,f.current+=n,w.current+=n},appendSwimLane(t){S.current=[...S.current,t],m()},updateSwimLane(t,n){S.current=S.current.map(s=>s.id===t?{...s,...n,id:s.id}:s),m()},removeSwimLane(t){S.current=S.current.filter(n=>n.id!==t),m()},reorderSwimLanes(t){const n=new Map(S.current.map(c=>[c.id,c])),s=[];for(const c of t){const o=n.get(c);o&&s.push(o)}S.current=s,m()}}));const m=r.useCallback(()=>{const t=d.current;if(!t)return;const n=t.getContext("2d");if(!n)return;const s=t.getBoundingClientRect(),c=s.width,o=s.height;if(c===0||o===0)return;const i=window.devicePixelRatio||1,g=Math.round(c*i),x=Math.round(o*i);(t.width!==g||t.height!==x)&&(t.width=g,t.height=x),n.save(),n.scale(i,i);const F=y.drawTimeline(n,c,o,ft());F!==ct.current&&(ct.current=F),n.restore()},[ft]);r.useLayoutEffect(()=>{m();const t=d.current;if(!t)return;const n=new ResizeObserver(()=>m());return n.observe(t),()=>n.disconnect()},[m]),r.useEffect(()=>{if(e.current)return;const t=A.JulianDate.toDate(O).getTime();k.current!==t&&(k.current=t,m())},[O,m]);const Y=r.useCallback(t=>{if(rt.current!==null)return;const n=()=>{const s=d.current,c=w.current-f.current,o=t*c*.01;if(f.current+=o,w.current+=o,s){const i=s.getBoundingClientRect(),g=Math.max(0,Math.min(i.width,lt.current-i.left)),x=f.current+g/i.width*(w.current-f.current);k.current=x,W(A.JulianDate.fromDate(new Date(x)))}m(),rt.current=requestAnimationFrame(n)};rt.current=requestAnimationFrame(n)},[m,W]),pt=r.useCallback(()=>{rt.current!==null&&(cancelAnimationFrame(rt.current),rt.current=null)},[]),Q=r.useCallback((t,n,s,c)=>y.hitTestSwimLane(t,n,s,c,ft()),[ft]),ht=r.useCallback((t,n,s)=>y.hitTestLaneLabel(t,n,s,ft()),[ft]),mt=r.useCallback((t,n)=>y.isInSwimLaneRegion(t,n,ft()),[ft]),Tt=r.useCallback(t=>{t.preventDefault();const n=t.currentTarget.getBoundingClientRect(),s=t.clientX-n.left,c=t.clientY-n.top;if(t.button===0&&L.current){const o=ht(s,c,n.height);if(o){const g=S.current.findIndex(x=>x.id===o.id);V.current={dragging:!0,dragLaneId:o.id,dragStartY:t.clientY,currentY:t.clientY,insertIndex:g},t.currentTarget.style.cursor="grabbing";return}}if(t.button===0&&mt(c,n.height)){const o=(k.current-f.current)/(w.current-f.current)*n.width;if(!(Math.abs(s-o)<=10)&&Q(s,c,n.width,n.height)){ut.current=performance.now();return}}if(t.button===0){b.current="scrub",lt.current=t.clientX,t.currentTarget.style.cursor="grabbing",C==null||C();const o=f.current+s/n.width*(w.current-f.current);k.current=o,m(),W(A.JulianDate.fromDate(new Date(o)))}else if(t.button===1)b.current="slide",D.current=t.clientX;else if(t.button===2){if(I.current&&mt(c,n.height))return;b.current="zoom",D.current=t.clientX}},[m,W,C,ht,mt,Q]);r.useEffect(()=>{const t=s=>{const c=V.current;if(c&&c.dragging){c.currentY=s.clientY;const x=d.current;if(x){const F=x.getBoundingClientRect(),K=s.clientY-F.top;let wt=-ct.current;const At=S.current;let Jt=At.length;for(let yt=0;yt<At.length;yt++){const Nt=At[yt].height??y.DEFAULT_LANE_HEIGHT,Kt=wt+Nt/2;if(K<Kt){Jt=yt;break}wt+=Nt+y.LANE_GAP}c.insertIndex=Jt}m();return}if(b.current==="none")return;const o=d.current;if(!o)return;const i=o.getBoundingClientRect(),g=i.width;if(b.current==="scrub"){lt.current=s.clientX;const x=s.clientX-i.left,F=g*.08;x<F?Y(-1):x>g-F?Y(1):pt();const K=Math.max(0,Math.min(g,x)),dt=f.current+K/g*(w.current-f.current);k.current=dt,m(),W(A.JulianDate.fromDate(new Date(dt)))}else if(b.current==="slide"){const x=D.current-s.clientX;if(D.current=s.clientX,x!==0){const F=x/g*(w.current-f.current);f.current+=F,w.current+=F,m()}}else if(b.current==="zoom"){const x=D.current-s.clientX;D.current=s.clientX,x!==0&>(Math.pow(1.01,x))}},n=()=>{var c;const s=V.current;if(s&&s.dragging){const o=Math.abs(s.currentY-s.dragStartY),i=S.current,g=i.findIndex(x=>x.id===s.dragLaneId);if(o>5&&g>=0&&s.insertIndex!==g&&s.insertIndex!==g+1){const x=[...i],[F]=x.splice(g,1),K=s.insertIndex>g?s.insertIndex-1:s.insertIndex;x.splice(K,0,F),S.current=x,(c=L.current)==null||c.call(L,x.map(dt=>dt.id))}V.current=null,d.current&&(d.current.style.cursor="default"),m();return}pt(),b.current="none",d.current&&(d.current.style.cursor="default"),G==null||G()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}},[m,W,G,Y,pt]);const gt=r.useCallback(t=>{const n=y.zoomRange(f.current,w.current,t);f.current=n.startMs,w.current=n.endMs,m()},[m]),Et=r.useCallback(t=>{t.preventDefault();const n=d.current;if(!n)return;const s=n.getBoundingClientRect(),c=t.clientY-s.top,o=nt.current,i=S.current;if(o&&i.length>0){const g=Math.max(0,s.height-y.TICK_AREA_HEIGHT);if(c>=0&&c<g){let x=0;for(const K of i)x+=(K.height??y.DEFAULT_LANE_HEIGHT)+y.LANE_GAP;const F=Math.max(0,x-g);if(F>0){ct.current=Math.max(0,Math.min(F,ct.current+t.deltaY*y.SWIM_LANE_SCROLL_SPEED)),m();return}}}gt(Math.pow(1.05,t.deltaY>0?-1:1))},[gt,m]);r.useEffect(()=>{const t=d.current;if(t)return t.addEventListener("wheel",Et,{passive:!1}),()=>t.removeEventListener("wheel",Et)},[Et]),r.useEffect(()=>{const t=d.current;if(!t)return;const n=o=>{o.preventDefault();const i=t.getBoundingClientRect();if(o.touches.length===1){const g=o.touches[0].clientX-i.left,x=Math.max(0,Math.min(i.width,g)),F=f.current+x/i.width*(w.current-f.current);M.current="scrub",at.current=o.touches[0].clientX,lt.current=o.touches[0].clientX,k.current=F,m(),C==null||C(),W(A.JulianDate.fromDate(new Date(F)))}else o.touches.length>=2&&(M.current="pinch",it.current=bt(o.touches[0],o.touches[1]))},s=o=>{o.preventDefault();const i=t.getBoundingClientRect();if(M.current==="scrub"&&o.touches.length>=1){const g=o.touches[0].clientX-i.left,x=i.width*.08;if(lt.current=o.touches[0].clientX,g<x)Y(-1);else if(g>i.width-x)Y(1);else{pt();const F=Math.max(0,Math.min(i.width,g)),K=f.current+F/i.width*(w.current-f.current);k.current=K,m(),W(A.JulianDate.fromDate(new Date(K)))}}else if(M.current==="slide"&&o.touches.length>=1){const g=at.current-o.touches[0].clientX;if(at.current=o.touches[0].clientX,g!==0){const x=g/i.width*(w.current-f.current);f.current+=x,w.current+=x,m()}}else if(M.current==="pinch"&&o.touches.length>=2){const g=bt(o.touches[0],o.touches[1]);g>0&&it.current>0&>(it.current/g),it.current=g}},c=o=>{pt(),M.current==="scrub"&&(G==null||G()),o.touches.length===0?M.current="none":o.touches.length===1&&(M.current="slide",at.current=o.touches[0].clientX)};return t.addEventListener("touchstart",n,{passive:!1}),t.addEventListener("touchmove",s,{passive:!1}),t.addEventListener("touchend",c,{passive:!1}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",s),t.removeEventListener("touchend",c)}},[m,C,G,W,gt,Y,pt]);const Dt=r.useCallback(t=>{var g,x,F;if(b.current!=="none")return;const n=t.currentTarget.getBoundingClientRect(),s=t.clientX-n.left,c=t.clientY-n.top,o=(k.current-f.current)/(w.current-f.current)*n.width,i=Math.abs(s-o)<=10;if(mt(c,n.height)){const K=Q(s,c,n.width,n.height),dt=N.current;if(K)t.currentTarget.style.cursor=i?"grab":"pointer",(!dt||dt.item.id!==K.item.id||dt.lane.id!==K.lane.id)&&(N.current=K,(g=R.current)==null||g.call(R,{laneId:K.lane.id,item:K.item,originalEvent:t.nativeEvent}),m());else if(dt&&(N.current=null,(x=R.current)==null||x.call(R,null),m()),i)t.currentTarget.style.cursor="grab";else{const wt=ht(s,c,n.height);t.currentTarget.style.cursor=wt&&L.current?"grab":"default"}return}N.current&&(N.current=null,(F=R.current)==null||F.call(R,null),m()),t.currentTarget.style.cursor=i?"grab":"default"},[m,Q,mt,ht]),_t=r.useCallback(t=>{var g;if(performance.now()-ut.current>300)return;const s=t.currentTarget.getBoundingClientRect(),c=t.clientX-s.left,o=t.clientY-s.top,i=Q(c,o,s.width,s.height);i&&((g=X.current)==null||g.call(X,{laneId:i.lane.id,item:i.item,originalEvent:t.nativeEvent}))},[Q]),jt=r.useCallback(t=>{var i;const n=t.currentTarget.getBoundingClientRect(),s=t.clientX-n.left,c=t.clientY-n.top,o=Q(s,c,n.width,n.height);o&&((i=l.current)==null||i.call(l,{laneId:o.lane.id,item:o.item,originalEvent:t.nativeEvent}))},[Q]),p=r.useCallback(t=>{const n=t.currentTarget.getBoundingClientRect(),s=t.clientX-n.left,c=t.clientY-n.top,o=Q(s,c,n.width,n.height);o&&I.current?(t.preventDefault(),I.current({laneId:o.lane.id,item:o.item,originalEvent:t.nativeEvent})):t.preventDefault()},[Q]);return r.useEffect(()=>()=>{rt.current!==null&&cancelAnimationFrame(rt.current),ot.current!==null&&cancelAnimationFrame(ot.current)},[]),a.jsx("canvas",{ref:d,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:Tt,onMouseMove:Dt,onClick:_t,onDoubleClick:jt,onMouseLeave:()=>{var t;N.current&&(N.current=null,(t=R.current)==null||t.call(R,null),m()),b.current==="none"&&d.current&&(d.current.style.cursor="default")},onContextMenu:p})});Mt.displayName="TimelineCanvas";const Pt=[2,4,8,16,32,100,1],Ft=[1,2,4,8,16,32,100],Gt=({startTime:v,endTime:_,currentTime:O,clock:u,onTimeChange:T,onPlayPause:j,onMultiplierChange:P,height:J,showControls:W=!0,showJumpToStart:C,showJumpToEnd:G,enableDrag:B=!0,dateTimeFormat:st,onDateTimeClick:Z,jumpToTime:$,maxTicks:tt,ffSpeeds:H=Pt,rwSpeeds:et=Ft,theme:d,className:E,timezone:U,swimLanes:z,showSwimLanes:f,onShowSwimLanesChange:w,swimLaneTransition:k="animated",onSwimLaneItemClick:S,onSwimLaneItemHover:nt,onSwimLaneItemDoubleClick:ct,onSwimLaneItemContextMenu:N,onSwimLaneReorder:V})=>{const X=()=>Date.now(),R=v?A.JulianDate.toDate(y.toJulianDate(v)).getTime():X()-432e5,l=_?A.JulianDate.toDate(y.toJulianDate(_)).getTime():X()+12*3600*1e3,[I,L]=r.useState(()=>y.toJulianDate(O??v??A.JulianDate.fromDate(new Date))),[rt,ot]=r.useState((u==null?void 0:u.shouldAnimate)??!1),[e,h]=r.useState((u==null?void 0:u.multiplier)??1),[b,D]=r.useState(f??!0);r.useEffect(()=>{f!=null&&D(f)},[f]);const lt=()=>{const p=!b;D(p),w==null||w(p)},ut=z!=null&&z.length>0,M=r.useRef(null),[at,it]=r.useState(0);r.useEffect(()=>{const p=M.current;if(!p)return;const t=new ResizeObserver(([n])=>it(n.borderBoxSize[0].blockSize));return t.observe(p),()=>t.disconnect()},[W]);const ft=ut&&!b?`${at+y.TICK_AREA_HEIGHT}px`:J!=null?`${J}px`:"100%",m=r.useRef(!1),Y=r.useRef(null),pt={...y.defaultTheme,...d};r.useEffect(()=>{if(!u)return;const p=()=>{if(!m.current){const t=A.JulianDate.clone(u.currentTime);if(L(t),ot(u.shouldAnimate),h(u.multiplier),Y.current){const{startMs:n,endMs:s}=Y.current.getVisibleRange(),c=s-n,o=A.JulianDate.toDate(t).getTime(),i=o-n;i<=c*.1?Y.current.zoomTo(o-c*.1,o+c*.9,o):i>=c*.9&&Y.current.zoomTo(o-c*.9,o+c*.1,o)}}};return u.onTick.addEventListener(p),()=>{u.onTick.removeEventListener(p)}},[u]),r.useEffect(()=>{if(u)return;const p=setInterval(()=>{if(m.current)return;const t=A.JulianDate.fromDate(new Date);if(L(t),Y.current){const{startMs:n,endMs:s}=Y.current.getVisibleRange(),c=s-n,o=A.JulianDate.toDate(t).getTime(),i=o-n;i<=c*.1?Y.current.zoomTo(o-c*.1,o+c*.9,o):i>=c*.9&&Y.current.zoomTo(o-c*.9,o+c*.1,o)}},1e3);return()=>clearInterval(p)},[u]),r.useEffect(()=>{if(!$)return;const p=y.toJulianDate($);if(ht(p),Y.current){const{startMs:t,endMs:n}=Y.current.getVisibleRange(),s=n-t,c=A.JulianDate.toDate(p).getTime();Y.current.zoomTo(c-s/2,c+s/2)}},[$]);const Q=(p,t=!0)=>{u&&(u.multiplier=p,t&&(u.shouldAnimate=!0)),h(p),t&&ot(!0),P==null||P(p)},ht=p=>{L(p),u&&(u.currentTime=A.JulianDate.clone(p)),T==null||T(p)},mt=p=>{p&&e<0&&Q(1,!1),u&&(u.shouldAnimate=p),ot(p),j==null||j(p)},Tt=()=>{const p=H.length>0?H:Pt,t=e>1?e:1,n=p.indexOf(t),s=p[n<0||n===p.length-1?0:n+1];Q(s)},gt=()=>{const p=et.length>0?et:Ft,t=e<0?Math.abs(e):0,n=p.indexOf(t),s=-p[n<0||n===p.length-1?0:n+1];Q(s)},Et=()=>{var t;const p=y.toJulianDate(v??A.JulianDate.fromDate(new Date(R)));u&&(u.currentTime=A.JulianDate.clone(p)),L(p),(t=Y.current)==null||t.zoomTo(R,l)},Dt=()=>{var t;const p=y.toJulianDate(_??A.JulianDate.fromDate(new Date(l)));u&&(u.currentTime=A.JulianDate.clone(p)),L(p),(t=Y.current)==null||t.zoomTo(R,l)},_t=()=>{var n;const p=A.JulianDate.fromDate(new Date);u&&(u.currentTime=A.JulianDate.clone(p)),L(p),Q(1);const t=Date.now();(n=Y.current)==null||n.zoomTo(t-12*3600*1e3,t+12*3600*1e3)},jt=Math.abs(A.JulianDate.toDate(I).getTime()-Date.now())<1e4;return a.jsxs("div",{className:E,style:{width:"100%",height:ft,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:k==="animated"?"height 0.2s ease":void 0},children:[W&&a.jsx("div",{ref:M,children:a.jsx(It,{currentTime:I,isPlaying:rt,multiplier:e,isLive:jt,hasStartTime:v!=null,hasEndTime:_!=null,showJumpToStart:C,showJumpToEnd:G,onPlayPause:mt,onJumpToStart:Et,onRewind:gt,onFastForward:Tt,onJumpToEnd:Dt,onJumpToLive:_t,onResetSpeed:()=>Q(1),onDateTimeClick:Z,dateTimeFormat:st,timezone:U,theme:pt,swimLanesVisible:ut?b:void 0,onToggleSwimLanes:ut?lt:void 0})}),B!==!1&&a.jsx(Mt,{ref:Y,currentTime:I,defaultStartMs:R,defaultEndMs:l,theme:pt,maxTicks:tt,timezone:U,onTimeChange:ht,onDragStart:()=>{m.current=!0},onDragEnd:()=>{m.current=!1},swimLanes:z,showSwimLanes:b,onSwimLaneItemClick:S,onSwimLaneItemHover:nt,onSwimLaneItemDoubleClick:ct,onSwimLaneItemContextMenu:N,onSwimLaneReorder:V})]})},Vt=({startTime:v,endTime:_,currentTime:O,width:u,height:T,tickInterval:j,showLabels:P,snapToTicks:J,enableDrag:W,theme:C,onTimeChange:G,onVisibleRangeChange:B,onDragStart:st,onDragEnd:Z})=>{const $=r.useMemo(()=>y.generateTicks(v,_,j,u),[v,_,j,u]),tt=r.useMemo(()=>y.timeToPosition(O,v,_,u),[O,v,_,u]),H=r.useRef(null),et=E=>{if(!W)return;const U=E.currentTarget.getBoundingClientRect(),z=E.clientX-U.left,f=Math.max(0,Math.min(u,z));if(!(Math.abs(f-tt)<=10)){let I=f;J&&(I=y.snapToTick(f,$,10));const L=new Date(v).getTime(),rt=new Date(_).getTime();G(A.JulianDate.fromDate(new Date(L+I/u*(rt-L))));return}st==null||st();const k=E.clientX,S=new Date(O).getTime(),nt=new Date(v).getTime(),N=(new Date(_).getTime()-nt)/u;let V=0,X=!1;const R=I=>{V=I.clientX-k,X=!0,H.current||(H.current=requestAnimationFrame(()=>{if(X){const L=S+V*N;G(A.JulianDate.fromDate(new Date(L))),X=!1}H.current=null}))},l=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",l),H.current!==null&&(cancelAnimationFrame(H.current),H.current=null),Z==null||Z()};document.addEventListener("mousemove",R),document.addEventListener("mouseup",l)},d=E=>{E.preventDefault();const U=E.shiftKey?E.deltaY:E.deltaX!==0?E.deltaX:E.deltaY;if(Math.abs(U)<1)return;const z=new Date(v).getTime(),f=new Date(_).getTime(),w=U/u*(f-z)*.5;B==null||B(A.JulianDate.fromDate(new Date(z+w)),A.JulianDate.fromDate(new Date(f+w)))};return a.jsxs("svg",{width:"100%",height:T,style:{backgroundColor:C.backgroundColor,display:"block",cursor:"default"},onMouseDown:et,onWheel:d,children:[a.jsx("rect",{width:u,height:T,fill:C.backgroundColor}),$.map((E,U)=>a.jsxs("g",{children:[a.jsx("line",{x1:E.position,y1:T-(E.isMajor?C.majorTickHeight:C.minorTickHeight),x2:E.position,y2:T,stroke:E.isMajor?C.majorTickColor:C.tickColor,strokeWidth:"1"}),P&&E.isMajor&&E.label&&a.jsx("text",{x:E.position,y:T-C.majorTickHeight-5,textAnchor:"middle",fill:C.labelColor,fontSize:C.fontSize,fontFamily:"monospace",children:E.label})]},U)),a.jsx("line",{x1:tt,y1:0,x2:tt,y2:T,stroke:C.indicatorColor,strokeWidth:C.indicatorLineWidth,pointerEvents:"none"}),W&&a.jsx("rect",{x:Math.max(0,tt-10),y:0,width:20,height:T,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),a.jsx("circle",{cx:tt,cy:5,r:4,fill:C.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(q,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>y.TICK_AREA_HEIGHT}),q.Timeline=Gt,q.TimelineCanvas=Mt,q.TimelineControls=It,q.TimelineSVG=Vt,Object.keys(y).forEach(v=>{v!=="default"&&!Object.prototype.hasOwnProperty.call(q,v)&&Object.defineProperty(q,v,{enumerable:!0,get:()=>y[v]})}),Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare interface ControlsProps {
|
|
|
13
13
|
multiplier: number;
|
|
14
14
|
dateTimeFormat?: string;
|
|
15
15
|
onDateTimeClick?: () => void;
|
|
16
|
+
/** @see TimelineBaseProps.timezone */
|
|
17
|
+
timezone?: string;
|
|
16
18
|
onPlayPause: (isPlaying: boolean) => void;
|
|
17
19
|
onJumpToStart: () => void;
|
|
18
20
|
onRewind: () => void;
|
|
@@ -23,6 +25,8 @@ export declare interface ControlsProps {
|
|
|
23
25
|
isLive: boolean;
|
|
24
26
|
hasStartTime: boolean;
|
|
25
27
|
hasEndTime: boolean;
|
|
28
|
+
showJumpToStart?: boolean;
|
|
29
|
+
showJumpToEnd?: boolean;
|
|
26
30
|
theme: TimelineTheme;
|
|
27
31
|
swimLanesVisible?: boolean;
|
|
28
32
|
onToggleSwimLanes?: () => void;
|
|
@@ -63,6 +67,8 @@ declare interface TimelineCanvasProps {
|
|
|
63
67
|
defaultEndMs: number;
|
|
64
68
|
theme: TimelineTheme;
|
|
65
69
|
maxTicks?: number;
|
|
70
|
+
/** @see TimelineBaseProps.timezone */
|
|
71
|
+
timezone?: string;
|
|
66
72
|
onTimeChange: (time: Cesium.JulianDate) => void;
|
|
67
73
|
onDragStart?: () => void;
|
|
68
74
|
onDragEnd?: () => void;
|
|
@@ -87,6 +93,8 @@ export declare interface TimelineProps {
|
|
|
87
93
|
onMultiplierChange?: (multiplier: number) => void;
|
|
88
94
|
height?: number;
|
|
89
95
|
showControls?: boolean;
|
|
96
|
+
showJumpToStart?: boolean;
|
|
97
|
+
showJumpToEnd?: boolean;
|
|
90
98
|
enableDrag?: boolean;
|
|
91
99
|
dateTimeFormat?: string;
|
|
92
100
|
onDateTimeClick?: () => void;
|
|
@@ -96,6 +104,8 @@ export declare interface TimelineProps {
|
|
|
96
104
|
rwSpeeds?: number[];
|
|
97
105
|
theme?: Partial<TimelineTheme>;
|
|
98
106
|
className?: string;
|
|
107
|
+
/** @see TimelineBaseProps.timezone */
|
|
108
|
+
timezone?: string;
|
|
99
109
|
swimLanes?: SwimLane[];
|
|
100
110
|
showSwimLanes?: boolean;
|
|
101
111
|
onShowSwimLanesChange?: (visible: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kteneyck/cesium-timeline-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React timeline component for Cesium with clock integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "kteneyck",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/react-dom": ">=18"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@kteneyck/cesium-timeline-core": "0.
|
|
55
|
+
"@kteneyck/cesium-timeline-core": "0.4.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/react": "19.0.1",
|