@labelbee/lb-components 1.19.1-alpha.1 → 1.20.0-alpha.10
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/assets/annotation/toolHotKeyIcon/icon_eraser.svg.js +1 -0
- package/dist/assets/annotation/toolHotKeyIcon/icon_line_static.svg.js +1 -0
- package/dist/assets/annotation/toolHotKeyIcon/icon_scribble.svg.js +1 -0
- package/dist/assets/annotation/toolHotKeyIcon/icon_strokeEnlarge.svg.js +1 -0
- package/dist/assets/annotation/toolHotKeyIcon/icon_strokeReduction.svg.js +1 -0
- package/dist/assets/annotation/video/icon_timePoint.svg.js +1 -0
- package/dist/assets/annotation/video/icon_videoCut.svg.js +1 -0
- package/dist/assets/annotation/video/icon_videoCutting.svg.js +1 -0
- package/dist/assets/attributeIcon/eraser.svg.js +1 -1
- package/dist/assets/attributeIcon/eraser_a.svg.js +1 -1
- package/dist/assets/attributeIcon/icon_eyeLock_a.svg.js +1 -0
- package/dist/assets/attributeIcon/icon_eyeLock_h.svg.js +1 -0
- package/dist/assets/attributeIcon/pen.svg.js +1 -1
- package/dist/assets/attributeIcon/pen_a.svg.js +1 -1
- package/dist/assets/icons/32b52174.svg +5 -0
- package/dist/assets/icons/ad8081bf.svg +13 -0
- package/dist/components/LLMToolView/sidebar/components/answerList/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -0
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -1
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.module.scss.js +1 -0
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/attributeList/index.js +1 -1
- package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/dist/components/audioAnnotate/audioSide/labelFilterInput/index.js +1 -1
- package/dist/components/audioAnnotate/audioSide/labelSidebar/index.js +1 -1
- package/dist/components/audioAnnotate/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.js +1 -1
- package/dist/components/audioPlayer/combineTip/index.js +1 -1
- package/dist/components/audioPlayer/index.js +1 -1
- package/dist/components/audioPlayer/labelDisplayToggle/index.js +1 -1
- package/dist/components/audioPlayer/segmentTip/index.js +1 -1
- package/dist/components/audioPlayer/zoomSlider/index.js +1 -1
- package/dist/components/latexEditor/constant/config.js +1 -0
- package/dist/components/latexEditor/index.js +1 -0
- package/dist/components/latexEditor/index.module.scss.js +1 -0
- package/dist/components/pointCloudView/PointCloudInfos.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/components/videoAnnotate/index.js +1 -1
- package/dist/components/videoAnnotate/videoClipTool/VideoClipToolContext.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/ToolTipForClip.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/annotatedList/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/annotatedList/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoTrack/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoTrack/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/constant.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -0
- package/dist/components/videoAnnotate/videoTextTool/index.js +1 -0
- package/dist/components/videoPlayer/VideoTagLayer.js +1 -1
- package/dist/components/videoPlayer/VideoTextLayer.js +2 -0
- package/dist/components/videoPlayer/components/SpeedController/index.js +1 -1
- package/dist/components/videoPlayer/components/controller/index.js +1 -1
- package/dist/components/videoPlayer/index.js +1 -1
- package/dist/components/videoPlayer/utils.js +1 -1
- package/dist/index.css +385 -3
- package/dist/index.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/App.d.ts +2 -2
- package/dist/types/components/LLMToolView/sidebar/components/textEditor/index.d.ts +1 -0
- package/dist/types/components/LLMToolView/types.d.ts +1 -0
- package/dist/types/components/audioAnnotate/audioSide/labelSidebar/index.d.ts +4 -21
- package/dist/types/components/audioAnnotate/index.d.ts +1 -1
- package/dist/types/components/latexEditor/constant/config.d.ts +18 -0
- package/dist/types/components/latexEditor/index.d.ts +12 -0
- package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloud3DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudBackView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudSegment.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudSegment2DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudSegmentListener.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudSideView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudTopView.d.ts +3 -3
- package/dist/types/components/pointCloudView/index.d.ts +3 -3
- package/dist/types/components/videoAnnotate/index.d.ts +18 -7
- package/dist/types/components/videoAnnotate/videoClipTool/VideoClipToolContext.d.ts +27 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/ToolTipForClip.d.ts +8 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/annotatedList/index.d.ts +7 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.d.ts +14 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.d.ts +18 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.d.ts +6 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.d.ts +3 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/videoTrack/index.d.ts +11 -0
- package/dist/types/components/videoAnnotate/videoClipTool/constant.d.ts +26 -0
- package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +131 -0
- package/dist/types/components/{videoPlayer → videoAnnotate/videoTagTool}/TagToolInstanceAdaptor.d.ts +6 -10
- package/dist/types/components/videoAnnotate/videoTextTool/index.d.ts +56 -0
- package/dist/types/components/videoPlayer/VideoTagLayer.d.ts +1 -0
- package/dist/types/components/videoPlayer/VideoTextLayer.d.ts +2 -0
- package/dist/types/components/videoPlayer/components/controller/index.d.ts +4 -2
- package/dist/types/components/videoPlayer/index.d.ts +11 -0
- package/dist/types/components/videoPlayer/utils.d.ts +6 -0
- package/dist/types/hooks/annotation.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +2 -1
- package/dist/types/views/MainView/toolFooter/FooterTips/ToolHotKey/scribble/index.d.ts +25 -0
- package/dist/utils/audio.js +1 -1
- package/dist/views/MainView/LLMLayout/index.js +1 -1
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/ScribbleSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/index.js +1 -1
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/audioText/index.js +1 -1
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/common/index.js +1 -1
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/scribble/index.js +1 -1
- package/es/assets/annotation/toolHotKeyIcon/icon_eraser.svg.js +1 -0
- package/es/assets/annotation/toolHotKeyIcon/icon_line_static.svg.js +1 -0
- package/es/assets/annotation/toolHotKeyIcon/icon_scribble.svg.js +1 -0
- package/es/assets/annotation/toolHotKeyIcon/icon_strokeEnlarge.svg.js +1 -0
- package/es/assets/annotation/toolHotKeyIcon/icon_strokeReduction.svg.js +1 -0
- package/es/assets/annotation/video/icon_timePoint.svg.js +1 -0
- package/es/assets/annotation/video/icon_videoCut.svg.js +1 -0
- package/es/assets/annotation/video/icon_videoCutting.svg.js +1 -0
- package/es/assets/attributeIcon/eraser.svg.js +1 -1
- package/es/assets/attributeIcon/eraser_a.svg.js +1 -1
- package/es/assets/attributeIcon/icon_eyeLock_a.svg.js +1 -0
- package/es/assets/attributeIcon/icon_eyeLock_h.svg.js +1 -0
- package/es/assets/attributeIcon/pen.svg.js +1 -1
- package/es/assets/attributeIcon/pen_a.svg.js +1 -1
- package/es/components/LLMToolView/sidebar/components/answerList/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -0
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -1
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.module.scss.js +1 -0
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/attributeList/index.js +1 -1
- package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
- package/es/components/audioAnnotate/audioSide/labelFilterInput/index.js +1 -1
- package/es/components/audioAnnotate/audioSide/labelSidebar/index.js +1 -1
- package/es/components/audioAnnotate/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.js +1 -1
- package/es/components/audioPlayer/combineTip/index.js +1 -1
- package/es/components/audioPlayer/index.js +1 -1
- package/es/components/audioPlayer/labelDisplayToggle/index.js +1 -1
- package/es/components/audioPlayer/segmentTip/index.js +1 -1
- package/es/components/audioPlayer/zoomSlider/index.js +1 -1
- package/es/components/latexEditor/constant/config.js +1 -0
- package/es/components/latexEditor/index.js +1 -0
- package/es/components/latexEditor/index.module.scss.js +1 -0
- package/es/components/pointCloudView/PointCloudInfos.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/components/videoAnnotate/index.js +1 -1
- package/es/components/videoAnnotate/videoClipTool/VideoClipToolContext.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/ToolTipForClip.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/annotatedList/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/annotatedList/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoTrack/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoTrack/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/constant.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -0
- package/es/components/videoAnnotate/videoTextTool/index.js +1 -0
- package/es/components/videoPlayer/VideoTagLayer.js +1 -1
- package/es/components/videoPlayer/VideoTextLayer.js +2 -0
- package/es/components/videoPlayer/components/SpeedController/index.js +1 -1
- package/es/components/videoPlayer/components/controller/index.js +1 -1
- package/es/components/videoPlayer/index.js +1 -1
- package/es/components/videoPlayer/utils.js +1 -1
- package/es/index.css +385 -3
- package/es/index.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/utils/audio.js +1 -1
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/ScribbleSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/index.js +1 -1
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/audioText/index.js +1 -1
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/common/index.js +1 -1
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/scribble/index.js +1 -1
- package/package.json +6 -4
- package/dist/components/videoPlayer/TagToolInstanceAdaptor.js +0 -1
- package/es/components/videoPlayer/TagToolInstanceAdaptor.js +0 -1
- /package/dist/components/{videoPlayer → videoAnnotate/videoTagTool}/TagToolInstanceAdaptorI18nProvider.js +0 -0
- /package/dist/types/components/{videoPlayer → videoAnnotate/videoTagTool}/TagToolInstanceAdaptorI18nProvider.d.ts +0 -0
- /package/es/components/{videoPlayer → videoAnnotate/videoTagTool}/TagToolInstanceAdaptorI18nProvider.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import T from"../../../attributeList/index.js";import _ from"../../../checkboxList/index.js";import{CaretRightOutlined as j}from"@ant-design/icons";import{Collapse as x,Tooltip as B,Badge as R}from"antd";import{cloneDeep as V}from"lodash";import t,{Component as F}from"react";import u from"./index.module.scss.js";import k from"../LabelDetailPopover/index.js";import A from"../labelFilterInput/index.js";import{TagUtils as O}from"@labelbee/lb-annotation";import M from"../../../../assets/annotation/common/icon_clearSmall.svg.js";import $ from"../../../../assets/annotation/common/icon_clearSmall_a.svg.js";import{withTranslation as U}from"react-i18next";const H=(i,l)=>w(i,l,"#666FFF"),w=(i,l,s)=>{if(!i||!l)return i;const a=i.indexOf(l);return a===-1?i:t.createElement(t.Fragment,null,i.slice(0,a),t.createElement("span",{style:{color:s}},l),i.slice(a+l.length))},{Panel:W}=x;class q extends F{constructor(l){super(l);this.sideBar=t.createRef(),this.updateScrollTop=s=>{var a;this.sideBar.current&&((a=this.sideBar.current.children[s])==null||a.scrollIntoView({block:"center"}))},this.setExpendKeyList=(s,a,p,m)=>{const r=V(s);r[a]===""||m===!0?r[a]=p:r[a]="",this.setState({expandKeyList:r})},this.setInputValue=s=>{this.setState({inputValue:s.target.value})},this.state={hoverDeleteIndex:-1,expandKeyList:l.labelInfoSet.map(s=>s.value),inputValue:""}}shouldComponentUpdate(l,s){var a;const{labelSelectedList:p,labelInfoSet:m}=l;if((this.props.labelInfoSet.length!==l.labelInfoSet.length||this.state.inputValue!==s.inputValue)&&this.setState({expandKeyList:l.labelInfoSet.map(r=>r.value)}),p[0]!==this.props.labelSelectedList[0]&&l.labelSelectedList.length===1){const r=p[0],f=(a=m.filter((v,c)=>c===r)[0])==null?void 0:a.value;return this.setExpendKeyList(this.state.expandKeyList,r,f,!0),!0}return l.labelSelectedList.length===1&&this.updateScrollTop(p[0]),(this.props.imgIndex!==l.imgIndex||this.props.graphIndex!==l.graphIndex)&&this.updateScrollTop(0),!0}render(){const{labelInfoSet:l,labelSelectedList:s,tagResult:a,clearResult:p,entityMap:m,t:r}=this.props,{hoverDeleteIndex:f,expandKeyList:v,inputValue:c}=this.state,K=l;let L=!1;l.forEach(o=>{const{subSelected:h=[]}=o;o.hasShow=!1,h.forEach(e=>{const{key:n}=e;if(!c){e.showLabel=e.key,e.show=!0;return}n.indexOf(c)>-1?(e.showLabel=H(n,c),e.show=!0,o.hasShow=!0):(e.showLabel=e.key,e.show=!1)}),o.hasShow&&(L=!0)});const D=o=>s.length>0&&s[0]===o?t.createElement("span",{className:u.keyDownIconActive},o+1):t.createElement("span",{className:u.keyDownIcon},o+1),N=({isActive:o})=>t.createElement(j,{rotate:o?90:0}),y=(o,h=-1)=>{if(!!o)return o.map((e,n)=>{var E,S,I;if(e.subSelected){if(c&&!e.hasShow)return null;const b=O.judgeResultIsInInputList(e.value,a==null?void 0:a[e.value],K);return t.createElement(x,{bordered:!1,expandIcon:N,key:`collapse_${n}_${h+1}`,onChange:()=>this.setExpendKeyList(v,n,e.value),activeKey:[v[n]]},t.createElement(W,{header:t.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},t.createElement("span",null,e.key,t.createElement(B,{placement:"bottom",title:r("ClearThisOption")},t.createElement("img",{style:{marginLeft:5,cursor:"pointer"},onClick:g=>{g.stopPropagation(),p(e.value)},src:f===n||b?$:M,onMouseEnter:()=>{this.setState({hoverDeleteIndex:n})},onMouseLeave:()=>{this.setState({hoverDeleteIndex:-1})}})),b&&v[n]===""&&t.createElement(R,{color:"#87d068"})),!c&&this.props.labelInfoSet.length>1&&D(n)),key:e.value},t.createElement("div",{className:u.level,style:{backgroundColor:s.length>0&&s[0]===n?"rgba(158, 158, 158, 0.18)":""}},y(e.subSelected,n))))}else{const b=this.props.labelInfoSet[h]?this.props.labelInfoSet[h].value:0,g=((S=(E=a==null?void 0:a[b])==null?void 0:E.split(";"))==null?void 0:S.indexOf(e.value))>-1?e.value:"",C=m==null?void 0:m.get(e.value);if(((I=this.props.labelInfoSet[h])==null?void 0:I.isMulti)===!0){let d=n+1;return typeof d=="number"&&d<=9&&d>=0||(d="-"),(e==null?void 0:e.show)&&t.createElement("div",{className:u.singleBar},t.createElement(k,{labelDetail:C,visible:this.props.dynamicTag},t.createElement(_,{attributeChanged:()=>this.props.setLabel(h,n),selectedAttribute:[g],list:[{value:e.value,label:e.key,showLabel:e.showLabel}],num:d})))}else return(e==null?void 0:e.show)&&t.createElement("div",{className:u.singleBar},t.createElement(k,{labelDetail:C,visible:this.props.dynamicTag},t.createElement(T,{attributeChanged:()=>this.props.setLabel(h,n),selectedAttribute:g,list:[{value:e.value,label:e.key}],num:n+1})))}})};return l.length===0?t.createElement("div",{style:{padding:20,textAlign:"center"}},r("NoConfiguration")):t.createElement("div",{className:u.filterContainer},t.createElement("div",{className:u.filterInputContainer},t.createElement(A,{value:c,onChange:this.setInputValue})),t.createElement("div",{className:u.filterContent},t.createElement("div",{className:u.main,ref:this.sideBar},y(l),!!c&&!L&&t.createElement("div",{style:{textAlign:"center",color:"#999"}},r("NoData")))))}}const z=U()(q);export{z as default,w as highlightKeyword};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i,{useState as F,useEffect as B,useMemo as ne}from"react";import{AudioPlayer as _e}from"../audioPlayer/index.js";import{getClassName as Ce}from"../../utils/dom.js";import Re from"../predictTracking/previewResult/index.js";import{Layout as oe}from"antd/es";import{Spin as Te}from"antd";import{prefix as je}from"../../constant/index.js";import{cKeyCode as Pe,CommonToolUtils as K,uuid as he,TagUtils as we,EventBus as Le,cTool as Oe}from"@labelbee/lb-annotation";import N from"./index.module.scss.js";import Ae from"./tagResultShow/index.js";import{AudioClipProvider as Ie,useAudioClipStore as Ne}from"./audioContext/index.js";import ke from"./textInput/index.js";import{connect as De}from"react-redux";import{a2MapStateToProps as $e}from"../../store/annotation/map.js";import{LabelBeeContext as Me}from"../../store/ctx.js";import{jsonParser as Ve}from"../../utils/index.js";import{useCustomToolInstance as Be}from"../../hooks/annotation.js";import{sidebarCls as Q}from"../../views/MainView/sidebar/index.js";import Ke from"./audioSide/labelSidebar/index.js";import We from"./audioSide/clipSidebar/index.js";import Ue from"../../assets/annotation/audio/tag.svg.js";import Fe from"../../assets/annotation/audio/tagA.svg.js";import Xe from"../../assets/annotation/audio/clip.svg.js";import qe from"../../assets/annotation/audio/clipA.svg.js";var ze=Object.defineProperty,Ge=Object.defineProperties,He=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,le=(t,n,s)=>n in t?ze(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s,E=(t,n)=>{for(var s in n||(n={}))Je.call(n,s)&&le(t,s,n[s]);if(ie)for(var s of ie(n))Qe.call(n,s)&&le(t,s,n[s]);return t},k=(t,n)=>Ge(t,He(n));const{EAudioToolName:Ye}=Oe,re=Pe.default,{Sider:Ze,Content:et}=oe,se=`${je}-layout`,tt=({setSideTab:t,sideTab:n})=>{const s=[{tab:"tag",commonSvg:Ue,selectedSvg:Fe},{tab:"clip",commonSvg:Xe,selectedSvg:qe}];return i.createElement("div",{className:N.toggleAudioOption},s.map((p,S)=>{const{tab:f,selectedSvg:x,commonSvg:R}=p;return i.createElement("div",{key:S,className:N.option},i.createElement("img",{className:N.icon,src:n===f?x:R,onClick:()=>{n!==f&&t(f)}}))}))},nt=({result:t,inputDisabled:n,updateText:s,configList:p,autofocus:S,preContext:f,isCheck:x,clipAttributeConfigurable:R,clipTextConfigurable:D,textConfigurable:g,updateRegion:_,clipAttributeList:m})=>i.createElement("div",{className:N.textareaContainer},i.createElement("div",{className:N.textareaContent},i.createElement(ke,{isCheck:x,result:t==null?void 0:t.value,textInputDisabled:n,textID:(t==null?void 0:t.id)||0,updateText:s,configList:p,autofocus:!n&&S,preContext:f,regions:t==null?void 0:t.regions,clipAttributeConfigurable:R,clipTextConfigurable:D,textConfigurable:g,updateRegion:_,clipAttributeList:m}))),ot=t=>{var n,s;const{sider:p,config:S,result:f,updateTagResult:x,updateRegion:R,isEdit:D,tagConfigurable:g,clipConfigurable:_}=t;let m=(S==null?void 0:S.inputList)||[],C=(n=f==null?void 0:f.tag)!=null?n:{},a=(s=f==null?void 0:f.regions)!=null?s:[];const[X,L]=F([]),[T,v]=F("tag");B(()=>{if(!g&&_){v("clip");return}v("tag")},[g,_]),B(()=>(window.addEventListener("keydown",$),()=>{window.removeEventListener("keydown",$)}));const $=l=>{if(g&&_)switch(l.keyCode){case re.L:v("tag");break;case re.X:v("clip");break}if(T==="tag"){if(!K.hotkeyFilter(l))return;K.isMoveKey(l==null?void 0:l.keyCode)&&l.preventDefault();let r=l.keyCode;if(r&&(r<=57&&r>=49||r<=105&&r>=97)){r>57?r=r-97:r=r-49;const d=X.slice();m.length===1?(j(0,r),L([0,r]),setTimeout(()=>{L([])},500)):d.length===1?(j(d[0],r),L([d[0],r]),setTimeout(()=>{L([])},500)):L([r])}}},j=(l,r)=>{if(l<m.length&&m[l].subSelected&&r<m[l].subSelected.length){const d=m[l].value,b=m[l].isMulti;let P=m[l].subSelected[r].value,q=0;const W=C;for(const h in C)if(h===m[l].value){if(q++,b===!0){const I=W[h].split(";").filter(z=>z!==""),V=I.indexOf(P);V===-1?I.push(P):I.splice(V,1),P=I.join(";")}P===""?delete W[h]:W[h]=P}q===0&&Object.assign(C,{[d]:P}),x(C)}},O=l=>{delete C[l],x(C)},A=g&&_&&i.createElement(tt,{setSideTab:v,sideTab:T}),M=T==="tag"&&i.createElement(Ke,{labelInfoSet:g?m:[],labelSelectedList:X,setLabel:j,tagResult:C,clearResult:O,isEdit:D,withPanelTab:!1}),u=T==="clip"&&i.createElement(We,{regions:a,updateRegion:R,useAudioClipStore:Ne});return p?typeof p=="function"?i.createElement("div",{className:`${Q}`},p({toggleAudioOption:A,labelSidebar:M,clipSidebar:u})):p:i.createElement("div",{className:`${Q}`},i.createElement("div",{className:`${Q}__content`},A,M,u))},it=t=>{var n,s,p,S,f,x,R,D,g;const _=(s=(n=t.style)==null?void 0:n.sider)==null?void 0:s.width,{step:m,stepList:C,audioContext:a,sider:X,drawLayerSlot:L,imgList:T,imgIndex:v,currentData:$,config:j,stepInfo:O}=t,A=K.getCurrentStepToolAndConfig(m,C),M=Ve($.result),{toolInstanceRef:u}=Be({basicInfo:M}),[l,r]=F(!0),[d,b]=F(null),[P,q]=F(0);B(()=>{r(!0)},[v]),B(()=>{l===!1&&pe()},[l]),B(()=>{W()},[]),B(()=>{u.current.exportData=()=>[[d],{duration:P,valid:H}],u.current.setResult=Se,u.current.clearResult=xe,u.current.currentPageResult=d==null?void 0:d.regions,u.current.emit("updatePageNumber")},[d]);const W=()=>{u.current.emit=e=>{const o=u.current.fns.get(e);o&&o.forEach(c=>{c&&(c==null||c())})},u.current.fns=new Map,u.current.singleOn=(e,o)=>{u.current.fns.set(e,[o])},u.current.on=(e,o)=>{u.current.singleOn(e,o)},u.current.unbindAll=e=>{u.current.fns.delete(e)}},h=ne(()=>{const e=M[`step_${O==null?void 0:O.step}`];return(e==null?void 0:e.result)||[]},[j,M,O]),{tagConfigurable:I,textConfigurable:V=!0,clipConfigurable:z=!1,clipAttributeConfigurable:Y=!1,clipAttributeList:Z=[],clipTextConfigurable:G=!1,inputList:ae=[],configList:ue=[]}=ne(()=>{if(A)return K.jsonParser(A==null?void 0:A.config)},[A]),ce={clipConfigurable:z,clipAttributeConfigurable:Y,clipAttributeList:Z,clipTextConfigurable:G},H=a?a==null?void 0:a.valid:!0,de=(S=(p=K.jsonParser($.result))==null?void 0:p.duration)!=null?S:0,fe=H?de:0,me=!H||l||![V,G].includes(!0);let ee={};if(v!==-1&&(T==null?void 0:T.length)){const e=(f=T[v])==null?void 0:f.preResult,o=(a==null?void 0:a.isEdit)?(x=a==null?void 0:a.stepConfig)==null?void 0:x.loadPreStep:O==null?void 0:O.loadPreStep;if(e&&o){const c=K.jsonParser(e),y=(D=(R=c==null?void 0:c.config)==null?void 0:R.context)!=null?D:{};Object.keys(y).forEach(w=>{w&&y[w]&&(ee[w]={visible:!0,content:y[w],type:w})})}}const pe=()=>{(h==null?void 0:h.length)>0?b(h[0]):b({id:he(),sourceID:"",value:te(),tag:ge(),regions:[]})},te=(e=!0)=>{const o={};let c=j.configList||[];return c.length>0&&c.forEach(y=>{o[y.key]=e&&y.default||""}),o},ge=()=>we.getDefaultResultByConfig(j.inputList||[]),ve=({duration:e,hasError:o})=>{r(!1),q(e)},be=e=>{b(o=>k(E({},o),{regions:((o==null?void 0:o.regions)||[]).filter(c=>c.id!==e)}))},J=e=>{b(o=>{var c;const y=(c=o==null?void 0:o.regions)!=null?c:[],{id:w}=e;return y.find(U=>U.id===w)?k(E({},o),{regions:y.map(U=>w===U.id?E(E({},U),e):U)}):k(E({},o),{regions:[...y,e]})})},ye=(e,o)=>{b(c=>k(E({},c),{value:k(E({},c.value),{[o]:e})}))},Ee=e=>{b(o=>k(E({},o),{tag:e}))},Se=e=>{b(e)},xe=()=>{b(e=>k(E({},e),{value:te(),tag:{},regions:[]})),Le.emit("clearRegions")};return i.createElement(Ie,null,i.createElement(Te,{spinning:l,wrapperClassName:"audio-tool-spinner"},i.createElement(oe,{className:Ce("layout","container"),style:{height:"100%"}},t==null?void 0:t.leftSider,i.createElement(et,{className:`${se}__content`},i.createElement("div",{className:N.containerWrapper},i.createElement("div",{className:N.audioWrapper},I&&i.createElement(Ae,{result:d==null?void 0:d.tag,labelInfoSet:ae,hasPromptLayer:!!(a==null?void 0:a.promptLayer)}),a==null?void 0:a.promptLayer,i.createElement(_e,E({context:{isEdit:a==null?void 0:a.isEdit,count:fe,toolName:Ye.AudioTextTool,imgIndex:v},drawLayerSlot:L,fileData:$,onLoaded:ve,invalid:!H,updateRegion:J,removeRegion:be,regions:d==null?void 0:d.regions,activeToolPanel:a==null?void 0:a.activeToolPanel,footer:t.footer},ce))),(V||G)&&i.createElement(nt,{preContext:ee,result:d,inputDisabled:me,updateText:ye,updateRegion:J,configList:ue,autofocus:!1,textConfigurable:V,clipTextConfigurable:G,clipAttributeList:Z,clipAttributeConfigurable:Y}))),i.createElement(Ze,{className:`${se}__side`,width:_!=null?_:240,style:(g=t.style)==null?void 0:g.sider},i.createElement(ot,{sider:X,config:j,result:d,updateTagResult:Ee,updateRegion:J,isEdit:a==null?void 0:a.isEdit,tagConfigurable:I,clipConfigurable:z})),i.createElement(Re,null))))};var lt=De($e,null,null,{context:Me})(it);export{lt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useState as
|
|
1
|
+
import e,{useState as M,useRef as X,useEffect as q}from"react";import{Tooltip as J,Radio as K,Switch as se}from"antd";import{QuestionCircleOutlined as ce}from"@ant-design/icons";import{TextareaWithFooter as ie}from"../../../views/MainView/sidebar/TextToolSidebar/index.js";import{timeFormat as Y,getAttributeColor as de,getAttributeFontColor as me,updateColorOpacity as Ee,getAttributeShowText as pe,DEFAULT_TEXT_CONFIG_ITEM as fe}from"../../../utils/audio.js";import{cKeyCode as ve}from"@labelbee/lb-annotation";import z from"classnames";import Z,{useAudioClipStore as xe}from"../audioContext/index.js";import o from"./index.module.scss.js";import{useTranslation as ee}from"react-i18next";var Fe=Object.defineProperty,ge=Object.defineProperties,Ce=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,ae=(u,n,r)=>n in u?Fe(u,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):u[n]=r,le=(u,n)=>{for(var r in n||(n={}))he.call(n,r)&&ae(u,r,n[r]);if(te)for(var r of te(n))be.call(n,r)&&ae(u,r,n[r]);return u},Te=(u,n)=>ge(u,Ce(n));const d=ve.default,ne=({onClick:u,title:n,disabled:r})=>e.createElement(J,{placement:"bottom",title:n},e.createElement("span",{className:z({[o.clearIcon]:!0,[o.disabled]:r}),onClick:u})),G=u=>{var n;const{t:r}=ee(),D=X(null),[f,y]=M(!1),[w,v]=M(!1),{disabled:s,config:c,result:P,updateText:x,index:F,switchToNextTextarea:O,hasMultiple:L,textID:b,addPlaceholder:g,onFocus:N,onBlur:T,onFocusStyle:k={},extra:$}=u,{maxLength:C}=c,B=P?P[c.key]:"",I=(n=B==null?void 0:B.length)!=null?n:0,S=a=>{x&&(x(a,c.key),c.required&&v(!a))},j=L&&O,m={id:`textInput-${F}`,ref:D,disabled:s,value:B,maxLength:C,autoSize:{minRows:2,maxRows:6},onChange:a=>{const i=a.target.value;S(i)},onFocus:a=>{y(!0),N==null||N(a),a.target.value&&v(!1)},onBlur:a=>{y(!1),T==null||T(a),c.required&&v(!a.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:a=>{const{keyCode:i}=a;if(a.ctrlKey){if(i===d.Enter&&a.preventDefault(),g&&[d.One,d.Two,d.Three].includes(i))switch(a.preventDefault(),i){case d.One:g("\u4986");break;case d.Two:g("\u652B");break;case d.Three:g("\u7383");break}}else i===d.Tab&&j?(a.preventDefault(),a.nativeEvent.stopImmediatePropagation(),O(F)):a.nativeEvent.stopPropagation()}},E=e.createElement("div",{className:o.textAreaFooter},e.createElement("div",{className:o.hotkeyTip},j&&e.createElement("span",null,"[",r("Switch"),"]Tab"),e.createElement("span",null,"[",r("TurnPage"),"]Ctrl+Enter")),e.createElement("div",{className:o.wordCount},e.createElement("span",{className:I>=C?o.warning:""},I),"/",e.createElement("span",null,C)));return q(()=>{s&&y(!1)},[s]),q(()=>{v(!1)},[b]),e.createElement("div",{className:o.textField},e.createElement("div",{className:o.label},e.createElement("span",{className:z({[o.required]:c.required})},c.label),e.createElement(ne,{onClick:()=>{s||S("")},title:"",disabled:s}),e.createElement("div",{className:o.extra},$)),e.createElement("div",{className:z({disabled:s,"textarea-outline":!0,"ant-input-focused":f,[o.textareaContainer]:!0,[o.focus]:f,[o.invalid]:w}),style:f?k:{}},e.createElement(ie,{footer:E,textareaProps:m})))},ye=u=>{const{configList:n,autofocus:r,textID:D,result:f,showText:y,updateText:w,toggleShowText:v,textInputDisabled:s,isCheck:c,isEdit:P,config:x,preContext:F,regions:O=[],textConfigurable:L=!0,clipTextConfigurable:b,clipAttributeConfigurable:g,updateRegion:N,clipAttributeList:T=[]}=u,{t:k}=ee(),[$,C]=M(0),[B,I]=M(""),S=X(null),{audioClipState:j}=xe(),m=n||[le({},fe)];let E=O;if(b&&!c){const t=j.selectedRegion.id;E=E.filter(l=>l.id===t)}const a=t=>{setTimeout(()=>{const l=document.getElementById(`textInput-${t}`);l&&(C(t),l.focus(),l.select(),l.scrollIntoView({behavior:"smooth",block:"center"}))})},i=t=>{const l=L?m.length:0,p=b?E.length:0,h=l+p,_=(t+1)%h;a(_)},Q=t=>{t.keyCode===d.Tab&&(t.preventDefault(),m.length>0&&a(0))},R=t=>{const l=document.getElementById(`textInput-${$}`);if(!(x==null?void 0:x.enablePlaceholderHotkey)||!l||!w)return;const{value:p,selectionStart:h,selectionEnd:_}=l,A=`${p.slice(0,h)}${t}${p.slice(_)}`;w(A,m[$].key),I(t),setTimeout(()=>{l.setSelectionRange(h+1,h+1),l.focus()},0),clearTimeout(S.current),S.current=setTimeout(()=>{I("")},400)};q(()=>(P||document.addEventListener("keydown",Q),()=>{document.removeEventListener("keydown",Q)}),[n]),q(()=>{r&&!s&&a(0)},[D]);let H=m;c&&(H=m.filter(t=>(f==null?void 0:f[t.key])!==void 0));let U={};return b&&E&&E.forEach(t=>{const{id:l,text:p}=t;U[l]=p}),e.createElement(e.Fragment,null,(x==null?void 0:x.enablePlaceholderHotkey)&&e.createElement("div",{className:o.placeholderHotkey},e.createElement("div",{className:o.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",e.createElement(J,{overlayStyle:{maxWidth:240},title:e.createElement("div",null,e.createElement("div",null,"\u4986\uFF08Ctrl+1\uFF09\uFF1A"),e.createElement("div",{style:{marginBottom:12}},"\u6587\u5B57\u5F02\u5E38\uFF0C\u4F46\u53EA\u6839\u636E\u8FD9\u4E2A\u5B57\u7684\u5F62\u72B6\u5C31\u53EF\u4EE5\u731C\u51FA\u662F\u4EC0\u4E48\u5B57"),e.createElement("div",null,"\u652B\uFF08Ctrl+2\uFF09\uFF1A"),e.createElement("div",{style:{marginBottom:12}},"\u6587\u5B57\u5F02\u5E38\uFF0C\u4E14\u65E0\u6CD5\u6839\u636E\u5F62\u72B6\u731C\u5B57\uFF0C\u4F46\u80FD\u7ED3\u5408\u4E0A\u4E0B\u6587\u8BED\u4E49\u5224\u65AD\u51FA\u662F\u4EC0\u4E48\u5B57"),e.createElement("div",null,"\u7383\uFF08Ctrl+3\uFF09\uFF1A"),e.createElement("div",null,"\u5B8C\u5168\u65E0\u6CD5\u5224\u65AD\u662F\u4EC0\u4E48\u5B57")),placement:"bottom"},e.createElement(ce,{className:o.questionIcon}))),e.createElement(K.Group,{value:B},e.createElement(K.Button,{value:"\u4986",onClick:t=>R(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u4986 (\u89C6\u89C9)"),e.createElement("div",{className:"hotkey"},"Ctrl+1"))),e.createElement(K.Button,{value:"\u652B",onClick:t=>R(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u652B (\u8BED\u4E49)"),e.createElement("div",{className:"hotkey"},"Ctrl+2"))),e.createElement(K.Button,{value:"\u7383",onClick:t=>R(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u7383 (\u65E0\u6548)"),e.createElement("div",{className:"hotkey"},"Ctrl+3"))))),e.createElement("div",{className:o.textInputContainer},e.createElement(Z,{audioContext:F==null?void 0:F.before}),L&&H.map((t,l)=>e.createElement(G,{config:t,key:l,index:l,result:f,updateText:w,switchToNextTextarea:i,hasMultiple:m.length>1,disabled:s,textID:D,addPlaceholder:R,onFocus:()=>C(l)})),b&&E.map((t,l)=>{const{id:p,start:h,end:_,attribute:A}=t,oe={label:`${k("textTool")}\uFF08${Y(h,"ss.SSS")} - ${Y(_,"ss.SSS")}\uFF09`,key:p,maxLength:3e3},V=H.length+l,W=de(A,T),re={color:me(A,T),backgroundColor:W};return e.createElement(G,{config:oe,key:l,index:V,disabled:s,result:U,updateText:ue=>{N==null||N(Te(le({},t),{text:ue}))},switchToNextTextarea:()=>{i(V)},hasMultiple:!0,onFocus:()=>C(V),onFocusStyle:g?{borderColor:W,boxShadow:`0 0 0 2px ${Ee(W,.4)}`}:{},extra:g?e.createElement("div",{style:re,className:o.attribute},pe(A,[{value:"",key:k("NoAttribute")},...T])):null})}),e.createElement(Z,{audioContext:F==null?void 0:F.after}),v&&e.createElement("div",{className:o.switchItem},k("toggleShowText"),e.createElement(se,{style:{alignSelf:"center"},checked:y,onChange:t=>{v(t)}}))))};export{ne as ClearIcon,G as SingleTextInput,ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"react";import{useAudioClipStore as c}from"../../audioAnnotate/audioContext/index.js";import{useMouse as m,useHover as u}from"ahooks";import l from"../index.module.scss.js";import{useTranslation as p}from"react-i18next";const d=e=>{const{t:i}=p(),{container:o}=e,{audioClipState:s}=c(),{combined:n}=s,t=m(o),r=u(o);return!o||!n||!r?null:a.createElement("div",{className:l.tips,style:{left:t.clientX+20,top:t.clientY-20}},i("AudioCombineTip"))};export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i,{useState as b,useRef as z,useEffect as A}from"react";import{getWebPcm2WavBase64 as Kt}from"../audioAnnotate/utils/getWebPcm2Wac.js";import Vt,{debounce as Gt,sortBy as Yt}from"lodash";import{PauseOutlined as Jt,CaretRightOutlined as Qt}from"@ant-design/icons";import{cKeyCode as er,cTool as tr,EventBus as _}from"@labelbee/lb-annotation";import{Button as rr}from"antd";import or from"../invalidPage/index.js";import nr from"../imageError/index.js";import{classnames as $}from"../../utils/index.js";import ir,{EPlayerType as lr}from"../videoPlayer/components/SpeedController/index.js";import sr from"@labelbee/wavesurfer";import ar from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import cr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import ur,{audioZoomInfo as Xe}from"./zoomSlider/index.js";import dr from"./labelDisplayToggle/index.js";import mr from"./clipRegion/index.js";import{useAudioClipStore as pr}from"../audioAnnotate/audioContext/index.js";import{useLatest as H,useUpdate as fr,useDeepCompareEffect as Ze,useThrottleFn as vr}from"ahooks";import gr from"./useAudioScroll/index.js";import f from"./index.module.scss.js";import{getAttributeColor as br,formatTime as qe,timeFormat as Ke,dispatchResizeEvent as yr,precisionMinus as Ve,isDoubleClick as _r,getCanMoveRange as Er}from"../../utils/audio.js";import hr from"./progressDot/index.js";import Pr from"./clipTip/index.js";import Sr from"./useSwitchHotkey/index.js";import Cr from"./useAudioCombine/index.js";import Rr from"./useAudioSegment/index.js";import wr from"./combineTip/index.js";import Tr from"./segmentTip/index.js";import Ar from"../../views/MainView/toolFooter/index.js";import{decimalReserved as U}from"../videoPlayer/utils.js";var jr=Object.defineProperty,xr=Object.defineProperties,Dr=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Ye=(v,a,c)=>a in v?jr(v,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):v[a]=c,Je=(v,a)=>{for(var c in a||(a={}))Mr.call(a,c)&&Ye(v,c,a[c]);if(Ge)for(var c of Ge(a))kr.call(a,c)&&Ye(v,c,a[c]);return v},Qe=(v,a)=>xr(v,Dr(a));const{EToolName:et}=tr,X=er.default,tt=.1,rt=i.createContext({count:0,isEdit:!1,toolName:et.Empty,imgIndex:0}),Ir=({fileData:v={},onLoaded:a,context:c,invalid:ot,height:nt,hideError:it,onError:ue,updateRegion:j,removeRegion:L,regions:x=[],activeToolPanel:lt,clipConfigurable:st,clipTextConfigurable:at,clipAttributeList:ct,clipAttributeConfigurable:de,isCheck:S,hoverRegionId:Z,footer:ut,drawLayerSlot:me})=>{var pe,fe;const{url:O,path:ve}=v,[q,K]=b(!1),[ge,be]=b(!1),[C,dt]=b(0),[mt,ye]=b(!1),[N,_e]=b(0),n=z(null),R=z(null),Ee=z(C),V=e=>{Ee.current=e,dt(e)},[he,pt]=b(0),[F,ft]=b(1),G=z(null),[Pe,vt]=b({}),{audioClipState:Y,setAudioClipState:k}=pr(),[J,Q]=b(!1),u=H(Y),Se=H(Pe),gt=H(q),D=H(x),Ce=fr(),[Re,bt]=b([]),[we,yt]=b({}),_t=Gt(()=>{_.emit("audioZoom")},500),Te=e=>{e<Xe.min||e>Xe.max||(ft(e),yr(),_t())};gr({container:G.current,target:document.querySelector(`[data-id=${(fe=(pe=u.current)==null?void 0:pe.selectedRegion)==null?void 0:fe.id}]`),clipping:J,zoom:F,zoomHandler:Te});const W=()=>{let e=D.current;const{attributeLockList:r}=u.current;r.length&&(e=e.filter(t=>r.includes(t.attribute))),te(),e.forEach(t=>{var o;(o=n.current)==null||o.addRegion(Qe(Je({},t),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),Ce()},m=e=>{var r,t,o,l,s,p,E;const{id:d,loop:g=!0,playImmediately:P=!1}=e;if(d){const M=(o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{};Object.entries(M).forEach(([,y])=>{const{id:T}=y;d===T?y.select():y.cancelSelect()}),k({selectedRegion:{id:d,loop:g},selectedAttribute:(p=(s=(l=D.current)==null?void 0:l.find(y=>y.id===d))==null?void 0:s.attribute)!=null?p:""}),g&&P&&((E=I(d))==null||E.playLoop())}else k({selectedRegion:{}})},{combineInstance:Et}=Cr({waveRef:n,sortByStartRegions:Re,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),{segmentInstance:ht,onRegionMouseMove:Pt,segmentTimeTip:St}=Rr({waveRef:n,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),Ae={clipTextConfigurable:at,clipAttributeList:ct,clipAttributeConfigurable:de,clipConfigurable:st};A(()=>{k({selectedAttribute:""})},[de]),A(()=>{ee()},[Y.selectedAttribute]),A(()=>{W()},[Y.attributeLockList]),Ze(()=>{k(Ae),setTimeout(()=>{je()})},[Ae]),Ze(()=>{bt(Yt(x,["start"])),yt(x.reduce((e,r)=>{const{id:t}=r;return Qe(Je({},e),{[t]:r})},{}))},[x]),A(()=>{if(Z){const e=gt.current;m({id:Z,loop:e,playImmediately:!0})}else m({})},[Z]);const je=()=>{var e,r;u.current.clipConfigurable?(!S&&n.current&&((e=n.current)==null||e.enableDragSelection({slop:5})),W()):((r=n.current)==null||r.disableDragSelection(),te()),ee()},ee=()=>{var e,r,t,o,l;let s="";u.current.clipConfigurable?s=br(u.current.selectedAttribute,(e=u.current.clipAttributeList)!=null?e:[]):s="transparent",((t=(r=n==null?void 0:n.current)==null?void 0:r.cursor)==null?void 0:t.cursor)&&((l=(o=n==null?void 0:n.current)==null?void 0:o.cursor)==null||l.setStyle({border:`2px dashed ${s}`}))},I=e=>{var r,t,o;return((o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{})[e]},xe=()=>{var e,r;if(O){const t=((r=(e=ve==null?void 0:ve.split("."))==null?void 0:e.pop())==null?void 0:r.toLowerCase())==="pcm";ye(!1),t?Kt(O).then(o=>{De(o)}):De(O)}},De=e=>{var r;e&&(be(!0),V(0),_e(0),(r=n==null?void 0:n.current)==null||r.load(e))},te=()=>{var e;(e=n.current)==null||e.clearRegions()},re=e=>{const r=I(e);r&&(Q(!1),r==null||r.remove(),L==null||L(e),m({}))},{run:Me}=vr(m,{wait:500});Sr({sortByStartRegions:Re,setSelectedRegion:m});const Ct=e=>{const{start:r,end:t}=Se.current;return(r||t)&&e.update(Se.current),e},Rt=({action:e,id:r,eventDownTime:t})=>{var o,l;if(!u.current.clipConfigurable)return;r&&m({id:r});const s=I((r!=null?r:(o=u.current.selectedRegion)==null?void 0:o.id)||""),p=[];(e==="create"?D.current:(l=D.current)==null?void 0:l.filter(g=>g.id!==s.id)).forEach(g=>{const{start:P,end:M,attribute:y}=g;y===u.current.selectedAttribute&&[P,M].forEach(T=>{p.includes(T)||p.push(T)})});const d=Er(p.sort((g,P)=>g-P),t);n.current.range=d},wt=e=>{ee(),setTimeout(()=>{Q(!1)});const r=Ct(e),{id:t,start:o,end:l}=r;m({id:t,playImmediately:!0});const s={id:t,start:U(o,3),end:U(l,3),attribute:"",text:""};j==null||j(s),Ce()},Tt=()=>{const e=sr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:nt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[ar.create({regions:x,dragSelection:{slop:5},canMove:!1}),cr.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),r=()=>{var t;V(((t=n==null?void 0:n.current)==null?void 0:t.getCurrentTime())||0)};e.on("ready",()=>{var t;const o=((t=n==null?void 0:n.current)==null?void 0:t.getDuration())||0;_e(o),r(),a==null||a({duration:Math.round(o)}),be(!1),B(),_.on("setCurrentTimeByPosition",ne),_.on("clearRegions",te),_.on("removeRegionById",re),_.on("setSelectedRegion",Me),e.on("regions-eventDown",Rt),je()}),e.on("audioprocess",()=>{r()}),e.on("play",()=>{K(!0)}),e.on("pause",()=>{K(!1)}),e.on("finish",()=>{K(!1)}),e.on("seek",()=>{r()}),e.on("error",()=>{ye(!0),a==null||a({hasError:!0}),ue==null||ue()}),e.on("region-created",t=>{const{id:o,start:l,end:s}=t;if(D.current.find(E=>E.id===o))return;const p={id:o,start:U(l,3),end:U(s,3),attribute:u.current.selectedAttribute,text:""};j==null||j(p)}),e.on("region-updated",(t,o)=>{var l,s,p,E,d,g,P,M,y,T;const We=o==null?void 0:o.action;k({combined:!1,segment:!1}),We==="resize"&&((s=(l=n==null?void 0:n.current)==null?void 0:l.cursor)==null||s.setStyle({borderStyle:"solid"})),We==="drag"&&((E=(p=n==null?void 0:n.current)==null?void 0:p.cursor)==null||E.setStyle({borderColor:"transparent"}));const ie={},le=[],se={},Ft=(d=D.current)==null?void 0:d.filter(h=>h.id!==t.id),Wt=(M=(P=(g=n.current)==null?void 0:g.regions)==null?void 0:P.list)!=null?M:{};Ft.forEach(h=>{var $e,He;const{element:ae}=($e=Wt[h.id])!=null?$e:{},{start:Ht,end:Ut}=h;if(ae){const{x:Ue,width:Xt}=((He=ae.getBoundingClientRect)==null?void 0:He.call(ae))||{},Zt=Ue+Xt;[Ue,Zt].forEach((ce,qt)=>{le.includes(ce)||(le.push(ce),se[ce]=qt===0?Ht:Ut)})}});const{x:ze,width:zt}=((T=(y=t.element).getBoundingClientRect)==null?void 0:T.call(y))||{},$t=ze+zt;le.forEach(h=>{Math.abs(Ve(h,ze))<5&&(ie.start=se[h]),Math.abs(Ve(h,$t))<5&&(ie.end=se[h])}),vt(ie),Me({id:t.id}),Q(!0)}),e.on("region-update-end",t=>{wt(t)}),e.on("region-contextmenu",(t,o)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),_r(o)){re(t.id);return}m({id:t.id,playImmediately:!0})}}),e.on("region-click",(t,o,l)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),u.current.combined){Et(t);return}if(u.current.segment){ht(t,l);return}m({id:t.id,playImmediately:!0})}}),e.on("region-mousemove",Pt),n.current=e},At=q?i.createElement(Jt,null):i.createElement(Qt,null),ke=e=>e?`${parseFloat((e/N*100).toFixed(4))}%`:"0%",Ie=ke(C),jt=ke(he),w=()=>{if(!ge)return n==null?void 0:n.current},xt=()=>{var e;(e=w())==null||e.skipForward(tt)},Dt=()=>{var e;(e=w())==null||e.skipBackward(tt)},B=()=>{var e;(e=w())==null||e.playPause(),m({})},Be=e=>{var r;switch(e.keyCode){case X.Right:xt();break;case X.Left:Dt();break;case X.Space:e.preventDefault(),B();break;case X.Delete:if(!S){const{id:t}=((r=u.current)==null?void 0:r.selectedRegion)||{};t&&re(t)}break}},Mt=e=>{ne(e)},Le=Vt.throttle(Mt,50);let oe=!1;const Oe=()=>{oe&&(B(),oe=!1),document.removeEventListener("mousemove",Le),document.removeEventListener("mouseup",Oe)},kt=e=>{ne(e),q&&(oe=!0,B()),document.addEventListener("mousemove",Le),document.addEventListener("mouseup",Oe)},It=()=>{xe()};A(()=>(Tt(),()=>{var e;(e=n==null?void 0:n.current)==null||e.destroy(),n.current=null,_.unbindAll("setCurrentTimeByPosition"),_.unbindAll("clearRegions"),_.unbindAll("removeRegionById"),_.unbindAll("setSelectedRegion")}),[]);const Bt=e=>{var r,t,o;(r=w())==null||r.playPause(),(t=w())==null||t.setPlaybackRate(e),(o=w())==null||o.playPause()};A(()=>(document.addEventListener("keydown",Be),()=>{document.removeEventListener("keydown",Be)})),A(()=>{m({}),xe()},[O]);const Ne=e=>{var r,t,o,l;if((n==null?void 0:n.current)&&(R==null?void 0:R.current)){const s=(t=(r=n==null?void 0:n.current)==null?void 0:r.getDuration())!=null?t:0,p=(o=R==null?void 0:R.current)==null?void 0:o.getBoundingClientRect();let d=(e.clientX-p.left)/(((l=R==null?void 0:R.current)==null?void 0:l.clientWidth)||0)*s;return d>s&&(d=s),d}return 0},ne=e=>{var r;const t=Ne(e);(r=n==null?void 0:n.current)==null||r.skip(t-Ee.current),V(t)},Lt=e=>{pt(Ne(e))},Ot=N?Math.max(N-C,0):0,Nt=(c==null?void 0:c.toolName)!==et.Empty&&(c==null?void 0:c.isEdit)!==!0&&(lt==="remark"||S),Fe=i.createElement("div",{className:f.audioPlayer},mt&&!it&&i.createElement(nr,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:It,backgroundColor:"#ffffffbb"}),i.createElement(Pr,{getRegionInstanceById:I,clipping:J}),i.createElement(wr,{container:G.current}),i.createElement(Tr,{segmentTimeTip:St}),i.createElement("div",{className:f.waveformContainer,ref:G},i.createElement("div",{id:"waveform",style:{width:`${F*100}%`},className:$({[f.waveform]:!0,[f.combined]:u.current.combined,[f.clip]:u.current.clipConfigurable})},ot&&i.createElement(or,{isAudio:!0}),i.createElement("div",{ref:R,className:f.progress,onMouseDown:kt,onMouseMove:Lt},i.createElement("div",{className:$({[f.radioTooltip]:!0}),style:{left:Ie}},qe(C)),i.createElement("div",{className:$({[f.radioTooltip]:!0,[f.mouseTooltip]:!0}),style:{left:jt}},qe(he)),i.createElement(hr,{playPercentage:Ie})),Nt&&(me==null?void 0:me({currentTime:C,remainingTime:Ot,audioPlayer:w()})))),i.createElement("div",{className:f.controlBar},i.createElement(rr,{type:"link",icon:At,onClick:()=>{B()},className:$({[f.playButton]:!0,[f.playButtonDisabled]:ge})}),i.createElement("span",{className:f.time},`${Ke(C,"ss.SSS")} / -${Ke(N-C,"ss.SSS")}`),i.createElement(ir,{playerType:lr.Audio,onChange:e=>{Bt(e)}}),i.createElement(ur,{onChange:e=>{Te(e)},zoom:F}),i.createElement(dr,{EventBus:_})));return c?i.createElement(rt.Provider,{value:c},Fe,x.map(e=>{const{id:r}=e,t=document.querySelector(`[data-id=${r}]`);return t?i.createElement(mr,{el:t,key:r,region:e,edgeAdsorption:Pe,clipping:J,zoom:F,instance:I(r)}):null}),i.createElement(Ar,{footer:ut})):Fe};export{Ir as AudioPlayer,rt as AudioPlayerContext};
|
|
1
|
+
import i,{useState as g,useRef as z,useEffect as A}from"react";import{getWebPcm2WavBase64 as Kt}from"../audioAnnotate/utils/getWebPcm2Wac.js";import Vt,{debounce as Gt,sortBy as Yt}from"lodash";import{PauseOutlined as Jt,CaretRightOutlined as Qt}from"@ant-design/icons";import{cKeyCode as er,cTool as tr,EventBus as _}from"@labelbee/lb-annotation";import{Button as rr}from"antd";import or from"../invalidPage/index.js";import nr from"../imageError/index.js";import{classnames as $}from"../../utils/index.js";import ir,{EPlayerType as lr}from"../videoPlayer/components/SpeedController/index.js";import sr from"@labelbee/wavesurfer";import ar from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import ur from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import cr,{audioZoomInfo as Xe}from"./zoomSlider/index.js";import dr from"./labelDisplayToggle/index.js";import mr from"./clipRegion/index.js";import{useAudioClipStore as pr}from"../audioAnnotate/audioContext/index.js";import{useLatest as H,useUpdate as fr,useDeepCompareEffect as Ze,useThrottleFn as vr}from"ahooks";import gr from"./useAudioScroll/index.js";import b from"./index.module.scss.js";import{getAttributeColor as br,formatTime as qe,timeFormat as Ke,dispatchResizeEvent as yr,precisionMinus as Ve,isDoubleClick as _r,getCanMoveRange as Er}from"../../utils/audio.js";import hr from"./progressDot/index.js";import Pr from"./clipTip/index.js";import Sr from"./useSwitchHotkey/index.js";import Cr from"./useAudioCombine/index.js";import Rr from"./useAudioSegment/index.js";import wr from"./combineTip/index.js";import Tr from"./segmentTip/index.js";import Ar from"../../views/MainView/toolFooter/index.js";import{decimalReserved as U}from"../videoPlayer/utils.js";var jr=Object.defineProperty,xr=Object.defineProperties,Dr=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Ye=(f,a,u)=>a in f?jr(f,a,{enumerable:!0,configurable:!0,writable:!0,value:u}):f[a]=u,Je=(f,a)=>{for(var u in a||(a={}))Mr.call(a,u)&&Ye(f,u,a[u]);if(Ge)for(var u of Ge(a))kr.call(a,u)&&Ye(f,u,a[u]);return f},Qe=(f,a)=>xr(f,Dr(a));const{EToolName:et}=tr,X=er.default,tt=.1,rt=i.createContext({count:0,isEdit:!1,toolName:et.Empty,imgIndex:0}),Ir=({fileData:f={},onLoaded:a,context:u,invalid:ot,height:nt,hideError:it,onError:ce,updateRegion:j,removeRegion:L,regions:x=[],activeToolPanel:lt,clipConfigurable:st,clipTextConfigurable:at,clipAttributeList:ut,clipAttributeConfigurable:de,isCheck:S,hoverRegionId:Z,footer:ct,drawLayerSlot:me})=>{var pe,fe;const{url:O,path:ve}=f,[q,K]=g(!1),[ge,be]=g(!1),[C,dt]=g(0),[mt,ye]=g(!1),[N,_e]=g(0),n=z(null),R=z(null),Ee=z(C),V=e=>{Ee.current=e,dt(e)},[he,pt]=g(0),[F,ft]=g(1),G=z(null),[Pe,vt]=g({}),{audioClipState:Y,setAudioClipState:k}=pr(),[J,Q]=g(!1),c=H(Y),Se=H(Pe),gt=H(q),D=H(x),Ce=fr(),[Re,bt]=g([]),[we,yt]=g({}),_t=Gt(()=>{_.emit("audioZoom")},500),Te=e=>{e<Xe.min||e>Xe.max||(ft(e),yr(),_t())};gr({container:G.current,target:document.querySelector(`[data-id=${(fe=(pe=c.current)==null?void 0:pe.selectedRegion)==null?void 0:fe.id}]`),clipping:J,zoom:F,zoomHandler:Te});const W=()=>{let e=D.current;const{attributeLockList:r}=c.current;r.length&&(e=e.filter(t=>r.includes(t.attribute))),te(),e.forEach(t=>{var o;(o=n.current)==null||o.addRegion(Qe(Je({},t),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),Ce()},m=e=>{var r,t,o,l,s,p,E;const{id:d,loop:v=!0,playImmediately:P=!1}=e;if(d){const M=(o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{};Object.entries(M).forEach(([,y])=>{const{id:T}=y;d===T?y.select():y.cancelSelect()}),k({selectedRegion:{id:d,loop:v},selectedAttribute:(p=(s=(l=D.current)==null?void 0:l.find(y=>y.id===d))==null?void 0:s.attribute)!=null?p:""}),v&&P&&((E=I(d))==null||E.playLoop())}else k({selectedRegion:{}})},{combineInstance:Et}=Cr({waveRef:n,sortByStartRegions:Re,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),{segmentInstance:ht,onRegionMouseMove:Pt,segmentTimeTip:St}=Rr({waveRef:n,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),Ae={clipTextConfigurable:at,clipAttributeList:ut,clipAttributeConfigurable:de,clipConfigurable:st};A(()=>{k({selectedAttribute:""})},[de]),A(()=>{ee()},[Y.selectedAttribute]),A(()=>{W()},[Y.attributeLockList]),Ze(()=>{k(Ae),setTimeout(()=>{je()})},[Ae]),Ze(()=>{bt(Yt(x,["start"])),yt(x.reduce((e,r)=>{const{id:t}=r;return Qe(Je({},e),{[t]:r})},{}))},[x]),A(()=>{if(Z){const e=gt.current;m({id:Z,loop:e,playImmediately:!0})}else m({})},[Z]);const je=()=>{var e,r;c.current.clipConfigurable?(!S&&n.current&&((e=n.current)==null||e.enableDragSelection({slop:5})),W()):((r=n.current)==null||r.disableDragSelection(),te()),ee()},ee=()=>{var e,r,t,o,l;let s="";c.current.clipConfigurable?s=br(c.current.selectedAttribute,(e=c.current.clipAttributeList)!=null?e:[]):s="transparent",((t=(r=n==null?void 0:n.current)==null?void 0:r.cursor)==null?void 0:t.cursor)&&((l=(o=n==null?void 0:n.current)==null?void 0:o.cursor)==null||l.setStyle({border:`2px dashed ${s}`}))},I=e=>{var r,t,o;return((o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{})[e]},xe=()=>{var e,r;if(O){const t=((r=(e=ve==null?void 0:ve.split("."))==null?void 0:e.pop())==null?void 0:r.toLowerCase())==="pcm";ye(!1),t?Kt(O).then(o=>{De(o)}):De(O)}},De=e=>{var r;e&&(be(!0),V(0),_e(0),(r=n==null?void 0:n.current)==null||r.load(e))},te=()=>{var e;(e=n.current)==null||e.clearRegions()},re=e=>{const r=I(e);r&&(Q(!1),r==null||r.remove(),L==null||L(e),m({}))},{run:Me}=vr(m,{wait:500});Sr({sortByStartRegions:Re,setSelectedRegion:m});const Ct=e=>{const{start:r,end:t}=Se.current;return(r||t)&&e.update(Se.current),e},Rt=({action:e,id:r,eventDownTime:t})=>{var o,l;if(!c.current.clipConfigurable)return;r&&m({id:r});const s=I((r!=null?r:(o=c.current.selectedRegion)==null?void 0:o.id)||""),p=[];(e==="create"?D.current:(l=D.current)==null?void 0:l.filter(v=>v.id!==s.id)).forEach(v=>{const{start:P,end:M,attribute:y}=v;y===c.current.selectedAttribute&&[P,M].forEach(T=>{p.includes(T)||p.push(T)})});const d=Er(p.sort((v,P)=>v-P),t);n.current.range=d},wt=e=>{ee(),setTimeout(()=>{Q(!1)});const r=Ct(e),{id:t,start:o,end:l}=r;m({id:t,playImmediately:!0});const s={id:t,start:U(o,3),end:U(l,3)};j==null||j(s),Ce()},Tt=()=>{const e=sr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:nt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[ar.create({regions:x,dragSelection:{slop:5},canMove:!1}),ur.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),r=()=>{var t;V(((t=n==null?void 0:n.current)==null?void 0:t.getCurrentTime())||0)};e.on("ready",()=>{var t;const o=((t=n==null?void 0:n.current)==null?void 0:t.getDuration())||0;_e(o),r(),a==null||a({duration:Math.round(o)}),be(!1),B(),_.on("setCurrentTimeByPosition",ne),_.on("clearRegions",te),_.on("removeRegionById",re),_.on("setSelectedRegion",Me),e.on("regions-eventDown",Rt),je()}),e.on("audioprocess",()=>{r()}),e.on("play",()=>{K(!0)}),e.on("pause",()=>{K(!1)}),e.on("finish",()=>{K(!1)}),e.on("seek",()=>{r()}),e.on("error",()=>{ye(!0),a==null||a({hasError:!0}),ce==null||ce()}),e.on("region-created",t=>{const{id:o,start:l,end:s}=t;if(D.current.find(E=>E.id===o))return;const p={id:o,start:U(l,3),end:U(s,3),attribute:c.current.selectedAttribute,text:""};j==null||j(p)}),e.on("region-updated",(t,o)=>{var l,s,p,E,d,v,P,M,y,T;const We=o==null?void 0:o.action;k({combined:!1,segment:!1}),We==="resize"&&((s=(l=n==null?void 0:n.current)==null?void 0:l.cursor)==null||s.setStyle({borderStyle:"solid"})),We==="drag"&&((E=(p=n==null?void 0:n.current)==null?void 0:p.cursor)==null||E.setStyle({borderColor:"transparent"}));const ie={},le=[],se={},Ft=(d=D.current)==null?void 0:d.filter(h=>h.id!==t.id),Wt=(M=(P=(v=n.current)==null?void 0:v.regions)==null?void 0:P.list)!=null?M:{};Ft.forEach(h=>{var $e,He;const{element:ae}=($e=Wt[h.id])!=null?$e:{},{start:Ht,end:Ut}=h;if(ae){const{x:Ue,width:Xt}=((He=ae.getBoundingClientRect)==null?void 0:He.call(ae))||{},Zt=Ue+Xt;[Ue,Zt].forEach((ue,qt)=>{le.includes(ue)||(le.push(ue),se[ue]=qt===0?Ht:Ut)})}});const{x:ze,width:zt}=((T=(y=t.element).getBoundingClientRect)==null?void 0:T.call(y))||{},$t=ze+zt;le.forEach(h=>{Math.abs(Ve(h,ze))<5&&(ie.start=se[h]),Math.abs(Ve(h,$t))<5&&(ie.end=se[h])}),vt(ie),Me({id:t.id}),Q(!0)}),e.on("region-update-end",t=>{wt(t)}),e.on("region-contextmenu",(t,o)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),_r(o)){re(t.id);return}m({id:t.id,playImmediately:!0})}}),e.on("region-click",(t,o,l)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),c.current.combined){Et(t);return}if(c.current.segment){ht(t,l);return}m({id:t.id,playImmediately:!0})}}),e.on("region-mousemove",Pt),n.current=e},At=q?i.createElement(Jt,null):i.createElement(Qt,null),ke=e=>e?`${parseFloat((e/N*100).toFixed(4))}%`:"0%",Ie=ke(C),jt=ke(he),w=()=>{if(!ge)return n==null?void 0:n.current},xt=()=>{var e;(e=w())==null||e.skipForward(tt)},Dt=()=>{var e;(e=w())==null||e.skipBackward(tt)},B=()=>{var e;(e=w())==null||e.playPause(),m({})},Be=e=>{var r;switch(e.keyCode){case X.Right:xt();break;case X.Left:Dt();break;case X.Space:e.preventDefault(),B();break;case X.Delete:if(!S){const{id:t}=((r=c.current)==null?void 0:r.selectedRegion)||{};t&&re(t)}break}},Mt=e=>{ne(e)},Le=Vt.throttle(Mt,50);let oe=!1;const Oe=()=>{oe&&(B(),oe=!1),document.removeEventListener("mousemove",Le),document.removeEventListener("mouseup",Oe)},kt=e=>{ne(e),q&&(oe=!0,B()),document.addEventListener("mousemove",Le),document.addEventListener("mouseup",Oe)},It=()=>{xe()};A(()=>(Tt(),()=>{var e;(e=n==null?void 0:n.current)==null||e.destroy(),n.current=null,_.unbindAll("setCurrentTimeByPosition"),_.unbindAll("clearRegions"),_.unbindAll("removeRegionById"),_.unbindAll("setSelectedRegion")}),[]);const Bt=e=>{var r,t,o;(r=w())==null||r.playPause(),(t=w())==null||t.setPlaybackRate(e),(o=w())==null||o.playPause()};A(()=>(document.addEventListener("keydown",Be),()=>{document.removeEventListener("keydown",Be)})),A(()=>{m({}),xe()},[O]);const Ne=e=>{var r,t,o,l;if((n==null?void 0:n.current)&&(R==null?void 0:R.current)){const s=(t=(r=n==null?void 0:n.current)==null?void 0:r.getDuration())!=null?t:0,p=(o=R==null?void 0:R.current)==null?void 0:o.getBoundingClientRect();let d=(e.clientX-p.left)/(((l=R==null?void 0:R.current)==null?void 0:l.clientWidth)||0)*s;return d>s&&(d=s),d}return 0},ne=e=>{var r;const t=Ne(e);(r=n==null?void 0:n.current)==null||r.skip(t-Ee.current),V(t)},Lt=e=>{pt(Ne(e))},Ot=N?Math.max(N-C,0):0,Nt=(u==null?void 0:u.toolName)!==et.Empty&&(u==null?void 0:u.isEdit)!==!0&&(lt==="remark"||S),Fe=i.createElement("div",{className:b.audioPlayer},mt&&!it&&i.createElement(nr,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:It,backgroundColor:"#ffffffbb"}),i.createElement(Pr,{getRegionInstanceById:I,clipping:J}),i.createElement(wr,{container:G.current}),i.createElement(Tr,{segmentTimeTip:St}),i.createElement("div",{className:b.waveformContainer,ref:G},i.createElement("div",{id:"waveform",style:{width:`${F*100}%`},className:$({[b.waveform]:!0,"bee-audio-combined":c.current.combined,"bee-audio-clip":c.current.clipConfigurable})},ot&&i.createElement(or,{isAudio:!0}),i.createElement("div",{ref:R,className:b.progress,onMouseDown:kt,onMouseMove:Lt},i.createElement("div",{className:$({[b.radioTooltip]:!0}),style:{left:Ie}},qe(C)),i.createElement("div",{className:$({[b.radioTooltip]:!0,[b.mouseTooltip]:!0}),style:{left:jt}},qe(he)),i.createElement(hr,{playPercentage:Ie})),Nt&&(me==null?void 0:me({currentTime:C,remainingTime:Ot,audioPlayer:w()})))),i.createElement("div",{className:b.controlBar},i.createElement(rr,{type:"link",icon:At,onClick:()=>{B()},className:$({[b.playButton]:!0,[b.playButtonDisabled]:ge})}),i.createElement("span",{className:b.time},`${Ke(C,"ss.SSS")} / -${Ke(N-C,"ss.SSS")}`),i.createElement(ir,{playerType:lr.Audio,onChange:e=>{Bt(e)}}),i.createElement(cr,{onChange:e=>{Te(e)},zoom:F}),i.createElement(dr,{EventBus:_})));return u?i.createElement(rt.Provider,{value:u},Fe,x.map(e=>{const{id:r}=e,t=document.querySelector(`[data-id=${r}]`);return t?i.createElement(mr,{el:t,key:r,region:e,edgeAdsorption:Pe,clipping:J,zoom:F,instance:I(r)}):null}),i.createElement(Ar,{footer:ct})):Fe};export{Ir as AudioPlayer,rt as AudioPlayerContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Switch as c}from"antd";import e,{useState as
|
|
1
|
+
import{Switch as c}from"antd";import e,{useState as i}from"react";import a from"./index.module.scss.js";import{useTranslation as g}from"react-i18next";const p=o=>{const{t:r}=g(),{EventBus:l}=o,[t,n]=i(!0),m=s=>{l.emit("toggleShowLabel",s),n(s)};return e.createElement("span",{className:a.remarkDisplayToggle},e.createElement("span",{className:a.text},r("CompareTags")),e.createElement(c,{checked:t,onChange:m,size:"small",style:{minWidth:32,backgroundColor:t?"#6371ff":"rgb(204, 204, 204)"}}))};export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i,{useRef as m}from"react";import{timeFormat as n}from"../../../utils/audio.js";import{useMouse as u}from"ahooks";import a from"../index.module.scss.js";import{useTranslation as l}from"react-i18next";const c=t=>{const s=m(null),{t:o}=l(),{segmentTimeTip:e}=t,r=u(s.current);return e?i.createElement("div",{className:a.tips,style:{left:r.clientX,top:75,marginLeft:-130,zIndex:999}},o("AudioSegmentTip",{time:n(e,"ss.SSS")})):null};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t,{useEffect as p}from"react";import{ZoomOutOutlined as y,ZoomInOutlined as E}from"@ant-design/icons";import{Slider as k}from"antd";import{precisionAdd as v,precisionMinus as x}from"../../../utils/audio.js";import{cKeyCode as C}from"@labelbee/lb-annotation";import{useLatest as h}from"ahooks";import Z from"./index.module.scss.js";import{useTranslation as b}from"react-i18next";const l=C.default,o={min:1,max:150,ratio:1},g=d=>{const{onChange:u,zoom:r}=d,{t:f}=b(),i=h(r),n=e=>{u(e)},s={fontSize:14,margin:"0 8px",cursor:"pointer"},a=()=>{const e=v(i.current,o.ratio);n(e)},c=()=>{const e=x(i.current,o.ratio);n(e)},m=e=>{switch(e.keyCode){case l.I:e.ctrlKey&&a();break;case l.O:e.ctrlKey&&(e.preventDefault(),c());break}};return p(()=>(document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}),[]),t.createElement("div",{className:Z.sliderContainer},t.createElement("div",null,f("Scale")),t.createElement(y,{style:s,onClick:c}),t.createElement("div",{style:{width:120}},t.createElement(k,{min:o.min,max:o.max,step:o.ratio,onChange:n,value:r})),t.createElement(E,{style:s,onClick:a}))};export{o as audioZoomInfo,g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={key:"commonSymbols",label:"CommonSymbols",children:[{key:"binaryOperator",label:"BinaryOperations",children:[{key:"+",remark:""},{key:"-"},{key:"\\times"},{key:"{\\div}"},{key:"\\pm"},{key:"\\mp"},{key:"\\triangleleft"},{key:"\\triangleright"},{key:"\\cdot"},{key:"\\setminus"},{key:"\\star"},{key:"\\ast"},{key:"\\cup"},{key:"\\cap"},{key:"\\sqcup"},{key:"\\sqcap"},{key:"\\vee"},{key:"\\wedge"},{key:"\\circ"},{key:"\\bullet"},{key:"\\oplus"},{key:"\\ominus"},{key:"\\odot"},{key:"\\oslash"},{key:"\\otimes"},{key:"\\bigcirc"},{key:"\\diamond"},{key:"\\uplus"},{key:"\\bigtriangleup"},{key:"\\bigtriangledown"},{key:"\\lhd"},{key:"\\rhd"},{key:"\\unlhd"},{key:"\\unrhd"},{key:"\\amalg"},{key:"\\wr"},{key:"\\dagger"},{key:"\\ddagger"}]},{key:"binaryRelation",label:"BinaryRelations",children:[{key:"<"},{key:">"},{key:"="},{key:"\\le"},{key:"\\ge"},{key:"\\equiv"},{key:"\\ll"},{key:"\\gg"},{key:"\\doteq"},{key:"\\prec"},{key:"\\succ"},{key:"\\sim"},{key:"\\preceq"},{key:"\\succeq"},{key:"\\simeq"},{key:"\\approx"},{key:"\\subset"},{key:"\\supset"},{key:"\\subseteq"},{key:"\\supseteq"},{key:"\\sqsubset"},{key:"\\sqsupset"},{key:"\\sqsubseteq"},{key:"\\sqsupseteq"},{key:"\\cong"},{key:"\\Join"},{key:"\\bowtie"},{key:"\\propto"},{key:"\\in"},{key:"\\ni"},{key:"\\vdash"},{key:"\\dashv"},{key:"\\models"},{key:"\\mid"},{key:"\\parallel"},{key:"\\perp"},{key:"\\smile"},{key:"\\frown"},{key:"\\asymp"},{key:":"},{key:"\\notin"},{key:"\\ne"}]},{key:"arrowSymbol",label:"Arrows",children:[{key:"\\gets"},{key:"\\to"},{key:"\\longleftarrow"},{key:"\\longrightarrow"},{key:"\\uparrow"},{key:"\\downarrow"},{key:"\\updownarrow"},{key:"\\leftrightarrow"},{key:"\\Uparrow"},{key:"\\Downarrow"},{key:"\\Updownarrow"},{key:"\\longleftrightarrow"},{key:"\\Leftarrow"},{key:"\\Longleftarrow"},{key:"\\Rightarrow"},{key:"\\Longrightarrow"},{key:"\\Leftrightarrow"},{key:"\\Longleftrightarrow"},{key:"\\mapsto"},{key:"\\longmapsto"},{key:"\\nearrow"},{key:"\\searrow"},{key:"\\swarrow"},{key:"\\nwarrow"},{key:"\\hookleftarrow"},{key:"\\hookrightarrow"},{key:"\\rightleftharpoons"},{key:"\\iff"},{key:"\\leftharpoonup"},{key:"\\rightharpoonup"},{key:"\\leftharpoondown"},{key:"\\rightharpoondown"}]},{key:"otherSymbol",label:"Others",children:[{key:"\\because"},{key:"\\therefore"},{key:"\\dots"},{key:"\\cdots"},{key:"\\vdots"},{key:"\\ddots"},{key:"\\forall"},{key:"\\exists"},{key:"\\nexists"},{key:"\\Finv"},{key:"\\neg"},{key:"\\prime"},{key:"\\emptyset"},{key:"\\infty"},{key:"\\nabla"},{key:"\\triangle"},{key:"\\Box"},{key:"\\Diamond"},{key:"\\bot"},{key:"\\top"},{key:"\\angle"},{key:"\\measuredangle"},{key:"\\sphericalangle"},{key:"\\surd"},{key:"\\diamondsuit"},{key:"\\heartsuit"},{key:"\\clubsuit"},{key:"\\spadesuit"},{key:"\\flat"},{key:"\\natural"},{key:"\\sharp"}]}]},a={key:"greek",label:"Greek",children:[{key:"lower",label:"Lowercase",children:[{key:"\\alpha"},{key:"\\beta"},{key:"\\gamma"},{key:"\\delta"},{key:"\\epsilon"},{key:"\\varepsilon"},{key:"\\zeta"},{key:"\\eta"},{key:"\\theta"},{key:"\\vartheta"},{key:"\\iota"},{key:"\\kappa"},{key:"\\lambda"},{key:"\\mu"},{key:"\\nu"},{key:"\\xi"},{key:"o"},{key:"\\pi"},{key:"\\varpi"},{key:"\\rho"},{key:"\\varrho"},{key:"\\sigma"},{key:"\\varsigma"},{key:"\\tau"},{key:"\\upsilon"},{key:"\\phi"},{key:"\\varphi"},{key:"\\chi"},{key:"\\psi"},{key:"\\omega"}]},{key:"uppercase",label:"Uppercase",children:[{key:"\\Gamma"},{key:"\\Delta"},{key:"\\Theta"},{key:"\\Lambda"},{key:"\\Xi"},{key:"\\Pi"},{key:"\\Sigma"},{key:"\\Upsilon"},{key:"\\Phi"},{key:"\\Psi"},{key:"\\Omega"}]}]},t={key:"advancedMathematics",label:"AdvancedMathematics",children:[{key:"fractionalDifferentiation",label:"FractionalDifferentiation",children:[{key:"fraction",label:"Fraction",children:[{key:"\\frac{a}{b}"},{key:"\\tfrac{a}{b}"},{key:"\\mathrm{d}t"},{key:"\\frac{\\mathrm{d}y}{\\mathrm{d}x}"},{key:"\\partial t"},{key:"\\frac{\\partial y}{\\partial x}"},{key:"\\nabla\\psi"},{key:"\\frac{\\partial^2}{\\partial x_1\\partial x_2}y"}]},{key:"derivative",label:"Derivative",children:[{key:"\\dot{a}"},{key:"\\ddot{a}"},{key:"{f}'"},{key:"{f}''"},{key:"{f}^{(n)}"}]},{key:"modularArithmetic",label:"ModularArithmetic",children:[{key:"a \\bmod b"},{key:"a \\equiv b \\pmod{m}"},{key:"\\gcd(m, n)"},{key:"\\operatorname{lcm}(m, n)"}]}]},{key:"radical",label:"Radical",children:[{key:"radicalItem",label:"Radical",children:[{key:"\\sqrt{x}"},{key:"\\sqrt[n]{x}"}]},{key:"mark",label:"SupAndSub",children:[{key:"x^{a}"},{key:"x_{a}"},{key:"x_{a}^{b}"}]}]},{key:"limitLogarithm",label:"LimitLogarithm",children:[{key:"limits",label:"Limits",children:[{key:"\\lim a"},{key:"\\displaystyle \\lim_{x \\to 0}"},{key:"\\lim_{x \\to \\infty}"},{key:"\\textstyle \\lim_{x \\to 0}"},{key:"\\max_{}"},{key:"\\min_{}"}]},{key:"maLogarithmsAndExponentsrk",label:"LogarithmsAndExponents",children:[{key:"\\log_{a}{b}"},{key:"\\lg_{a}{b}"},{key:"\\ln_{a}{b}"},{key:"\\exp a"}]},{key:"bounds",label:"Bounds",children:[{key:"\\min x"},{key:"\\max y"},{key:"\\sup t"},{key:"\\inf s"},{key:"\\lim u"},{key:"\\limsup w"},{key:"\\liminf v"},{key:"\\dim p"},{key:"\\ker\\phi"}]}]},{key:"integralOperation",label:"IntegralOperation",children:[{key:"integral",label:"Integral",children:[{key:"\\int"},{key:"\\int_{a}^{b}"},{key:"\\int\\limits_{a}^{b}"}]},{key:"doubleIntegral",label:"DoubleIntegral",children:[{key:"\\iint"},{key:"\\iint_{a}^{b}"},{key:"\\iint\\limits_{a}^{b}"}]},{key:"tripleIntegral",label:"TripleIntegral",children:[{key:"\\iiint"},{key:"\\iiint_{a}^{b}"},{key:"\\iiint\\limits_{a}^{b}"}]}]},{key:"largeOperations",label:"LargeOperations",children:[{key:"summation",label:"\u6C42\u548C",children:[{key:"\\sum"},{key:"\\displaystyle \\sum_{a}^{b}"},{key:"{\\textstyle \\sum_{a}^{b}}"}]},{key:"productsAndCoproducts",label:"ProductsAndCoproducts",children:[{key:"\\prod"},{key:"\\displaystyle \\prod_{a}^{b}"},{key:"{\\textstyle \\prod_{a}^{b}}"},{key:"\\coprod"},{key:"\\displaystyle \\coprod_{a}^{b}"},{key:"{\\textstyle \\coprod_{a}^{b}}"}]},{key:"intersectionAndUnion",label:"IntersectionAndUnion",children:[{key:"\\bigcup"},{key:"\\displaystyle \\bigcup_{a}^{b}"},{key:"{\\textstyle \\bigcup_{a}^{b}}"},{key:"\\bigcap"},{key:"\\displaystyle \\bigcap_{a}^{b}"},{key:"{\\textstyle \\bigcap_{a}^{b}}"}]}]}]},r={key:"linearAlgebra",label:"LinearAlgebra",children:[{key:"bracketForensics",label:"BracketForensics",children:[{key:"bracket",label:"Bracket",children:[{key:"\\left ( a \\right )"},{key:"\\left [ a \\right ]"},{key:"\\left \\langle a \\right \\rangle"},{key:"\\left \\{ a \\right \\}"},{key:"\\left | a \\right |"},{key:"\\left \\| a \\right \\|"}]},{key:"common",label:"Common",children:[{key:"\\binom{n}{r}"},{key:"\\left [ 0,1 \\right )"},{key:"\\left \\langle \\psi \\right |"},{key:"\\left | \\psi \\right \\rangle"},{key:"\\left \\langle \\psi | \\psi \\right \\rangle"}]}]},{key:"arrayMatrix",label:"ArrayMatrix",children:[{key:"\\begin{matrix} 11& 11 &11 \\\\ 11& 11 &11 \\end{matrix}"},{key:"\\begin{bmatrix} 11 & 11\\\\ 11 & 11 \\end{bmatrix}"},{key:"\\begin{pmatrix} 11& 11& 11\\\\ 11& 11& 11 \\end{pmatrix}"},{key:"\\begin{vmatrix} 11& 11\\\\ 11&11 \\end{vmatrix}"},{key:"\\begin{Bmatrix} 11& 11\\\\ 11&11 \\end{Bmatrix}"}]}]},y={key:"trigonometric",label:"TrigonometricFunctions",children:[{key:"trigonometricFunctions",label:"TrigonometricFunctions",children:[{key:"\\sin\\alpha"},{key:"\\cos\\alpha"},{key:"\\tan\\alpha"},{key:"\\cot\\alpha"},{key:"\\sec\\alpha"},{key:"\\csc\\alpha"}]},{key:"inverseTrigonometricFunctions",label:"InverseTrigonometricFunctions",children:[{key:"\\sin^{-1}\\alpha"},{key:"\\cos^{-1}\\alpha"},{key:"\\tan^{-1}\\alpha"},{key:"\\cot^{-1}\\alpha"},{key:"\\sec^{-1}\\alpha"},{key:"\\csc^{-1}\\alpha"},{key:"\\arcsin\\alpha"},{key:"\\arccos\\alpha"},{key:"\\arctan\\alpha"},{key:"\\operatorname{arccot}\\alpha"},{key:"\\operatorname{arccsc}\\alpha"}]},{key:"hyperblicFunctions",label:"HyperblicFunctions",children:[{key:"\\sinh\\alpha"},{key:"\\cosh\\alpha"},{key:"\\tanh\\alpha"},{key:"\\coth\\alpha"},{key:"\\operatorname{sech}\\alpha"},{key:"\\operatorname{csch}\\alpha"}]},{key:"inverseHyperblicFunctions",label:"InverseHyperblicFunctions",children:[{key:"\\sinh^{-1}\\alpha"},{key:"\\cosh^{-1}\\alpha"},{key:"\\tanh^{-1}\\alpha"},{key:"\\coth^{-1}\\alpha"},{key:"\\operatorname{sech}^{-1}\\alpha"},{key:"\\operatorname{csch}^{-1}\\alpha"}]}]},l={key:"formulaTemplate",label:"FormulaTemplate",children:[{key:"algebraFormula",label:"Algebra",children:[{key:"\\left(x-1\\right)\\left(x+3\\right)"},{key:"\\frac{a}{b}\\pm \\frac{c}{d}= \\frac{ad \\pm bc}{bd}"},{key:"x ={-b \\pm \\sqrt{b^2-4ac}\\over 2a}"},{key:"\\left\\{\\begin{matrix} x=a + r\\text{cos}\\theta \\\\ y=b + r\\text{sin}\\theta \\end{matrix}\\right."}]},{key:"geometryFormula",label:"Geometry",children:[{key:"\\Delta ABC"},{key:"a \\parallel c,b \\parallel c \\Rightarrow a \\parallel b"},{key:"\\left.\\begin{matrix} a \\perp \\alpha \\\\ b \\perp \\alpha \\end{matrix}\\right\\}\\Rightarrow a \\parallel b"},{key:"\\begin{array}{c} \\text{\u76F4\u89D2\u4E09\u89D2\u5F62\u4E2D,\u76F4\u89D2\u8FB9\u957Fa,b,\u659C\u8FB9\u8FB9\u957Fc} \\\\ a^{2}+b^{2}=c^{2} \\end{array}"}]},{key:"inequalityFormula",label:"Inequality",children:[{key:"a > b,b > c \\Rightarrow a > c"},{key:"\\left | a-b \\right | \\geqslant \\left | a \\right | -\\left | b \\right |"},{key:"-\\left | a \\right |\\leq a\\leqslant \\left | a \\right |"},{key:"\\begin{array}{c} a,b \\in \\mathbb{R}^{+} \\\\ \\Rightarrow \\frac{a+b}{{2}}\\ge \\sqrt{ab} \\\\ \\left( \\text{\u5F53\u4E14\u4EC5\u5F53}a=b\\text{\u65F6\u53D6\u201C}=\\text{\u201D\u53F7}\\right) \\end{array}"},{key:"\\begin{array}{c} a,b \\in \\mathbb{R} \\\\ \\Rightarrow a^{2}+b^{2}\\gt 2ab \\\\ \\left( \\text{\u5F53\u4E14\u4EC5\u5F53}a=b\\text{\u65F6\u53D6\u201C}=\\text{\u201D\u53F7}\\right) \\end{array}"}]},{key:"integralFormula",label:"Integral",children:[{key:"\\frac{\\mathrm{d}}{\\mathrm{d}x}x^n=nx^{n-1}"},{key:"\\frac{\\mathrm{d}}{\\mathrm{d}x}\\sin x=\\cos x"},{key:"\\frac{\\mathrm{d}}{\\mathrm{d}x}\\cos x=-\\sin x"},{key:"\\int k\\mathrm{d}x = kx+C"}]},{key:"matrixFormula",label:"Matrix",children:[{key:"\\begin{pmatrix} 1 & 0 \\\\ 0 & 1\\end{pmatrix}"},{key:"\\begin{pmatrix} a_{11} & a_{12} & a_{13} \\\\ a_{21} & a_{22} & a_{23} \\\\ a_{31} & a_{32} & a_{33}\\end{pmatrix}"},{key:"A_{m\\times n}=\\begin{bmatrix} a_{11}& a_{12}& \\cdots & a_{1n} \\\\ a_{21}& a_{22}& \\cdots & a_{2n} \\\\ \\vdots & \\vdots & \\ddots & \\vdots \\\\ a_{m1}& a_{m2}& \\cdots & a_{mn}\\end{bmatrix}=\\left [ a_{ij}\\right ]"},{key:"\\mathbf{V}_1 \\times \\mathbf{V}_2 =\\begin{vmatrix} \\mathbf{i}& \\mathbf{j}& \\mathbf{k} \\\\ \\frac{\\partial X}{\\partial u}& \\frac{\\partial Y}{\\partial u}& 0 \\\\ \\frac{\\partial X}{\\partial v}& \\frac{\\partial Y}{\\partial v}& 0 \\\\ \\end{vmatrix}"}]},{key:"triangleFormula",label:"Triangle",children:[{key:"e^{i \\theta}"},{key:"\\text{sin}^{2}\\frac{\\alpha}{2}=\\frac{1- \\text{cos}\\alpha}{2}"},{key:"\\sin \\alpha + \\sin \\beta =2 \\sin \\frac{\\alpha + \\beta}{2}\\cos \\frac{\\alpha - \\beta}{2}"},{key:"\\cos \\alpha + \\cos \\beta =2 \\cos \\frac{\\alpha + \\beta}{2}\\cos \\frac{\\alpha - \\beta}{2}"}]},{key:"statisticsFormula",label:"Statistics",children:[{key:"C_{r}^{n}"},{key:"\\sum_{i=1}^{n}{X_i}"},{key:"\\begin{array}{c} \\text{\u82E5}P \\left( AB \\right) =P \\left( A \\right) P \\left( B \\right) \\\\ \\text{\u5219}P \\left( A \\left| B\\right. \\right) =P \\left({B}\\right) \\end{array}"},{key:"P \\left( A \\right) = \\lim \\limits_{n \\to \\infty}f_{n}\\left ( A \\right )"}]},{key:"sequenceFormula",label:"Sequence",children:[{key:"a_{n}=a_{1}q^{n-1}"},{key:"S_{n}=\\frac{n \\left( a_{1}+a_{n}\\right)}{2}"},{key:"\\frac{1}{4n^{2}-1}=\\frac{1}{2}\\left( \\frac{1}{2n-1}-\\frac{1}{2n+1}\\right)"},{key:"\\begin{array}{c} \\text{\u82E5}\\left \\{a_{n}\\right \\}\u3001\\left \\{b_{n}\\right \\}\\text{\u4E3A\u7B49\u5DEE\u6570\u5217}, \\\\ \\text{\u5219}\\left \\{a_{n}+ b_{n}\\right \\}\\text{\u4E3A\u7B49\u5DEE\u6570\u5217} \\end{array}"}]},{key:"physicsFormula",label:"Physics",children:[{key:"\\sum \\vec{F}_i = \\frac{d\\vec{v}}{dt} = 0"},{key:"{E_p} = -\\frac{{GMm}}{r}"},{key:"d \\vec{F}= Id \\vec{l} \\times \\vec{B}"},{key:"\\begin{array}{l} \\nabla \\cdot \\mathbf{D} =\\rho _f \\\\ \\nabla \\cdot \\mathbf{B} = 0 \\\\ \\nabla \\times \\mathbf{E} = -\\cfrac{\\partial \\mathbf{B}}{\\partial t } \\\\ \\nabla \\times \\mathbf{H} = \\mathbf{J}_f + \\cfrac{\\partial \\mathbf{D}}{\\partial t } \\end{array}"}]}]},i=[e,a,t,r,y,l];export{i as latexList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n,{useState as N,useRef as x}from"react";import{Dropdown as $,Spin as w,Tooltip as L,Button as f}from"antd";import{RightOutlined as A}from"@ant-design/icons";import{latexList as k}from"./constant/config.js";import y from"../markdownView/index.js";import o from"./index.module.scss.js";import E from"classnames";import{useTranslation as h}from"react-i18next";const C=({data:i,columnIndex:p,onSelectLatex:v,setActiveKeys:c,activeKeys:s,getInitActiveKey:u,disabled:d})=>{var a,t;const{t:r}=h();return((a=i==null?void 0:i.children)==null?void 0:a.some(e=>!(e==null?void 0:e.children)))&&(i==null?void 0:i.children)?n.createElement("div",{className:o.lastNode},i.children.map(e=>{const m=` $$${e.key}$$ `;return(e==null?void 0:e.remark)?n.createElement(L,{placement:"top",title:e==null?void 0:e.remark,key:e.key},n.createElement(f,{key:e.key,className:o.markdownItem,onClick:()=>{v(m)},disabled:d},n.createElement(y,{value:m}))):n.createElement(f,{key:e.key,className:o.markdownItem,onClick:()=>{v(m)},disabled:d},n.createElement(y,{value:m}))})):n.createElement("div",{className:o.itemList},(t=i==null?void 0:i.children)==null?void 0:t.map(e=>n.createElement("div",{key:e.key,onClick:()=>{const m=u(e),g=[...s.slice(0,p+1),...m];c(g)},className:E({[`${o.item}`]:!0,[`${o.itemActive}`]:s.includes(e.key)})},r(e.label||""),n.createElement(A,{style:{marginLeft:4,fontSize:10}}))))},I=({onSelectLatex:i,disabled:p})=>{const{t:v}=h(),[c,s]=N([]),u=x(null),d=(t,r)=>{for(const l of t){if((l==null?void 0:l.key)===r)return l;if(l==null?void 0:l.children){const e=d(l.children,r);if(e)return e}}return null},a=(t,r=[])=>{var l;const e=r;return e.push(t.key),(t==null?void 0:t.children)&&((l=t==null?void 0:t.children)==null?void 0:l.length)>0&&a(t.children[0],e),e};return n.createElement("div",{className:o.latexEditor,ref:u},k.map(t=>n.createElement($,{dropdownRender:()=>n.createElement(w,{spinning:c.length===0},n.createElement("div",{className:o.dropContent},c.map((r,l)=>{const e=d(k,r);return n.createElement("div",{key:r},n.createElement(C,{data:e,columnIndex:l,onSelectLatex:i,setActiveKeys:s,activeKeys:c,getInitActiveKey:a,disabled:p}))}))),key:t.key,className:E({[`${o.latexHeaderTitle}`]:!0,[`${o.itemActive}`]:c.includes(t.key)}),getPopupContainer:()=>(u==null?void 0:u.current)||document.body,trigger:["click"],onOpenChange:r=>{if(r){const l=a(t);s(l)}else s([])}},n.createElement("span",null,v(t.label)))))};export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={latexEditor:"index-module_latexEditor__0fK8G",latexHeaderTitle:"index-module_latexHeaderTitle__JIpOj",dropContent:"index-module_dropContent__XVBYH",itemList:"index-module_itemList__Y3q0e",item:"index-module_item__q4v2V",itemActive:"index-module_itemActive__a5EPl",lastNode:"index-module_lastNode__TXbWG",markdownItem:"index-module_markdownItem__AkW22"};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudUtils as v,EPerspectiveView as
|
|
1
|
+
import{PointCloudUtils as v,EPerspectiveView as k}from"@labelbee/lb-utils";import r,{useState as D,useEffect as N}from"react";import{PointCloudContext as m}from"./PointCloudContext.js";import{UnitUtils as V}from"@labelbee/lb-annotation";import{useSingleBox as $}from"./hooks/useSingleBox.js";import{useTranslation as x}from"react-i18next";var H=Object.defineProperty,U=Object.defineProperties,R=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,S=(o,e,t)=>e in o?H(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,B=(o,e)=>{for(var t in e||(e={}))T.call(e,t)&&S(o,t,e[t]);if(I)for(var t of I(e))K.call(e,t)&&S(o,t,e[t]);return o},F=(o,e)=>U(o,R(e));const a=2,A={color:"white",backgroundColor:"rgba(153, 153, 153, 0.3)",padding:"8px 10px",zIndex:20,fontSize:12},W=({perspectiveView:o})=>{const{pointCloudBoxList:e,selectedID:t}=r.useContext(m),c=e.find(u=>u.id===t),l=x(),{t:s}=l;if(t&&c){const{length:u,width:b,height:i}=v.transferBox2Kitti(c),f=o===k.Back?[{label:s("Width"),value:b},{label:s("Height"),value:i}]:[{label:s("Length"),value:u},{label:s("Height"),value:i}];return r.createElement("div",{style:F(B({position:"absolute"},A),{bottom:"4%",left:"50%",transform:"translate(-50%, 0)"})},f.map((d,n)=>r.createElement("span",{key:n,style:{marginRight:n===0?16:0}},`${d.label}: ${d.value.toFixed(a)}`)))}return null},M=({checkMode:o,config:e,style:t})=>{const c=r.useContext(m),{selectedBox:l}=$(),[s,u]=D([]),b=x(),{t:i,i18n:f}=b,d=t;return N(()=>{var n,g;if(!l)return;const{length:h,width:_,height:y,rotation_y:L}=v.transferBox2Kitti(l.info),{x:P,y:C,z:w}=l.info.center;let p=[{label:"x",value:P==null?void 0:P.toFixed(a)},{label:"y",value:C==null?void 0:C.toFixed(a)},{label:"z",value:w==null?void 0:w.toFixed(a)},{label:i("Length"),value:h==null?void 0:h.toFixed(a)},{label:i("Width"),value:_==null?void 0:_.toFixed(a)},{label:i("Height"),value:y==null?void 0:y.toFixed(a)},{label:i("Rotation_y"),value:(n=V.rad2deg(L))==null?void 0:n.toFixed(a)}];(g=c.mainViewInstance)==null||g.filterPointsByBox(l.info).then(j=>{var E,O;if(!j){u(p);return}p.push({label:i("PointCount"),value:`${(O=(E=l.info)==null?void 0:E.count)!=null?O:0}`}),o===!0&&l.info.subAttribute&&e&&v.getSubAttributeName(l.info.subAttribute,e).forEach(z=>p.push(z)),u(p)})},[l,f.language]),l?r.createElement("div",{style:t||F(B({position:"absolute"},A),{right:8,bottom:8})},s.map(n=>d?r.createElement("div",{key:n.label,style:{margin:"0px 4px"}},`${n.label}: ${n.value}`):r.createElement("div",{key:n.label},r.createElement("span",{style:{width:"38px",display:"inline-block",textAlign:"end"}},n.label),": ",r.createElement("span",null,n.value)))):null},X=()=>{const o=r.useContext(m),{t:e}=x();return o.valid===!1?r.createElement("div",{style:{position:"absolute",backgroundColor:"rgb(242, 101, 73)",color:"white",opacity:.7,left:0,top:0,fontSize:30,padding:"8px 16px",zIndex:20,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},e("Invalid")):null};export{M as BoxInfos,X as PointCloudValidity,W as SizeInfoForView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudName as nt,MathUtils as w,getCuboidFromPointCloudBox as Gt}from"@labelbee/lb-annotation";import{EPerspectiveView as Q,PointCloudUtils as V,DEFAULT_SPHERE_PARAMS as Qt}from"@labelbee/lb-utils";import{useContext as Xt}from"react";import{PointCloudContext as Yt}from"../PointCloudContext.js";import{useSingleBox as qt}from"./useSingleBox.js";import{useSphere as Jt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as ft,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as it,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{message as eo}from"antd";import{useTranslation as no}from"react-i18next";import{useHistory as io}from"./useHistory.js";import{usePolygon as so}from"./usePolygon.js";import{useLatest as ro}from"ahooks";var lo=Object.defineProperty,ao=Object.defineProperties,co=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))uo.call(t,i)&&xt(e,i,t[i]);if(mt)for(var i of mt(t))po.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ao(e,co(t)),st=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(P){o(P)}},g=u=>{try{c(i.throw(u))}catch(P){o(P)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const J=5,K=90,ht=.01,v={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},rt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Qt,u={center:{x:a,y:g,z:c},id:e.id},P=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},lt=(e,t,i,d,o,a)=>{let g=e.pointList.map(B=>V.transferCanvas2World(B,t)),c=0,u=1,P={};if(i){const B=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,u=B.maxZ-B.minZ,P={count:B.zCount}}const[h,S,F]=g,R=w.getLineCenterPoint([h,F]),z=w.getLineLength(h,S),A=w.getLineLength(S,F),N=w.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:R.x,y:R.y,z:c},width:a?A+ht:A,height:a?z+ht:z,depth:u,rotation:N,id:e.id},j=L(d?L(L({},d),T):O(L({},T),{attribute:"",valid:!0}),P);o&&Object.assign(j,o);const E=g.map(B=>V.transferWorld2Canvas(B,t));return{boxParams:j,newPointList:E}},Lt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},yt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j,{newBoxParams:B}=d.getNewBoxBySideUpdate(R,E,N,i);return B},go=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},fo=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j;let{newBoxParams:B}=d.getNewBoxByBackUpdate(R,E,N,i);return B},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Left);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},wt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Back);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,Q.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},dt=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),P=[...g.polygonList],h=P.find(S=>S.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):P.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(P,t.id)},Co=()=>{const e=Xt(Yt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:S,setHighlight2DDataList:F,cuboidBoxIn2DView:R,imageSizes:z}=e,{addHistory:A,initHistory:N,pushHistoryUnderUpdatePolygon:T}=io(),{selectedPolygon:j}=so(),{getPointCloudSphereByID:E,updatePointCloudSphere:B,selectedSphere:X}=Jt(),{currentData:W,config:b}=Kt(n=>{const{stepList:r,step:p,imgList:s,imgIndex:l}=n.annotation;return{currentData:s[l],config:ft(to.getCurrentStepInfo(p,r).config)}}),H=$t(),Dt=ro(R),$=n=>{if(!Dt.current){const{mappingImgList:r=[]}=W,p=r.map(s=>oo({pointCloudBox:n,mappingData:s,imageSizes:z}));Object.assign(n,{rects:p.filter(s=>s!==void 0)})}},{selectedBox:_,updateSelectedBox:St,updateSelectedBoxes:tt,getPointCloudByID:_t}=qt({generateRects:$}),{t:Vt}=no(),at=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Ot=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},kt=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},At=({newPoint:n,size:r,zoom:p,trackConfigurable:s})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};s===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=rt(n,r,ot,void 0,f);c(n.id);const m=g(C);Y(v.Top,n,C,p,m,b),A({newSphereParams:C})},Ut=({polygon:n,size:r,imgList:p,trackConfigurable:s,zoom:l,intelligentFit:f})=>{var C,m;const x={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};s===!0&&Object.assign(x,{trackID:V.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const I=t==null?void 0:t.toolInstance,D=L({},n);let{boxParams:y,newPointList:U}=lt(D,r,ot,void 0,x,f);if(y=H(it({tool:nt.PointCloud,dataList:[y],stepConfig:b,action:"viewUpdateBox"}))[0],(b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<b.lowerLimitPointsNumInBox){eo.info(Vt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),I.deletePolygon(y.id);return}f&&(U==null?void 0:U.length)&&(D.pointList=U);const k=S.includes(D.attribute);$(y);const G=a(y),et=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(y.id),I.selection.setSelectedIDs(D.id),M({omitView:v.Top,polygon:D,boxParams:y,zoom:l,newPointCloudBoxList:G}),f&&dt(y,D,t,o)),A({newBoxParams:y})},Rt=n=>{const{boxID:r,imageName:p,width:s,height:l,x:f,y:C}=n,m=P.find(x=>x.id===r);if(m==null?void 0:m.rects){const{rects:x=[]}=m,I=x.find(D=>D.imageName===p);if(I){let D=x;const y=O(L({},I),{width:s,height:l,x:f,y:C});D=x.map(k=>k===I?y:k);const U=O(L({},m),{rects:D}),Z=P.map(k=>k===m?U:k);return t==null||t.updatePolygonList(Z!=null?Z:[]),Z}}},zt=({newSelectedBox:n,newPointCloudList:r,newSelectedSphere:p,newSphereList:s})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const C=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const m=f.selectedPolygon;if(u.length===1&&C){M({omitView:v.Top,polygon:m,boxParams:C,newPointCloudBoxList:r});return}}if((p||X)&&u.length===1){const C=p!=null?p:X;f.setSelectedID(u[0]);const m=f.selectedPoint;C&&Y(v.Top,m,C,void 0,s,b)}}},ct=(n,r,p)=>{if(at){let s,l;switch(p){case v.Back:s=fo;break;case v.Side:s=yt;break;default:s=yt;break}l=s(n,r,at,i.pointCloudInstance);const C=H(it({tool:nt.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;if(l=C,o){const{count:I}=o.getSensesPointZAxisInPolygon(Gt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:I})}const x=St(l);return l=x.find(I=>I.id===l.id),M({omitView:m?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},ut=(n,r,p)=>{if(X){let s,l;switch(p){case v.Back:s=go;break;case v.Side:s=Lt;break;default:s=Lt;break}l=s(n,r,X);const f=B(l);return Y(p,n,l,void 0,f,b),f}},Tt=(n,r)=>{ut(n,r,v.Side)},jt=(n,r)=>{ut(n,r,v.Back)},Nt=(n,r)=>{ct(n,r,v.Side)},Et=(n,r)=>{ct(n,r,v.Back)},Ht=(n,r)=>{const p=E(n.id),s=rt(n,r,ot,p),l=B(s);Y(v.Top,n,s,void 0,l,b)},Ft=(n,r)=>{if(j){const s=L({},n[0].newPolygon);s.pointList=s.pointList.map(l=>V.transferCanvas2World(l,r)),T(s);return}let p=n.map(({newPolygon:s})=>{const l=_t(s.id),{boxParams:f}=lt(s,r,t.pointCloudInstance,l);return f});if(p=H(it({tool:nt.PointCloud,dataList:p,stepConfig:b,action:"viewUpdateBox"})),p.length===1){const{newPolygon:s}=n[0],l=tt(p);M({polygon:s,boxParams:p[0],newPointCloudBoxList:l})}else{const s=tt(p);s&&e.syncAllViewPointCloudColor(s)}},Wt=n=>{var r,p,s,l,f;if(_){const C=Number(n.widthDefault),m=Number(n.depthDefault),x=Number(n.heightDefault),I=_==null?void 0:_.info.trackID,y=((r=t==null?void 0:t.toolInstance)==null?void 0:r.polygonList).find(q=>(q==null?void 0:q.trackID)===I),U={width:(s=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:s.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},Z=y.pointList.map(q=>V.transferCanvas2World(q,U)),k=w.getModifiedRectangleCoordinates(Z,x,C),G=k[0],et=k[2],pt=w.getLineCenterPoint([G,et]),Zt=_.info.center.z-_.info.depth/2,gt=O(L({},_.info),{center:{x:pt.x,y:pt.y,z:Zt+m/2},width:C,height:x,depth:m,valid:!0}),Mt=tt([gt]);M({omitView:v["3D"],polygon:y,boxParams:gt,newPointCloudBoxList:Mt})}},Y=(n,r,p,s,l,f)=>st(void 0,null,function*(){const C=W==null?void 0:W.url,m={[v.Side]:()=>{vt(p,r,i,C,f)},[v.Back]:()=>{d&&wt(p,r,d,C,f)},[v.Top]:()=>{It(p,r,t,o)}};Object.keys(m).forEach(x=>{x!==n&&m[x]()}),s&&(o==null||o.updateCameraZoom(s)),kt(p)}),M=n=>st(void 0,null,function*(){const{omitView:r,polygon:p,boxParams:s,zoom:l,newPointCloudBoxList:f}=n,C=W==null?void 0:W.url;f&&(yield e.syncAllViewPointCloudColor(f));const m={[v.Side]:()=>{Bt(s,p,i,C)},[v.Back]:()=>{d&&bt(s,p,d,C)},[v.Top]:()=>{dt(s,p,t,o)}};Object.keys(m).forEach(x=>{x!==r&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Ot(s)});return{topViewAddSphere:At,topViewAddBox:Ut,topViewSelectedChanged:zt,topViewUpdatePoint:Ht,sideViewUpdatePoint:Tt,backViewUpdatePoint:jt,topViewUpdateBox:Ft,sideViewUpdateBox:Nt,backViewUpdateBox:Et,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const r=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(r),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>st(void 0,[...n],function*(r=W){var p,s,l,f,C,m;if(!(r==null?void 0:r.url)||!o)return;F([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(r.url,(p=b==null?void 0:b.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],I=[],D=[],y=[];o.updateTopCamera();const U=(l=(s=ft(r.result))==null?void 0:s.valid)!=null?l:!0;e.setPointCloudValid(U),(f=e.sideViewInstance)==null||f.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),t.updateData(r.url,r.result,{radius:(m=b==null?void 0:b.radius)!=null?m:K}),r.result&&(x=V.getBoxParamsFromResultList(r.result),D=V.getPolygonListFromResultList(r.result),I=V.getLineListFromResultList(r.result),y=V.getSphereParamsFromResultList(r.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),N({pointCloudBoxList:x,polygonList:D,lineList:I,pointCloudSphereList:y}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Wt,generateRects:$,update2DViewRect:Rt}};export{wt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,bt as synchronizeBackView,Bt as synchronizeSideView,dt as synchronizeTopView,rt as topViewPoint2PointCloud,lt as topViewPolygon2PointCloud,Co as usePointCloudViews};
|
|
1
|
+
import{EPointCloudName as nt,MathUtils as B,getCuboidFromPointCloudBox as Mt}from"@labelbee/lb-annotation";import{EPerspectiveView as J,PointCloudUtils as V,POINT_CLOUD_DEFAULT_STEP as Gt,DEFAULT_SPHERE_PARAMS as Jt}from"@labelbee/lb-utils";import{useContext as Qt}from"react";import{PointCloudContext as Xt}from"../PointCloudContext.js";import{useSingleBox as Yt}from"./useSingleBox.js";import{useSphere as qt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as it,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as st,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{useHistory as eo}from"./useHistory.js";import{usePolygon as no}from"./usePolygon.js";import{useLatest as io}from"ahooks";var so=Object.defineProperty,ro=Object.defineProperties,lo=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertySymbols,ao=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?so(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))ao.call(t,i)&&xt(e,i,t[i]);if(ht)for(var i of ht(t))co.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ro(e,lo(t)),rt=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(h){o(h)}},g=u=>{try{c(i.throw(u))}catch(h){o(h)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const q=5,K=90,mt=.01,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},lt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Jt,u={center:{x:a,y:g,z:c},id:e.id},h=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(h,o),h},dt=(e,t,i,d,o,a)=>{let g=e.pointList.map(v=>V.transferCanvas2World(v,t)),c=0,u=1,h={};if(i){const v=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&v.fittedCoordinates.length>0&&(g=v.fittedCoordinates),c=(v.maxZ+v.minZ)/2,u=v.maxZ-v.minZ,h={count:v.zCount}}const[m,I,W]=g,z=B.getLineCenterPoint([m,W]),T=B.getLineLength(m,I),R=B.getLineLength(I,W),E=B.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const j={center:{x:z.x,y:z.y,z:c},width:a?R+mt:R,height:a?T+mt:T,depth:u,rotation:E,id:e.id},N=L(d?L(L({},d),j):O(L({},j),{attribute:"",valid:!0}),h);o&&Object.assign(N,o);const F=g.map(v=>V.transferWorld2Canvas(v,t));return{boxParams:N,newPointList:F}},Lt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},yt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,h]=t.pointList,m=B.getLineCenterPoint([o,g]),I=B.getLineCenterPoint([c,h]),z={x:{x:m.x-I.x,y:m.y-I.y}.x,y:0,z:m.y-I.y},T=B.getLineLength(o,a),R=B.getLineLength(c,u),E=T-R,j=B.getLineLength(a,g),N=B.getLineLength(u,h),F=j-N,{newBoxParams:v}=d.getNewBoxBySideUpdate(z,F,E,i);return v},uo=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},po=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,h]=t.pointList,m=B.getLineCenterPoint([o,g]),I=B.getLineCenterPoint([c,h]),z={x:{x:m.x-I.x,y:m.y-I.y}.x,y:0,z:m.y-I.y},T=B.getLineLength(o,a),R=B.getLineLength(c,u),E=T-R,j=B.getLineLength(a,g),N=B.getLineLength(u,h),F=j-N;let{newBoxParams:v}=d.getNewBoxByBackUpdate(z,F,E,i);return v},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,J.Left);c.setInitCameraPosition(u);const{point2d:h,zoom:m}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=m,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(m),g.setResult([O(L(L({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:q,depth:q});const{cameraPositionVector:g}=a.updateOrthoCamera(e,J.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},bt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,J.Back);c.setInitCameraPosition(u);const{point2d:h,zoom:m}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=m,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(m),g.setResult([O(L(L({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},wt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:q,depth:q});const{cameraPositionVector:g}=a.updateOrthoCamera(e,J.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,J.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},at=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),h=[...g.polygonList],m=h.find(I=>I.id===t.id);m?(m.pointList=u,m.valid=(o=e.valid)!=null?o:!0):h.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(h,t.id)},go=()=>{const e=Qt(Xt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:h,pointCloudSphereList:m,hideAttributes:I,setHighlight2DDataList:W,cuboidBoxIn2DView:z,imageSizes:T}=e,{addHistory:R,initHistory:E,pushHistoryUnderUpdatePolygon:j}=eo(),{selectedPolygon:N}=no(),{getPointCloudSphereByID:F,updatePointCloudSphere:v,selectedSphere:Q}=qt(),{currentData:Z,config:S}=Kt(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:it(to.getCurrentStepInfo(p,s).config)}}),H=$t(),St=io(z),$=n=>{if(!St.current){const{mappingImgList:s=[]}=Z,p=s.map(r=>oo({pointCloudBox:n,mappingData:r,imageSizes:T}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:Dt,updateSelectedBoxes:tt,getPointCloudByID:_t}=Yt({generateRects:$}),ct=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Vt=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},Ot=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},kt=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:m})});const P=lt(n,s,ot,void 0,f);c(n.id);const x=g(P);X(y.Top,n,P,p,x,S),R({newSphereParams:P})},Rt=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var P,x;const C={attribute:(P=t.toolInstance.defaultAttribute)!=null?P:""};r===!0&&Object.assign(C,{trackID:V.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:m})});const D=t==null?void 0:t.toolInstance,w=L({},n);let{boxParams:b,newPointList:A}=dt(w,s,ot,void 0,C,f);b=H(st({tool:nt.PointCloud,dataList:[b],stepConfig:S,action:"viewUpdateBox"}))[0],f&&(A==null?void 0:A.length)&&(w.pointList=A);const k=I.includes(w.attribute);$(b);const G=a(b),et=(x=e==null?void 0:e.polygonList)!=null?x:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(b.id),D.selection.setSelectedIDs(w.id),M({omitView:y.Top,polygon:w,boxParams:b,zoom:l,newPointCloudBoxList:G}),f&&at(b,w,t,o)),R({newBoxParams:b})},At=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:P}=n,x=h.find(C=>C.id===s);if(x==null?void 0:x.rects){const{rects:C=[]}=x,D=C.find(w=>w.imageName===p);if(D){let w=C;const b=O(L({},D),{width:r,height:l,x:f,y:P});w=C.map(k=>k===D?b:k);const A=O(L({},x),{rects:w}),U=h.map(k=>k===x?A:k);return t==null||t.updatePolygonList(U!=null?U:[]),U}}},Ut=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const P=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const x=f.selectedPolygon;if(u.length===1&&P){M({omitView:y.Top,polygon:x,boxParams:P,newPointCloudBoxList:s});return}}if((p||Q)&&u.length===1){const P=p!=null?p:Q;f.setSelectedID(u[0]);const x=f.selectedPoint;P&&X(y.Top,x,P,void 0,r,S)}}},ut=(n,s,p)=>{if(ct){let r,l;switch(p){case y.Back:r=po;break;case y.Side:r=yt;break;default:r=yt;break}if(l=r(n,s,ct,i.pointCloudInstance),o){const{count:D}=o.getSensesPointZAxisInPolygon(Mt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:D})}const P=H(st({tool:nt.PointCloud,dataList:[l],stepConfig:S,action:"viewUpdateBox"}))[0],x=l.valid!==P.valid;l=P;const C=Dt(l);return l=C.find(D=>D.id===l.id),M({omitView:x?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:C}),C}},pt=(n,s,p)=>{if(Q){let r,l;switch(p){case y.Back:r=uo;break;case y.Side:r=Lt;break;default:r=Lt;break}l=r(n,s,Q);const f=v(l);return X(p,n,l,void 0,f,S),f}},zt=(n,s)=>{pt(n,s,y.Side)},Tt=(n,s)=>{pt(n,s,y.Back)},jt=(n,s)=>{ut(n,s,y.Side)},Nt=(n,s)=>{ut(n,s,y.Back)},Et=(n,s)=>{const p=F(n.id),r=lt(n,s,ot,p),l=v(r);X(y.Top,n,r,void 0,l,S)},Ft=(n,s)=>{if(N){const r=L({},n[0].newPolygon);r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),j(r);return}let p=n.map(({newPolygon:r})=>{const l=_t(r.id),{boxParams:f}=dt(r,s,t.pointCloudInstance,l);return f});if(p=H(st({tool:nt.PointCloud,dataList:p,stepConfig:S,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=tt(p);M({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=tt(p);r&&e.syncAllViewPointCloudColor(r)}},Ht=n=>{var s,p,r,l,f;if(_){const P=Number(n.widthDefault),x=Number(n.depthDefault),C=Number(n.heightDefault),D=_==null?void 0:_.info.trackID,b=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(Y=>(Y==null?void 0:Y.trackID)===D),A={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},U=b.pointList.map(Y=>V.transferCanvas2World(Y,A)),k=B.getModifiedRectangleCoordinates(U,C,P),G=k[0],et=k[2],gt=B.getLineCenterPoint([G,et]),Wt=_.info.center.z-_.info.depth/2,ft=O(L({},_.info),{center:{x:gt.x,y:gt.y,z:Wt+x/2},width:P,height:C,depth:x,valid:!0}),Zt=tt([ft]);M({omitView:y["3D"],polygon:b,boxParams:ft,newPointCloudBoxList:Zt})}},X=(n,s,p,r,l,f)=>rt(void 0,null,function*(){const P=Z==null?void 0:Z.url,x={[y.Side]:()=>{vt(p,s,i,P,f)},[y.Back]:()=>{d&&bt(p,s,d,P,f)},[y.Top]:()=>{It(p,s,t,o)}};Object.keys(x).forEach(C=>{C!==n&&x[C]()}),r&&(o==null||o.updateCameraZoom(r)),Ot(p)}),M=n=>rt(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,P=Z==null?void 0:Z.url;f&&(yield e.syncAllViewPointCloudColor(f));const x={[y.Side]:()=>{Bt(r,p,i,P)},[y.Back]:()=>{d&&wt(r,p,d,P)},[y.Top]:()=>{at(r,p,t,o)}};Object.keys(x).forEach(C=>{C!==s&&x[C]()}),l&&(o==null||o.updateCameraZoom(l)),Vt(r)});return{topViewAddSphere:kt,topViewAddBox:Rt,topViewSelectedChanged:Ut,topViewUpdatePoint:Et,sideViewUpdatePoint:zt,backViewUpdatePoint:Tt,topViewUpdateBox:Ft,sideViewUpdateBox:jt,backViewUpdateBox:Nt,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>rt(void 0,[...n],function*(s=Z){var p,r,l,f,P,x;if(!(s==null?void 0:s.url)||!o)return;W([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(s.url,(p=S==null?void 0:S.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let C=[],D=[],w=[],b=[];o.updateTopCamera();const A=(l=(r=it(s.result))==null?void 0:r.valid)!=null?l:!0;if(e.setPointCloudValid(A),(f=e.sideViewInstance)==null||f.clearAllData(),(P=e.backViewInstance)==null||P.clearAllData(),s.result){if(C=V.getBoxParamsFromResultList(s.result),(C==null?void 0:C.length)>0&&s.isPreResult&&(S==null?void 0:S.lowerLimitPointsNumInBox)>0){C=yield o==null?void 0:o.filterPreResult(s.url,S,C);const U=it(s.result);U[Gt].result=C,s.result=JSON.stringify(U),e.setPointCloudResult(C)}w=V.getPolygonListFromResultList(s.result),D=V.getLineListFromResultList(s.result),b=V.getSphereParamsFromResultList(s.result),t.updateData(s.url,s.result,{radius:(x=S==null?void 0:S.radius)!=null?x:K}),o==null||o.generateBoxes(C),o==null||o.generateSpheres(b),yield e.syncAllViewPointCloudColor(C,[])}E({pointCloudBoxList:C,polygonList:w,lineList:D,pointCloudSphereList:b}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Ht,generateRects:$,update2DViewRect:At}};export{bt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,wt as synchronizeBackView,Bt as synchronizeSideView,at as synchronizeTopView,lt as topViewPoint2PointCloud,dt as topViewPolygon2PointCloud,go as usePointCloudViews};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from"react";import{connect as x}from"react-redux";import{LabelBeeContext as y,useDispatch as I}from"../../store/ctx.js";import{ANNOTATION_ACTIONS as _}from"../../store/Actions.js";import{PageBackward as c,PageForward as d,PageJump as m}from"../../store/annotation/actionCreators.js";import{TagToolInstanceAdaptor as b}from"./videoTagTool/TagToolInstanceAdaptor.js";import{cTool as S}from"@labelbee/lb-annotation";import V from"./videoClipTool/index.js";import A from"../../utils/StepUtils.js";import{jsonParser as E}from"../../utils/index.js";import{VideoTextTool as C}from"./videoTextTool/index.js";var N=Object.defineProperty,h=Object.defineProperties,L=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,O=(e,o,t)=>o in e?N(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,u=(e,o)=>{for(var t in o||(o={}))B.call(o,t)&&O(e,t,o[t]);if(v)for(var t of v(o))F.call(o,t)&&O(e,t,o[t]);return e},f=(e,o)=>h(e,L(o));const{EVideoToolName:g}=S,J=e=>{const{stepInfo:o}=e,t=o==null?void 0:o.tool,r=I(),a=n=>{r({type:_.SET_TOOL,payload:{instance:n}})},i=()=>{r({type:_.SET_TOOL,payload:{instance:void 0}})};return t===g.VideoClipTool?s.createElement(V,f(u({},e),{pageBackward:()=>r(c()),pageForward:()=>r(d()),pageJump:n=>r(m(~~n)),onMounted:a,onUnmounted:i})):t===g.VideoTextTool?s.createElement(C,f(u({},e),{pageBackward:()=>r(c()),pageForward:()=>r(d()),pageJump:n=>r(m(~~n)),onMounted:a,onUnmounted:i})):t===g.VideoTagTool?s.createElement(b,f(u({},e),{pageBackward:()=>r(c()),pageForward:()=>r(d()),pageJump:n=>r(m(~~n)),onMounted:a,onUnmounted:i})):null},D=e=>{var o,t,r,a,i;const{annotation:{imgList:n,imgIndex:T,step:P,stepList:w,loading:j}}=e,p=A.getCurrentStepInfo((o=e.annotation)==null?void 0:o.step,(t=e.annotation)==null?void 0:t.stepList),l=(r=n[T])!=null?r:{};return{imgIndex:T,imgList:n,stepInfo:p,config:E(p==null?void 0:p.config),step:P,stepList:w,path:(i=(a=l==null?void 0:l.path)!=null?a:l==null?void 0:l.url)!=null?i:"",loading:j}};var U=x(D,null,null,{context:y})(J);export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import{EClipStatus as i}from"./constant.js";const t=e.createContext({result:[],selectedID:"",attributeList:[],clipStatus:i.Stop}),r=t.Provider,o=e.createContext({onSelectedTimeSlice:()=>{},removeTimeSlice:()=>{},updateSelectedSliceTimeProperty:()=>{}});o.Provider;export{o as VideoClipAnnotatedListContext,t as VideoClipToolContext,r as VideoClipToolContextProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{timeFormat as o,precisionMinus as v}from"../../../../utils/audio.js";import{AttributeUtils as F}from"@labelbee/lb-annotation";import{Tooltip as S}from"antd";import e from"react";import{ETimeSliceType as T}from"../constant.js";import{decimalReserved as u}from"../../../videoPlayer/utils.js";import{useTranslation as A}from"react-i18next";const $=m=>{var l,n;const{slot:s,item:t,attributeList:c}=m,{t:r}=A();if(!s)return null;const{type:d,attribute:p,textAttribute:b}=t;if(t.start===void 0||t.end===void 0)return null;const i=u(t.start,2),a=(n=u((l=t.end)!=null?l:0,2))!=null?n:0,f=e.createElement("div",null,e.createElement("div",null,d===T.Period?`${o(i,"ss:SS")}~${o(a,"ss:SS")}\uFF0C${v(a,i)}s`:o(i,"ss:SS")),e.createElement("div",null,`${r("Attribute")}\uFF1A${F.getAttributeShowText(p,c)||r("NoAttribute")}`),e.createElement("div",null,`${r("textTool")}\uFF1A${b}`));return e.createElement(S,{title:f},s)};export{$ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{timeFormat as E}from"../../../../../utils/audio.js";import{classnames as d}from"../../../../../utils/index.js";import{CloseCircleFilled as y,EnvironmentFilled as S,ScissorOutlined as I}from"@ant-design/icons";import t,{useState as L,useEffect as g}from"react";import{EClipStatus as N,TIME_SLICE_TYPE as j,ETimeSliceType as v}from"../../constant.js";import A from"../timeSliceRange/index.js";import k from"../ToolTipForClip.js";import{getDisplayContent as b}from"../videoTrack/index.js";import l from"./index.module.scss.js";import{decimalReserved as F}from"../../../../videoPlayer/utils.js";import{LabelBeeContext as $}from"../../../../../store/ctx.js";import{connect as D}from"react-redux";import{useTranslation as C}from"react-i18next";const R=({type:e})=>e===v.Time?t.createElement(S,null):t.createElement(I,{rotate:270}),V=()=>{const{t:e}=C();return t.createElement("div",{className:l.noContent},t.createElement("div",null,e("NoClippedData")),t.createElement("div",null,t.createElement("span",{className:l.hotkey},"X"),e("ClipSlice")),t.createElement("div",null,t.createElement("span",{className:l.hotkey},"E"),e("TimeStamp")))},h=({children:e})=>{const n=e.length===0;return t.createElement("div",{className:d({[l.empty]:n,[l.timeSliceListContent]:!0})},n?t.createElement(V,null):e)},O=({timeSliceProps:e,index:n,exportContext:r})=>{const{selectedID:o,attributeList:a,onSelectedTimeSlice:s,removeTimeSlice:c}=r;return t.createElement("div",{key:n,className:d({[l.timeSliceItem]:!0,[l.timeSliceItemActivated]:e.id===o}),onClick:()=>{s(e)}},t.createElement(k,{slot:t.createElement("div",{className:l.timeSliceItemContent},t.createElement("div",{className:l.textOverflow},`${n+1}\u3001\u3010${j[e.type]}\u3011 ${b(e,a)}`),t.createElement("div",{className:d({[l.textOverflow]:!0})},t.createElement(R,{type:e.type}),t.createElement("span",{style:{marginLeft:10}},`${E(e.start,"ss:SS")} ${e.end&&e.type===v.Period?"~ "+E(e.end,"ss:SS")+", "+F(e.end-e.start,2)+"s":""}`))),item:e,attributeList:a}),t.createElement(y,{className:l.timeSliceItemDeleteIcon,onClick:u=>{u.stopPropagation(),c(e)}}))},_=e=>{const{toolInstance:n}=e,{selectedID:r,result:o,videoPlayer:a,clipStatus:s,updateSelectedSliceTimeProperty:c}=(n==null?void 0:n.exportContext)||{},[u,f]=L(0),{t:x}=C();g(()=>(n&&n.singleOn("changeClipSidebar",i=>{f(m=>m+1)}),()=>{var i;(i=n==null?void 0:n.unbindAll)==null||i.call(n,"changeClipSidebar")}),[n]);const T=o==null?void 0:o.find(i=>i.id===r),p=o==null?void 0:o.filter(i=>i.end!==null);return(n==null?void 0:n.exportContext)?t.createElement("div",null,t.createElement("div",{className:l.timeSliceListHeader},x("AnnotatedList")),t.createElement(h,null,p==null?void 0:p.map((i,m)=>t.createElement(O,{timeSliceProps:i,index:m,key:i.id,exportContext:(n==null?void 0:n.exportContext)||{}}))),t.createElement(A,{selectedTimeSlice:T,videoPlayer:a,updateTimeForSelected:c,disabled:s===N.Clipping})):null},w=({annotation:e})=>{const{toolInstance:n}=e;return{toolInstance:n}};var B=D(w,null,null,{context:$})(_);export{B as default};
|
package/es/components/videoAnnotate/videoClipTool/components/annotatedList/index.module.scss.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={timeSliceListContent:"index-module_timeSliceListContent__gvFHy",empty:"index-module_empty__wcFM6",noContent:"index-module_noContent__zjGb0",hotkey:"index-module_hotkey__dDkgv",timeSliceItem:"index-module_timeSliceItem__Xa-cQ",timeSliceItemActivated:"index-module_timeSliceItemActivated__Zlb3b",timeSliceAttribute:"index-module_timeSliceAttribute__Q5E-f",timeSliceItemContent:"index-module_timeSliceItemContent__Aqa8l",timeSliceItemDeleteIcon:"index-module_timeSliceItemDeleteIcon__nlQ6B"};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Resizable as D}from"re-resizable";import i,{useState as N}from"react";import W from"../ToolTipForClip.js";import{getDisplayContent as I}from"../videoTrack/index.js";import u from"./index.module.scss.js";import{decimalReserved as L}from"../../../../videoPlayer/utils.js";var k=Object.defineProperty,F=Object.defineProperties,H=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,w=(e,t,r)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,n=(e,t)=>{for(var r in t||(t={}))A.call(t,r)&&w(e,r,t[r]);if(_)for(var r of _(t))G.call(t,r)&&w(e,r,t[r]);return e},g=(e,t)=>F(e,H(t));const y=45,K=e=>{var t;const{track:r,currentTime:s,attributeList:l,readonly:O,onClipping:b,onTrackResizeStart:c}=e,{start:d,end:P}=r,R=P||s,[S,f]=N({width:0,height:0}),z=(o,E,j,h)=>{var v;const C=(h.width-S.width)/((v=j.parentNode)==null?void 0:v.clientWidth);f(h),e.onResize(E,C)},T=()=>{f({width:0,height:0}),c==null||c()},m=n({transform:"none",overflow:"hidden",textOverflow:"ellipsis",fontSize:12},e.style),x={top:!1,right:!0,left:!0,bottom:!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},p=i.createElement("div",{style:{margin:"10px 5px"}},i.createElement("div",{className:u.textOverflow},`${L(Math.max(R-d,1),0)}s`),i.createElement("div",{className:u.textOverflow},I(r,l)));let a;if(b||O||!e.isSelected){const o=g(n({},m),{height:y});e.isSelected&&s-d<0&&(o.width=100,o.backgroundColor="transparent"),a=i.createElement("div",{style:o},p)}else a=i.createElement(D,{size:{width:(t=e.style.width)!=null?t:0,height:y},minWidth:1,onResize:z,onResizeStart:T,enable:x,style:m},p);return i.createElement(W,{slot:a,item:g(n({},r),{end:r.end===null?s:r.end}),attributeList:l})};export{K as default};
|
package/es/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.module.scss.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={textOverflow:"index-module_textOverflow__HcSP3"};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{classnames as h}from"../../../../../utils/index.js";import{Input as I,message as T}from"antd";import j from"lodash";import e,{useState as O,useEffect as y}from"react";import{ETimeSliceType as A,PER_SLICE_CHANGE as g}from"../../constant.js";import a from"./index.module.scss.js";import{precisionMinus as G,precisionAdd as M,timeFormat as l}from"../../../../../utils/audio.js";import{decimalReserved as _}from"../../../../videoPlayer/utils.js";import{useTranslation as v}from"react-i18next";const p=({initialVal:t,timeType:E="",videoPlayer:r,min:F,max:m,updateTime:i,disabled:c})=>{const[f,d]=O(""),{t:B}=v(),C=()=>{S(f).then(u=>{i(u)}).catch(u=>{T.error(u),x()})},R=u=>{const[s,o]=u.split(":");return~~s*60+parseFloat(o)},D=(u,s=!1)=>{if(F!==void 0&&u<F){const n=l(F,"ss.SS");return s?`\u4FEE\u6539\u65F6\u95F4\u5931\u8D25, \u4FEE\u6539\u65F6\u95F4\u4E0D\u5141\u8BB8\u5C11\u4E8E${n}`:`\u5F53\u524D\u65F6\u95F4\u683C\u5F0F\u8F93\u5165\u6709\u8BEF, \u8F93\u5165\u65F6\u95F4\u4E0D\u5141\u8BB8\u5C11\u4E8E${n}`}if(m!==void 0&&u>m){const n=l(m,"ss.SS");return s?`\u4FEE\u6539\u65F6\u95F4\u5931\u8D25, \u4FEE\u6539\u65F6\u95F4\u4E0D\u5141\u8BB8\u5927\u4E8E${n}`:`\u5F53\u524D\u65F6\u95F4\u683C\u5F0F\u8F93\u5165\u6709\u8BEF, \u8F93\u5165\u65F6\u95F4\u4E0D\u5141\u8BB8\u5927\u4E8E${n}`}const o=r==null?void 0:r.duration;if(r&&o&&u>o){const n=l(o,"ss.SS");return s?`\u4FEE\u6539\u65F6\u95F4\u5931\u8D25, \u8F93\u5165\u65F6\u95F4\u4E0D\u5141\u8BB8\u5927\u4E8E${n}`:`\u5F53\u524D\u65F6\u95F4\u683C\u5F0F\u8F93\u5165\u6709\u8BEF, \u8F93\u5165\u65F6\u95F4\u4E0D\u5141\u8BB8\u5927\u4E8E${n}`}},S=u=>new Promise((s,o)=>{if(u.match(/^\d+\:\d\d\.\d\d$/)){const n=R(u),N=D(n);if(N){o(N);return}s(n)}else o(new Error("\u5F53\u524D\u65F6\u95F4\u683C\u5F0F\u8F93\u5165\u6709\u8BEF, \u65F6\u95F4\u683C\u5F0F\u5E94\u4E3Axx:xx.xx"))}),x=()=>{j.isNumber(t)&&d(l(t,"ss.SS"))},$=()=>{if(!c&&r){const u=_(r==null?void 0:r.currentTime,2),s=D(u,!0);if(s){T.error(s);return}i(u)}};return y(()=>{x()},[t]),e.createElement("div",{className:a.inputWrapper},e.createElement(I,{placeholder:"00:00.00",value:f,onChange:u=>d(u.target.value),onBlur:C,onPressEnter:C,disabled:c}),e.createElement("span",{className:h({[a.getCurr]:!0,[a.disabled]:c!=null?c:!1}),onClick:$},B(E==="start"?"GetStartTime":"GetEndTime")))},w=({selectedTimeSlice:t,videoPlayer:E,updateTimeForSelected:r,disabled:F})=>{if(!t)return null;const{t:m}=v();return(t==null?void 0:t.type)===A.Period?e.createElement("div",{className:a.timeSliceInputContainer},e.createElement("div",{className:a.title},m("ClipTime")),e.createElement("div",{className:a.inputContainer},e.createElement(p,{initialVal:t.start,timeType:"start",videoPlayer:E,max:G(t.end,g),updateTime:i=>{r(i,"start")},disabled:F}),e.createElement("span",{className:a.spliter}),e.createElement(p,{initialVal:t.end,timeType:"end",videoPlayer:E,min:M(t.start,g),updateTime:i=>{r(i,"end")},disabled:F}))):e.createElement("div",{className:a.timeSliceInputContainer},e.createElement("div",{className:a.title},m("StampTime")),e.createElement(p,{initialVal:t.start,videoPlayer:E,updateTime:i=>{r(i,"start")}}))};export{w as default};
|
package/es/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.module.scss.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={timeSliceInputContainer:"index-module_timeSliceInputContainer__579hr",title:"index-module_title__9kdsk",inputWrapper:"index-module_inputWrapper__uXmv-",getCurr:"index-module_getCurr__-dchP",disabled:"index-module_disabled__j6aK6",inputContainer:"index-module_inputContainer__PqtI8",spliter:"index-module_spliter__wXZhC"};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import t from"./index.module.scss.js";import s from"../../../../../assets/annotation/video/icon_videoCut.svg.js";import n from"../../../../../assets/annotation/video/icon_timePoint.svg.js";const i=({toggleClipStatus:o,addTime:a})=>e.createElement("div",{className:t.clipToolbar},e.createElement("span",{className:t.buttonWrapper},e.createElement("i",{className:t.cutButton,onClick:()=>{o==null||o()},style:{backgroundImage:s}}),"\u622A\u53D6"),e.createElement("span",{className:t.buttonWrapper},e.createElement("i",{className:t.localButton,onClick:a,style:{backgroundImage:n}}),"\u6807\u65F6\u95F4\u70B9"));export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o={clipToolbar:"index-module_clipToolbar__amC2X",buttonWrapper:"index-module_buttonWrapper__o1C44",cutButton:"index-module_cutButton__M6mOs",localButton:"index-module_localButton__6D1-H"};export{o as default};
|
package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{classnames as S}from"../../../../../utils/index.js";import{AttributeUtils as u,MathUtils as d}from"@labelbee/lb-annotation";import s from"react";import{CSSTransition as g,TransitionGroup as E}from"react-transition-group";import{TIME_SLICE_TYPE as h,ETimeSliceType as w}from"../../constant.js";import a from"./index.module.scss.js";var O=Object.defineProperty,P=Object.defineProperties,x=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,T=(i,e,r)=>e in i?O(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,A=(i,e)=>{for(var r in e||(e={}))I.call(e,r)&&T(i,r,e[r]);if(f)for(var r of f(e))j.call(e,r)&&T(i,r,e[r]);return i},N=(i,e)=>P(i,x(e));const C=i=>{const{attributeList:e,result:r,currentTime:m,extraStyle:_}=i,y=t=>{const{type:o,start:n,end:p}=t;let l=!1;return o===w.Time?l=d.isInRange(m,[n-.1,n+.1]):l=p===null||d.isInRange(m,[n,p]),l},b=[],c=[];r.forEach(t=>{(y(t)?c:b).push(t)});const v=c.sort((t,o)=>t.start-o.start).map(t=>N(A({},t),{withinTime:!0})).map(t=>s.createElement(g,{classNames:"fade",key:t.id,timeout:500},s.createElement("div",{className:S({[a.timeSliceWrapper]:!0,[a.active]:t.withinTime})},s.createElement("div",{className:a.timeSliceItemAttribute,style:{textAlign:"right"}},s.createElement("span",{style:{backgroundColor:u.getAttributeColor(t.attribute,e)}},`${h[t.type]}: ${u.getAttributeShowText(t.attribute,e)||"\u65E0\u5C5E\u6027"}`)),t.textAttribute&&s.createElement("div",{className:a.timeSliceItemText},`\u6587\u672C: ${t.textAttribute}`))));return s.createElement("div",{className:a.videoTimeSlices,style:_},s.createElement(E,{className:"fade-group"},v))};export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={videoTimeSlices:"index-module_videoTimeSlices__v-2k1",timeSliceWrapper:"index-module_timeSliceWrapper__kebC3",active:"index-module_active__cIGVq",timeSliceItemText:"index-module_timeSliceItemText__FJFwH",timeSliceItemAttribute:"index-module_timeSliceItemAttribute__--3E1"};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{timeFormat as $}from"../../../../../utils/audio.js";import{AttributeUtils as b,MathUtils as g}from"@labelbee/lb-annotation";import{EnvironmentFilled as z}from"@ant-design/icons";import i,{useContext as R,useRef as D,useMemo as S}from"react";import X from"../resizableSnippet/index.js";import{ETimeSliceType as N,EClipStatus as U}from"../../constant.js";import W from"../ToolTipForClip.js";import u from"./index.module.scss.js";import{decimalReserved as x,hashCode as L}from"../../../../videoPlayer/utils.js";import{VideoClipToolContext as q}from"../../VideoClipToolContext.js";import{VideoPlayerCtx as B}from"../../../../videoPlayer/index.js";import{useTranslation as G}from"react-i18next";var H=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,A=(o,r,t)=>r in o?H(o,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[r]=t,J=(o,r)=>{for(var t in r||(r={}))Y.call(r,t)&&A(o,t,r[t]);if(w)for(var t of w(r))Z.call(r,t)&&A(o,t,r[t]);return o},tt=(o,r)=>K(o,Q(r));const et=(o,r)=>{const{t}=G(),{attribute:p,textAttribute:n}=o;return[b.getAttributeShowText(p,r)||t("NoAttribute"),n?`${t("textTool")}: ${n}`:""].filter(y=>y).join("\uFF0C")},rt=(o,r)=>{const t=(o||[]).filter(n=>n).map(()=>[]);o.forEach(n=>{if(n.id!==r){const s=t.findIndex(y=>{const l=n.start,c=n.end;return y.every(f=>{const T=[f.start,f.end],m=[l,c];return!g.isInRange(l,T)&&!g.isInRange(c,T)&&!g.isInRange(f.start,m)&&!g.isInRange(f.end,m)})});s>-1&&t[s].push(n)}});const p=ot(t.filter(n=>n.length>0));return p==null?void 0:p.map(n=>({data:n,id:L(n==null?void 0:n.map(s=>s.id).join("_"))}))},ot=(o,r=2)=>{let t=o;return t.length-r<0&&(t=t.concat(Array.from({length:r-t.length}))),t},nt=o=>{var r;const{currentTime:t,readonly:p,onTrackResizeStart:n}=o,{result:s,selectedAttribute:y,attributeList:l,selectedID:c,clipStatus:f,contextToCancel:T}=R(q),{duration:m}=R(B),C=D(null),I=t/m,h=(e,a=4)=>`${x(e*100,a)}%`,k=e=>{if(e){const a=b.getAttributeColor(e.attribute,l),v=Math.max((e.end||t)-e.start,0)/m,d={backgroundColor:a,left:h(e.start/m,2),width:h(e.end?Math.max(v,.001):v,2),position:"absolute",borderRadius:5};return e.type===N.Time&&(delete d.width,delete d.backgroundColor,d.top="50%",d.transform="translate(-50%)",d.color=a),d}return{}},_=b.getAttributeColor(y,l),E=((r=C.current)==null?void 0:r.clientWidth)||0,P=x(Math.max(E*I,0),0),F=x(Math.min(P,Math.floor(E-68)),0),j=e=>{if(e)return e.type===N.Time?i.createElement(W,{slot:i.createElement(z,{style:k(e)}),item:tt(J({},e),{end:e.end===null?t:e.end}),attributeList:l}):i.createElement(X,{track:e,currentTime:t,style:k(e),onResize:(a,v)=>o.onTrackResize(e.id,a,v),onTrackResizeStart:n,onClipping:f===U.Clipping,isSelected:e.id===c,readonly:p,attributeList:l})},M=S(()=>{const e=rt(s,c);return e==null?void 0:e.map((a,v)=>{var d;return i.createElement("div",{className:u.track,key:(a==null?void 0:a.id)||v},(d=a.data)==null?void 0:d.map(O=>j(O)))})},[s,c,m,JSON.stringify(l)]),V=S(()=>{const e=s.find(a=>(a==null?void 0:a.id)===c);return c&&e?i.createElement("div",{className:u.track,key:e==null?void 0:e.id},j(e)):null},[s,c,m,t,JSON.stringify(l)]);return i.createElement("div",{className:u.videoTrackContainer,ref:C,onContextMenu:T},i.createElement("div",{className:u.timeTrack}),i.createElement("div",{className:u.videoTrack},V,M),i.createElement("div",{className:u.timeline,style:{transform:`translate3d(${P}px, 0px, 0px)`,backgroundColor:_}}),i.createElement("div",{className:u.displayTime,style:{backgroundColor:_,transform:`translateX(${F}px, 0px, 0px)`}},$(t)))};var at=nt;export{at as default,et as getDisplayContent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={videoTrackContainer:"index-module_videoTrackContainer__0oBy3",timeTrack:"index-module_timeTrack__f--CU",videoTrack:"index-module_videoTrack__auEud",track:"index-module_track__N8mLd",timeline:"index-module_timeline__GppcX",displayTime:"index-module_displayTime__h0Lg7",textOverflow:"index-module_textOverflow__jf6jA"};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n;(function(o){o[o.AHEAD=1]="AHEAD",o[o.BACK=-1]="BACK"})(n||(n={}));var t;(function(o){o.Left="left",o.Right="right"})(t||(t={}));var i;(function(o){o[o.Clipping=0]="Clipping",o[o.Stop=1]="Stop"})(i||(i={}));var r;(function(o){o[o.Period=0]="Period",o[o.Time=1]="Time"})(r||(r={}));const u={[0]:"\u7247\u6BB5",[1]:"\u65F6\u95F4\u70B9"},A=.05,f=.05;export{i as EClipStatus,t as EDirection,n as EPageChanges,r as ETimeSliceType,f as PER_SLICE_CHANGE,A as SLICE_MIN_TIME,u as TIME_SLICE_TYPE};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MathUtils as I,CommonToolUtils as V,uuid as w,AttributeUtils as k}from"@labelbee/lb-annotation";import{jsonParser as C}from"../../../utils/index.js";import{precisionAdd as D,precisionMinus as j,isImageValue as B}from"../../../utils/audio.js";import{message as m}from"antd";import y from"lodash";import v from"react";import A from"./index.module.scss.js";import{VideoClipToolContextProvider as M}from"./VideoClipToolContext.js";import{EClipStatus as u,ETimeSliceType as x,PER_SLICE_CHANGE as b,SLICE_MIN_TIME as T}from"./constant.js";import{VideoPlayer as N}from"../../videoPlayer/index.js";import U from"./components/videoTimeSlicesOverVideo/index.js";import J from"../../../assets/annotation/video/icon_videoCutting.svg.js";import{decimalReserved as F}from"../../videoPlayer/utils.js";var $=Object.defineProperty,z=Object.defineProperties,G=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,O=(c,r,t)=>r in c?$(c,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[r]=t,q=(c,r)=>{for(var t in r||(r={}))H.call(r,t)&&O(c,t,r[t]);if(L)for(var t of L(r))W.call(r,t)&&O(c,t,r[t]);return c},K=(c,r)=>z(c,G(r));class Q extends v.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=y.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===u.Clipping){m.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:a,start:o,type:l}=this.state.result[this.selectedSliceIndex],n=I.withinRange(D(o,t),[0,j(l===x.Time?s:a,b)]);this.updateSelectedSliceTimeProperty(n,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===u.Clipping){m.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],a=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===x.Time){m.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:o,start:l}=s,n=I.withinRange(D(o,t),[D(l,b),a]);this.updateSelectedSliceTimeProperty(n,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:y.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!V.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-b);break;case"=":this.updateSelectedSliceTimeStartByPer(b);break;case"[":this.updateSelectedSliceTimeEndByPer(-b);break;case"]":this.updateSelectedSliceTimeEndByPer(b);break}},this.videoLoaded=t=>{var e;const i=this.resultJSON,s=i&&!["","{}"].includes(i),a=t?parseFloat(t.toFixed(2)):0,o={loading:!1};((e=C(i))==null?void 0:e.duration)||Object.assign(o,{result:JSON.stringify(K(q({},C(i)),{duration:a}))}),s||Object.assign(o,{result:JSON.stringify({width:0,height:0,rotate:0,valid:!0,duration:a})}),this.setState({loading:!1})},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===u.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==u.Clipping)return;const s=t.findIndex(a=>a.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:u.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:o}=this.state,l=a!==u.Clipping;let n=l?u.Clipping:u.Stop,{result:d,selectedID:p,textValue:S}=this.state;const h=y.cloneDeep(d),f=t||((e=this.videoPlayer)==null?void 0:e.currentTime),E=(i=this.videoPlayer)==null?void 0:i.duration;if(E===void 0||f===void 0)return;const R=F(f,2);if(l){const g=w();p=g,h.push({start:R,end:null,attribute:o,textAttribute:this.defaultTextAttribute,duration:E,id:g,type:x.Period}),S=this.defaultTextAttribute}else{const g=h.findIndex(_=>_.id===p),P=h[g];P&&(f-P.start<T?(h.splice(g,1),m.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${T}s`),n=u.Stop,p="",S=""):(h[g].end=F(f,2),(s=this.videoPlayer)==null||s.pause(),m.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:n,result:h,selectedID:p,textValue:S}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:o,selectedID:l}=this.state,n=w(),d=y.cloneDeep(a),p=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:p,end:p,attribute:o,textAttribute:this.defaultTextAttribute,id:n,type:x.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const S={result:d,selectedID:n,textValue:this.defaultTextAttribute},h=d.find(f=>f.id===l);this.isClipping&&h?(delete S.selectedID,delete S.textValue,m.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(S),this.updateSidebar()},this.contextToCancel=t=>{this.state.clipStatus===u.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,a;const{result:o}=this.state,l=o.find(n=>n.id===t);if(l){const n=l.duration,d=e==="left",p=d?"start":"end",S=d?-n*i:n*i,h=d?[0,Math.max(((s=l.end)!=null?s:0)-T,0)]:[l.start+T,n],f=I.withinRange(S+((a=l==null?void 0:l[p])!=null?a:0),h);l[p]=f,this.throttledUpdateTime(f)}this.setState({result:[...o]}),this.updateSidebar()},this.renderMediaContent=()=>{const{pageForward:t,pageJump:e,pageBackward:i}=this.props,{result:s,currentTime:a,videoError:o,valid:l}=this.state;return v.createElement("div",{className:A.clipContainer},v.createElement(N,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:i,pageForward:t,pageJump:e,valid:l,setVideoRef:n=>{this.videoPlayer=n},showVideoTrack:!o,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.videoLoaded}),v.createElement(U,{result:s,currentTime:a,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&v.createElement("i",{className:A.clipping,style:{backgroundImage:J}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(a=>a.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const o=C(s[i].result)[`step_${this.stepInfo().step}`],l=(o==null?void 0:o.result)||[],n=B(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:u.Stop,valid:n},()=>{this.updateSidebar(),n||m.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(a=>a.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.setTextAttribute=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:u.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===u.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return k.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return v.createElement(M,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}export{Q as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={clipContainer:"index-module_clipContainer__L8DlL",containerWrapper:"index-module_containerWrapper__49TNa",clipping:"index-module_clipping__M-9B2"};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import h from"react";import{CommonToolUtils as p,uuid as f}from"@labelbee/lb-annotation";import{jsonParser as c}from"../../../utils/index.js";import{VideoPlayer as y}from"../../videoPlayer/index.js";import{VideoTagLayer as L}from"../../videoPlayer/VideoTagLayer.js";import g from"lodash";import{getKeyCodeNumber as b}from"../../videoPlayer/utils.js";class R extends h.Component{constructor(s){super(s);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const i=e?this.state.tagResult.map(l=>((l==null?void 0:l.result[e])&&delete l.result[e],l)):[];this.setState({tagResult:i},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e,i,l,r,o,n;const a=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0,d=(i=this.videoPlayer)==null?void 0:i.getVideoPlaybackQuality(),u=d==null?void 0:d.totalVideoFrames,v=(r=(l=this.videoPlayer)==null?void 0:l.videoWidth)!=null?r:0,m=(n=(o=this.videoPlayer)==null?void 0:o.videoHeight)!=null?n:0;return[this.state.tagResult,{valid:this.state.valid,duration:a,frames:u,videoWidth:v,videoHeight:m}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var i,l;const{isMulti:r}=t,{key:o,value:n}=t.value;if(r){let a=(l=(i=e[o])==null?void 0:i.split(";"))!=null?l:[];a.includes(n)?a=a.filter(u=>u!==n):a.push(n);const d=new Set(a);return e[o]=Array.from(d).join(";"),g.pickBy(e,u=>u)}return e[o]=e[o]===n?void 0:n,g.pickBy(e,a=>a)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,e)=>{this.setLabelBySelectedList(t,e)},this.keydown=t=>{const e=b(t.keyCode);if(e){const i=e-1;if(this.config.inputList.length===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{var e;const{imgList:i,imgIndex:l,step:r}=t;if(!i[l])return;const o=c(i[l].result),n=o[`step_${r}`];this.setState({tagResult:(e=n==null?void 0:n.result)!=null?e:[],valid:(o==null?void 0:o.valid)===void 0?!0:o.valid})},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var s;return c((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var s;return(s=this.state.tagResult[0])!=null?s:{}}get valid(){return this.state.valid}singleOn(s,t){this.fns[s]=t}on(s,t){this.singleOn(s,t)}unbindAll(s){delete this.fns[s]}getTagResultByCode(s,t){var e,i,l;try{const r=(i=(e=this.config)==null?void 0:e.inputList)!=null?i:[],o=r.length>1,n=t!==void 0?s:0,a=t!==void 0?t:s,d=o?r[n]:r[0],u=((l=d.subSelected)!=null?l:[])[a];if(d&&u)return{value:{key:d.value,value:u.value},isMulti:d.isMulti}}catch(r){return}}setLabelBySelectedList(s,t){var e,i,l,r;const o=this.getTagResultByCode(s,t);if(o){const n=this.combineResult(o,(i=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?i:{}),a=[{sourceID:p.getSourceID(),id:(r=(l=this.currentTagResult)==null?void 0:l.id)!=null?r:f(8,62),result:n}];this.setState({tagResult:a},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s;const{imgIndex:t,imgList:e,pageForward:i,pageJump:l,pageBackward:r}=this.props,{tagResult:o,valid:n}=this.state;return h.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},h.createElement(y,{imgIndex:t,imgList:e,pageBackward:r,pageForward:i,pageJump:l,valid:n,setVideoRef:a=>{this.videoPlayer=a},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),h.createElement(L,{result:o,inputList:(s=this.config)==null?void 0:s.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}export{R as TagToolInstanceAdaptor};
|