@kteneyck/cesium-timeline-react 0.9.0 → 0.10.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/README.md +79 -41
- package/dist/cesium-timeline-react.js +946 -886
- package/dist/cesium-timeline-react.umd.cjs +4 -4
- package/dist/index.d.ts +18 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(it,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react"),require("cesium"),require("@kteneyck/cesium-timeline-core")):typeof define=="function"&&define.amd?define(["exports","react","cesium","@kteneyck/cesium-timeline-core"],n):(it=typeof globalThis<"u"?globalThis:it||self,n(it.CesiumTimelineReact={},it.React,it.Cesium,it.CesiumTimelineCore))})(this,(function(it,n,qt,E){"use strict";function $t(R){const C=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(R){for(const F in R)if(F!=="default"){const d=Object.getOwnPropertyDescriptor(R,F);Object.defineProperty(C,F,d.get?d:{enumerable:!0,get:()=>R[F]})}}return C.default=R,Object.freeze(C)}const _=$t(qt);var It={exports:{}},St={};/**
|
|
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 Yt;function te(){if(Yt)return St;Yt=1;var R=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function F(d,j,k){var J=null;if(k!==void 0&&(J=""+k),j.key!==void 0&&(J=""+j.key),"key"in j){k={};for(var N in j)N!=="key"&&(k[N]=j[N])}else k=j;return j=k.ref,{$$typeof:R,type:d,key:J,ref:j!==void 0?j:null,props:k}}return St.Fragment=C,St.jsx=F,St.jsxs=F,St}var jt={};/**
|
|
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 Wt;function ee(){return Wt||(Wt=1,process.env.NODE_ENV!=="production"&&(function(){function R(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Et?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Z:return"Fragment";case T:return"Profiler";case dt:return"StrictMode";case Q:return"Suspense";case S:return"SuspenseList";case gt:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case ft:return"Portal";case K:return t.displayName||"Context";case M:return(t._context.displayName||"Context")+".Consumer";case nt:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L:return i=t.displayName||null,i!==null?i:R(t.type)||"Memo";case rt:i=t._payload,t=t._init;try{return R(t(i))}catch{}}return null}function C(t){return""+t}function F(t){try{C(t);var i=!1}catch{i=!0}if(i){i=console;var a=i.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return a.call(i,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),C(t)}}function d(t){if(t===Z)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===rt)return"<...>";try{var i=R(t);return i?"<"+i+">":"<...>"}catch{return"<...>"}}function j(){var t=ot.A;return t===null?null:t.getOwner()}function k(){return Error("react-stack-top-frame")}function J(t){if(s.call(t,"key")){var i=Object.getOwnPropertyDescriptor(t,"key").get;if(i&&i.isReactWarning)return!1}return t.key!==void 0}function N(t,i){function a(){at||(at=!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)",i))}a.isReactWarning=!0,Object.defineProperty(t,"key",{get:a,configurable:!0})}function pt(){var t=R(this.type);return q[t]||(q[t]=!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.")),t=this.props.ref,t!==void 0?t:null}function z(t,i,a,g,ut,mt){var A=a.ref;return t={$$typeof:U,type:t,key:i,props:a,_owner:g},(A!==void 0?A:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:pt}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ut}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:mt}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function Y(t,i,a,g,ut,mt){var A=i.children;if(A!==void 0)if(g)if(b(A)){for(g=0;g<A.length;g++)W(A[g]);Object.freeze&&Object.freeze(A)}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 W(A);if(s.call(i,"key")){A=R(t);var tt=Object.keys(i).filter(function(wt){return wt!=="key"});g=0<tt.length?"{key: someKey, "+tt.join(": ..., ")+": ...}":"{key: someKey}",H[A+g]||(tt=0<tt.length?"{"+tt.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} />`,D,Y,A,Y),P[Y+D]=!0)}if(Y=null,E!==void 0&&(J(E),Y=""+E),B(p)&&(J(p.key),Y=""+p.key),"key"in p){E={};for(var dt in p)dt!=="key"&&(E[dt]=p[dt])}else E=p;return Y&&G(E,typeof e=="function"?e.displayName||e.name||"Unknown":e),U(e,Y,E,C(),rt,gt)}function K(e){F(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===st&&(e._payload.status==="fulfilled"?F(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function F(e){return typeof e=="object"&&e!==null&&e.$$typeof===q}var ct=n,q=Symbol.for("react.transitional.element"),ut=Symbol.for("react.portal"),et=Symbol.for("react.fragment"),lt=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),$=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),ot=Symbol.for("react.suspense_list"),mt=Symbol.for("react.memo"),st=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),h=Symbol.for("react.client.reference"),x=ct.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,S=Array.isArray,tt=console.createTask?console.createTask:function(){return null};ct={react_stack_bottom_frame:function(e){return e()}};var N,k={},a=ct.react_stack_bottom_frame.bind(ct,I)(),Q=tt(i(I)),P={};At.Fragment=et,At.jsx=function(e,p,E){var D=1e4>x.recentlyCreatedOwnerStacks++;return Z(e,p,E,!1,D?Error("react-stack-top-frame"):a,D?tt(i(e)):Q)},At.jsxs=function(e,p,E){var D=1e4>x.recentlyCreatedOwnerStacks++;return Z(e,p,E,!0,D?Error("react-stack-top-frame"):a,D?tt(i(e)):Q)}})()),At}var Nt;function qt(){return Nt||(Nt=1,process.env.NODE_ENV==="production"?Ct.exports=Zt():Ct.exports=Qt()),Ct.exports}var l=qt();const $t=520,te=()=>l.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:[l.jsx("rect",{x:"1",y:"0",width:"4",height:"16",rx:"1"}),l.jsx("rect",{x:"9",y:"0",width:"4",height:"16",rx:"1"})]}),Yt=()=>l.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:l.jsx("polyline",{points:"3,5 7,9 11,5"})}),zt=()=>l.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:l.jsx("polyline",{points:"3,9 7,5 11,9"})}),Wt=({currentTime:v,isPlaying:L,multiplier:J,dateTimeFormat:i,timezone:C,isLive:I,hasStartTime:B,hasEndTime:G,showJumpToStart:ft=!0,showJumpToEnd:U=!0,onPlayPause:Z,onJumpToStart:K,onRewind:F,onFastForward:ct,onJumpToEnd:q,onJumpToLive:ut,onResetSpeed:et,onDateTimeClick:lt,theme:y,swimLanesVisible:R,onToggleSwimLanes:$,labels:M})=>{const H=J<0,ot=J>1,mt=J===1,st=Math.abs(J),j=n.useMemo(()=>({...b.DEFAULT_LABELS,...M}),[M]),h=n.useRef(null),[x,O]=n.useState(!1);n.useEffect(()=>{const a=h.current;if(!a)return;const Q=new ResizeObserver(([P])=>{O(P.contentRect.width<$t)});return Q.observe(a),()=>Q.disconnect()},[]);const S={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},tt=a=>({...S,color:a?y.buttonActiveColor:y.buttonColor,borderColor:a?`${y.buttonActiveColor}33`:"transparent"}),N=(a,Q)=>{a.currentTarget.style.backgroundColor=Q?`${y.buttonActiveColor}22`:y.buttonHoverColor+"44"},k=a=>{a.currentTarget.style.backgroundColor="transparent"};return l.jsxs("div",{ref:h,style:{display:x?"flex":"grid",gridTemplateColumns:x?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:y.controlBarBackground,borderBottom:`1px solid ${y.controlBarBorder}`,fontFamily:"system-ui, -apple-system, sans-serif"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l.jsx("div",{onClick:lt,title:lt?j.dateTimeClickTooltip:void 0,style:{color:y.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:lt?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:a=>{lt&&(a.currentTarget.style.background=y.buttonHoverColor+"44")},onMouseLeave:a=>a.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:a,dateFormat:Q}=b.splitForDisplay(i),P=b.getTimezoneAbbr(v,C);return l.jsxs(l.Fragment,{children:[a&&l.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:b.formatDateTime(v,a,C)}),Q&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[l.jsx("span",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:y.buttonActiveColor},children:b.formatDateTime(v,Q,C)}),P&&l.jsx("span",{style:{fontSize:"0.9em",color:y.labelColor,opacity:.7,fontWeight:"bold",letterSpacing:"0.04em"},children:P})]})]})})()}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"},children:[l.jsx("button",{onClick:ut,style:{...S,fontSize:"11px",fontWeight:"bold",letterSpacing:"0.05em",width:"52px",minWidth:"52px",height:"20px",borderRadius:"3px",color:I?y.controlBarBackground:y.buttonActiveColor,backgroundColor:I?y.buttonActiveColor:"transparent",borderColor:y.buttonActiveColor,opacity:I?1:.55},onMouseEnter:a=>{a.currentTarget.style.opacity="1"},onMouseLeave:a=>{a.currentTarget.style.opacity=I?"1":"0.55"},title:I?j.liveActiveTooltip:j.liveTooltip,children:I?j.liveActiveLabel:j.liveLabel}),l.jsx("div",{style:{height:"20px",display:"flex",alignItems:"center"},children:!mt&&l.jsx("button",{onClick:()=>et(),style:{...S,fontSize:"11px",color:y.buttonActiveColor,borderColor:`${y.buttonActiveColor}44`,width:"52px",minWidth:"52px",height:"20px"},onMouseEnter:a=>N(a,!0),onMouseLeave:k,title:j.resetSpeedTooltip,children:H?`◀ ${st}×`:`${st}× ▶`})})]})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...x?{flex:1,justifyContent:"center"}:{}},children:[ft&&l.jsx("button",{onClick:B?K:void 0,disabled:!B,style:{...tt(!1),opacity:B?1:.3,cursor:B?"pointer":"default"},onMouseEnter:B?a=>N(a,!1):void 0,onMouseLeave:B?k:void 0,title:B?j.jumpToStartTooltip:j.noStartTimeTooltip,children:"⏮"}),l.jsx("button",{onClick:F,style:{...tt(H),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>N(a,H),onMouseLeave:k,title:H?b.resolveLabel(j.rewindActiveTooltip,st):j.rewindTooltip,children:H?l.jsxs(l.Fragment,{children:[l.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[st,"×"]}),"◀◀"]}):"◀◀"}),l.jsx("button",{onClick:()=>Z(!L),style:{...S,color:y.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${y.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:L?"0":"2px"},onMouseEnter:a=>N(a,!0),onMouseLeave:k,title:L?j.pauseTooltip:H?j.playFromRewindTooltip:j.playTooltip,children:L?l.jsx(te,{}):"▶"}),l.jsx("button",{onClick:ct,style:{...tt(ot),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>N(a,ot),onMouseLeave:k,title:ot?b.resolveLabel(j.fastForwardActiveTooltip,st):j.fastForwardTooltip,children:ot?l.jsxs(l.Fragment,{children:["▶▶",l.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[st,"×"]})]}):"▶▶"}),U&&l.jsx("button",{onClick:G?q:void 0,disabled:!G,style:{...tt(!1),opacity:G?1:.3,cursor:G?"pointer":"default"},onMouseEnter:G?a=>N(a,!1):void 0,onMouseLeave:G?k:void 0,title:G?j.jumpToEndTooltip:j.noEndTimeTooltip,children:"⏭"})]}),!x&&l.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:$!=null&&R!=null&&l.jsx("button",{onClick:$,style:{...S,color:y.buttonActiveColor,borderColor:`${y.buttonActiveColor}33`},onMouseEnter:a=>N(a,R),onMouseLeave:k,title:R?j.collapseSwimLanesTooltip:j.expandSwimLanesTooltip,children:R?l.jsx(Yt,{}):l.jsx(zt,{})})}),x&&$!=null&&R!=null&&l.jsx("button",{onClick:$,style:{...S,color:y.buttonActiveColor,borderColor:`${y.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:a=>N(a,R),onMouseLeave:k,title:R?j.collapseSwimLanesTooltip:j.expandSwimLanesTooltip,children:R?l.jsx(Yt,{}):l.jsx(zt,{})})]})},Pt=n.forwardRef((v,L)=>{const{currentTime:J,defaultStartMs:i,defaultEndMs:C,theme:I,maxTicks:B,timezone:G,dateTimeFormat:ft,months:U,onTimeChange:Z,onDragStart:K,onDragEnd:F,onRangeSelect:ct,swimLanes:q,showSwimLanes:ut,onSwimLaneItemClick:et,onSwimLaneItemHover:lt,onSwimLaneItemDoubleClick:y,onSwimLaneItemContextMenu:R,onSwimLaneReorder:$}=v,M=n.useRef(null),H=n.useRef(I),ot=n.useRef(B),mt=n.useRef(G),st=n.useRef(ft),j=n.useRef(U),h=n.useRef(i),x=n.useRef(C),O=n.useRef(T.JulianDate.toDate(J).getTime());n.useEffect(()=>{H.current=I},[I]),n.useEffect(()=>{ot.current=B},[B]),n.useEffect(()=>{mt.current=G,g()},[G]),n.useEffect(()=>{st.current=ft,g()},[ft]),n.useEffect(()=>{j.current=U,g()},[U]);const S=n.useRef(q??[]),tt=n.useRef(ut??(q!=null&&q.length>0)),N=n.useRef(0),k=n.useRef(null),a=n.useRef(null),Q=n.useRef(et),P=n.useRef(lt),e=n.useRef(y),p=n.useRef(R),E=n.useRef($);n.useEffect(()=>{Q.current=et},[et]),n.useEffect(()=>{P.current=lt},[lt]),n.useEffect(()=>{e.current=y},[y]),n.useEffect(()=>{p.current=R},[R]),n.useEffect(()=>{E.current=$},[$]),n.useEffect(()=>{S.current=q??[],g()},[q]),n.useEffect(()=>{tt.current=ut??(q!=null&&q.length>0),g()},[ut,q]);const D=n.useRef(null),rt=n.useRef(null),gt=n.useRef(!1),Y=n.useRef(0),A=n.useRef("none"),dt=n.useRef(0),Rt=n.useRef(0),kt=n.useRef(0),_t=n.useRef(0),Lt=n.useRef(0),xt=n.useRef(null),V=n.useRef(ct);n.useEffect(()=>{V.current=ct},[ct]);const pt=n.useRef("none"),vt=n.useRef(0),yt=n.useRef(0),jt=n.useRef(0),St=n.useRef(0),It=(t,r)=>Math.hypot(r.clientX-t.clientX,r.clientY-t.clientY),bt=n.useCallback(()=>({startMs:h.current,endMs:x.current,currentMs:O.current,theme:H.current,maxTicks:ot.current,timezone:mt.current,use12h:/h/.test(st.current??""),months:j.current,swimLanes:S.current,showSwimLanes:tt.current,scrollTop:N.current,reorderState:a.current,rangeSelection:xt.current}),[]);n.useImperativeHandle(L,()=>({zoomTo(t,r,o){const d=Math.max(b.MIN_SPAN_MS,Math.min(b.MAX_SPAN_MS,r-t)),s=(t+r)/2;h.current=s-d/2,x.current=s+d/2,o!==void 0&&(O.current=o),g()},getVisibleRange(){return{startMs:h.current,endMs:x.current}},startFollow(t){if(Y.current=t,rt.current!==null)return;gt.current=!0;let r=performance.now();const o=()=>{const d=performance.now(),s=d-r;r=d;const c=s*Y.current;h.current+=c,x.current+=c,O.current+=c,g(),rt.current=requestAnimationFrame(o)};rt.current=requestAnimationFrame(o)},stopFollow(){gt.current=!1,rt.current!==null&&(cancelAnimationFrame(rt.current),rt.current=null)},correctFollow(t){if(!gt.current)return;const r=t-O.current;O.current=t,h.current+=r,x.current+=r},appendSwimLane(t){S.current=[...S.current,t],g()},updateSwimLane(t,r){S.current=S.current.map(o=>o.id===t?{...o,...r,id:o.id}:o),g()},removeSwimLane(t){S.current=S.current.filter(r=>r.id!==t),g()},reorderSwimLanes(t){const r=new Map(S.current.map(d=>[d.id,d])),o=[];for(const d of t){const s=r.get(d);s&&o.push(s)}S.current=o,g()}}));const g=n.useCallback(()=>{const t=M.current;if(!t)return;const r=t.getContext("2d");if(!r)return;const o=t.getBoundingClientRect(),d=o.width,s=o.height;if(d===0||s===0)return;const c=window.devicePixelRatio||1,m=Math.round(d*c),f=Math.round(s*c);(t.width!==m||t.height!==f)&&(t.width=m,t.height=f),r.save(),r.scale(c,c);const w=b.drawTimeline(r,d,s,bt());w!==N.current&&(N.current=w),r.restore()},[bt]);n.useLayoutEffect(()=>{g();const t=M.current;if(!t)return;const r=new ResizeObserver(()=>g());return r.observe(t),()=>r.disconnect()},[g]),n.useEffect(()=>{if(gt.current)return;const t=T.JulianDate.toDate(J).getTime();O.current!==t&&(O.current=t,g())},[J,g]);const Et=n.useCallback(t=>{if(D.current!==null)return;const r=()=>{const o=M.current,d=x.current-h.current,s=t*d*.01;if(h.current+=s,x.current+=s,o){const c=o.getBoundingClientRect(),m=Math.max(0,Math.min(c.width,Rt.current-c.left)),f=h.current+m/c.width*(x.current-h.current);O.current=f,Z(T.JulianDate.fromDate(new Date(f)))}g(),D.current=requestAnimationFrame(r)};D.current=requestAnimationFrame(r)},[g,Z]),wt=n.useCallback(()=>{D.current!==null&&(cancelAnimationFrame(D.current),D.current=null)},[]),u=n.useCallback((t,r,o,d)=>b.hitTestSwimLane(t,r,o,d,bt()),[bt]),_=n.useCallback((t,r,o)=>b.hitTestLaneLabel(t,r,o,bt()),[bt]),X=n.useCallback((t,r)=>b.isInSwimLaneRegion(t,r,bt()),[bt]),it=n.useCallback(t=>{t.preventDefault();const r=t.currentTarget.getBoundingClientRect(),o=t.clientX-r.left,d=t.clientY-r.top;if(t.button===0&&E.current){const s=_(o,d,r.height);if(s){const m=S.current.findIndex(f=>f.id===s.id);a.current={dragging:!0,dragLaneId:s.id,dragStartY:t.clientY,currentY:t.clientY,insertIndex:m},t.currentTarget.style.cursor="grabbing";return}}if(t.button===0&&X(d,r.height)){const s=(O.current-h.current)/(x.current-h.current)*r.width;if(!(Math.abs(o-s)<=10)&&u(o,d,r.width,r.height)){kt.current=performance.now();return}}if(t.button===0){const s=(O.current-h.current)/(x.current-h.current)*r.width,c=Math.abs(o-s)<=10,m=d>=r.height-b.TICK_AREA_HEIGHT;if(!c&&m)A.current="rangeSelectPending",Lt.current=o,_t.current=h.current+o/r.width*(x.current-h.current),t.currentTarget.style.cursor="crosshair",K==null||K();else{A.current="scrub",Rt.current=t.clientX,t.currentTarget.style.cursor="grabbing",K==null||K();const f=h.current+o/r.width*(x.current-h.current);O.current=f,g(),Z(T.JulianDate.fromDate(new Date(f)))}}else if(t.button===1)A.current="slide",dt.current=t.clientX;else if(t.button===2){if(p.current&&X(d,r.height))return;A.current="zoom",dt.current=t.clientX}},[g,Z,K,_,X,u]);n.useEffect(()=>{const t=o=>{const d=a.current;if(d&&d.dragging){d.currentY=o.clientY;const f=M.current;if(f){const w=f.getBoundingClientRect(),W=o.clientY-w.top;let Tt=-N.current;const Ft=S.current;let Gt=Ft.length;for(let Ot=0;Ot<Ft.length;Ot++){const Ut=Ft[Ot].height??b.DEFAULT_LANE_HEIGHT,ce=Tt+Ut/2;if(W<ce){Gt=Ot;break}Tt+=Ut+b.LANE_GAP}d.insertIndex=Gt}g();return}if(A.current==="none")return;const s=M.current;if(!s)return;const c=s.getBoundingClientRect(),m=c.width;if(A.current==="scrub"){Rt.current=o.clientX;const f=o.clientX-c.left,w=m*.08;f<w?Et(-1):f>m-w?Et(1):wt();const W=Math.max(0,Math.min(m,f)),ht=h.current+W/m*(x.current-h.current);O.current=ht,g(),Z(T.JulianDate.fromDate(new Date(ht)))}else if(A.current==="rangeSelectPending"||A.current==="rangeSelect"){const f=o.clientX-c.left,w=Math.abs(f-Lt.current);if(A.current==="rangeSelectPending"&&w>=3&&(A.current="rangeSelect"),A.current==="rangeSelect"){const W=Math.max(0,Math.min(m,f)),ht=h.current+W/m*(x.current-h.current);xt.current={startMs:_t.current,endMs:ht},g()}}else if(A.current==="slide"){const f=dt.current-o.clientX;if(dt.current=o.clientX,f!==0){const w=f/m*(x.current-h.current);h.current+=w,x.current+=w,g()}}else if(A.current==="zoom"){const f=dt.current-o.clientX;dt.current=o.clientX,f!==0&&z(Math.pow(1.01,f))}},r=()=>{var d,s;const o=a.current;if(o&&o.dragging){const c=Math.abs(o.currentY-o.dragStartY),m=S.current,f=m.findIndex(w=>w.id===o.dragLaneId);if(c>5&&f>=0&&o.insertIndex!==f&&o.insertIndex!==f+1){const w=[...m],[W]=w.splice(f,1),ht=o.insertIndex>f?o.insertIndex-1:o.insertIndex;w.splice(ht,0,W),S.current=w,(d=E.current)==null||d.call(E,w.map(Tt=>Tt.id))}a.current=null,M.current&&(M.current.style.cursor="default"),g();return}if(wt(),A.current==="rangeSelectPending"){O.current=_t.current,xt.current=null,A.current="none",M.current&&(M.current.style.cursor="default"),g(),Z(T.JulianDate.fromDate(new Date(_t.current))),F==null||F();return}if(A.current==="rangeSelect"){const c=xt.current;if(xt.current=null,c){const m=Math.min(c.startMs,c.endMs),f=Math.max(c.startMs,c.endMs);h.current=m,x.current=f;const w=T.JulianDate.fromDate(new Date(m)),W=T.JulianDate.fromDate(new Date(f));(s=V.current)==null||s.call(V,w,W)}A.current="none",M.current&&(M.current.style.cursor="default"),g(),F==null||F();return}A.current="none",M.current&&(M.current.style.cursor="default"),F==null||F()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",r),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)}},[g,Z,F,Et,wt]);const z=n.useCallback(t=>{const r=b.zoomRange(h.current,x.current,t);h.current=r.startMs,x.current=r.endMs,g()},[g]),nt=n.useCallback(t=>{t.preventDefault();const r=M.current;if(!r)return;const o=r.getBoundingClientRect(),d=t.clientY-o.top,s=tt.current,c=S.current;if(s&&c.length>0){const m=Math.max(0,o.height-b.TICK_AREA_HEIGHT);if(d>=0&&d<m){let f=0;for(const W of c)f+=(W.height??b.DEFAULT_LANE_HEIGHT)+b.LANE_GAP;const w=Math.max(0,f-m);if(w>0){N.current=Math.max(0,Math.min(w,N.current+t.deltaY*b.SWIM_LANE_SCROLL_SPEED)),g();return}}}z(Math.pow(1.05,t.deltaY>0?-1:1))},[z,g]);n.useEffect(()=>{const t=M.current;if(t)return t.addEventListener("wheel",nt,{passive:!1}),()=>t.removeEventListener("wheel",nt)},[nt]),n.useEffect(()=>{const t=M.current;if(!t)return;const r=s=>{s.preventDefault();const c=t.getBoundingClientRect();if(s.touches.length===1){const m=s.touches[0].clientX-c.left,f=Math.max(0,Math.min(c.width,m)),w=h.current+f/c.width*(x.current-h.current);St.current=O.current,pt.current="scrub",vt.current=s.touches[0].clientX,Rt.current=s.touches[0].clientX,O.current=w,g(),K==null||K(),Z(T.JulianDate.fromDate(new Date(w)))}else s.touches.length>=2&&(pt.current==="scrub"&&(O.current=St.current,g(),Z(T.JulianDate.fromDate(new Date(St.current)))),pt.current="pinch",yt.current=It(s.touches[0],s.touches[1]),jt.current=(s.touches[0].clientX+s.touches[1].clientX)/2-c.left)},o=s=>{s.preventDefault();const c=t.getBoundingClientRect();if(pt.current==="scrub"&&s.touches.length>=1){const m=s.touches[0].clientX-c.left,f=c.width*.08;if(Rt.current=s.touches[0].clientX,m<f)Et(-1);else if(m>c.width-f)Et(1);else{wt();const w=Math.max(0,Math.min(c.width,m)),W=h.current+w/c.width*(x.current-h.current);O.current=W,g(),Z(T.JulianDate.fromDate(new Date(W)))}}else if(pt.current==="slide"&&s.touches.length>=1){const m=vt.current-s.touches[0].clientX;if(vt.current=s.touches[0].clientX,m!==0){const f=m/c.width*(x.current-h.current);h.current+=f,x.current+=f,g()}}else if(pt.current==="pinch"&&s.touches.length>=2){const m=It(s.touches[0],s.touches[1]),f=(s.touches[0].clientX+s.touches[1].clientX)/2-c.left;if(m>0&&yt.current>0){const w=h.current+jt.current/c.width*(x.current-h.current),W=b.zoomAroundMs(h.current,x.current,yt.current/m,w);h.current=W.startMs,x.current=W.endMs,g()}yt.current=m,jt.current=f}},d=s=>{wt(),pt.current==="scrub"&&(F==null||F()),s.touches.length===0?pt.current="none":s.touches.length===1&&(pt.current="slide",vt.current=s.touches[0].clientX)};return t.addEventListener("touchstart",r,{passive:!1}),t.addEventListener("touchmove",o,{passive:!1}),t.addEventListener("touchend",d,{passive:!1}),()=>{t.removeEventListener("touchstart",r),t.removeEventListener("touchmove",o),t.removeEventListener("touchend",d)}},[g,K,F,Z,z,Et,wt]);const Mt=n.useCallback(t=>{var m,f,w;if(A.current!=="none")return;const r=t.currentTarget.getBoundingClientRect(),o=t.clientX-r.left,d=t.clientY-r.top,s=(O.current-h.current)/(x.current-h.current)*r.width,c=Math.abs(o-s)<=10;if(X(d,r.height)){const W=u(o,d,r.width,r.height),ht=k.current;if(W)t.currentTarget.style.cursor=c?"grab":"pointer",(!ht||ht.item.id!==W.item.id||ht.lane.id!==W.lane.id)&&(k.current=W,(m=P.current)==null||m.call(P,{laneId:W.lane.id,item:W.item,originalEvent:t.nativeEvent}),g());else if(ht&&(k.current=null,(f=P.current)==null||f.call(P,null),g()),c)t.currentTarget.style.cursor="grab";else{const Tt=_(o,d,r.height);t.currentTarget.style.cursor=Tt&&E.current?"grab":"default"}return}k.current&&(k.current=null,(w=P.current)==null||w.call(P,null),g()),c?t.currentTarget.style.cursor="grab":d>=r.height-b.TICK_AREA_HEIGHT?t.currentTarget.style.cursor="crosshair":t.currentTarget.style.cursor="default"},[g,u,X,_]),re=n.useCallback(t=>{var m;if(performance.now()-kt.current>300)return;const o=t.currentTarget.getBoundingClientRect(),d=t.clientX-o.left,s=t.clientY-o.top,c=u(d,s,o.width,o.height);c&&((m=Q.current)==null||m.call(Q,{laneId:c.lane.id,item:c.item,originalEvent:t.nativeEvent}))},[u]),oe=n.useCallback(t=>{var c;const r=t.currentTarget.getBoundingClientRect(),o=t.clientX-r.left,d=t.clientY-r.top,s=u(o,d,r.width,r.height);s&&((c=e.current)==null||c.call(e,{laneId:s.lane.id,item:s.item,originalEvent:t.nativeEvent}))},[u]),se=n.useCallback(t=>{const r=t.currentTarget.getBoundingClientRect(),o=t.clientX-r.left,d=t.clientY-r.top,s=u(o,d,r.width,r.height);s&&p.current?(t.preventDefault(),p.current({laneId:s.lane.id,item:s.item,originalEvent:t.nativeEvent})):t.preventDefault()},[u]);return n.useEffect(()=>()=>{D.current!==null&&cancelAnimationFrame(D.current),rt.current!==null&&cancelAnimationFrame(rt.current)},[]),l.jsx("canvas",{ref:M,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:it,onMouseMove:Mt,onClick:re,onDoubleClick:oe,onMouseLeave:()=>{var t;k.current&&(k.current=null,(t=P.current)==null||t.call(P,null),g()),A.current==="none"&&M.current&&(M.current.style.cursor="default")},onContextMenu:se})});Pt.displayName="TimelineCanvas";const Bt=[2,4,8,16,32,100,1],Ht=[1,2,4,8,16,32,100],ee=({startTime:v,endTime:L,currentTime:J,clock:i,onTimeChange:C,onPlayPause:I,onMultiplierChange:B,height:G,showControls:ft=!0,showJumpToStart:U,showJumpToEnd:Z,enableDrag:K=!0,dateTimeFormat:F,onDateTimeClick:ct,jumpToTime:q,maxTicks:ut,ffSpeeds:et=Bt,rwSpeeds:lt=Ht,theme:y,className:R,timezone:$,swimLanes:M,showSwimLanes:H,onShowSwimLanesChange:ot,swimLaneTransition:mt="animated",onSwimLaneItemClick:st,onSwimLaneItemHover:j,onSwimLaneItemDoubleClick:h,onSwimLaneItemContextMenu:x,onSwimLaneReorder:O,onRangeSelect:S,labels:tt})=>{const N=()=>Date.now(),k=v?T.JulianDate.toDate(b.toJulianDate(v)).getTime():N()-432e5,a=L?T.JulianDate.toDate(b.toJulianDate(L)).getTime():N()+12*3600*1e3,[Q,P]=n.useState(()=>b.toJulianDate(J??v??T.JulianDate.fromDate(new Date))),[e,p]=n.useState((i==null?void 0:i.shouldAnimate)??!1),[E,D]=n.useState((i==null?void 0:i.multiplier)??1),[rt,gt]=n.useState(H??!0);n.useEffect(()=>{H!=null&>(H)},[H]);const Y=()=>{const u=!rt;gt(u),ot==null||ot(u)},A=M!=null&&M.length>0,dt=n.useRef(null),[Rt,kt]=n.useState(0);n.useEffect(()=>{const u=dt.current;if(!u)return;const _=new ResizeObserver(([X])=>kt(X.borderBoxSize[0].blockSize));return _.observe(u),()=>_.disconnect()},[ft]);const Lt=A&&!rt?`${Rt+b.TICK_AREA_HEIGHT}px`:G!=null?`${G}px`:"100%",xt=n.useRef(!1),V=n.useRef(null),pt={...b.defaultTheme,...y};n.useEffect(()=>{if(!i)return;const u=()=>{if(!xt.current){const _=T.JulianDate.clone(i.currentTime);if(P(_),p(i.shouldAnimate),D(i.multiplier),V.current){const{startMs:X,endMs:it}=V.current.getVisibleRange(),z=it-X,nt=T.JulianDate.toDate(_).getTime(),Mt=nt-X;Mt<=z*.1?V.current.zoomTo(nt-z*.1,nt+z*.9,nt):Mt>=z*.9&&V.current.zoomTo(nt-z*.9,nt+z*.1,nt)}}};return i.onTick.addEventListener(u),()=>{i.onTick.removeEventListener(u)}},[i]),n.useEffect(()=>{if(i)return;const u=setInterval(()=>{if(xt.current)return;const _=T.JulianDate.fromDate(new Date);if(P(_),V.current){const{startMs:X,endMs:it}=V.current.getVisibleRange(),z=it-X,nt=T.JulianDate.toDate(_).getTime(),Mt=nt-X;Mt<=z*.1?V.current.zoomTo(nt-z*.1,nt+z*.9,nt):Mt>=z*.9&&V.current.zoomTo(nt-z*.9,nt+z*.1,nt)}},1e3);return()=>clearInterval(u)},[i]),n.useEffect(()=>{if(!q)return;const u=b.toJulianDate(q);if(yt(u),V.current){const{startMs:_,endMs:X}=V.current.getVisibleRange(),it=X-_,z=T.JulianDate.toDate(u).getTime();V.current.zoomTo(z-it/2,z+it/2)}},[q]);const vt=(u,_=!0)=>{i&&(i.multiplier=u,_&&(i.shouldAnimate=!0)),D(u),_&&p(!0),B==null||B(u)},yt=u=>{P(u),i&&(i.currentTime=T.JulianDate.clone(u)),C==null||C(u)},jt=u=>{u&&E<0&&vt(1,!1),i&&(i.shouldAnimate=u),p(u),I==null||I(u)},St=()=>{const u=et.length>0?et:Bt,_=E>1?E:1,X=u.indexOf(_),it=u[X<0||X===u.length-1?0:X+1];vt(it)},It=()=>{const u=lt.length>0?lt:Ht,_=E<0?Math.abs(E):0,X=u.indexOf(_),it=-u[X<0||X===u.length-1?0:X+1];vt(it)},bt=()=>{var _;const u=b.toJulianDate(v??T.JulianDate.fromDate(new Date(k)));i&&(i.currentTime=T.JulianDate.clone(u)),P(u),(_=V.current)==null||_.zoomTo(k,a)},g=()=>{var _;const u=b.toJulianDate(L??T.JulianDate.fromDate(new Date(a)));i&&(i.currentTime=T.JulianDate.clone(u)),P(u),(_=V.current)==null||_.zoomTo(k,a)},Et=()=>{const u=T.JulianDate.fromDate(new Date);i&&(i.currentTime=T.JulianDate.clone(u)),P(u),vt(1);const _=Date.now();if(V.current){const{startMs:X,endMs:it}=V.current.getVisibleRange(),z=it-X;V.current.zoomTo(_-z/2,_+z/2)}},wt=Math.abs(T.JulianDate.toDate(Q).getTime()-Date.now())<1e4;return l.jsxs("div",{className:R,style:{width:"100%",height:Lt,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:mt==="animated"?"height 0.2s ease":void 0},children:[ft&&l.jsx("div",{ref:dt,children:l.jsx(Wt,{currentTime:Q,isPlaying:e,multiplier:E,isLive:wt,hasStartTime:v!=null,hasEndTime:L!=null,showJumpToStart:U,showJumpToEnd:Z,onPlayPause:jt,onJumpToStart:bt,onRewind:It,onFastForward:St,onJumpToEnd:g,onJumpToLive:Et,onResetSpeed:()=>vt(1),onDateTimeClick:ct,dateTimeFormat:F,timezone:$,theme:pt,swimLanesVisible:A?rt:void 0,onToggleSwimLanes:A?Y:void 0,labels:tt})}),K!==!1&&l.jsx(Pt,{ref:V,currentTime:Q,defaultStartMs:k,defaultEndMs:a,theme:pt,maxTicks:ut,timezone:$,dateTimeFormat:F,months:tt==null?void 0:tt.months,onTimeChange:yt,onDragStart:()=>{xt.current=!0},onDragEnd:()=>{xt.current=!1},swimLanes:M,showSwimLanes:rt,onSwimLaneItemClick:st,onSwimLaneItemHover:j,onSwimLaneItemDoubleClick:h,onSwimLaneItemContextMenu:x,onSwimLaneReorder:O,onRangeSelect:S})]})},ne=({startTime:v,endTime:L,currentTime:J,width:i,height:C,tickInterval:I,showLabels:B,snapToTicks:G,enableDrag:ft,theme:U,onTimeChange:Z,onVisibleRangeChange:K,onDragStart:F,onDragEnd:ct})=>{const q=n.useMemo(()=>b.generateTicks(v,L,I,i),[v,L,I,i]),ut=n.useMemo(()=>b.timeToPosition(J,v,L,i),[J,v,L,i]),et=n.useRef(null),lt=R=>{if(!ft)return;const $=R.currentTarget.getBoundingClientRect(),M=R.clientX-$.left,H=Math.max(0,Math.min(i,M));if(!(Math.abs(H-ut)<=10)){let k=H;G&&(k=b.snapToTick(H,q,10));const a=new Date(v).getTime(),Q=new Date(L).getTime();Z(T.JulianDate.fromDate(new Date(a+k/i*(Q-a))));return}F==null||F();const mt=R.clientX,st=new Date(J).getTime(),j=new Date(v).getTime(),x=(new Date(L).getTime()-j)/i;let O=0,S=!1;const tt=k=>{O=k.clientX-mt,S=!0,et.current||(et.current=requestAnimationFrame(()=>{if(S){const a=st+O*x;Z(T.JulianDate.fromDate(new Date(a))),S=!1}et.current=null}))},N=()=>{document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",N),et.current!==null&&(cancelAnimationFrame(et.current),et.current=null),ct==null||ct()};document.addEventListener("mousemove",tt),document.addEventListener("mouseup",N)},y=R=>{R.preventDefault();const $=R.shiftKey?R.deltaY:R.deltaX!==0?R.deltaX:R.deltaY;if(Math.abs($)<1)return;const M=new Date(v).getTime(),H=new Date(L).getTime(),ot=$/i*(H-M)*.5;K==null||K(T.JulianDate.fromDate(new Date(M+ot)),T.JulianDate.fromDate(new Date(H+ot)))};return l.jsxs("svg",{width:"100%",height:C,style:{backgroundColor:U.backgroundColor,display:"block",cursor:"default"},onMouseDown:lt,onWheel:y,children:[l.jsx("rect",{width:i,height:C,fill:U.backgroundColor}),q.map((R,$)=>l.jsxs("g",{children:[l.jsx("line",{x1:R.position,y1:C-(R.isMajor?U.majorTickHeight:U.minorTickHeight),x2:R.position,y2:C,stroke:R.isMajor?U.majorTickColor:U.tickColor,strokeWidth:"1"}),B&&R.isMajor&&R.label&&l.jsx("text",{x:R.position,y:C-U.majorTickHeight-5,textAnchor:"middle",fill:U.labelColor,fontSize:U.fontSize,fontFamily:"monospace",children:R.label})]},$)),l.jsx("line",{x1:ut,y1:0,x2:ut,y2:C,stroke:U.indicatorColor,strokeWidth:U.indicatorLineWidth,pointerEvents:"none"}),ft&&l.jsx("rect",{x:Math.max(0,ut-10),y:0,width:20,height:C,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),l.jsx("circle",{cx:ut,cy:5,r:4,fill:U.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(at,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>b.TICK_AREA_HEIGHT}),at.Timeline=ee,at.TimelineCanvas=Pt,at.TimelineControls=Wt,at.TimelineSVG=ne,Object.keys(b).forEach(v=>{v!=="default"&&!Object.prototype.hasOwnProperty.call(at,v)&&Object.defineProperty(at,v,{enumerable:!0,get:()=>b[v]})}),Object.defineProperty(at,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,g,A,tt,A),H[A+g]=!0)}if(A=null,a!==void 0&&(F(a),A=""+a),J(i)&&(F(i.key),A=""+i.key),"key"in i){a={};for(var st in i)st!=="key"&&(a[st]=i[st])}else a=i;return A&&N(a,typeof t=="function"?t.displayName||t.name||"Unknown":t),z(t,A,a,j(),ut,mt)}function W(t){O(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===rt&&(t._payload.status==="fulfilled"?O(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function O(t){return typeof t=="object"&&t!==null&&t.$$typeof===U}var ct=n,U=Symbol.for("react.transitional.element"),ft=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),dt=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),K=Symbol.for("react.context"),nt=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),S=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),rt=Symbol.for("react.lazy"),gt=Symbol.for("react.activity"),Et=Symbol.for("react.client.reference"),ot=ct.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,s=Object.prototype.hasOwnProperty,b=Array.isArray,v=console.createTask?console.createTask:function(){return null};ct={react_stack_bottom_frame:function(t){return t()}};var at,q={},D=ct.react_stack_bottom_frame.bind(ct,k)(),$=v(d(k)),H={};jt.Fragment=Z,jt.jsx=function(t,i,a){var g=1e4>ot.recentlyCreatedOwnerStacks++;return Y(t,i,a,!1,g?Error("react-stack-top-frame"):D,g?v(d(t)):$)},jt.jsxs=function(t,i,a){var g=1e4>ot.recentlyCreatedOwnerStacks++;return Y(t,i,a,!0,g?Error("react-stack-top-frame"):D,g?v(d(t)):$)}})()),jt}var Bt;function ne(){return Bt||(Bt=1,process.env.NODE_ENV==="production"?It.exports=te():It.exports=ee()),It.exports}var l=ne();const re=520,oe=()=>l.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:[l.jsx("rect",{x:"1",y:"0",width:"4",height:"16",rx:"1"}),l.jsx("rect",{x:"9",y:"0",width:"4",height:"16",rx:"1"})]}),Ht=()=>l.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:l.jsx("polyline",{points:"3,5 7,9 11,5"})}),Gt=()=>l.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:l.jsx("polyline",{points:"3,9 7,5 11,9"})}),se={sm:{width:44,height:18,fontSize:"10px",dot:5,borderRadius:"3px"},md:{width:56,height:22,fontSize:"11px",dot:6,borderRadius:"3px"},lg:{width:72,height:30,fontSize:"13px",dot:8,borderRadius:"4px"}},Ut=({currentTime:R,isPlaying:C,multiplier:F,dateTimeFormat:d,timezone:j,isLive:k,hasStartTime:J,hasEndTime:N,showJumpToStart:pt=!0,showJumpToEnd:z=!0,onPlayPause:Y,onJumpToStart:W,onRewind:O,onFastForward:ct,onJumpToEnd:U,onJumpToLive:ft,onResetSpeed:Z,onDateTimeClick:dt,theme:T,swimLanesVisible:M,onToggleSwimLanes:K,labels:nt,liveButtonSize:Q="md",liveButtonPosition:S="left",live:L=!1})=>{const rt=F<0,gt=F>1,Et=F===1,ot=Math.abs(F),s=n.useMemo(()=>({...E.DEFAULT_LABELS,...nt}),[nt]),b=n.useRef(null),[v,at]=n.useState(!1);n.useEffect(()=>{const a=b.current;if(!a)return;const g=new ResizeObserver(([ut])=>{at(ut.contentRect.width<re)});return g.observe(a),()=>g.disconnect()},[]);const q={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},D=a=>({...q,color:a?T.buttonActiveColor:T.buttonColor,borderColor:a?`${T.buttonActiveColor}33`:"transparent"}),$=(a,g)=>{a.currentTarget.style.backgroundColor=g?`${T.buttonActiveColor}22`:T.buttonHoverColor+"44"},H=a=>{a.currentTarget.style.backgroundColor="transparent"},t=se[Q],i=l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[l.jsxs("button",{onClick:L?void 0:ft,style:{...q,fontSize:t.fontSize,fontWeight:"bold",letterSpacing:"0.05em",width:`${t.width}px`,minWidth:`${t.width}px`,height:`${t.height}px`,borderRadius:t.borderRadius,color:L||k?T.controlBarBackground:T.buttonActiveColor,backgroundColor:L||k?T.buttonActiveColor:"transparent",borderColor:T.buttonActiveColor,opacity:1,gap:"4px",cursor:L?"default":"pointer"},onMouseEnter:L?void 0:(a=>{a.currentTarget.style.opacity="1"}),onMouseLeave:L?void 0:(a=>{a.currentTarget.style.opacity=k?"1":"0.55"}),title:L||k?s.liveActiveTooltip:s.liveTooltip,children:[(L||k)&&l.jsx("span",{style:{width:`${t.dot}px`,height:`${t.dot}px`,borderRadius:"50%",backgroundColor:T.liveDotColor,display:"inline-block",flexShrink:0}}),L||k?s.liveActiveLabel:s.liveLabel]}),!Et&&!L&&l.jsx("button",{onClick:()=>Z(),style:{...q,fontSize:"11px",color:T.buttonActiveColor,borderColor:`${T.buttonActiveColor}44`,width:`${t.width}px`,minWidth:`${t.width}px`,height:`${t.height}px`},onMouseEnter:a=>$(a,!0),onMouseLeave:H,title:s.resetSpeedTooltip,children:rt?`◀ ${ot}×`:`${ot}× ▶`})]});return l.jsxs("div",{ref:b,style:{display:v?"flex":"grid",gridTemplateColumns:v?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:T.controlBarBackground,borderBottom:`1px solid ${T.controlBarBorder}`,fontFamily:"system-ui, -apple-system, sans-serif"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l.jsx("div",{onClick:L?void 0:dt,title:!L&&dt?s.dateTimeClickTooltip:void 0,style:{color:T.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:!L&&dt?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:a=>{!L&&dt&&(a.currentTarget.style.background=T.buttonHoverColor+"44")},onMouseLeave:a=>a.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:a,dateFormat:g}=E.splitForDisplay(d),ut=E.getTimezoneAbbr(R,j);return l.jsxs(l.Fragment,{children:[a&&l.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:E.formatDateTime(R,a,j)}),g&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[l.jsx("span",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:T.buttonActiveColor},children:E.formatDateTime(R,g,j)}),ut&&l.jsx("span",{style:{fontSize:"0.9em",color:T.labelColor,opacity:.7,fontWeight:"bold",letterSpacing:"0.04em"},children:ut})]})]})})()}),S==="left"&&i]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...v?{flex:1,justifyContent:"center"}:{}},children:[!L&&pt&&l.jsx("button",{onClick:J?W:void 0,disabled:!J,style:{...D(!1),opacity:J?1:.3,cursor:J?"pointer":"default"},onMouseEnter:J?a=>$(a,!1):void 0,onMouseLeave:J?H:void 0,title:J?s.jumpToStartTooltip:s.noStartTimeTooltip,children:"⏮"}),!L&&l.jsx("button",{onClick:O,style:{...D(rt),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>$(a,rt),onMouseLeave:H,title:rt?E.resolveLabel(s.rewindActiveTooltip,ot):s.rewindTooltip,children:rt?l.jsxs(l.Fragment,{children:[l.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[ot,"×"]}),"◀◀"]}):"◀◀"}),!L&&l.jsx("button",{onClick:()=>Y(!C),style:{...q,color:T.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${T.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:C?"0":"2px"},onMouseEnter:a=>$(a,!0),onMouseLeave:H,title:C?s.pauseTooltip:rt?s.playFromRewindTooltip:s.playTooltip,children:C?l.jsx(oe,{}):"▶"}),!L&&l.jsx("button",{onClick:ct,style:{...D(gt),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>$(a,gt),onMouseLeave:H,title:gt?E.resolveLabel(s.fastForwardActiveTooltip,ot):s.fastForwardTooltip,children:gt?l.jsxs(l.Fragment,{children:["▶▶",l.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[ot,"×"]})]}):"▶▶"}),!L&&z&&l.jsx("button",{onClick:N?U:void 0,disabled:!N,style:{...D(!1),opacity:N?1:.3,cursor:N?"pointer":"default"},onMouseEnter:N?a=>$(a,!1):void 0,onMouseLeave:N?H:void 0,title:N?s.jumpToEndTooltip:s.noEndTimeTooltip,children:"⏭"})]}),!v&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"8px"},children:[S==="right"&&i,K!=null&&M!=null&&l.jsx("button",{onClick:K,style:{...q,color:T.buttonActiveColor,borderColor:`${T.buttonActiveColor}33`},onMouseEnter:a=>$(a,M),onMouseLeave:H,title:M?s.collapseSwimLanesTooltip:s.expandSwimLanesTooltip,children:M?l.jsx(Ht,{}):l.jsx(Gt,{})})]}),v&&K!=null&&M!=null&&l.jsx("button",{onClick:K,style:{...q,color:T.buttonActiveColor,borderColor:`${T.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:a=>$(a,M),onMouseLeave:H,title:M?s.collapseSwimLanesTooltip:s.expandSwimLanesTooltip,children:M?l.jsx(Ht,{}):l.jsx(Gt,{})})]})},Nt=n.forwardRef((R,C)=>{const{currentTime:F,defaultStartMs:d,defaultEndMs:j,theme:k,maxTicks:J,timezone:N,dateTimeFormat:pt,months:z,onTimeChange:Y,onDragStart:W,onDragEnd:O,onRangeSelect:ct,swimLanes:U,showSwimLanes:ft,onSwimLaneItemClick:Z,onSwimLaneItemHover:dt,onSwimLaneItemDoubleClick:T,onSwimLaneItemContextMenu:M,onSwimLaneReorder:K,disableNeedleDrag:nt,invertScrollZoom:Q}=R,S=n.useRef(null),L=n.useRef(k),rt=n.useRef(J),gt=n.useRef(N),Et=n.useRef(pt),ot=n.useRef(z),s=n.useRef(d),b=n.useRef(j),v=n.useRef(_.JulianDate.toDate(F).getTime());n.useEffect(()=>{L.current=k},[k]),n.useEffect(()=>{rt.current=J},[J]),n.useEffect(()=>{gt.current=N,x()},[N]),n.useEffect(()=>{Et.current=pt,x()},[pt]),n.useEffect(()=>{ot.current=z,x()},[z]);const at=n.useRef(nt??!1);n.useEffect(()=>{at.current=nt??!1},[nt]);const q=n.useRef(Q??!1);n.useEffect(()=>{q.current=Q??!1},[Q]);const D=n.useRef(U??[]),$=n.useRef(ft??(U!=null&&U.length>0)),H=n.useRef(0),t=n.useRef(null),i=n.useRef(null),a=n.useRef(Z),g=n.useRef(dt),ut=n.useRef(T),mt=n.useRef(M),A=n.useRef(K);n.useEffect(()=>{a.current=Z},[Z]),n.useEffect(()=>{g.current=dt},[dt]),n.useEffect(()=>{ut.current=T},[T]),n.useEffect(()=>{mt.current=M},[M]),n.useEffect(()=>{A.current=K},[K]),n.useEffect(()=>{D.current=U??[],x()},[U]),n.useEffect(()=>{$.current=ft??(U!=null&&U.length>0),x()},[ft,U]);const tt=n.useRef(null),st=n.useRef(null),wt=n.useRef(!1),Ot=n.useRef(0),P=n.useRef("none"),xt=n.useRef(0),Dt=n.useRef(0),Pt=n.useRef(0),Ct=n.useRef(0),Ft=n.useRef(0),bt=n.useRef(null),B=n.useRef(ct);n.useEffect(()=>{B.current=ct},[ct]);const vt=n.useRef(null),lt=n.useRef("none"),yt=n.useRef(0),At=n.useRef(0),kt=n.useRef(0),Lt=n.useRef(0),Xt=(e,r)=>Math.hypot(r.clientX-e.clientX,r.clientY-e.clientY),Rt=n.useCallback(()=>({startMs:s.current,endMs:b.current,currentMs:v.current,theme:L.current,maxTicks:rt.current,timezone:gt.current,use12h:/h/.test(Et.current??""),months:ot.current,swimLanes:D.current,showSwimLanes:$.current,scrollTop:H.current,reorderState:i.current,rangeSelection:bt.current,hoverMs:vt.current}),[]);n.useImperativeHandle(C,()=>({zoomTo(e,r,o){const p=Math.max(E.MIN_SPAN_MS,Math.min(E.MAX_SPAN_MS,r-e)),c=(e+r)/2;s.current=c-p/2,b.current=c+p/2,o!==void 0&&(v.current=o),x()},getVisibleRange(){return{startMs:s.current,endMs:b.current}},startFollow(e){if(Ot.current=e,st.current!==null)return;wt.current=!0;let r=performance.now();const o=()=>{const p=performance.now(),c=p-r;r=p;const u=c*Ot.current;s.current+=u,b.current+=u,v.current+=u,x(),st.current=requestAnimationFrame(o)};st.current=requestAnimationFrame(o)},stopFollow(){wt.current=!1,st.current!==null&&(cancelAnimationFrame(st.current),st.current=null)},correctFollow(e){if(!wt.current)return;const r=e-v.current;v.current=e,s.current+=r,b.current+=r},appendSwimLane(e){D.current=[...D.current,e],x()},updateSwimLane(e,r){D.current=D.current.map(o=>o.id===e?{...o,...r,id:o.id}:o),x()},removeSwimLane(e){D.current=D.current.filter(r=>r.id!==e),x()},reorderSwimLanes(e){const r=new Map(D.current.map(p=>[p.id,p])),o=[];for(const p of e){const c=r.get(p);c&&o.push(c)}D.current=o,x()}}));const x=n.useCallback(()=>{const e=S.current;if(!e)return;const r=e.getContext("2d");if(!r)return;const o=e.getBoundingClientRect(),p=o.width,c=o.height;if(p===0||c===0)return;const u=window.devicePixelRatio||1,m=Math.round(p*u),f=Math.round(c*u);(e.width!==m||e.height!==f)&&(e.width=m,e.height=f),r.save(),r.scale(u,u);const y=E.drawTimeline(r,p,c,Rt());y!==H.current&&(H.current=y),r.restore()},[Rt]);n.useLayoutEffect(()=>{x();const e=S.current;if(!e)return;const r=new ResizeObserver(()=>x());return r.observe(e),()=>r.disconnect()},[x]),n.useEffect(()=>{if(wt.current)return;const e=_.JulianDate.toDate(F).getTime();v.current!==e&&(v.current=e,x())},[F,x]);const Tt=n.useCallback(e=>{if(tt.current!==null)return;const r=()=>{const o=S.current,p=b.current-s.current,c=e*p*.01;if(s.current+=c,b.current+=c,o){const u=o.getBoundingClientRect(),m=Math.max(0,Math.min(u.width,Dt.current-u.left)),f=s.current+m/u.width*(b.current-s.current);v.current=f,Y(_.JulianDate.fromDate(new Date(f)))}x(),tt.current=requestAnimationFrame(r)};tt.current=requestAnimationFrame(r)},[x,Y]),h=n.useCallback(()=>{tt.current!==null&&(cancelAnimationFrame(tt.current),tt.current=null)},[]),w=n.useCallback((e,r,o,p)=>E.hitTestSwimLane(e,r,o,p,Rt()),[Rt]),X=n.useCallback((e,r,o)=>E.hitTestLaneLabel(e,r,o,Rt()),[Rt]),et=n.useCallback((e,r)=>E.isInSwimLaneRegion(e,r,Rt()),[Rt]),G=n.useCallback(e=>{e.preventDefault();const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left,p=e.clientY-r.top;if(e.button===0&&A.current){const c=X(o,p,r.height);if(c){const m=D.current.findIndex(f=>f.id===c.id);i.current={dragging:!0,dragLaneId:c.id,dragStartY:e.clientY,currentY:e.clientY,insertIndex:m},e.currentTarget.style.cursor="grabbing";return}}if(e.button===0&&et(p,r.height)){const c=(v.current-s.current)/(b.current-s.current)*r.width;if(!(Math.abs(o-c)<=10)&&w(o,p,r.width,r.height)){Pt.current=performance.now();return}}if(e.button===0){if(at.current){P.current="slide",xt.current=e.clientX;return}const c=(v.current-s.current)/(b.current-s.current)*r.width,u=Math.abs(o-c)<=10,m=p>=r.height-E.TICK_AREA_HEIGHT;if(!u&&m)P.current="rangeSelectPending",Ft.current=o,Ct.current=s.current+o/r.width*(b.current-s.current),e.currentTarget.style.cursor="crosshair",W==null||W();else{P.current="scrub",Dt.current=e.clientX,e.currentTarget.style.cursor="grabbing",W==null||W();const f=s.current+o/r.width*(b.current-s.current);v.current=f,x(),Y(_.JulianDate.fromDate(new Date(f)))}}else if(e.button===1)P.current="slide",xt.current=e.clientX;else if(e.button===2){if(mt.current&&et(p,r.height))return;P.current="zoom",xt.current=e.clientX}},[x,Y,W,X,et,w]);n.useEffect(()=>{const e=o=>{const p=i.current;if(p&&p.dragging){p.currentY=o.clientY;const f=S.current;if(f){const y=f.getBoundingClientRect(),I=o.clientY-y.top;let _t=-H.current;const zt=D.current;let Zt=zt.length;for(let Jt=0;Jt<zt.length;Jt++){const Qt=zt[Jt].height??E.DEFAULT_LANE_HEIGHT,de=_t+Qt/2;if(I<de){Zt=Jt;break}_t+=Qt+E.LANE_GAP}p.insertIndex=Zt}x();return}if(P.current==="none")return;const c=S.current;if(!c)return;const u=c.getBoundingClientRect(),m=u.width;if(P.current==="scrub"){Dt.current=o.clientX;const f=o.clientX-u.left,y=m*.08;f<y?Tt(-1):f>m-y?Tt(1):h();const I=Math.max(0,Math.min(m,f)),ht=s.current+I/m*(b.current-s.current);v.current=ht,x(),Y(_.JulianDate.fromDate(new Date(ht)))}else if(P.current==="rangeSelectPending"||P.current==="rangeSelect"){const f=o.clientX-u.left,y=Math.abs(f-Ft.current);if(P.current==="rangeSelectPending"&&y>=3&&(P.current="rangeSelect"),P.current==="rangeSelect"){const I=Math.max(0,Math.min(m,f)),ht=s.current+I/m*(b.current-s.current);bt.current={startMs:Ct.current,endMs:ht},x()}}else if(P.current==="slide"){const f=xt.current-o.clientX;if(xt.current=o.clientX,f!==0){const y=f/m*(b.current-s.current);s.current+=y,b.current+=y,x()}}else if(P.current==="zoom"){const f=xt.current-o.clientX;xt.current=o.clientX,f!==0&&V(Math.pow(1.01,f))}},r=()=>{var p,c;const o=i.current;if(o&&o.dragging){const u=Math.abs(o.currentY-o.dragStartY),m=D.current,f=m.findIndex(y=>y.id===o.dragLaneId);if(u>5&&f>=0&&o.insertIndex!==f&&o.insertIndex!==f+1){const y=[...m],[I]=y.splice(f,1),ht=o.insertIndex>f?o.insertIndex-1:o.insertIndex;y.splice(ht,0,I),D.current=y,(p=A.current)==null||p.call(A,y.map(_t=>_t.id))}i.current=null,S.current&&(S.current.style.cursor="default"),x();return}if(h(),P.current==="rangeSelectPending"){v.current=Ct.current,bt.current=null,P.current="none",S.current&&(S.current.style.cursor="default"),x(),Y(_.JulianDate.fromDate(new Date(Ct.current))),O==null||O();return}if(P.current==="rangeSelect"){const u=bt.current;if(bt.current=null,u){const m=Math.min(u.startMs,u.endMs),f=Math.max(u.startMs,u.endMs);s.current=m,b.current=f;const y=Math.max(m,Math.min(f,v.current));y!==v.current&&(v.current=y,Y(_.JulianDate.fromDate(new Date(y))));const I=_.JulianDate.fromDate(new Date(m)),ht=_.JulianDate.fromDate(new Date(f));(c=B.current)==null||c.call(B,I,ht)}P.current="none",S.current&&(S.current.style.cursor="default"),x(),O==null||O();return}P.current="none",S.current&&(S.current.style.cursor="default"),O==null||O()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",r),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r)}},[x,Y,O,Tt,h]);const V=n.useCallback(e=>{const r=E.zoomRange(s.current,b.current,e);s.current=r.startMs,b.current=r.endMs,x()},[x]),Mt=n.useCallback(e=>{e.preventDefault();const r=S.current;if(!r)return;const o=r.getBoundingClientRect(),p=e.clientY-o.top,c=$.current,u=D.current;if(c&&u.length>0){const m=Math.max(0,o.height-E.TICK_AREA_HEIGHT);if(p>=0&&p<m){let f=0;for(const I of u)f+=(I.height??E.DEFAULT_LANE_HEIGHT)+E.LANE_GAP;const y=Math.max(0,f-m);if(y>0){H.current=Math.max(0,Math.min(y,H.current+e.deltaY*E.SWIM_LANE_SCROLL_SPEED)),x();return}}}V(Math.pow(1.05,e.deltaY>0===q.current?-1:1))},[V,x]);n.useEffect(()=>{const e=S.current;if(e)return e.addEventListener("wheel",Mt,{passive:!1}),()=>e.removeEventListener("wheel",Mt)},[Mt]),n.useEffect(()=>{const e=S.current;if(!e)return;const r=c=>{c.preventDefault();const u=e.getBoundingClientRect();if(c.touches.length===1){const m=c.touches[0].clientX-u.left,f=Math.max(0,Math.min(u.width,m)),y=s.current+f/u.width*(b.current-s.current);Lt.current=v.current,at.current?(lt.current="slide",yt.current=c.touches[0].clientX):(lt.current="scrub",yt.current=c.touches[0].clientX,Dt.current=c.touches[0].clientX,v.current=y,x(),W==null||W(),Y(_.JulianDate.fromDate(new Date(y))))}else c.touches.length>=2&&(lt.current==="scrub"&&(v.current=Lt.current,x(),Y(_.JulianDate.fromDate(new Date(Lt.current)))),lt.current="pinch",At.current=Xt(c.touches[0],c.touches[1]),kt.current=(c.touches[0].clientX+c.touches[1].clientX)/2-u.left)},o=c=>{c.preventDefault();const u=e.getBoundingClientRect();if(lt.current==="scrub"&&c.touches.length>=1){const m=c.touches[0].clientX-u.left,f=u.width*.08;if(Dt.current=c.touches[0].clientX,m<f)Tt(-1);else if(m>u.width-f)Tt(1);else{h();const y=Math.max(0,Math.min(u.width,m)),I=s.current+y/u.width*(b.current-s.current);v.current=I,x(),Y(_.JulianDate.fromDate(new Date(I)))}}else if(lt.current==="slide"&&c.touches.length>=1){const m=yt.current-c.touches[0].clientX;if(yt.current=c.touches[0].clientX,m!==0){const f=m/u.width*(b.current-s.current);s.current+=f,b.current+=f,x()}}else if(lt.current==="pinch"&&c.touches.length>=2){const m=Xt(c.touches[0],c.touches[1]),f=(c.touches[0].clientX+c.touches[1].clientX)/2-u.left;if(m>0&&At.current>0){const y=s.current+kt.current/u.width*(b.current-s.current),I=E.zoomAroundMs(s.current,b.current,At.current/m,y);s.current=I.startMs,b.current=I.endMs,x()}At.current=m,kt.current=f}},p=c=>{h(),lt.current==="scrub"&&(O==null||O()),c.touches.length===0?lt.current="none":c.touches.length===1&&(lt.current="slide",yt.current=c.touches[0].clientX)};return e.addEventListener("touchstart",r,{passive:!1}),e.addEventListener("touchmove",o,{passive:!1}),e.addEventListener("touchend",p,{passive:!1}),()=>{e.removeEventListener("touchstart",r),e.removeEventListener("touchmove",o),e.removeEventListener("touchend",p)}},[x,W,O,Y,V,Tt,h]);const ue=n.useCallback(e=>{var m,f,y;const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left,p=e.clientY-r.top;if(P.current==="none")if(at.current)vt.current!==null&&(vt.current=null);else{const I=s.current+Math.max(0,Math.min(r.width,o))/r.width*(b.current-s.current);vt.current!==I&&(vt.current=I)}if(P.current!=="none"){vt.current=null;return}const c=(v.current-s.current)/(b.current-s.current)*r.width,u=!at.current&&Math.abs(o-c)<=10;if(et(p,r.height)){const I=w(o,p,r.width,r.height),ht=t.current;if(I)e.currentTarget.style.cursor=u?"grab":"pointer",(!ht||ht.item.id!==I.item.id||ht.lane.id!==I.lane.id)&&(t.current=I,(m=g.current)==null||m.call(g,{laneId:I.lane.id,item:I.item,originalEvent:e.nativeEvent}));else if(ht&&(t.current=null,(f=g.current)==null||f.call(g,null)),u)e.currentTarget.style.cursor="grab";else{const _t=X(o,p,r.height);e.currentTarget.style.cursor=_t&&A.current?"grab":"default"}x();return}t.current&&(t.current=null,(y=g.current)==null||y.call(g,null)),u?e.currentTarget.style.cursor="grab":!at.current&&p>=r.height-E.TICK_AREA_HEIGHT?e.currentTarget.style.cursor="crosshair":e.currentTarget.style.cursor="default",x()},[x,w,et,X]),le=n.useCallback(e=>{var m;if(performance.now()-Pt.current>300)return;const o=e.currentTarget.getBoundingClientRect(),p=e.clientX-o.left,c=e.clientY-o.top,u=w(p,c,o.width,o.height);u&&((m=a.current)==null||m.call(a,{laneId:u.lane.id,item:u.item,originalEvent:e.nativeEvent}))},[w]),ie=n.useCallback(e=>{var u;const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left,p=e.clientY-r.top,c=w(o,p,r.width,r.height);c&&((u=ut.current)==null||u.call(ut,{laneId:c.lane.id,item:c.item,originalEvent:e.nativeEvent}))},[w]),fe=n.useCallback(e=>{const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left,p=e.clientY-r.top,c=w(o,p,r.width,r.height);c&&mt.current?(e.preventDefault(),mt.current({laneId:c.lane.id,item:c.item,originalEvent:e.nativeEvent})):e.preventDefault()},[w]);return n.useEffect(()=>()=>{tt.current!==null&&cancelAnimationFrame(tt.current),st.current!==null&&cancelAnimationFrame(st.current)},[]),l.jsx("canvas",{ref:S,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:G,onMouseMove:ue,onClick:le,onDoubleClick:ie,onMouseLeave:()=>{var e;t.current&&(t.current=null,(e=g.current)==null||e.call(g,null)),vt.current=null,P.current==="none"&&S.current&&(S.current.style.cursor="default"),x()},onContextMenu:fe})});Nt.displayName="TimelineCanvas";const Kt=[2,4,8,16,32,100,1],Vt=[1,2,4,8,16,32,100],ce=({startTime:R,endTime:C,currentTime:F,clock:d,onTimeChange:j,onPlayPause:k,onMultiplierChange:J,height:N,showControls:pt=!0,showJumpToStart:z,showJumpToEnd:Y,enableDrag:W=!0,dateTimeFormat:O,onDateTimeClick:ct,jumpToTime:U,maxTicks:ft,ffSpeeds:Z=Kt,rwSpeeds:dt=Vt,theme:T,className:M,timezone:K,swimLanes:nt,showSwimLanes:Q,onShowSwimLanesChange:S,swimLaneTransition:L="animated",onSwimLaneItemClick:rt,onSwimLaneItemHover:gt,onSwimLaneItemDoubleClick:Et,onSwimLaneItemContextMenu:ot,onSwimLaneReorder:s,onRangeSelect:b,labels:v,liveButtonSize:at,liveButtonPosition:q,live:D,invertScrollZoom:$})=>{const H=()=>Date.now(),t=R?_.JulianDate.toDate(E.toJulianDate(R)).getTime():H()-432e5,i=C?_.JulianDate.toDate(E.toJulianDate(C)).getTime():H()+12*3600*1e3,[a,g]=n.useState(()=>E.toJulianDate(F??R??_.JulianDate.fromDate(new Date))),[ut,mt]=n.useState((d==null?void 0:d.shouldAnimate)??!1),[A,tt]=n.useState((d==null?void 0:d.multiplier)??1),[st,wt]=n.useState(Q??!0);n.useEffect(()=>{Q!=null&&wt(Q)},[Q]);const Ot=()=>{const h=!st;wt(h),S==null||S(h)},P=nt!=null&&nt.length>0,xt=n.useRef(null),[Dt,Pt]=n.useState(0);n.useEffect(()=>{const h=xt.current;if(!h)return;const w=new ResizeObserver(([X])=>Pt(X.borderBoxSize[0].blockSize));return w.observe(h),()=>w.disconnect()},[pt]);const Ft=P&&!st?`${Dt+E.TICK_AREA_HEIGHT}px`:N!=null?`${N}px`:"100%",bt=n.useRef(!1),B=n.useRef(null),vt={...E.defaultTheme,...T};n.useEffect(()=>{if(!d)return;const h=()=>{if(!bt.current){const w=_.JulianDate.clone(d.currentTime);if(g(w),mt(d.shouldAnimate),tt(d.multiplier),B.current){const{startMs:X,endMs:et}=B.current.getVisibleRange(),G=et-X,V=_.JulianDate.toDate(w).getTime(),Mt=V-X;Mt<=G*.1?B.current.zoomTo(V-G*.1,V+G*.9,V):Mt>=G*.9&&B.current.zoomTo(V-G*.9,V+G*.1,V)}}};return d.onTick.addEventListener(h),()=>{d.onTick.removeEventListener(h)}},[d]),n.useEffect(()=>{if(d)return;const h=setInterval(()=>{if(bt.current)return;const w=_.JulianDate.fromDate(new Date);if(g(w),B.current){const{startMs:X,endMs:et}=B.current.getVisibleRange(),G=et-X,V=_.JulianDate.toDate(w).getTime(),Mt=V-X;Mt<=G*.1?B.current.zoomTo(V-G*.1,V+G*.9,V):Mt>=G*.9&&B.current.zoomTo(V-G*.9,V+G*.1,V)}},1e3);return()=>clearInterval(h)},[d]),n.useEffect(()=>{if(!U||D)return;const h=E.toJulianDate(U);if(yt(h),B.current){const{startMs:w,endMs:X}=B.current.getVisibleRange(),et=X-w,G=_.JulianDate.toDate(h).getTime();B.current.zoomTo(G-et/2,G+et/2)}},[U]);const lt=(h,w=!0)=>{d&&(d.multiplier=h,w&&(d.shouldAnimate=!0)),tt(h),w&&mt(!0),J==null||J(h)},yt=h=>{g(h),d&&(d.currentTime=_.JulianDate.clone(h)),j==null||j(h)},At=h=>{h&&A<0&<(1,!1),d&&(d.shouldAnimate=h),mt(h),k==null||k(h)},kt=()=>{const h=Z.length>0?Z:Kt,w=A>1?A:1,X=h.indexOf(w),et=h[X<0||X===h.length-1?0:X+1];lt(et)},Lt=()=>{const h=dt.length>0?dt:Vt,w=A<0?Math.abs(A):0,X=h.indexOf(w),et=-h[X<0||X===h.length-1?0:X+1];lt(et)},Xt=()=>{var w;const h=E.toJulianDate(R??_.JulianDate.fromDate(new Date(t)));d&&(d.currentTime=_.JulianDate.clone(h)),g(h),(w=B.current)==null||w.zoomTo(t,i)},Rt=()=>{var w;const h=E.toJulianDate(C??_.JulianDate.fromDate(new Date(i)));d&&(d.currentTime=_.JulianDate.clone(h)),g(h),(w=B.current)==null||w.zoomTo(t,i)},x=()=>{const h=_.JulianDate.fromDate(new Date);d&&(d.currentTime=_.JulianDate.clone(h)),g(h),lt(1);const w=Date.now();if(B.current){const{startMs:X,endMs:et}=B.current.getVisibleRange(),G=et-X;B.current.zoomTo(w-G/2,w+G/2)}},Tt=Math.abs(_.JulianDate.toDate(a).getTime()-Date.now())<2e3;return l.jsxs("div",{className:M,style:{width:"100%",height:Ft,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:L==="animated"?"height 0.2s ease":void 0},children:[pt&&l.jsx("div",{ref:xt,children:l.jsx(Ut,{currentTime:a,isPlaying:ut,multiplier:A,isLive:Tt,hasStartTime:R!=null,hasEndTime:C!=null,showJumpToStart:z,showJumpToEnd:Y,onPlayPause:At,onJumpToStart:Xt,onRewind:Lt,onFastForward:kt,onJumpToEnd:Rt,onJumpToLive:x,onResetSpeed:()=>lt(1),onDateTimeClick:ct,dateTimeFormat:O,timezone:K,theme:vt,swimLanesVisible:P?st:void 0,onToggleSwimLanes:P?Ot:void 0,labels:v,liveButtonSize:at,liveButtonPosition:q,live:D})}),(W!==!1||D)&&l.jsx(Nt,{ref:B,currentTime:a,defaultStartMs:t,defaultEndMs:i,theme:vt,maxTicks:ft,timezone:K,dateTimeFormat:O,months:v==null?void 0:v.months,onTimeChange:yt,onDragStart:()=>{bt.current=!0},onDragEnd:()=>{bt.current=!1},disableNeedleDrag:!!D,invertScrollZoom:$,swimLanes:nt,showSwimLanes:st,onSwimLaneItemClick:rt,onSwimLaneItemHover:gt,onSwimLaneItemDoubleClick:Et,onSwimLaneItemContextMenu:ot,onSwimLaneReorder:s,onRangeSelect:b})]})},ae=({startTime:R,endTime:C,currentTime:F,width:d,height:j,tickInterval:k,showLabels:J,snapToTicks:N,enableDrag:pt,theme:z,onTimeChange:Y,onVisibleRangeChange:W,onDragStart:O,onDragEnd:ct})=>{const U=n.useMemo(()=>E.generateTicks(R,C,k,d),[R,C,k,d]),ft=n.useMemo(()=>E.timeToPosition(F,R,C,d),[F,R,C,d]),Z=n.useRef(null),dt=M=>{if(!pt)return;const K=M.currentTarget.getBoundingClientRect(),nt=M.clientX-K.left,Q=Math.max(0,Math.min(d,nt));if(!(Math.abs(Q-ft)<=10)){let q=Q;N&&(q=E.snapToTick(Q,U,10));const D=new Date(R).getTime(),$=new Date(C).getTime();Y(_.JulianDate.fromDate(new Date(D+q/d*($-D))));return}O==null||O();const L=M.clientX,rt=new Date(F).getTime(),gt=new Date(R).getTime(),ot=(new Date(C).getTime()-gt)/d;let s=0,b=!1;const v=q=>{s=q.clientX-L,b=!0,Z.current||(Z.current=requestAnimationFrame(()=>{if(b){const D=rt+s*ot;Y(_.JulianDate.fromDate(new Date(D))),b=!1}Z.current=null}))},at=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",at),Z.current!==null&&(cancelAnimationFrame(Z.current),Z.current=null),ct==null||ct()};document.addEventListener("mousemove",v),document.addEventListener("mouseup",at)},T=M=>{M.preventDefault();const K=M.shiftKey?M.deltaY:M.deltaX!==0?M.deltaX:M.deltaY;if(Math.abs(K)<1)return;const nt=new Date(R).getTime(),Q=new Date(C).getTime(),S=K/d*(Q-nt)*.5;W==null||W(_.JulianDate.fromDate(new Date(nt+S)),_.JulianDate.fromDate(new Date(Q+S)))};return l.jsxs("svg",{width:"100%",height:j,style:{backgroundColor:z.backgroundColor,display:"block",cursor:"default"},onMouseDown:dt,onWheel:T,children:[l.jsx("rect",{width:d,height:j,fill:z.backgroundColor}),U.map((M,K)=>l.jsxs("g",{children:[l.jsx("line",{x1:M.position,y1:j-(M.isMajor?z.majorTickHeight:z.minorTickHeight),x2:M.position,y2:j,stroke:M.isMajor?z.majorTickColor:z.tickColor,strokeWidth:"1"}),J&&M.isMajor&&M.label&&l.jsx("text",{x:M.position,y:j-z.majorTickHeight-5,textAnchor:"middle",fill:z.labelColor,fontSize:z.fontSize,fontFamily:"monospace",children:M.label})]},K)),l.jsx("line",{x1:ft,y1:0,x2:ft,y2:j,stroke:z.indicatorColor,strokeWidth:z.indicatorLineWidth,pointerEvents:"none"}),pt&&l.jsx("rect",{x:Math.max(0,ft-10),y:0,width:20,height:j,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),l.jsx("circle",{cx:ft,cy:5,r:4,fill:z.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(it,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>E.TICK_AREA_HEIGHT}),it.Timeline=ce,it.TimelineCanvas=Nt,it.TimelineControls=Ut,it.TimelineSVG=ae,Object.keys(E).forEach(R=>{R!=="default"&&!Object.prototype.hasOwnProperty.call(it,R)&&Object.defineProperty(it,R,{enumerable:!0,get:()=>E[R]})}),Object.defineProperty(it,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,12 @@ export declare interface ControlsProps {
|
|
|
33
33
|
onToggleSwimLanes?: () => void;
|
|
34
34
|
/** Overrides for control-bar labels and tooltips (i18n / custom verbiage). */
|
|
35
35
|
labels?: Partial<TimelineLabels>;
|
|
36
|
+
/** @see TimelineBaseProps.liveButtonSize */
|
|
37
|
+
liveButtonSize?: 'sm' | 'md' | 'lg';
|
|
38
|
+
/** @see TimelineBaseProps.liveButtonPosition */
|
|
39
|
+
liveButtonPosition?: 'left' | 'right';
|
|
40
|
+
/** @see TimelineBaseProps.live */
|
|
41
|
+
live?: boolean;
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
export { TICK_AREA_HEIGHT }
|
|
@@ -79,6 +85,10 @@ declare interface TimelineCanvasProps {
|
|
|
79
85
|
onTimeChange: (time: Cesium.JulianDate) => void;
|
|
80
86
|
onDragStart?: () => void;
|
|
81
87
|
onDragEnd?: () => void;
|
|
88
|
+
/** When true, needle scrub is disabled (left-click becomes pan). Zoom and pan remain active. */
|
|
89
|
+
disableNeedleDrag?: boolean;
|
|
90
|
+
/** @see TimelineBaseProps.invertScrollZoom */
|
|
91
|
+
invertScrollZoom?: boolean;
|
|
82
92
|
onRangeSelect?: (start: Cesium.JulianDate, end: Cesium.JulianDate) => void;
|
|
83
93
|
swimLanes?: SwimLane[];
|
|
84
94
|
showSwimLanes?: boolean;
|
|
@@ -130,6 +140,14 @@ export declare interface TimelineProps {
|
|
|
130
140
|
* want to change; everything else falls back to the English defaults.
|
|
131
141
|
*/
|
|
132
142
|
labels?: Partial<TimelineLabels>;
|
|
143
|
+
/** @see TimelineBaseProps.liveButtonSize */
|
|
144
|
+
liveButtonSize?: 'sm' | 'md' | 'lg';
|
|
145
|
+
/** @see TimelineBaseProps.liveButtonPosition */
|
|
146
|
+
liveButtonPosition?: 'left' | 'right';
|
|
147
|
+
/** @see TimelineBaseProps.live */
|
|
148
|
+
live?: boolean;
|
|
149
|
+
/** @see TimelineBaseProps.invertScrollZoom */
|
|
150
|
+
invertScrollZoom?: boolean;
|
|
133
151
|
}
|
|
134
152
|
|
|
135
153
|
export declare const TimelineSVG: default_2.FC<TimelineSVGProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kteneyck/cesium-timeline-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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.10.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@testing-library/jest-dom": "^6.0.0",
|