@pennsieve-viz/tsviewer 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BFLibraryButton-CjW78KwZ.js → BFLibraryButton-DEY9t1Is.js} +1 -1
- package/dist/{BFLibraryButton-DGI5G53e.cjs → BFLibraryButton-zWDUe3E8.cjs} +1 -1
- package/dist/{IconSelection-BJc1giuT.cjs → IconSelection-DsOecTVD.cjs} +1 -1
- package/dist/{IconSelection-ChXlHpsu.js → IconSelection-IJR6hdts.js} +1 -1
- package/dist/{TSAnnotationCanvas-CfyqYTnB.js → TSAnnotationCanvas-B0b_EheO.js} +3 -3
- package/dist/{TSAnnotationCanvas-DhskkXWf.cjs → TSAnnotationCanvas-Bfxc75PD.cjs} +1 -1
- package/dist/{TSAnnotationModal-Bde2b3U0.cjs → TSAnnotationModal-DkLaOB7u.cjs} +1 -1
- package/dist/{TSAnnotationModal-KX-_Afb3.js → TSAnnotationModal-DpLHrHfV.js} +3 -3
- package/dist/{TSFilterModal-BMSEMK8Y.js → TSFilterModal-C1-o1zyF.js} +3 -3
- package/dist/{TSFilterModal-RgvcihE6.cjs → TSFilterModal-DsVcUoIk.cjs} +1 -1
- package/dist/{TSScrubber-DqCc3Zp7.js → TSScrubber-9ABMW6b2.js} +1 -1
- package/dist/{TSScrubber-C90JS4pD.cjs → TSScrubber-BlHHGh3F.cjs} +1 -1
- package/dist/{TSViewerCanvas-3TTYdC6T.js → TSViewerCanvas-A6HgBZ4E.js} +313 -313
- package/dist/{TSViewerCanvas-BUlYMq9z.cjs → TSViewerCanvas-DBpG0Erk.cjs} +9 -9
- package/dist/{TSViewerLayerWindow-C5Va7dH9.cjs → TSViewerLayerWindow-Cu8yQKRU.cjs} +1 -1
- package/dist/{TSViewerLayerWindow-B94J9tDk.js → TSViewerLayerWindow-Dnij6c3F.js} +2 -2
- package/dist/{TSViewerToolbar-ECRy1rzk.js → TSViewerToolbar-CO68rvXF.js} +1 -1
- package/dist/{TSViewerToolbar-B1q33g4K.cjs → TSViewerToolbar-_NqUlS08.cjs} +1 -1
- package/dist/{TsAnnotationDeleteDialog-3aMg8Pa_.js → TsAnnotationDeleteDialog-D9eQGzqE.js} +3 -3
- package/dist/{TsAnnotationDeleteDialog-O-NFN0pa.cjs → TsAnnotationDeleteDialog-fM5Y7SRB.cjs} +1 -1
- package/dist/{index-B-qad683.cjs → index-CMJlEiLT.cjs} +1 -1
- package/dist/{index-ZGQLYYRT.js → index-CgKUmS0K.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{pathOr-BHBhJmTE.cjs → pathOr-DKv8SMY9.cjs} +1 -1
- package/dist/{pathOr-Byg6zMXz.js → pathOr-kR7j_Y-C.js} +1 -1
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@ import { b as Ce, j as he, l as fn, k as Ct, c as Pe, _ as Be, E as ve, w as xa,
|
|
|
2
2
|
import { u as Hn, a as Un, E as Wn } from "./el-overlay-BMUWCEw_.js";
|
|
3
3
|
import { d as Ra, e as Ia, f as Oa, c as hn, u as pn, h as Kn, i as zn, j as jn, k as mn, l as qn, m as Gn, o as Zn, E as Jn, g as ut, n as Qn, p as Xn, q as er, r as tr, T as ar, C as Ma, s as nr, t as rr, a as sr, b as or } from "./el-input-DQtvBLS6.js";
|
|
4
4
|
import { computed as B, inject as Ve, ref as X, useSlots as ua, Text as lr, defineComponent as we, createBlock as ue, openBlock as T, resolveDynamicComponent as ze, mergeProps as Rt, unref as e, withCtx as re, createElementBlock as Z, createCommentVNode as oe, Fragment as ye, renderSlot as fe, normalizeClass as $, provide as xt, reactive as bn, toRef as Ue, normalizeStyle as sa, createElementVNode as j, useAttrs as Ya, watch as De, nextTick as Ye, onBeforeUnmount as gn, withModifiers as Ze, toDisplayString as pe, onMounted as yn, renderList as _e, createTextVNode as et, withDirectives as Oe, createVNode as G, Transition as ir, withKeys as Je, vShow as Xe, getCurrentInstance as kn, defineAsyncComponent as ur } from "vue";
|
|
5
|
-
import { g as cr, h as dr, p as Ka } from "./index-
|
|
5
|
+
import { g as cr, h as dr, p as Ka } from "./index-CgKUmS0K.js";
|
|
6
6
|
import { storeToRefs as fr } from "pinia";
|
|
7
|
-
import { I as vr } from "./IconSelection-
|
|
7
|
+
import { I as vr } from "./IconSelection-IJR6hdts.js";
|
|
8
8
|
import { g as nt } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
9
9
|
import { v as za } from "./index-BAtTJnp_.js";
|
|
10
10
|
const wn = Symbol("buttonGroupContextKey"), hr = (a, n) => {
|
|
@@ -5004,7 +5004,7 @@ const $o = xa(Co), Po = { slot: "body" }, _o = { class: "select-wrapper" }, Vo =
|
|
|
5004
5004
|
},
|
|
5005
5005
|
emits: ["closeWindow", "createUpdateAnnotation"],
|
|
5006
5006
|
setup(a, { emit: n }) {
|
|
5007
|
-
const t = ur(() => import("./BFLibraryButton-
|
|
5007
|
+
const t = ur(() => import("./BFLibraryButton-DEY9t1Is.js")), r = a, s = X(!1);
|
|
5008
5008
|
De(() => r.visible, (x) => {
|
|
5009
5009
|
if (s.value = x, !x) return;
|
|
5010
5010
|
const V = u.value.start / 1e3, O = u.value.end / 1e3;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "./base-VCnLhxie.js";
|
|
2
2
|
import { E as F } from "./el-overlay-BMUWCEw_.js";
|
|
3
|
-
import { I as g } from "./IconSelection-
|
|
3
|
+
import { I as g } from "./IconSelection-IJR6hdts.js";
|
|
4
4
|
import { a as y, b as k } from "./el-input-DQtvBLS6.js";
|
|
5
5
|
import { E as S } from "./el-input-number-DXCID3jJ.js";
|
|
6
6
|
import { resolveComponent as P, createBlock as u, openBlock as o, withCtx as i, createElementVNode as s, createVNode as r, createElementBlock as a, toDisplayString as c, createTextVNode as d, createCommentVNode as p, Fragment as _, renderList as v } from "vue";
|
|
7
|
-
import { g as N } from "./index-
|
|
7
|
+
import { g as N } from "./index-CgKUmS0K.js";
|
|
8
8
|
const H = {
|
|
9
9
|
name: "TimeseriesFilterModal",
|
|
10
10
|
components: {
|
|
11
|
-
"bf-library-button": () => import("./BFLibraryButton-
|
|
11
|
+
"bf-library-button": () => import("./BFLibraryButton-DEY9t1Is.js"),
|
|
12
12
|
IconSelection: g
|
|
13
13
|
},
|
|
14
14
|
mixins: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./base-BQSnEcNP.cjs");const m=require("./el-overlay-D192MFpl.cjs"),u=require("./IconSelection-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./base-BQSnEcNP.cjs");const m=require("./el-overlay-D192MFpl.cjs"),u=require("./IconSelection-DsOecTVD.cjs"),c=require("./el-input-CwVmeiqs.cjs"),f=require("./el-input-number-Cxwc3-EL.cjs"),e=require("vue"),b=require("./index-CMJlEiLT.cjs"),V={name:"TimeseriesFilterModal",components:{"bf-library-button":()=>Promise.resolve().then(()=>require("./BFLibraryButton-zWDUe3E8.cjs")),IconSelection:u.IconSelection},mixins:[],watch:{},computed:{computeVisible0:function(){switch(this.selectedFilter){case"lowpass":return!0;case"highpass":return!0;case"bandpass":return!0;default:return!1}},onSingleChannel:function(){return this.onChannels.length==1},selectedChannels:function(){return this.onChannels.length},computeVisible1:function(){switch(this.selectedFilter){case"lowpass":return!1;case"highpass":return!1;case"bandpass":return!0;default:return!1}},computeVisible2:function(){switch(this.selectedFilter){case"bandstop":return!0;default:return!1}},computePlaceholder1:function(l){switch(this.selectedFilter){case"lowpass":return"Low Pass Cutoff Frequency (Hz)";case"highpass":return"High Pass Cutoff Frequency (Hz)";case"bandpass":return"Low Pass Cutoff Frequency (Hz)";default:return""}},computePlaceholder2:function(l){switch(this.selectedFilter){case"bandpass":return"High Pass Cutoff Frequency (Hz)";default:return""}}},props:{visible:{type:Boolean,default:!1}},data:function(){return{selectedFilter:null,filterOptions:[{label:"No Filter",value:"clear"},{label:"Low Pass",value:"lowpass"},{label:"High Pass",value:"highpass"},{label:"Band Pass",value:"bandpass"},{label:"Notch",value:"bandstop"}],selectedNotch:null,notchOptions:[{label:"50Hz",value:50},{label:"60Hz",value:60}],input0:null,input1:null,onChannels:[]}},methods:{close:function(){this.$emit("closeWindow")},handleChange:function(){},onButtonClick:function(){},submitForm:function(l){this.$emit("closeWindow")}}},v={slot:"body"},g={class:"select-wrapper"},C={key:0,class:"filter-input-wrapper"},_={key:1,class:"filter-input-wrapper"},k={slot:"footer"},w={class:"button-wrapper"},N={class:"channels-selected"},B={key:0},y={key:1},F={class:"buttons"};function S(l,n,s,P,q,o){const a=c.ElOption,r=c.ElSelect,i=f.ElInputNumber,d=u.IconSelection,p=e.resolveComponent("bf-library-button"),h=m.ElDialog;return e.openBlock(),e.createBlock(h,{class:"timeseries-filter-modal",ref:"filter-modal",title:"Set Filter",modelValue:s.visible,"onUpdate:modelValue":n[4]||(n[4]=t=>s.visible=t),onClose:o.close},{default:e.withCtx(()=>[e.createElementVNode("div",v,[e.createElementVNode("div",g,[e.createVNode(r,{modelValue:l.selectedFilter,"onUpdate:modelValue":n[0]||(n[0]=t=>l.selectedFilter=t),placeholder:"Select"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.filterOptions,t=>(e.openBlock(),e.createBlock(a,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),o.computeVisible0?(e.openBlock(),e.createElementBlock("div",C,[e.createTextVNode(e.toDisplayString(o.computePlaceholder1)+" ",1),e.createVNode(i,{class:"filterInput",modelValue:l.input0,"onUpdate:modelValue":n[1]||(n[1]=t=>l.input0=t),"controls-position":"right",precision:2,onChange:o.handleChange},null,8,["modelValue","onChange"])])):e.createCommentVNode("",!0),o.computeVisible1?(e.openBlock(),e.createElementBlock("div",_,[e.createTextVNode(e.toDisplayString(o.computePlaceholder2)+" ",1),e.createVNode(i,{class:"filterInput",modelValue:l.input1,"onUpdate:modelValue":n[2]||(n[2]=t=>l.input1=t),"controls-position":"right",precision:2,onChange:o.handleChange},null,8,["modelValue","onChange"])])):e.createCommentVNode("",!0),o.computeVisible2?(e.openBlock(),e.createBlock(r,{key:2,modelValue:l.selectedNotch,"onUpdate:modelValue":n[3]||(n[3]=t=>l.selectedNotch=t),placeholder:"Select",class:"filter-input-wrapper"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.notchOptions,t=>(e.openBlock(),e.createBlock(a,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])])]),footer:e.withCtx(()=>[e.createElementVNode("div",k,[e.createElementVNode("div",w,[e.createElementVNode("div",N,[e.createVNode(d,{height:24,width:24}),o.onSingleChannel?(e.openBlock(),e.createElementBlock("div",B," Adding to single channel ")):(e.openBlock(),e.createElementBlock("div",y," Adding to "+e.toDisplayString(o.selectedChannels)+" Selected Channels ",1))]),e.createElementVNode("div",F,[e.createVNode(p,{onClick:o.submitForm},{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode("Set Filter ",-1)])]),_:1},8,["onClick"])])])])]),_:1},8,["modelValue","onClose"])}const E=b._export_sfc(V,[["render",S],["__scopeId","data-v-7546755f"]]);exports.default=E;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inject as Ne, ref as v, computed as N, watch as U, nextTick as E, onMounted as Ie, createElementBlock as $e, openBlock as Ue, createElementVNode as x, toDisplayString as K, normalizeStyle as Q } from "vue";
|
|
2
|
-
import { _ as ve, a as Se, b as Y, c as Ve, d as ge, e as Oe, f as je, k as Le, g as Xe, h as ze, u as de, i as fe, j as he } from "./index-
|
|
2
|
+
import { _ as ve, a as Se, b as Y, c as Ve, d as ge, e as Oe, f as je, k as Le, g as Xe, h as ze, u as de, i as fe, j as he } from "./index-CgKUmS0K.js";
|
|
3
3
|
function me(g, c, l) {
|
|
4
4
|
return function() {
|
|
5
5
|
for (var t = [], p = 0, u = g, k = 0; k < c.length || p < arguments.length; ) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),d=require("./index-B-qad683.cjs");function se(g,u,c){return function(){for(var t=[],b=0,v=g,k=0;k<u.length||b<arguments.length;){var W;k<u.length&&(!d._isPlaceholder(u[k])||b>=arguments.length)?W=u[k]:(W=arguments[b],b+=1),t[k]=W,d._isPlaceholder(W)||(v-=1),k+=1}return v<=0?c.apply(this,t):d._arity(v,se(g,t,c))}}var Te=d._curry2(function(u,c){return u===1?d._curry1(c):d._arity(u,se(u,[],c))});function ye(g,u){for(var c=0,t=u.length,b=Array(t);c<t;)b[c]=g(u[c]),c+=1;return b}var Ce=(function(){function g(u,c){this.xf=c,this.f=u}return g.prototype["@@transducer/init"]=d._xfBase.init,g.prototype["@@transducer/result"]=d._xfBase.result,g.prototype["@@transducer/step"]=function(u,c){return this.xf["@@transducer/step"](u,this.f(c))},g})(),xe=d._curry2(function(u,c){return new Ce(u,c)}),ke=d._curry2(d._dispatchable(["fantasy-land/map","map"],xe,function(u,c){switch(Object.prototype.toString.call(c)){case"[object Function]":return Te(c.length,function(){return u.call(this,c.apply(this,arguments))});case"[object Object]":return d._reduce(function(t,b){return t[b]=u(c[b]),t},{},d.keys(c));default:return ye(u,c)}}));const We={class:"timeseries-scrubber"},Ee={class:"dateWrap"},Ne={class:"noselect"},Pe={id:"scrubber",noselect:""},Re=["width","height"],Ae=["width","height"],Me=["width","height"],Ve={__name:"TSScrubber",props:{ts_start:Number,ts_end:Number,cWidth:Number,constants:Object,start:Number,duration:Number,cursorLoc:Number,labelWidth:Number,activeViewer:Object},emits:["setStart"],setup(g,{expose:u,emit:c}){const t=g,b=c,v=a.inject("viewerStore",()=>d.createViewerStore("default"),!0),k=a.ref(null),W=a.ref(null),j=a.ref(null),T=a.ref(null),f=a.ref(1),F=a.ref(28),y=a.ref(30),D=a.ref(!1),M=a.ref(""),I=a.ref("point"),G=a.ref(null),A=a.ref([]),w=a.ref([]),C=a.ref([]),$=a.ref(!1),J=a.ref(0),K=a.ref(0),E=a.ref(0),U=a.ref(0),oe=a.computed(()=>ee(t.ts_start)),ie=a.computed(()=>ee(t.ts_end)),le=a.computed(()=>{if(M.value!=="")return M.value;if(t.start>0){const n=new Date(t.start/1e3).toUTCString();return n.substring(0,n.length-3)}return""}),Q=a.computed(()=>({width:t.labelWidth+t.cWidth-8+5+"px",height:"28px"})),ce=a.computed(()=>({width:t.labelWidth+t.cWidth-8+5+"px",height:"30px"})),ue=a.computed(()=>t.cWidth+t.labelWidth-8+5),ve=a.computed(()=>Math.floor((t.ts_end-t.ts_start)/t.cWidth));a.watch(()=>t.start,()=>{N()}),a.watch(()=>t.duration,()=>{N()}),a.watch(()=>t.cWidth,()=>{N()}),a.watch(()=>t.activeViewer,(n,e)=>{var r;n&&n!==e&&(console.log("TSScrubber: ActiveViewer changed, resetting component state"),$.value=!0,Y(),(r=n.content)!=null&&r.id?a.nextTick(()=>{z(),$.value=!1}):$.value=!1)},{deep:!0}),a.watch(()=>v.viewerChannels,(n,e)=>{var r,o;n&&n.length>0&&!$.value&&(!e||n.length!==e.length||((r=n[0])==null?void 0:r.id)!==((o=e[0])==null?void 0:o.id))&&(console.log("TSScrubber: Viewer channels changed, re-initializing segments"),X(),a.nextTick(()=>{te()}))},{deep:!0}),a.watch(()=>v.viewerAnnotations,(n,e)=>{var r;n&&n!==e&&!$.value?(console.log("TSScrubber: Viewer annotations changed independently, re-fetching annotations"),a.nextTick(()=>{z()})):n&&n.length>0&&!e&&((r=t.activeViewer)!=null&&r.content.id)&&(console.log("TSScrubber: Annotation layers now available, fetching annotations"),a.nextTick(()=>{z()}))},{deep:!0});const Y=()=>{console.log("TSScrubber: Resetting component state"),A.value=[],X(),D.value=!1,M.value="",I.value="point",Z()},X=()=>{console.log("TSScrubber: Resetting segment state"),C.value=new Array(5e3),C.value=C.value.fill(0,0,4999),w.value=[]},Z=()=>{a.nextTick(()=>{[W.value,j.value,T.value].forEach(e=>{if(e){const r=e.getContext("2d");r&&r.clearRect(0,0,e.width,e.height)}})})},V=(n,e,r)=>e*(n+r),de=()=>{const n=T.value.getContext("2d"),e=window.devicePixelRatio||1,r=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;return e/r},ee=n=>{if(n>0)return n=n/1e3,n=new Date(n),("0"+n.getUTCHours()).slice(-2)+":"+("0"+n.getUTCMinutes()).slice(-2)+":"+("0"+n.getUTCSeconds()).slice(-2)},ge=n=>{if(D.value){const r=(n.clientX-J.value)/t.cWidth*(t.ts_end-t.ts_start),o=K.value+r;b("setStart",o);const s=new Date((r+t.ts_start)/1e3);M.value=s.toUTCString()}else{const e=T.value.getBoundingClientRect(),r=n.clientX-e.left,o=E.value+U.value,s=I.value;r>E.value-10&&r<o+10?(I.value="drag",T.value.setAttribute("dragme",!0),T.value.removeAttribute("resizeme")):(I.value="point",T.value.removeAttribute("dragme"),T.value.removeAttribute("resizeme"));const i=r/t.cWidth*(t.ts_end-t.ts_start)+t.ts_start,_=new Date(i/1e3).toUTCString();M.value=_.substring(0,_.length-3),s!==I.value&&N()}},fe=()=>{D.value=!1},he=n=>{D.value=!0;const e=T.value.getBoundingClientRect(),r=n.clientX-e.left;J.value=n.clientX;const o=r/ue.value*(t.ts_end-t.ts_start);b("setStart",o+t.ts_start),K.value=o+t.ts_start},me=()=>{D.value=!1},Se=()=>{M.value=""},te=()=>{var r;if(!v.viewerChannels||v.viewerChannels.length===0){console.warn("TSScrubber: Cannot init segment spans - no viewer channels available");return}if(!t.ts_start||!t.ts_end){console.warn("TSScrubber: Cannot init segment spans - invalid time range");return}if(!((r=v.config)!=null&&r.timeSeriesApi)){console.warn("TSScrubber: Cannot init segment spans - no timeSeriesApi configured");return}console.log(`TSScrubber: Initializing segment spans for ${v.viewerChannels.length} channels`),X();const n=Math.min(t.constants.SEGMENTSPAN,t.ts_end-t.ts_start),e=v.viewerChannels;for(let o=0;o<e.length;o++)ne(e[o].id,o,t.ts_start,t.ts_start+n,0)},ne=async(n,e,r,o,s)=>{var i;const l=t.constants.MAXRECURSION;if(!((i=v.config)!=null&&i.timeSeriesApi)){console.warn("TSScrubber: Cannot request segment span - no timeSeriesApi configured");return}if(!n){console.warn("TSScrubber: Cannot request segment span - no channel ID provided");return}try{const _=await d.useToken(),h=`${v.config.timeSeriesApi}/ts/retrieve/segments?session=${_}&channel=${n}&start=${r}&end=${o}`;console.log(`TSScrubber: Fetching segments for channel ${n} (${e})`);const S=await d.useSendXhr(h);if(!v.viewerChannels[e]||v.viewerChannels[e].id!==n){console.warn("TSScrubber: Channel mismatch detected, ignoring segment response (likely package switched)");return}let m=new Array(S.length*2),p=0;for(let R=0;R<S.length;R++){m[p]=S[R][0],m[p+1]=S[R][1],p=p+2;const q=Math.floor((S[R][0]-t.ts_start)/(t.ts_end-t.ts_start)*5e3),we=Math.ceil((S[R][1]-t.ts_start)/(t.ts_end-t.ts_start)*5e3);C.value.fill(1,q,we)}let x=0,O=!1,L=0;for(w.value=[];x<C.value.length-1;){if(!C.value[x]&&!O){x++;continue}else C.value[x]?O||(L=x,O=!0):(w.value=w.value.concat([L,x]),O=!1);x++}O&&(w.value=w.value.concat([L,x])),w.value=w.value.concat([5e3]);let _e=m[0],P=v.viewerChannels[e];if(!P||P.id!==n){console.warn("TSScrubber: Channel configuration mismatch, skipping update");return}_e<P.dataSegments[P.dataSegments.length-1]&&(m.shift(),m.shift()),P.dataSegments=P.dataSegments.concat(m.sort((R,q)=>R-q)),v.updateChannelProperty(P.id,"dataSegments",P.dataSegments);let re=o-r;r+re<t.ts_end&&s<l?ne(n,e,o,o+re,s+1):H()}catch(_){console.error(`TSScrubber: Error fetching segments for channel ${n}:`,_),d.useHandleXhrError(_)}},z=async()=>{var e,r,o;const n=(e=t.activeViewer)==null?void 0:e.content.id;if(!n){console.warn("TSScrubber: Cannot get annotations - no active viewer ID"),A.value=[];return}if(!((r=v.config)!=null&&r.apiUrl)){console.warn("TSScrubber: Cannot get annotations - no API URL configured"),A.value=[];return}if(!v.viewerAnnotations||v.viewerAnnotations.length===0){console.log("TSScrubber: No annotation layers available, skipping annotation fetch"),A.value=[],N();return}try{const s=await d.useToken(),l=ke(m=>m.id,v.viewerAnnotations),i=t.ts_end;let h=`${v.config.apiUrl}/timeseries/${n}/annotations/window`+`?api_key=${s}&aggregation=count&start=${t.ts_start}&end=${t.ts_end}&period=${ve.value}&mergePeriods=true`;for(let m in l)h=h+`&layerIds=${l[m]}`;console.log(`TSScrubber: Fetching annotations for viewer ${n}`);const S=await d.useSendXhr(h);((o=t.activeViewer)==null?void 0:o.content.id)===n?(A.value=S,N()):console.log("TSScrubber: Ignoring annotation response - viewer changed during fetch")}catch(s){console.error("TSScrubber: Error fetching annotations:",s),A.value=[],d.useHandleXhrError(s),N()}},N=()=>{B(),ae(),H()},B=()=>{a.nextTick(()=>{const n=T.value;if(!n){console.warn("iCanvas ref is missing, skipping render");return}const e=n.getContext("2d");if(!e){console.warn("2D context is not available");return}e.setTransform(f.value,0,0,f.value,0,0),e.clearRect(0,0,t.cWidth,y.value),E.value=(t.start-t.ts_start)/(t.ts_end-t.ts_start)*t.cWidth+.5|0,U.value=t.duration/(t.ts_end-t.ts_start)*t.cWidth+.5|0,e.fillStyle="rgb(80,80,80)",e.strokeStyle="rgb(80,80,80)",e.strokeRect(E.value+.5,.5,U.value,y.value-1),e.fillRect(E.value-2,y.value/2-5|0,2,10),e.fillRect(E.value+U.value+1,y.value/2-5|0,2,10);const r=E.value+t.cursorLoc*U.value;r>E.value+.5&&(e.strokeStyle="red",e.beginPath(),e.moveTo(r,0),e.lineTo(r,y.value-1),e.stroke())})},H=()=>{a.nextTick(()=>{const n=W.value;if(!n){console.warn("segmentsCanvas ref is missing, skipping renderSegments");return}const e=n.getContext("2d");if(!e){console.warn("Unable to get 2D context for segmentsCanvas, skipping renderSegments");return}e.setTransform(f.value,0,0,f.value,0,0),e.fillStyle=e.createPattern(G.value,"repeat"),e.clearRect(0,0,t.cWidth,y.value);for(let r=1;r<w.value.length;r+=2){const o=t.cWidth*w.value[r]/5e3,s=t.cWidth*w.value[r+1]/5e3;e.fillRect(o,2,s-o,y.value-6)}})},ae=()=>{const n=j.value;if(!n){console.warn("annotationCanvas ref is missing, skipping renderTimelimeLine");return}const e=n.getContext("2d");if(!e){console.warn("Unable to get 2D context for annotationCanvas, skipping renderTimelimeLine");return}e.setTransform(f.value,0,0,f.value,0,0),e.clearRect(0,0,t.cWidth,F.value);const r=t.ts_start,o=t.ts_end,s=A.value;let l=0;const i=0,_=Math.floor((F.value-2)/Object.keys(s).length-i),h=v.viewerAnnotations;let S="rgb(0,0,0)";for(const m in s)if(s.hasOwnProperty(m)){for(let p=0;p<h.length;p++)if(h[p].id===parseInt(m)){l=p,S=h[p].color;break}pe(e,r,o,i,_,s[m],l,S)}},pe=(n,e,r,o,s,l,i,_)=>{a.nextTick(()=>{n.setTransform(f.value,0,0,f.value,0,0),n.fillStyle=_;for(let h=0;h<l.length;h++)if(l[h].value>0){const S=(l[h].start-e)/(r-e)*t.cWidth;let p=(l[h].end-e)/(r-e)*t.cWidth-S;p<1&&(p=1);const x=1+i*(s-1+o)+i;n.fillRect(S,x,p,s)}})},be=()=>{const n=document.createElement("canvas"),e=n.getContext("2d",{antialias:!0}),r="rgb(220,220,220)",o=5,s=o,l=o,i=10;return n.width=s,n.height=l,e.fillStyle=r,e.beginPath(),e.moveTo(0,l*(1/i)),e.lineTo(s*(1/i),0),e.lineTo(0,0),e.lineTo(0,l*(1/i)),e.fill(),e.beginPath(),e.moveTo(s,l*(1/i)),e.lineTo(s*(1/i),l),e.lineTo(0,l),e.lineTo(0,l*((i-1)/i)),e.lineTo(s*((i-1)/i),0),e.lineTo(s,0),e.lineTo(s,l*(1/i)),e.fill(),e.beginPath(),e.moveTo(s,l*((i-1)/i)),e.lineTo(s*((i-1)/i),l),e.lineTo(s,l),e.lineTo(s,l*((i-1)/i)),e.fill(),n};return a.onMounted(()=>{C.value=new Array(5e3),C.value=C.value.fill(0,0,4999),f.value=de(),G.value=be(),B()}),u({getAnnotations:z,initSegmentSpans:te,render:N,renderViewPort:B,renderSegments:H,renderTimelimeLine:ae,resetComponentState:Y,resetSegmentState:X,clearCanvases:Z}),(n,e)=>(a.openBlock(),a.createElementBlock("div",We,[a.createElementVNode("div",Ee,[a.createElementVNode("div",null,a.toDisplayString(oe.value),1),a.createElementVNode("div",null,a.toDisplayString(le.value),1),a.createElementVNode("div",null,a.toDisplayString(ie.value),1)]),a.createElementVNode("div",Ne,[a.createElementVNode("div",Pe,[a.createElementVNode("div",{id:"canvasWrap",ref_key:"canvasWrap",ref:k},[a.createElementVNode("canvas",{id:"segmentsCanvas",class:"canvas",ref_key:"segmentsCanvas",ref:W,width:V(g.cWidth,f.value,0),height:V(y.value-2,f.value,0),style:a.normalizeStyle(Q.value)},null,12,Re),a.createElementVNode("canvas",{id:"annotationCanvas",class:"canvas",ref_key:"annotationCanvas",ref:j,width:V(g.cWidth,f.value,0),height:V(y.value-2,f.value,0),style:a.normalizeStyle(Q.value)},null,12,Ae),a.createElementVNode("canvas",{id:"iCanvas",class:"canvas",ref_key:"iCanvas",ref:T,width:V(g.cWidth,f.value,0),height:V(y.value,f.value,0),onClick:e[0]||(e[0]=(...r)=>n._onTap&&n._onTap(...r)),onMousemove:ge,onMousedown:he,onMouseup:fe,onMouseenter:me,onMouseout:Se,style:a.normalizeStyle(ce.value)},null,44,Me)],512)])])]))}},De=d._export_sfc(Ve,[["__scopeId","data-v-e01e61cc"]]);exports.default=De;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),d=require("./index-CMJlEiLT.cjs");function se(g,u,c){return function(){for(var t=[],b=0,v=g,k=0;k<u.length||b<arguments.length;){var W;k<u.length&&(!d._isPlaceholder(u[k])||b>=arguments.length)?W=u[k]:(W=arguments[b],b+=1),t[k]=W,d._isPlaceholder(W)||(v-=1),k+=1}return v<=0?c.apply(this,t):d._arity(v,se(g,t,c))}}var Te=d._curry2(function(u,c){return u===1?d._curry1(c):d._arity(u,se(u,[],c))});function ye(g,u){for(var c=0,t=u.length,b=Array(t);c<t;)b[c]=g(u[c]),c+=1;return b}var Ce=(function(){function g(u,c){this.xf=c,this.f=u}return g.prototype["@@transducer/init"]=d._xfBase.init,g.prototype["@@transducer/result"]=d._xfBase.result,g.prototype["@@transducer/step"]=function(u,c){return this.xf["@@transducer/step"](u,this.f(c))},g})(),xe=d._curry2(function(u,c){return new Ce(u,c)}),ke=d._curry2(d._dispatchable(["fantasy-land/map","map"],xe,function(u,c){switch(Object.prototype.toString.call(c)){case"[object Function]":return Te(c.length,function(){return u.call(this,c.apply(this,arguments))});case"[object Object]":return d._reduce(function(t,b){return t[b]=u(c[b]),t},{},d.keys(c));default:return ye(u,c)}}));const We={class:"timeseries-scrubber"},Ee={class:"dateWrap"},Ne={class:"noselect"},Pe={id:"scrubber",noselect:""},Re=["width","height"],Ae=["width","height"],Me=["width","height"],Ve={__name:"TSScrubber",props:{ts_start:Number,ts_end:Number,cWidth:Number,constants:Object,start:Number,duration:Number,cursorLoc:Number,labelWidth:Number,activeViewer:Object},emits:["setStart"],setup(g,{expose:u,emit:c}){const t=g,b=c,v=a.inject("viewerStore",()=>d.createViewerStore("default"),!0),k=a.ref(null),W=a.ref(null),j=a.ref(null),T=a.ref(null),f=a.ref(1),F=a.ref(28),y=a.ref(30),D=a.ref(!1),M=a.ref(""),I=a.ref("point"),G=a.ref(null),A=a.ref([]),w=a.ref([]),C=a.ref([]),$=a.ref(!1),J=a.ref(0),K=a.ref(0),E=a.ref(0),U=a.ref(0),oe=a.computed(()=>ee(t.ts_start)),ie=a.computed(()=>ee(t.ts_end)),le=a.computed(()=>{if(M.value!=="")return M.value;if(t.start>0){const n=new Date(t.start/1e3).toUTCString();return n.substring(0,n.length-3)}return""}),Q=a.computed(()=>({width:t.labelWidth+t.cWidth-8+5+"px",height:"28px"})),ce=a.computed(()=>({width:t.labelWidth+t.cWidth-8+5+"px",height:"30px"})),ue=a.computed(()=>t.cWidth+t.labelWidth-8+5),ve=a.computed(()=>Math.floor((t.ts_end-t.ts_start)/t.cWidth));a.watch(()=>t.start,()=>{N()}),a.watch(()=>t.duration,()=>{N()}),a.watch(()=>t.cWidth,()=>{N()}),a.watch(()=>t.activeViewer,(n,e)=>{var r;n&&n!==e&&(console.log("TSScrubber: ActiveViewer changed, resetting component state"),$.value=!0,Y(),(r=n.content)!=null&&r.id?a.nextTick(()=>{z(),$.value=!1}):$.value=!1)},{deep:!0}),a.watch(()=>v.viewerChannels,(n,e)=>{var r,o;n&&n.length>0&&!$.value&&(!e||n.length!==e.length||((r=n[0])==null?void 0:r.id)!==((o=e[0])==null?void 0:o.id))&&(console.log("TSScrubber: Viewer channels changed, re-initializing segments"),X(),a.nextTick(()=>{te()}))},{deep:!0}),a.watch(()=>v.viewerAnnotations,(n,e)=>{var r;n&&n!==e&&!$.value?(console.log("TSScrubber: Viewer annotations changed independently, re-fetching annotations"),a.nextTick(()=>{z()})):n&&n.length>0&&!e&&((r=t.activeViewer)!=null&&r.content.id)&&(console.log("TSScrubber: Annotation layers now available, fetching annotations"),a.nextTick(()=>{z()}))},{deep:!0});const Y=()=>{console.log("TSScrubber: Resetting component state"),A.value=[],X(),D.value=!1,M.value="",I.value="point",Z()},X=()=>{console.log("TSScrubber: Resetting segment state"),C.value=new Array(5e3),C.value=C.value.fill(0,0,4999),w.value=[]},Z=()=>{a.nextTick(()=>{[W.value,j.value,T.value].forEach(e=>{if(e){const r=e.getContext("2d");r&&r.clearRect(0,0,e.width,e.height)}})})},V=(n,e,r)=>e*(n+r),de=()=>{const n=T.value.getContext("2d"),e=window.devicePixelRatio||1,r=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;return e/r},ee=n=>{if(n>0)return n=n/1e3,n=new Date(n),("0"+n.getUTCHours()).slice(-2)+":"+("0"+n.getUTCMinutes()).slice(-2)+":"+("0"+n.getUTCSeconds()).slice(-2)},ge=n=>{if(D.value){const r=(n.clientX-J.value)/t.cWidth*(t.ts_end-t.ts_start),o=K.value+r;b("setStart",o);const s=new Date((r+t.ts_start)/1e3);M.value=s.toUTCString()}else{const e=T.value.getBoundingClientRect(),r=n.clientX-e.left,o=E.value+U.value,s=I.value;r>E.value-10&&r<o+10?(I.value="drag",T.value.setAttribute("dragme",!0),T.value.removeAttribute("resizeme")):(I.value="point",T.value.removeAttribute("dragme"),T.value.removeAttribute("resizeme"));const i=r/t.cWidth*(t.ts_end-t.ts_start)+t.ts_start,_=new Date(i/1e3).toUTCString();M.value=_.substring(0,_.length-3),s!==I.value&&N()}},fe=()=>{D.value=!1},he=n=>{D.value=!0;const e=T.value.getBoundingClientRect(),r=n.clientX-e.left;J.value=n.clientX;const o=r/ue.value*(t.ts_end-t.ts_start);b("setStart",o+t.ts_start),K.value=o+t.ts_start},me=()=>{D.value=!1},Se=()=>{M.value=""},te=()=>{var r;if(!v.viewerChannels||v.viewerChannels.length===0){console.warn("TSScrubber: Cannot init segment spans - no viewer channels available");return}if(!t.ts_start||!t.ts_end){console.warn("TSScrubber: Cannot init segment spans - invalid time range");return}if(!((r=v.config)!=null&&r.timeSeriesApi)){console.warn("TSScrubber: Cannot init segment spans - no timeSeriesApi configured");return}console.log(`TSScrubber: Initializing segment spans for ${v.viewerChannels.length} channels`),X();const n=Math.min(t.constants.SEGMENTSPAN,t.ts_end-t.ts_start),e=v.viewerChannels;for(let o=0;o<e.length;o++)ne(e[o].id,o,t.ts_start,t.ts_start+n,0)},ne=async(n,e,r,o,s)=>{var i;const l=t.constants.MAXRECURSION;if(!((i=v.config)!=null&&i.timeSeriesApi)){console.warn("TSScrubber: Cannot request segment span - no timeSeriesApi configured");return}if(!n){console.warn("TSScrubber: Cannot request segment span - no channel ID provided");return}try{const _=await d.useToken(),h=`${v.config.timeSeriesApi}/ts/retrieve/segments?session=${_}&channel=${n}&start=${r}&end=${o}`;console.log(`TSScrubber: Fetching segments for channel ${n} (${e})`);const S=await d.useSendXhr(h);if(!v.viewerChannels[e]||v.viewerChannels[e].id!==n){console.warn("TSScrubber: Channel mismatch detected, ignoring segment response (likely package switched)");return}let m=new Array(S.length*2),p=0;for(let R=0;R<S.length;R++){m[p]=S[R][0],m[p+1]=S[R][1],p=p+2;const q=Math.floor((S[R][0]-t.ts_start)/(t.ts_end-t.ts_start)*5e3),we=Math.ceil((S[R][1]-t.ts_start)/(t.ts_end-t.ts_start)*5e3);C.value.fill(1,q,we)}let x=0,O=!1,L=0;for(w.value=[];x<C.value.length-1;){if(!C.value[x]&&!O){x++;continue}else C.value[x]?O||(L=x,O=!0):(w.value=w.value.concat([L,x]),O=!1);x++}O&&(w.value=w.value.concat([L,x])),w.value=w.value.concat([5e3]);let _e=m[0],P=v.viewerChannels[e];if(!P||P.id!==n){console.warn("TSScrubber: Channel configuration mismatch, skipping update");return}_e<P.dataSegments[P.dataSegments.length-1]&&(m.shift(),m.shift()),P.dataSegments=P.dataSegments.concat(m.sort((R,q)=>R-q)),v.updateChannelProperty(P.id,"dataSegments",P.dataSegments);let re=o-r;r+re<t.ts_end&&s<l?ne(n,e,o,o+re,s+1):H()}catch(_){console.error(`TSScrubber: Error fetching segments for channel ${n}:`,_),d.useHandleXhrError(_)}},z=async()=>{var e,r,o;const n=(e=t.activeViewer)==null?void 0:e.content.id;if(!n){console.warn("TSScrubber: Cannot get annotations - no active viewer ID"),A.value=[];return}if(!((r=v.config)!=null&&r.apiUrl)){console.warn("TSScrubber: Cannot get annotations - no API URL configured"),A.value=[];return}if(!v.viewerAnnotations||v.viewerAnnotations.length===0){console.log("TSScrubber: No annotation layers available, skipping annotation fetch"),A.value=[],N();return}try{const s=await d.useToken(),l=ke(m=>m.id,v.viewerAnnotations),i=t.ts_end;let h=`${v.config.apiUrl}/timeseries/${n}/annotations/window`+`?api_key=${s}&aggregation=count&start=${t.ts_start}&end=${t.ts_end}&period=${ve.value}&mergePeriods=true`;for(let m in l)h=h+`&layerIds=${l[m]}`;console.log(`TSScrubber: Fetching annotations for viewer ${n}`);const S=await d.useSendXhr(h);((o=t.activeViewer)==null?void 0:o.content.id)===n?(A.value=S,N()):console.log("TSScrubber: Ignoring annotation response - viewer changed during fetch")}catch(s){console.error("TSScrubber: Error fetching annotations:",s),A.value=[],d.useHandleXhrError(s),N()}},N=()=>{B(),ae(),H()},B=()=>{a.nextTick(()=>{const n=T.value;if(!n){console.warn("iCanvas ref is missing, skipping render");return}const e=n.getContext("2d");if(!e){console.warn("2D context is not available");return}e.setTransform(f.value,0,0,f.value,0,0),e.clearRect(0,0,t.cWidth,y.value),E.value=(t.start-t.ts_start)/(t.ts_end-t.ts_start)*t.cWidth+.5|0,U.value=t.duration/(t.ts_end-t.ts_start)*t.cWidth+.5|0,e.fillStyle="rgb(80,80,80)",e.strokeStyle="rgb(80,80,80)",e.strokeRect(E.value+.5,.5,U.value,y.value-1),e.fillRect(E.value-2,y.value/2-5|0,2,10),e.fillRect(E.value+U.value+1,y.value/2-5|0,2,10);const r=E.value+t.cursorLoc*U.value;r>E.value+.5&&(e.strokeStyle="red",e.beginPath(),e.moveTo(r,0),e.lineTo(r,y.value-1),e.stroke())})},H=()=>{a.nextTick(()=>{const n=W.value;if(!n){console.warn("segmentsCanvas ref is missing, skipping renderSegments");return}const e=n.getContext("2d");if(!e){console.warn("Unable to get 2D context for segmentsCanvas, skipping renderSegments");return}e.setTransform(f.value,0,0,f.value,0,0),e.fillStyle=e.createPattern(G.value,"repeat"),e.clearRect(0,0,t.cWidth,y.value);for(let r=1;r<w.value.length;r+=2){const o=t.cWidth*w.value[r]/5e3,s=t.cWidth*w.value[r+1]/5e3;e.fillRect(o,2,s-o,y.value-6)}})},ae=()=>{const n=j.value;if(!n){console.warn("annotationCanvas ref is missing, skipping renderTimelimeLine");return}const e=n.getContext("2d");if(!e){console.warn("Unable to get 2D context for annotationCanvas, skipping renderTimelimeLine");return}e.setTransform(f.value,0,0,f.value,0,0),e.clearRect(0,0,t.cWidth,F.value);const r=t.ts_start,o=t.ts_end,s=A.value;let l=0;const i=0,_=Math.floor((F.value-2)/Object.keys(s).length-i),h=v.viewerAnnotations;let S="rgb(0,0,0)";for(const m in s)if(s.hasOwnProperty(m)){for(let p=0;p<h.length;p++)if(h[p].id===parseInt(m)){l=p,S=h[p].color;break}pe(e,r,o,i,_,s[m],l,S)}},pe=(n,e,r,o,s,l,i,_)=>{a.nextTick(()=>{n.setTransform(f.value,0,0,f.value,0,0),n.fillStyle=_;for(let h=0;h<l.length;h++)if(l[h].value>0){const S=(l[h].start-e)/(r-e)*t.cWidth;let p=(l[h].end-e)/(r-e)*t.cWidth-S;p<1&&(p=1);const x=1+i*(s-1+o)+i;n.fillRect(S,x,p,s)}})},be=()=>{const n=document.createElement("canvas"),e=n.getContext("2d",{antialias:!0}),r="rgb(220,220,220)",o=5,s=o,l=o,i=10;return n.width=s,n.height=l,e.fillStyle=r,e.beginPath(),e.moveTo(0,l*(1/i)),e.lineTo(s*(1/i),0),e.lineTo(0,0),e.lineTo(0,l*(1/i)),e.fill(),e.beginPath(),e.moveTo(s,l*(1/i)),e.lineTo(s*(1/i),l),e.lineTo(0,l),e.lineTo(0,l*((i-1)/i)),e.lineTo(s*((i-1)/i),0),e.lineTo(s,0),e.lineTo(s,l*(1/i)),e.fill(),e.beginPath(),e.moveTo(s,l*((i-1)/i)),e.lineTo(s*((i-1)/i),l),e.lineTo(s,l),e.lineTo(s,l*((i-1)/i)),e.fill(),n};return a.onMounted(()=>{C.value=new Array(5e3),C.value=C.value.fill(0,0,4999),f.value=de(),G.value=be(),B()}),u({getAnnotations:z,initSegmentSpans:te,render:N,renderViewPort:B,renderSegments:H,renderTimelimeLine:ae,resetComponentState:Y,resetSegmentState:X,clearCanvases:Z}),(n,e)=>(a.openBlock(),a.createElementBlock("div",We,[a.createElementVNode("div",Ee,[a.createElementVNode("div",null,a.toDisplayString(oe.value),1),a.createElementVNode("div",null,a.toDisplayString(le.value),1),a.createElementVNode("div",null,a.toDisplayString(ie.value),1)]),a.createElementVNode("div",Ne,[a.createElementVNode("div",Pe,[a.createElementVNode("div",{id:"canvasWrap",ref_key:"canvasWrap",ref:k},[a.createElementVNode("canvas",{id:"segmentsCanvas",class:"canvas",ref_key:"segmentsCanvas",ref:W,width:V(g.cWidth,f.value,0),height:V(y.value-2,f.value,0),style:a.normalizeStyle(Q.value)},null,12,Re),a.createElementVNode("canvas",{id:"annotationCanvas",class:"canvas",ref_key:"annotationCanvas",ref:j,width:V(g.cWidth,f.value,0),height:V(y.value-2,f.value,0),style:a.normalizeStyle(Q.value)},null,12,Ae),a.createElementVNode("canvas",{id:"iCanvas",class:"canvas",ref_key:"iCanvas",ref:T,width:V(g.cWidth,f.value,0),height:V(y.value,f.value,0),onClick:e[0]||(e[0]=(...r)=>n._onTap&&n._onTap(...r)),onMousemove:ge,onMousedown:he,onMouseup:fe,onMouseenter:me,onMouseout:Se,style:a.normalizeStyle(ce.value)},null,44,Me)],512)])])]))}},De=d._export_sfc(Ve,[["__scopeId","data-v-e01e61cc"]]);exports.default=De;
|