@pennsieve-viz/tsviewer 1.1.1 → 1.1.2
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-zWDUe3E8.cjs → BFLibraryButton-ClRfrYOf.cjs} +1 -1
- package/dist/{BFLibraryButton-DEY9t1Is.js → BFLibraryButton-DzzWe3Ya.js} +1 -1
- package/dist/{IconSelection-IJR6hdts.js → IconSelection-Bnm4c-Az.js} +1 -1
- package/dist/{IconSelection-DsOecTVD.cjs → IconSelection-CYX2jlGW.cjs} +1 -1
- package/dist/TSAnnotationCanvas-BCu7PmSh.cjs +1 -0
- package/dist/TSAnnotationCanvas-Cua-lW6X.js +704 -0
- package/dist/{TSAnnotationModal-DpLHrHfV.js → TSAnnotationModal-7GxnJomu.js} +3 -3
- package/dist/{TSAnnotationModal-DkLaOB7u.cjs → TSAnnotationModal-BVDkiUQ1.cjs} +1 -1
- package/dist/{TSFilterModal-C1-o1zyF.js → TSFilterModal-1E2UWL8T.js} +3 -3
- package/dist/{TSFilterModal-DsVcUoIk.cjs → TSFilterModal-BVfwi0tb.cjs} +1 -1
- package/dist/TSScrubber-CBKcwuMb.js +374 -0
- package/dist/TSScrubber-DBWjIhSE.cjs +1 -0
- package/dist/{TSViewerCanvas-A6HgBZ4E.js → TSViewerCanvas-D_RaJ4Mj.js} +1865 -1931
- package/dist/TSViewerCanvas-gjfcQXDY.cjs +11 -0
- package/dist/{TSViewerLayerWindow-Dnij6c3F.js → TSViewerLayerWindow-COWXfHNB.js} +2 -2
- package/dist/{TSViewerLayerWindow-Cu8yQKRU.cjs → TSViewerLayerWindow-D5j3_B1E.cjs} +1 -1
- package/dist/{TSViewerToolbar-CO68rvXF.js → TSViewerToolbar-Cb2W7W6J.js} +1 -1
- package/dist/{TSViewerToolbar-_NqUlS08.cjs → TSViewerToolbar-ep_lZr6h.cjs} +1 -1
- package/dist/{TsAnnotationDeleteDialog-D9eQGzqE.js → TsAnnotationDeleteDialog-B9pQMYZo.js} +3 -3
- package/dist/{TsAnnotationDeleteDialog-fM5Y7SRB.cjs → TsAnnotationDeleteDialog-BRIgCXxU.cjs} +1 -1
- package/dist/index-BU6e_1Ww.js +1414 -0
- package/dist/index-C-i9Taq7.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{pathOr-DKv8SMY9.cjs → pathOr-BQgOyNsu.cjs} +1 -1
- package/dist/{pathOr-kR7j_Y-C.js → pathOr-Dr8GvKXg.js} +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/TSAnnotationCanvas-B0b_EheO.js +0 -730
- package/dist/TSAnnotationCanvas-Bfxc75PD.cjs +0 -1
- package/dist/TSScrubber-9ABMW6b2.js +0 -377
- package/dist/TSScrubber-BlHHGh3F.cjs +0 -1
- package/dist/TSViewerCanvas-DBpG0Erk.cjs +0 -11
- package/dist/index-CMJlEiLT.cjs +0 -1
- package/dist/index-CgKUmS0K.js +0 -1459
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("./index-C-i9Taq7.cjs"),s={name:"BfLibraryButton",props:{type:{type:String,default:"button"},autofocus:Boolean,disabled:Boolean,processing:{type:Boolean,default:!1},processingText:{type:String,default:""}},computed:{hasPrefixSlot:function(){return!!this.$slots.prefix},hasSuffixSlot:function(){return!!this.$slots.suffix}},methods:{}},a=["disabled","autofocus","type"],l={key:0,class:"prefix"},c={key:3,class:"suffix"};function u(o,d,t,f,y,n){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["bf-library-button",[t.type?"bf-library-button--"+t.type:"",n.hasPrefixSlot?"hasPrefix":""]]),disabled:t.disabled||t.processing,autofocus:t.autofocus,type:t.type},[n.hasPrefixSlot?(e.openBlock(),e.createElementBlock("span",l,[e.renderSlot(o.$slots,"prefix",{},void 0,!0)])):e.createCommentVNode("",!0),t.processing?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.processingText?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.processingText),1)],64)):e.renderSlot(o.$slots,"default",{key:1},void 0,!0)],64)):e.createCommentVNode("",!0),t.processing?e.createCommentVNode("",!0):e.renderSlot(o.$slots,"default",{key:2},void 0,!0),n.hasSuffixSlot?(e.openBlock(),e.createElementBlock("span",c,[e.renderSlot(o.$slots,"suffix",{},void 0,!0)])):e.createCommentVNode("",!0)],10,a)}const i=r._export_sfc(s,[["render",u],["__scopeId","data-v-a46bc988"]]);exports.default=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElementBlock as t, openBlock as s, normalizeClass as u, createCommentVNode as n, renderSlot as a, Fragment as i, createTextVNode as f, toDisplayString as l } from "vue";
|
|
2
|
-
import { g as d } from "./index-
|
|
2
|
+
import { g as d } from "./index-BU6e_1Ww.js";
|
|
3
3
|
const c = {
|
|
4
4
|
name: "BfLibraryButton",
|
|
5
5
|
props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),o=require("./index-
|
|
1
|
+
"use strict";const t=require("vue"),o=require("./index-C-i9Taq7.cjs"),i={name:"IconSelection",props:{width:{type:Number,default:16},height:{type:Number,default:16},color:{type:String,default:"currentColor"}}},h=["width","height","fill"];function c(l,n,e,d,s,u){return t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:e.width,height:e.height,fill:e.color,viewBox:"0 0 24 24"},[...n[0]||(n[0]=[t.createElementVNode("path",{pid:"0",d:"M16 10V7h-4V4H4v10h4v3h4v3h8V10zM6 12V6h4v1H8v5zm4 3V9h4v1h-2v5zm8 3h-4v-6h4z"},null,-1)])],8,h)}const r=o._export_sfc(i,[["render",c]]);exports.IconSelection=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("vue"),p=require("./index-C-i9Taq7.cjs"),J=require("pinia"),K=require("./TSViewerCanvas-gjfcQXDY.cjs"),B=require("./pathOr-BQgOyNsu.cjs"),Q=require("./_commonjsHelpers-DKOUU3wS.cjs"),R=(t,o)=>{let c;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return c=t.substring(1).split(""),c.length===3&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),c="0x"+c.join(""),"rgba("+[c>>16&255,c>>8&255,c&255].join(",")+","+o+")";throw new Error("Bad Hex")},Y=t=>{t.sort((o,c)=>o.start<c.start?-1:o.start>c.start?1:0)},U=(t,o)=>{const c=(t==null?void 0:t.layer_id)||0;return p.defaultTo({},K.find(p.propEq("id",c),o))},q=(t,o,c,r=0,f=!1)=>{let u;return f?u=V(t,o,r,t.length-1,c):u=_(t,o,r,t.length-1,c),u===-1?u=0:u<0&&(u=-u-2),u},_=(t,o,c,r,f)=>{if(r<c){let g=r>=0?r:-r-2;if(g===-1)return g;const T=t[g].start;for(;g>=0&&t[g].start===T;)g--;return-g-2}const u=parseInt((c+r)/2);if(t[u].start>o)return _(t,o,c,u-1,f);if(t[u].start<o)return _(t,o,u+1,r,f);{let g=u;if(f){for(;g>=0&&t[g].start===o;)g--;g++}else{for(;g<t.length&&t[g].start===o;)g++;g--}return g}},V=(t,o,c,r,f)=>{if(r<c){let T=r>=0?r:-r-2;if(T===-1)return T;const M=t[T].start+t[T].duration;for(;T>=0&&t[T].start+t[T].duration===M;)T--;return-T-2}const u=parseInt((c+r)/2),g=t[u].start+t[u].duration;if(g>o)return V(t,o,c,u-1,f);if(g<o)return V(t,o,u+1,r,f);{let T=u;if(f){for(;T>=0&&t[T].start+t[T].duration===o;)T--;T++}else{for(;T<t.length&&t[T].start+t[T].duration===o;)T++;T--}return T}},z=(t,o,c=0)=>o*(t+c);function Z(t=null){const o=t||S.inject("viewerStore",null)||p.createViewerStore("default"),{viewerChannels:c,viewerAnnotations:r,viewerMontageScheme:f}=J.storeToRefs(o),u=S.ref([]),g=S.ref([]),T=w=>{const v=f.value!=="NOT_MONTAGED";let e=p.propOr("","id",w);if(v){const l=e.split("_");e=l.length?K.head(l):e}return e},M=async(w,v,e,l,d)=>{const i=[];i.push({start:w,end:e.tsEnd});let a=0;for(let n=0;n<u.value.length;n++){const s=u.value[n];if(w>=s.start&&v<=s.end)return;if(i[0].start>v)break;if(s.start<=i[0].start&&s.end>=w)a=n+1,i[0].start=s.end;else if(s.start>i[0].start){a=n;break}}const h=r.value.reduce((n,s)=>n+s.annotations.length,0);if(i[0].start>=i[0].end&&h>0)return;const y=0;for(let n=a;n<u.value.length;n++)if(u.value[n].start>=i[y].start)if(i[y].end=u.value[n].start,u.value[n].end<v)i.push({start:u.value[n].end,end:e.tsEnd});else break;if(!(i[0].start>=i[0].end&&h>0)&&i.length>0){c.value.map(n=>T(n));for(const n of i){for(const s of r.value){if(!s.id){console.warn("Layer ID is undefined, skipping annotation request for layer:",s);continue}const m=Math.floor(n.end),E={id:l.content.id,start:Math.floor(n.start),end:m,layerId:s.id,limit:e.constants.LIMITANNFETCH};try{const k=await p.useToken(),b=`${o.config.apiUrl}/timeseries/${l.content.id}/layers/${s.id}/annotations?api_key=${k}`,O=Object.keys(E).map(j=>`&${j}=${E[j]}`).join(""),I=`${b}${O}`,C=await fetch(I,{method:"GET",headers:{"Content-type":"application/json"}});if(C.status>=400)throw new Error(C.status);const H=await C.json();await A(H,d)}catch(k){p.useHandleXhrError(k)}}u.value.push({start:Math.floor(n.start),end:Math.floor(n.end)})}u.value.sort((n,s)=>n.start<s.start?-1:n.start>s.start?1:0)}},A=async(w,v)=>{const e=p.propOr({},"linkedPackages",w);let l=B.pathOr([],["annotations","results"],w);if(l.length>=500){let i=0;for(const a of l)a.start>i&&(i=a.start);for(const a of u.value)if(a.end>i&&a.start<i){a.end=i;break}}const d=f.value!=="NOT_MONTAGED";if(l.length>0){const i=l.map(a=>{const h={name:"",id:a.id,label:a.label,description:a.description,start:a.start,duration:a.end-a.start,end:a.end,cStart:null,cEnd:null,selected:!1,channelIds:a.channelIds,allChannels:!1,layer_id:a.layerId,userId:a.userId};if(a.linkedPackage){const y=a.linkedPackage;h.linkedPackage=B.pathOr("",["content","id"],e[y]),h.linkedPackageDTO=e[y]}return(!d&&h.channelIds.length===c.value.length||d&&h.channelIds.length>c.value.length)&&(h.allChannels=!0),h});r.value.forEach(a=>{const h=a.annotations,y=i.filter(n=>a.id===n.layer_id);a.annotations=h.concat(y),o.updateLayer(a)})}v("annotationsReceived")};return{cachedAnnRange:u,annLayerInfo:g,checkAnnotationRange:M,findNextAnnotation:w=>{const v=o.getViewerActiveLayer(),e=q(v.annotations,w,!1);return e<v.annotations.length?v.annotations[e].start>w?v.annotations[e]:v.annotations[e+1]||v.annotations[e]:v.annotations[e]},findPreviousAnnotation:w=>{const v=o.getViewerActiveLayer(),e=q(v.annotations,w,!0);return v.annotations[e].start<w?v.annotations[e]:e>0?v.annotations[e-1]:v.annotations[e]},getChannelId:T}}function x(t=null){const o=t||S.inject("viewerStore",null)||p.createViewerStore("default"),{viewerAnnotations:c,viewerChannels:r}=J.storeToRefs(o),f=S.ref([]),u=S.ref([]),g=S.ref(null),T=S.ref(["#FFFF4E"]),M=(e,l)=>{var h,y;const i=(((h=l.constants)==null?void 0:h.ANNOTATIONLABELHEIGHT)||20)/2|0,a=((y=l.constants)==null?void 0:y.XOFFSET)||0;for(const n of e){let s=n.start,m=n.duration;n.duration<0&&(s=n.start+n.duration,m=-n.duration);const E=a+(s-l.start)/l.rsPeriod;if(n.cStart=E|0,n.duration!==0){const k=a+(s+m-l.start)/l.rsPeriod;n.cEnd=k|0}else n.cEnd=n.cStart+l.cWidth/40|0;if(n.allChannels)n.allOffsets=[i],n.cY=i;else{n.allOffsets=[],n.minOffset=l.cHeight|0,n.maxOffset=0;const k=r.value;for(const F of n.channelIds){let b=null;for(const O of k)if(O.id===F&&O.visible){b=O.rowBaseline|0,b<n.minOffset&&(n.minOffset=b),b>n.maxOffset&&(n.maxOffset=b),n.allOffsets.push(b);break}}u.value.indexOf(n.minOffset)<0&&u.value.push(n.minOffset),n.cY=n.minOffset}}},A=(e,l,d,i)=>{var y,n;const a=((y=d.constants)==null?void 0:y.ANNOTATIONLABELHEIGHT)||20,h=a/2|0;e.setTransform(d.pixelRatio,0,0,d.pixelRatio,0,0),e.save(),e.lineWidth=1,e.setLineDash([8,5]),e.strokeStyle="rgba(0,0,0, 0.6)",e.fillStyle="rgba(0,0,0,0.05)";for(const s of l){const m=U(s,c.value);s.selected&&(e.save(),e.strokeStyle=m.selColor,e.fillStyle=m.bkColor,e.lineWidth=1);const E=Math.round(s.cStart)+.5,k=Math.round(s.cEnd)+.5;s.allChannels?s.duration===0?(e.beginPath(),e.moveTo(E+1,a),e.lineTo(E,i),e.stroke()):(e.fillRect(E,a,k-E,i-a),e.beginPath(),e.moveTo(E,a),e.lineTo(E,i),e.moveTo(k,a),e.lineTo(k,i),e.stroke()):((n=s==null?void 0:s.channelIds)==null?void 0:n.length)===1?s.duration===0&&(e.beginPath(),e.moveTo(E,s.minOffset+h),e.lineTo(E,s.minOffset+h+8),e.stroke()):s.duration===0?(e.beginPath(),e.moveTo(E,s.minOffset+h),e.lineTo(E,s.maxOffset-h),e.stroke()):(e.fillRect(E-1,s.minOffset+h,k-E+1,s.maxOffset-s.minOffset-a),e.beginPath(),e.moveTo(E,s.minOffset+h),e.lineTo(E,s.maxOffset-h),e.moveTo(k,s.minOffset+h),e.lineTo(k,s.maxOffset-h),e.stroke()),s.selected&&e.restore()}e.restore()},N=async(e,l,d,i,a,h)=>{var s;const y=((s=d.constants)==null?void 0:s.ANNOTATIONLABELHEIGHT)||20,n=y/2|0;e.setTransform(d.pixelRatio,0,0,d.pixelRatio,0,0),e.save(),e.lineWidth=2,e.font="14px sans-serif",e.textAlign="left";for(const m of l){const E=U(m,c.value);if(m===g.value&&i)continue;m.selected?(e.fillStyle=E.selColor||"rgba(51,204,102, 0.8)",e.strokeStyle="white"):(e.fillStyle=E.color||"rgba(51,204,102,0.8)",e.strokeStyle=m===g.value?"white":"rgba(255,255,255,0.8)");const k=Math.round(m.cStart)+1,F=Math.round(m.cEnd);let b=0;for(let C=0;C<m.allOffsets.length;C++)e.fillRect(k-1,m.allOffsets[C]-n,F-k+2,y),m.allOffsets[C]===m.minOffset&&(b=C);const O=m.allOffsets[b];if(["annSelect","annResize-left","annResize-right"].includes(a)&&h==="annotate"&&(e.beginPath(),m.duration!==0&&(e.moveTo(F-3,O-n+3),e.lineTo(F-3,O+n-3)),e.moveTo(k+3,O-n+3),e.lineTo(k+3,O+n-3),e.stroke()),F-k>m.label.length*8+10){e.fillStyle=T.value.indexOf(E.hexColor)>=0?"black":"white";const C=m.linkedPackage?k+30:k+10,H=m.linkedPackage?O+n-n/2:O+n-6;e.fillText(m.label,C,H)}const I=m.linkedPackageDTO;I&&F-k>=30&&await L(e,I,k,O,n,y)}e.restore()},L=async(e,l,d,i,a,h)=>{const y=B.pathOr({},["objects","view",1,"content"],l),n=p.propOr("","fileType",y),s=new Image;if(n==="PNG"){const{id:m,packageId:E}=y,k=o.config.apiUrl;try{const F=await p.useToken();s.src=`${k}/packages/${E}/files/${m}/presign/?api_key=${F}`,s.complete?e.drawImage(s,d,i-a,27,h):s.addEventListener("load",()=>{e.drawImage(s,d,i-a,27,h)},{once:!0})}catch(F){console.error("Error loading image:",F)}}else s.src=w(),e.drawImage(s,d+5,i-a,20,20)},w=e=>"/path/to/default/icon.png";return{renderAnn:f,hoverOffsets:u,focusedAnn:g,render:(e,l,d,i)=>{var m,E;if(!l){console.warn("TSAnnotationCanvas: annotationsCanvas prop is undefined or null");return}const a=l.getContext("2d"),h=d.getContext("2d");a.setTransform(e.pixelRatio,0,0,e.pixelRatio,0,0),h.setTransform(e.pixelRatio,0,0,e.pixelRatio,0,0),u.value=[(((m=e.constants)==null?void 0:m.ANNOTATIONLABELHEIGHT)||20)/2],a.clearRect(0,0,e.cWidth,e.cHeight),h.clearRect(0,0,e.cWidth,e.cHeight),f.value=[];const y=e.duration&&e.duration>0?e.duration:15e6,n=e.start||0,s=n+y;for(const k of c.value)if(k.visible&&((E=k.annotations)==null?void 0:E.length)>0){const F=k.annotations.filter(b=>{const O=b.start,I=b.end||b.start+(b.duration||0);return O<s&&I>n});F.length>0&&(F.sort((b,O)=>b.start-O.start),f.value.push(...F))}f.value.length!==0&&(Y(f.value),M(f.value,e),A(a,f.value,e,i),N(h,f.value,e,!0,e.pointerMode,e.viewerActiveTool),g.value&&N(h,[g.value],e,!1,e.pointerMode,e.viewerActiveTool))},computeRenderOptions:M,renderAnnotationAreas:A,renderAnnotationLabels:N}}function ee(t,o,c,r=null){const f=r||S.inject("viewerStore",null)||p.createViewerStore("default"),u=S.ref([0,0]),g=(e,l)=>{const i=((l==null?void 0:l.ANNOTATIONLABELHEIGHT)||20)/2;for(const a of c.value)if(e>=a-i&&e<=a+i)return!0;return!1},T=(e,l,d)=>{var h;const a=((d==null?void 0:d.ANNOTATIONLABELHEIGHT)||20)/2;for(let y=0;y<(((h=o.value)==null?void 0:h.length)||0);y++){const n=o.value[y];if(n.cStart<e&&n.cEnd>e){if(l>n.cY-a&&l<n.cY+a)return y}else if(n.cStart>e)break}return null},M=(e,l,d)=>{if(!d)return l;switch(l){case"annotate":return e<=d.cStart+10?"annResize-left":e>=d.cEnd-10&&d.duration>0?"annResize-right":"annSelect";case"pointer":return"annSelect";default:return l}};return{mouseDownPosition:u,shouldCheckAnnotationHover:g,findAnnotationAtPosition:T,determinePointerMode:M,resetFocusedAnnotation:()=>{var e;((e=t.value)==null?void 0:e.oldStart)!==void 0&&(t.value.start=t.value.oldStart,t.value.duration=t.value.oldDuration,t.value.end=t.value.start+t.value.duration)},selectFocusedAnnotation:()=>t.value?(f.setActiveAnnotation(t.value),!0):!1,onMouseDown:(e,l,d)=>{t.value&&["annResize-left","annResize-right"].includes(d)&&(t.value.oldStart=t.value.start,t.value.oldDuration=t.value.duration,u.value=[e,l])},onMouseMove:(e,l,d,i,a)=>{let h=d;if(i&&u.value){const y=(e-u.value[0])*a.rsPeriod;switch(d){case"annResize-left":t.value.oldDuration>0?(t.value.start=t.value.oldStart+y,t.value.duration=t.value.oldDuration-y,t.value.end=t.value.start+t.value.duration):t.value.start=t.value.oldStart+y;break;case"annResize-right":t.value.duration=t.value.oldDuration+y,t.value.end=t.value.start+t.value.duration;break}}else{const y=g(l,a.constants);if(h=a.viewerActiveTool,y){const n=T(e,l,a.constants);if(n!==null){const s=t.value,m=o.value[n];(!s||e<t.value.cStart||e>t.value.cEnd)&&(t.value=m),h=M(e,a.viewerActiveTool,t.value)}else t.value=null}else t.value=null,h=a.viewerActiveTool}return h},onMouseUp:(e,l)=>{if(t.value&&["annResize-left","annResize-right"].includes(e)){if(t.value.duration<0){const d=-t.value.duration,i=t.value.start-d;t.value.start=i,t.value.duration=d,t.value.end=i+d}f.setActiveAnnotation(t.value),l("updateAnnotation",t.value)}}}}var P={exports:{}},G;function te(){if(G)return P.exports;G=1;function t(){}return t.prototype={on:function(o,c,r){var f=this.e||(this.e={});return(f[o]||(f[o]=[])).push({fn:c,ctx:r}),this},once:function(o,c,r){var f=this;function u(){f.off(o,u),c.apply(r,arguments)}return u._=c,this.on(o,u,r)},emit:function(o){var c=[].slice.call(arguments,1),r=((this.e||(this.e={}))[o]||[]).slice(),f=0,u=r.length;for(f;f<u;f++)r[f].fn.apply(r[f].ctx,c);return this},off:function(o,c){var r=this.e||(this.e={}),f=r[o],u=[];if(f&&c)for(var g=0,T=f.length;g<T;g++)f[g].fn!==c&&f[g].fn._!==c&&u.push(f[g]);return u.length?r[o]=u:delete r[o],this}},P.exports=t,P.exports.TinyEmitter=t,P.exports}var D,W;function ne(){if(W)return D;W=1;var t=te();return D=new t,D}var oe=ne();const $=Q.getDefaultExportFromCjs(oe),X={$emit:(...t)=>$.emit(...t),$on:(...t)=>$.on(...t),$off:(...t)=>$.off(...t),$once:(...t)=>$.once(...t)};function ae(t=null){const o=t||S.inject("viewerStore",null)||p.createViewerStore("default"),c=S.ref([]),r=S.ref(["#18BA62","#FFBC27","#E94B4B","#0D4EFF","#FF4FFF","#50FFFF","#FFFF4E","#512BAF","#8A6ECF","#389BAD","#187D46","#B12800","#0C2475","#FF5321","#FF99CC","#DCC180","#FF6C21","#000000","#9B9B9B","#00FF00","#FA8072","#808000","#A0522D","#2760FF"]),f=async(L,w)=>{const v=[];if(L.results.length===0)await u({name:"Default",color:"#18BA62",description:"Default Annotation Layer"},null,w);else{for(let e=0;e<L.results.length;e++){const l=L.results[e];let d=l.color||r.value[e%r.value.length];const i={id:l.id,name:l.name,description:l.description,visible:!0,selected:e===0,annotations:[],color:R(d,.7),hexColor:d,bkColor:R(d,.15),selColor:R(d,.9)};v.push(i)}o.setAnnotations(v),w("annLayersInitialized")}c.value=L.results},u=async(L,w,v)=>{try{const e=await p.useToken(),l=`${o.config.apiUrl}/timeseries/${w.content.id}/layers?api_key=${e}`,d=await p.useSendXhr(l,{method:"POST",body:{name:L.name,color:L.color,description:L.description||L.name}}),i={...d,annotations:[],hexColor:d.color,color:R(d.color,.7),bkColor:R(d.color,.15),selColor:R(d.color,.9),visible:!0,selected:!0};return o.createLayer(i),o.setActiveAnnotationLayer(i.id),X.$emit("toast",{detail:{msg:`'${i.name}' Layer Created`}}),i}catch(e){throw p.useHandleXhrError(e),e}finally{v&&v("closeAnnotationLayerWindow")}};return{annLayerInfo:c,defaultColors:r,initializeLayers:f,createAnnotationLayer:u,updateLayerVisibility:(L,w)=>{const v=o.viewerAnnotations.find(e=>e.id===L);v&&(v.visible=w,o.updateLayer(v))},selectLayer:L=>{o.viewerAnnotations.forEach(v=>{v.selected=!1,o.updateLayer(v)});const w=o.viewerAnnotations.find(v=>v.id===L);w&&(w.selected=!0,o.updateLayer(w),o.setActiveAnnotationLayer(L))},deleteLayer:async(L,w)=>{try{const v=await p.useToken(),e=`${o.config.apiUrl}/timeseries/${w.content.id}/layers/${L}?api_key=${v}`;await p.useSendXhr(e,{method:"DELETE"}),o.removeLayer(L),X.$emit("toast",{detail:{msg:"Layer deleted successfully"}})}catch(v){throw p.useHandleXhrError(v),v}},updateLayerColor:async(L,w,v)=>{try{const e=await p.useToken(),l=`${o.config.apiUrl}/timeseries/${v.content.id}/layers/${L}?api_key=${e}`,d=await p.useSendXhr(l,{method:"PUT",body:{color:w}}),i=o.viewerAnnotations.find(a=>a.id===L);return i&&(i.hexColor=w,i.color=R(w,.7),i.bkColor=R(w,.15),i.selColor=R(w,.9),o.updateLayer(i)),d}catch(e){throw p.useHandleXhrError(e),e}},loadLayers:async(L,w)=>{try{const v=await p.useToken(),e=`${o.config.apiUrl}/timeseries/${L.content.id}/layers?api_key=${v}`,l=await p.useSendXhr(e);return await f(l,w),l}catch(v){throw p.useHandleXhrError(v),v}}}}const re=["width","height"],ie={__name:"TSAnnotationCanvas",props:{cWidth:{type:Number,default:0},cHeight:Number,start:Number,duration:Number,tsEnd:Number,rsPeriod:Number,pixelRatio:Number,constants:{type:Object,default:()=>({ANNOTATIONLABELHEIGHT:20,XOFFSET:0,LIMITANNFETCH:500})},pointerMode:String,annotationsCanvas:[HTMLCanvasElement,Object],activeViewer:{type:Object,required:!0},viewerActiveTool:String},emits:["annLayersInitialized","annotationsReceived","closeAnnotationLayerWindow","updateAnnotation"],setup(t,{expose:o,emit:c}){const r=t,f=c,u=S.ref(null),{checkAnnotationRange:g,findNextAnnotation:T,findPreviousAnnotation:M}=Z(),{renderAnn:A,hoverOffsets:N,focusedAnn:L,render:w}=x(),{resetFocusedAnnotation:v,selectFocusedAnnotation:e,onMouseDown:l,onMouseMove:d,onMouseUp:i}=ee(L,A,N),{createAnnotationLayer:a,loadLayers:h}=ae(),y=S.computed(()=>r.cHeight-20),n=S.computed(()=>({width:r.cWidth+"px",height:y.value+"px"})),s=()=>{w(r,r.annotationsCanvas,u.value,y.value)},m=(O,I)=>{l(O,I,r.pointerMode)},E=(O,I,C,H)=>d(O,I,C,H,r),k=()=>{i(r.pointerMode,f)},F=()=>{e()&&S.nextTick(()=>s())},b=async O=>{try{await a(O,r.activeViewer,f)}catch(I){console.error("Error creating layer:",I)}};return S.watch(()=>r.activeViewer,async O=>{try{await h(O,f),await g(r.start,r.start+r.duration,r,O,f)}catch(I){console.error("Error loading annotations for new viewer:",I)}}),S.onMounted(async()=>{try{await h(r.activeViewer,f),await g(r.start,r.start+r.duration,r,r.activeViewer,f)}catch(O){console.error("Error initializing annotations:",O)}}),o({render:s,resetFocusedAnnotation:v,findNextAnnotation:T,findPreviousAnnotation:M,checkAnnotationRange:(O,I)=>g(O,I,r,r.activeViewer,f),selectFocusedAnn:F,createAnnotationLayer:b,onMouseDown:m,onMouseMove:E,onMouseUp:k}),(O,I)=>(S.openBlock(),S.createElementBlock("canvas",{id:"annLabelArea",ref_key:"annLabelArea",ref:u,class:"timeseries-annotation-canvas",width:S.unref(z)(t.cWidth,t.pixelRatio,0),height:S.unref(z)(y.value,t.pixelRatio,0),style:S.normalizeStyle(n.value)},null,12,re))}},se=p._export_sfc(ie,[["__scopeId","data-v-2261f569"]]);exports.default=se;
|