@labelbee/lb-components 1.23.0-alpha.7 → 1.23.0-alpha.70

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.
Files changed (208) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/assets/annotation/icon_link.svg.js +1 -0
  3. package/dist/assets/annotation/icon_unlink.svg.js +1 -0
  4. package/dist/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
  5. package/dist/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
  6. package/dist/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
  7. package/dist/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
  8. package/dist/assets/icons/ad33251.svg +26 -0
  9. package/dist/components/AnnotationView/index.js +1 -1
  10. package/dist/components/LLMToolView/index.js +1 -1
  11. package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
  12. package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  13. package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
  14. package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  15. package/dist/components/LLMToolView/sidebar/index.js +1 -1
  16. package/dist/components/LLMToolView/utils/data.js +1 -1
  17. package/dist/components/NLPToolView/index.js +1 -1
  18. package/dist/components/audioAnnotate/audioContext/index.js +1 -1
  19. package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
  20. package/dist/components/audioAnnotate/index.js +1 -1
  21. package/dist/components/audioAnnotate/textInput/index.js +1 -1
  22. package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  23. package/dist/components/audioAnnotate/utils/dataTransform.js +1 -0
  24. package/dist/components/audioPlayer/clipRegion/index.js +1 -1
  25. package/dist/components/audioPlayer/index.js +1 -1
  26. package/dist/components/audioPlayer/useAudioCombine/index.js +3 -2
  27. package/dist/components/audioPlayer/useAudioSegment/index.js +1 -1
  28. package/dist/components/longText/index.js +1 -1
  29. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  30. package/dist/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
  31. package/dist/components/pointCloud2DRectOperationView/util.js +1 -0
  32. package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  33. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  34. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  35. package/dist/components/pointCloudView/PointCloudContext.js +1 -1
  36. package/dist/components/pointCloudView/PointCloudInfos.js +1 -1
  37. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  38. package/dist/components/pointCloudView/PointCloudSegment2DView.js +1 -1
  39. package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
  40. package/dist/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  41. package/dist/components/pointCloudView/hooks/useBoxes.js +1 -1
  42. package/dist/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
  43. package/dist/components/pointCloudView/hooks/useHighlight.js +1 -1
  44. package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
  45. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  46. package/dist/components/pointCloudView/hooks/usePolygon.js +1 -1
  47. package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
  48. package/dist/components/pointCloudView/hooks/useRotateEdge.js +1 -0
  49. package/dist/components/pointCloudView/hooks/useSingleBox.js +1 -1
  50. package/dist/components/pointCloudView/hooks/useStatus.js +1 -1
  51. package/dist/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
  52. package/dist/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
  53. package/dist/components/pointCloudView/index.js +1 -1
  54. package/dist/components/pointCloudView/utils/event-polyfill.js +1 -0
  55. package/dist/components/pointCloudView/utils/map.js +1 -0
  56. package/dist/components/subAttributeList/index.js +1 -0
  57. package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
  58. package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  59. package/dist/hooks/useToolStyle.js +1 -0
  60. package/dist/index.css +59 -17
  61. package/dist/index.js +1 -1
  62. package/dist/store/Actions.js +1 -1
  63. package/dist/store/annotatedBox/index.js +1 -1
  64. package/dist/store/annotation/actionCreators.js +1 -1
  65. package/dist/store/annotation/reducer.js +1 -1
  66. package/dist/types/App.d.ts +5 -1
  67. package/dist/types/components/AnnotationView/index.d.ts +1 -0
  68. package/dist/types/components/LLMToolView/utils/data.d.ts +1 -1
  69. package/dist/types/components/audioAnnotate/audioContext/index.d.ts +10 -2
  70. package/dist/types/components/audioAnnotate/textInput/index.d.ts +1 -0
  71. package/dist/types/components/audioAnnotate/utils/dataTransform.d.ts +9 -0
  72. package/dist/types/components/audioPlayer/index.d.ts +28 -21
  73. package/dist/types/components/longText/index.d.ts +1 -0
  74. package/dist/types/components/pointCloud2DRectOperationView/index.d.ts +1 -0
  75. package/dist/types/components/pointCloud2DRectOperationView/useUpdateRectList.d.ts +2 -0
  76. package/dist/types/components/pointCloud2DRectOperationView/util.d.ts +8 -0
  77. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
  78. package/dist/types/components/pointCloudView/PointCloudContext.d.ts +28 -4
  79. package/dist/types/components/pointCloudView/components/HighlightVisible/index.d.ts +2 -1
  80. package/dist/types/components/pointCloudView/hooks/useDataLinkSwitch.d.ts +19 -0
  81. package/dist/types/components/pointCloudView/hooks/useHighlight.d.ts +1 -1
  82. package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +8 -0
  83. package/dist/types/components/pointCloudView/hooks/useRotateEdge.d.ts +9 -0
  84. package/dist/types/components/pointCloudView/hooks/useSingleBox.d.ts +3 -2
  85. package/dist/types/components/pointCloudView/hooks/useTimeoutFunc.d.ts +6 -0
  86. package/dist/types/components/pointCloudView/hooks/useWindowKeydownListener.d.ts +16 -0
  87. package/dist/types/components/pointCloudView/utils/event-polyfill.d.ts +8 -0
  88. package/dist/types/components/pointCloudView/utils/map.d.ts +11 -0
  89. package/dist/types/components/subAttributeList/index.d.ts +10 -0
  90. package/dist/types/components/videoAnnotate/index.d.ts +2 -1
  91. package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +2 -1
  92. package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +1 -1
  93. package/dist/types/hooks/useToolStyle.d.ts +30 -0
  94. package/dist/types/index.d.ts +7 -2
  95. package/dist/types/store/Actions.d.ts +1 -0
  96. package/dist/types/store/annotatedBox/index.d.ts +2 -0
  97. package/dist/types/store/annotation/actionCreators.d.ts +3 -2
  98. package/dist/types/store/annotation/reducer.d.ts +1 -0
  99. package/dist/types/store/annotation/types.d.ts +9 -2
  100. package/dist/types/utils/AnnotationDataUtils.d.ts +58 -1
  101. package/dist/types/utils/ToolPointCloudBoxRenderHelper.d.ts +23 -0
  102. package/dist/types/utils/index.d.ts +31 -1
  103. package/dist/types/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.d.ts +3 -0
  104. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -1
  105. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.d.ts +9 -0
  106. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.d.ts +3 -0
  107. package/dist/types/views/MainView/toolFooter/BatchSwitchConnectIn2DView/index.d.ts +1 -0
  108. package/dist/types/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.d.ts +10 -2
  109. package/dist/types/views/MainView/toolFooter/index.d.ts +1 -1
  110. package/dist/types/views/MainView/toolHeader/StepSwitch/index.d.ts +1 -1
  111. package/dist/types/views/MainView/toolHeader/index.d.ts +1 -1
  112. package/dist/utils/AnnotationDataUtils.js +1 -1
  113. package/dist/utils/ToolPointCloudBoxRenderHelper.js +1 -0
  114. package/dist/utils/index.js +1 -1
  115. package/dist/views/MainView/index.js +1 -1
  116. package/dist/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
  117. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
  118. package/dist/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
  119. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  120. package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
  121. package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  122. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  123. package/dist/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
  124. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
  125. package/dist/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  126. package/dist/views/MainView/toolFooter/index.js +1 -1
  127. package/es/App.js +1 -1
  128. package/es/assets/annotation/icon_link.svg.js +1 -0
  129. package/es/assets/annotation/icon_unlink.svg.js +1 -0
  130. package/es/assets/annotation/pointCloudTool/Image2DBoxScale.svg.js +1 -0
  131. package/es/assets/annotation/pointCloudTool/leftArrow.svg.js +1 -1
  132. package/es/assets/annotation/pointCloudTool/rightArrow.svg.js +1 -1
  133. package/es/assets/annotation/pointCloudTool/rotate90_black.svg.js +1 -0
  134. package/es/components/AnnotationView/index.js +1 -1
  135. package/es/components/LLMToolView/index.js +1 -1
  136. package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
  137. package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -2
  138. package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -1
  139. package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
  140. package/es/components/LLMToolView/sidebar/index.js +1 -1
  141. package/es/components/LLMToolView/utils/data.js +1 -1
  142. package/es/components/NLPToolView/index.js +1 -1
  143. package/es/components/audioAnnotate/audioContext/index.js +1 -1
  144. package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -1
  145. package/es/components/audioAnnotate/index.js +1 -1
  146. package/es/components/audioAnnotate/textInput/index.js +1 -1
  147. package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  148. package/es/components/audioAnnotate/utils/dataTransform.js +1 -0
  149. package/es/components/audioPlayer/clipRegion/index.js +1 -1
  150. package/es/components/audioPlayer/index.js +1 -1
  151. package/es/components/audioPlayer/useAudioCombine/index.js +3 -2
  152. package/es/components/audioPlayer/useAudioSegment/index.js +1 -1
  153. package/es/components/longText/index.js +1 -1
  154. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  155. package/es/components/pointCloud2DRectOperationView/useUpdateRectList.js +1 -0
  156. package/es/components/pointCloud2DRectOperationView/util.js +1 -0
  157. package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  158. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  159. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  160. package/es/components/pointCloudView/PointCloudContext.js +1 -1
  161. package/es/components/pointCloudView/PointCloudInfos.js +1 -1
  162. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  163. package/es/components/pointCloudView/PointCloudSegment2DView.js +1 -1
  164. package/es/components/pointCloudView/PointCloudTopView.js +1 -1
  165. package/es/components/pointCloudView/components/HighlightVisible/index.js +1 -1
  166. package/es/components/pointCloudView/hooks/useBoxes.js +1 -1
  167. package/es/components/pointCloudView/hooks/useDataLinkSwitch.js +1 -0
  168. package/es/components/pointCloudView/hooks/useHighlight.js +1 -1
  169. package/es/components/pointCloudView/hooks/useHistory.js +1 -1
  170. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  171. package/es/components/pointCloudView/hooks/usePolygon.js +1 -1
  172. package/es/components/pointCloudView/hooks/useRotate.js +1 -1
  173. package/es/components/pointCloudView/hooks/useRotateEdge.js +1 -0
  174. package/es/components/pointCloudView/hooks/useSingleBox.js +1 -1
  175. package/es/components/pointCloudView/hooks/useStatus.js +1 -1
  176. package/es/components/pointCloudView/hooks/useTimeoutFunc.js +1 -0
  177. package/es/components/pointCloudView/hooks/useWindowKeydownListener.js +1 -0
  178. package/es/components/pointCloudView/index.js +1 -1
  179. package/es/components/pointCloudView/utils/event-polyfill.js +1 -0
  180. package/es/components/pointCloudView/utils/map.js +1 -0
  181. package/es/components/subAttributeList/index.js +1 -0
  182. package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
  183. package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  184. package/es/hooks/useToolStyle.js +1 -0
  185. package/es/index.css +59 -17
  186. package/es/index.js +1 -1
  187. package/es/store/Actions.js +1 -1
  188. package/es/store/annotatedBox/index.js +1 -1
  189. package/es/store/annotation/actionCreators.js +1 -1
  190. package/es/store/annotation/reducer.js +1 -1
  191. package/es/utils/AnnotationDataUtils.js +1 -1
  192. package/es/utils/ToolPointCloudBoxRenderHelper.js +1 -0
  193. package/es/utils/index.js +1 -1
  194. package/es/views/MainView/index.js +1 -1
  195. package/es/views/MainView/sidebar/NLPSidebar/NLPAnnotatedList.js +1 -1
  196. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js +1 -0
  197. package/es/views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.module.scss.js +1 -0
  198. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  199. package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
  200. package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  201. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js +1 -0
  202. package/es/views/MainView/toolFooter/BatchSwitchConnectIn2DView/Icons.js +1 -0
  203. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/pointCloud/index.js +1 -1
  204. package/es/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  205. package/package.json +3 -3
  206. package/dist/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
  207. package/dist/assets/icons/9d70807.svg +0 -5
  208. package/es/assets/annotation/pointCloudTool/rotate180_black.svg.js +0 -1
@@ -1 +1 @@
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
+ import l,{useState as U,useEffect as B,useMemo as le}from"react";import{AudioPlayer as Pe}from"../audioPlayer/index.js";import{getClassName as je}from"../../utils/dom.js";import we from"../predictTracking/previewResult/index.js";import{Layout as re}from"antd/es";import{Spin as Ae}from"antd";import{prefix as Ie}from"../../constant/index.js";import{cKeyCode as Oe,CommonToolUtils as K,EventBus as se,uuid as Ne,TagUtils as ke,cTool as De}from"@labelbee/lb-annotation";import A from"./index.module.scss.js";import $e from"./tagResultShow/index.js";import{AudioClipProvider as Me,DEFAULT_CLIP_TEXT_CONFIG_ITEM as Ve,useAudioClipStore as Be}from"./audioContext/index.js";import Ke from"./textInput/index.js";import{connect as We}from"react-redux";import{a2MapStateToProps as Fe}from"../../store/annotation/map.js";import{LabelBeeContext as Ue}from"../../store/ctx.js";import{jsonParser as Xe}from"../../utils/index.js";import{useCustomToolInstance as Ge}from"../../hooks/annotation.js";import{sidebarCls as Y}from"../../views/MainView/sidebar/index.js";import qe from"./audioSide/labelSidebar/index.js";import ze from"./audioSide/clipSidebar/index.js";import He from"../../assets/annotation/audio/tag.svg.js";import Je from"../../assets/annotation/audio/tagA.svg.js";import Qe from"../../assets/annotation/audio/clip.svg.js";import Ye from"../../assets/annotation/audio/clipA.svg.js";var Ze=Object.defineProperty,et=Object.defineProperties,tt=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,nt=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,ue=(n,o,a)=>o in n?Ze(n,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[o]=a,E=(n,o)=>{for(var a in o||(o={}))nt.call(o,a)&&ue(n,a,o[a]);if(ae)for(var a of ae(o))ot.call(o,a)&&ue(n,a,o[a]);return n},I=(n,o)=>et(n,tt(o));const{EAudioToolName:it}=De,ce=Oe.default,{Sider:lt,Content:rt}=re,de=`${Ie}-layout`,st=({setSideTab:n,sideTab:o})=>{const a=[{tab:"tag",commonSvg:He,selectedSvg:Je},{tab:"clip",commonSvg:Qe,selectedSvg:Ye}];return l.createElement("div",{className:A.toggleAudioOption},a.map((p,S)=>{const{tab:d,selectedSvg:_,commonSvg:C}=p;return l.createElement("div",{key:S,className:A.option},l.createElement("img",{className:A.icon,src:o===d?_:C,onClick:()=>{o!==d&&n(d)}}))}))},at=({result:n,inputDisabled:o,updateText:a,configList:p,autofocus:S,preContext:d,isCheck:_,clipAttributeConfigurable:C,clipTextConfigurable:O,textConfigurable:v,updateRegion:x,clipAttributeList:f,clipTextList:g})=>l.createElement("div",{className:A.textareaContainer},l.createElement("div",{className:A.textareaContent},l.createElement(Ke,{isCheck:_,result:n==null?void 0:n.value,textInputDisabled:o,textID:(n==null?void 0:n.id)||0,updateText:a,configList:p,autofocus:!o&&S,preContext:d,regions:n==null?void 0:n.regions,clipAttributeConfigurable:C,clipTextConfigurable:O,textConfigurable:v,updateRegion:x,clipAttributeList:f,clipTextList:g}))),ut=n=>{var o,a;const{sider:p,config:S,result:d,updateTagResult:_,updateRegion:C,isEdit:O,tagConfigurable:v,clipConfigurable:x}=n;let f=(S==null?void 0:S.inputList)||[],g=(o=d==null?void 0:d.tag)!=null?o:{},r=(a=d==null?void 0:d.regions)!=null?a:[];const[X,P]=U([]),[T,b]=U("tag");B(()=>{if(!v&&x){b("clip");return}b("tag")},[v,x]),B(()=>(window.addEventListener("keydown",N),()=>{window.removeEventListener("keydown",N)}));const N=t=>{if(v&&x)switch(t.keyCode){case ce.L:b("tag");break;case ce.X:b("clip");break}if(T==="tag"){if(!K.hotkeyFilter(t))return;K.isMoveKey(t==null?void 0:t.keyCode)&&t.preventDefault();let s=t.keyCode;if(s&&(s<=57&&s>=49||s<=105&&s>=97)){s>57?s=s-97:s=s-49;const R=X.slice();f.length===1?(L(0,s),P([0,s]),setTimeout(()=>{P([])},500)):R.length===1?(L(R[0],s),P([R[0],s]),setTimeout(()=>{P([])},500)):P([s])}}},L=(t,s)=>{if(t<f.length&&f[t].subSelected&&s<f[t].subSelected.length){const R=f[t].value,m=f[t].isMulti;let c=f[t].subSelected[s].value,G=0;const W=g;for(const $ in g)if($===f[t].value){if(G++,m===!0){const M=W[$].split(";").filter(q=>q!==""),V=M.indexOf(c);V===-1?M.push(c):M.splice(V,1),c=M.join(";")}c===""?delete W[$]:W[$]=c}G===0&&Object.assign(g,{[R]:c}),_(g)}},j=t=>{delete g[t],_(g)},k=v&&x&&l.createElement(st,{setSideTab:b,sideTab:T}),w=T==="tag"&&l.createElement(qe,{labelInfoSet:v?f:[],labelSelectedList:X,setLabel:L,tagResult:g,clearResult:j,isEdit:O,withPanelTab:!1}),D=T==="clip"&&l.createElement(ze,{regions:r,updateRegion:C,useAudioClipStore:Be});return p?typeof p=="function"?l.createElement("div",{className:`${Y}`},p({toggleAudioOption:k,labelSidebar:w,clipSidebar:D})):p:l.createElement("div",{className:`${Y}`},l.createElement("div",{className:`${Y}__content`},k,w,D))},ct=n=>{var o,a,p,S,d,_,C,O,v;const x=(a=(o=n.style)==null?void 0:o.sider)==null?void 0:a.width,{step:f,stepList:g,audioContext:r,sider:X,drawLayerSlot:P,imgList:T,imgIndex:b,currentData:N,config:L,stepInfo:j,checkMode:k}=n,w=K.getCurrentStepToolAndConfig(f,g),D=Xe(N.result),{toolInstanceRef:t}=Ge({basicInfo:D}),[s,R]=U(!0),[m,c]=U(null),[G,W]=U(0);B(()=>{R(!0)},[b]),B(()=>{s===!1&&Se()},[s]),B(()=>{M()},[]),B(()=>{t.current.exportData=()=>[[m],{duration:G,valid:H}],t.current.setResult=Re,t.current.clearResult=he,t.current.currentPageResult=m==null?void 0:m.regions,t.current.emit("updatePageNumber"),t.current.setSelectedRegion=$},[m]);const $=e=>{se.emit("setSelectedRegion",{id:e,isLoopStatus:!0,playImmediately:!0})},M=()=>{t.current.emit=e=>{const i=t.current.fns.get(e);i&&i.forEach(u=>{u&&(u==null||u())})},t.current.fns=new Map,t.current.singleOn=(e,i)=>{t.current.fns.set(e,[i])},t.current.on=(e,i)=>{t.current.singleOn(e,i)},t.current.unbindAll=e=>{t.current.fns.delete(e)}},V=le(()=>{const e=D[`step_${j==null?void 0:j.step}`];return(e==null?void 0:e.result)||[]},[L,D,j]),{tagConfigurable:q,textConfigurable:J=!0,clipConfigurable:Z=!1,clipAttributeConfigurable:ee=!1,clipAttributeList:te=[],clipTextConfigurable:z=!1,subAttributeList:fe=[],secondaryAttributeConfigurable:me=!1,inputList:pe=[],configList:ge=[],clipTextList:ne=Ve}=le(()=>{if(w)return K.jsonParser(w==null?void 0:w.config)},[w]),ve={clipConfigurable:Z,clipAttributeConfigurable:ee,clipAttributeList:te,clipTextConfigurable:z,subAttributeList:fe,secondaryAttributeConfigurable:me,clipTextList:ne},H=r?r==null?void 0:r.valid:!0,be=(S=(p=K.jsonParser(N.result))==null?void 0:p.duration)!=null?S:0,ye=H?be:0,Ee=!H||s||![J,z].includes(!0)||k;let oe={};if(b!==-1&&(T==null?void 0:T.length)){const e=(d=T[b])==null?void 0:d.preResult,i=(r==null?void 0:r.isEdit)?(_=r==null?void 0:r.stepConfig)==null?void 0:_.loadPreStep:j==null?void 0:j.loadPreStep;if(e&&i){const u=K.jsonParser(e),y=(O=(C=u==null?void 0:u.config)==null?void 0:C.context)!=null?O:{};Object.keys(y).forEach(h=>{h&&y[h]&&(oe[h]={visible:!0,content:y[h],type:h})})}}const Se=()=>{(V==null?void 0:V.length)>0?c(V[0]):c({id:Ne(),sourceID:"",value:ie(),tag:_e(),regions:[]})},ie=(e=!0)=>{const i={};let u=L.configList||[];return u.length>0&&u.forEach(y=>{i[y.key]=e&&y.default||""}),i},_e=()=>ke.getDefaultResultByConfig(L.inputList||[]),xe=({duration:e,hasError:i})=>{(r==null?void 0:r.onLoaded)&&(r==null||r.onLoaded()),R(!1),W(e)},Ce=e=>{c(i=>I(E({},i),{regions:((i==null?void 0:i.regions)||[]).filter(u=>u.id!==e)}))},Q=e=>{c(i=>{var u;const y=(u=i==null?void 0:i.regions)!=null?u:[],{id:h}=e;return y.find(F=>F.id===h)?I(E({},i),{regions:y.map(F=>h===F.id?E(E({},F),e):F)}):I(E({},i),{regions:[...y,e]})})},Te=(e,i)=>{c(u=>I(E({},u),{value:I(E({},u.value),{[i]:e})}))},Le=e=>{c(i=>I(E({},i),{tag:e}))},Re=e=>{c(e)},he=()=>{c(e=>I(E({},e),{value:ie(),tag:{},regions:[]})),se.emit("clearRegions")};return l.createElement(Me,null,l.createElement(Ae,{spinning:s,wrapperClassName:"audio-tool-spinner"},l.createElement(re,{className:je("layout","container"),style:{height:"100%"}},n==null?void 0:n.leftSider,l.createElement(rt,{className:`${de}__content`},l.createElement("div",{className:A.containerWrapper},l.createElement("div",{className:A.audioWrapper},q&&l.createElement($e,{result:m==null?void 0:m.tag,labelInfoSet:pe,hasPromptLayer:!!(r==null?void 0:r.promptLayer)}),r==null?void 0:r.promptLayer,l.createElement(Pe,E({context:{isEdit:r==null?void 0:r.isEdit,count:ye,toolName:it.AudioTextTool,imgIndex:b},drawLayerSlot:P,fileData:N,onLoaded:xe,invalid:!H,updateRegion:Q,removeRegion:Ce,regions:m==null?void 0:m.regions,activeToolPanel:r==null?void 0:r.activeToolPanel,footer:n.footer,isCheck:k},ve))),(J||z)&&l.createElement(at,{preContext:oe,result:m,inputDisabled:Ee,updateText:Te,updateRegion:Q,configList:ge,autofocus:!1,textConfigurable:J,clipTextConfigurable:z,clipAttributeList:te,clipAttributeConfigurable:ee,clipTextList:ne,isCheck:k}))),l.createElement(lt,{className:`${de}__side`,width:x!=null?x:240,style:(v=n.style)==null?void 0:v.sider},l.createElement(ut,{sider:X,config:L,result:m,updateTagResult:Le,updateRegion:Q,isEdit:r==null?void 0:r.isEdit,tagConfigurable:q,clipConfigurable:Z})),l.createElement(we,null))))};var dt=We(Fe,null,null,{context:Ue})(ct);export{dt as default};
@@ -1 +1 @@
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
+ import e,{useState as O,useRef as te,useEffect as q,useMemo as Ce}from"react";import{Tooltip as ae,Radio as H,Switch as be}from"antd";import{QuestionCircleOutlined as ye}from"@ant-design/icons";import{TextareaWithFooter as Ne}from"../../../views/MainView/sidebar/TextToolSidebar/index.js";import{timeFormat as ne,getAttributeColor as we,getAttributeFontColor as Be,getAttributeShowText as _e,updateColorOpacity as ke,DEFAULT_TEXT_CONFIG_ITEM as Ie}from"../../../utils/audio.js";import{cKeyCode as Se}from"@labelbee/lb-annotation";import U from"classnames";import oe,{useAudioClipStore as De,DEFAULT_CLIP_TEXT_CONFIG_ITEM as Ae}from"../audioContext/index.js";import l from"./index.module.scss.js";import{useTranslation as le}from"react-i18next";import re from"../../longText/index.js";import Le from"../../../assets/annotation/common/icon_clearSmall_a.svg.js";import Pe from"../../../assets/annotation/common/icon_clearSmall.svg.js";var Oe=Object.defineProperty,$e=Object.defineProperties,je=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,se=(u,o,r)=>o in u?Oe(u,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):u[o]=r,X=(u,o)=>{for(var r in o||(o={}))Me.call(o,r)&&se(u,r,o[r]);if(ue)for(var r of ue(o))Re.call(o,r)&&se(u,r,o[r]);return u},ie=(u,o)=>$e(u,je(o));const p=Se.default,ce=({onClick:u,title:o,disabled:r})=>{const[C,i]=O(!1);return e.createElement(ae,{placement:"bottom",title:o},e.createElement("img",{onMouseEnter:()=>{r||i(!0)},onMouseLeave:()=>i(!1),className:U({[l.clearIcon]:!0,[l.disabled]:r}),src:C?Le:Pe,onClick:u}))},Q=u=>{var o;const{t:r}=le(),C=te(null),[i,B]=O(!1),[_,x]=O(!1),{disabled:c,config:m,result:$,updateText:g,index:T,switchToNextTextarea:j,hasMultiple:k,textID:b,addPlaceholder:F,onFocus:I,onBlur:y,onFocusStyle:N={},extra:w,errorText:S}=u,{maxLength:h}=m,D=$?$[m.key]:"",A=(o=D==null?void 0:D.length)!=null?o:0,L=n=>{g&&(g(n,m.key),m.required&&x(!n))},M=k&&j,f={id:`textInput-${T}`,ref:C,disabled:c,value:D,maxLength:h,autoSize:{minRows:2,maxRows:6},onChange:n=>{const E=n.target.value;L(E)},onFocus:n=>{B(!0),I==null||I(n),n.target.value&&x(!1)},onBlur:n=>{B(!1),y==null||y(n),m.required&&x(!n.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:n=>{const{keyCode:E}=n;if(n.ctrlKey){if(E===p.Enter&&n.preventDefault(),F&&[p.One,p.Two,p.Three].includes(E))switch(n.preventDefault(),E){case p.One:F("\u4986");break;case p.Two:F("\u652B");break;case p.Three:F("\u7383");break}}else E===p.Tab&&M?(n.preventDefault(),n.nativeEvent.stopImmediatePropagation(),j(T)):n.nativeEvent.stopPropagation()}},v=e.createElement("div",{className:l.textAreaFooter},e.createElement("div",{className:l.hotkeyTip},M&&e.createElement("span",null,"[",r("Switch"),"]Tab"),e.createElement("span",null,"[",r("TurnPage"),"]Ctrl+Enter")),e.createElement("div",{className:l.wordCount},e.createElement("span",{className:A>=h?l.warning:""},A),"/",e.createElement("span",null,h)));return q(()=>{c&&B(!1)},[c]),q(()=>{x(!1)},[b]),e.createElement("div",{className:l.textField},e.createElement("div",{className:l.label},e.createElement("div",{className:l.labelText},e.createElement("span",{className:U({[l.titleText]:!0,[l.required]:m.required})},e.createElement(re,{text:m.label,openByText:!0,isToolTips:!0})),e.createElement(ce,{onClick:()=>{c||L("")},title:"",disabled:c})),e.createElement("div",{className:l.extra},w)),e.createElement("div",{className:U({disabled:c,"textarea-outline":!0,"ant-input-focused":i,[l.textareaContainer]:!0,[l.focus]:i,[l.invalid]:_}),style:i?N:{}},e.createElement(Ne,{footer:v,textareaProps:f})),S&&e.createElement("span",{style:{color:"#ff4d4f",lineHeight:"22px"}},S))},qe=u=>{const{configList:o,autofocus:r,textID:C,result:i,showText:B,updateText:_,toggleShowText:x,textInputDisabled:c,isCheck:m,isEdit:$,config:g,preContext:T,regions:j=[],textConfigurable:k=!0,clipTextConfigurable:b,clipAttributeConfigurable:F,updateRegion:I,clipAttributeList:y=[],clipTextList:N=Ae}=u,{t:w}=le(),[S,h]=O(0),[D,A]=O(""),L=te(null),{audioClipState:M}=De(),f=o||[X({},Ie)];let v=j;if(b&&!m){const t=M.selectedRegion.id;v=v.filter(a=>a.id===t)}const n=t=>{setTimeout(()=>{const a=document.getElementById(`textInput-${t}`);a&&(h(t),a.focus(),a.select(),a.scrollIntoView({behavior:"smooth",block:"center"}))})},E=t=>{const a=k?f.length:0,d=b?v.length*N.length:0,s=a+d,P=(t+1)%s;n(P)},J=t=>{t.keyCode===p.Tab&&(t.preventDefault(),(f.length>0||b&&N.length>0)&&n(0))},R=t=>{const a=document.getElementById(`textInput-${S}`);if(!(g==null?void 0:g.enablePlaceholderHotkey)||!a||!_)return;const{value:d,selectionStart:s,selectionEnd:P}=a,G=`${d.slice(0,s)}${t}${d.slice(P)}`;_(G,f[S].key),A(t),setTimeout(()=>{a.setSelectionRange(s+1,s+1),a.focus()},0),clearTimeout(L.current),L.current=setTimeout(()=>{A("")},400)};q(()=>($||document.addEventListener("keydown",J),()=>{document.removeEventListener("keydown",J)}),[o]),q(()=>{r&&!c&&n(0)},[C]);let K=f;m&&(K=f.filter(t=>(i==null?void 0:i[t.key])!==void 0));const me=Ce(()=>N.reduce((t,a)=>(v.forEach(d=>{d&&t.push(ie(X({},a),{clipTextResult:d}))}),t),[]),[N,v]);return e.createElement(e.Fragment,null,(g==null?void 0:g.enablePlaceholderHotkey)&&e.createElement("div",{className:l.placeholderHotkey},e.createElement("div",{className:l.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",e.createElement(ae,{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(ye,{className:l.questionIcon}))),e.createElement(H.Group,{value:D},e.createElement(H.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(H.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(H.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:l.textInputContainer},e.createElement(oe,{audioContext:T==null?void 0:T.before}),k&&K.map((t,a)=>e.createElement(Q,{config:t,key:a,index:a,result:i,updateText:_,switchToNextTextarea:E,hasMultiple:f.length>1,disabled:c,textID:C,addPlaceholder:R,onFocus:()=>h(a)})),b&&v.length>0&&me.map((t,a)=>{var d;const{clipTextResult:s}=t,{id:P,start:G,end:de,attribute:V}=s,{maxLength:Ee=3e3,label:Y,key:Z,required:pe}=t,ee=s==null?void 0:s[Z],fe={[s.id]:ee},ve={label:`${Y!=null?Y:w("textTool")}\uFF08${ne(G,"ss.SSS")} - ${ne(de,"ss.SSS")}\uFF09`,key:P,maxLength:Ee},W=(k?K.length:0)+a,z=we(V,y),xe={color:Be(V,y),backgroundColor:z},ge=w("LeastCharacterError",{num:1}),Te=pe&&ee.length<1?ge:void 0,Fe=(d=_e(V,[{value:"",key:w("NoAttribute")},...y]))!=null?d:"";return e.createElement(Q,{config:ve,key:a,index:W,disabled:c,result:fe,updateText:he=>{I==null||I(ie(X({},s),{[Z]:he}))},switchToNextTextarea:()=>{E(W)},hasMultiple:!0,onFocus:()=>h(W),onFocusStyle:F?{borderColor:z,boxShadow:`0 0 0 2px ${ke(z,.4)}`}:{},extra:F?e.createElement("div",{style:xe,className:l.attribute},e.createElement(re,{text:Fe,openByText:!0,isToolTips:!0})):null,errorText:Te})}),e.createElement(oe,{audioContext:T==null?void 0:T.after}),x&&e.createElement("div",{className:l.switchItem},w("toggleShowText"),e.createElement(be,{style:{alignSelf:"center"},checked:B,onChange:t=>{x(t)}}))))};export{ce as ClearIcon,Q as SingleTextInput,qe as default};
@@ -1 +1 @@
1
- var e={textInputContainer:"index-module_textInputContainer__ES6X3",textField:"index-module_textField__uRcb7",label:"index-module_label__xE6hM",required:"index-module_required__iElYl",extra:"index-module_extra__PW5Qk",textareaContainer:"index-module_textareaContainer__dTIv4",textAreaFooter:"index-module_textAreaFooter__h1Vv-",warning:"index-module_warning__NKpW6",hotkeyTip:"index-module_hotkeyTip__BSJ6A",wordCount:"index-module_wordCount__OD4eL",focus:"index-module_focus__H07-Y",invalid:"index-module_invalid__F9RC5",inputCount:"index-module_inputCount__--XiT",notify:"index-module_notify__rYuqq",switchItem:"index-module_switchItem__Q256x",placeholderHotkey:"index-module_placeholderHotkey__0SKPo",title:"index-module_title__YRpw9",questionIcon:"index-module_questionIcon__oK1HK",attribute:"index-module_attribute__g8Vbl",clearIcon:"index-module_clearIcon__ZBZqI",disabled:"index-module_disabled__zqh8C"};export{e as default};
1
+ var e={textInputContainer:"index-module_textInputContainer__ES6X3",textField:"index-module_textField__uRcb7",label:"index-module_label__xE6hM",labelText:"index-module_labelText__Zg1c4",titleText:"index-module_titleText__BRM44",required:"index-module_required__iElYl",extra:"index-module_extra__PW5Qk",textareaContainer:"index-module_textareaContainer__dTIv4",textAreaFooter:"index-module_textAreaFooter__h1Vv-",warning:"index-module_warning__NKpW6",hotkeyTip:"index-module_hotkeyTip__BSJ6A",wordCount:"index-module_wordCount__OD4eL",focus:"index-module_focus__H07-Y",invalid:"index-module_invalid__F9RC5",inputCount:"index-module_inputCount__--XiT",notify:"index-module_notify__rYuqq",switchItem:"index-module_switchItem__Q256x",placeholderHotkey:"index-module_placeholderHotkey__0SKPo",title:"index-module_title__YRpw9",questionIcon:"index-module_questionIcon__oK1HK",attribute:"index-module_attribute__g8Vbl",clearIcon:"index-module_clearIcon__ZBZqI",disabled:"index-module_disabled__zqh8C"};export{e as default};
@@ -0,0 +1 @@
1
+ import r from"lodash";class o{}o.getClipTextByConfig=(a,f,l=!1)=>{const t=r.cloneDeep(a);return f.forEach((e,c)=>{var s;const n=(s=e==null?void 0:e.default)!=null?s:"";c===0?Object.assign(t,{text:l?n:a[e.key]}):Object.assign(t,{[e.key]:l?n:a[e.key]})}),t};export{o as default};
@@ -1 +1 @@
1
- import t,{useRef as k}from"react";import S from"react-dom";import{useAudioClipStore as $}from"../../audioAnnotate/audioContext/index.js";import{getAttributeColor as w,getAttributeFontColor as N,updateColorOpacity as O,getAttributeShowText as T}from"../../../utils/audio.js";import F from"../../../assets/annotation/audio/loop.svg.js";import{Typography as P}from"antd";import{useClickAway as _}from"ahooks";import{classnames as D}from"../../../utils/index.js";import r from"./index.module.scss.js";const{Paragraph:I}=P,M=m=>{const{audioClipState:f,setAudioClipState:g}=$(),{clipAttributeList:i,clipAttributeConfigurable:b,clipTextConfigurable:x,selectedRegion:n}=f,c=k(null),{el:C,region:h,edgeAdsorption:y,clipping:A,instance:d}=m,{attribute:s="",text:v="",id:l,start:E,end:R}=h,{id:a}=n,o=w(s,i),u={color:N(s,i),backgroundColor:o},e={border:`2px solid ${o}`};if(l===a)e.backgroundColor=O(o,.6),e.borderLeft=`2px solid ${o}`,e.borderRight=`2px solid ${o}`;else if(d==null||d.setLoop(!1),e.borderLeft=`2px solid ${o}`,e.borderRight=`2px solid ${o}`,A){const p=Object.values(y);p.includes(E)&&(e.borderLeft="3px dashed #fff"),p.includes(R)&&(e.borderRight="3px dashed #fff")}_(()=>{l===a&&g({selectedRegion:{}})},c,["contextmenu"]);const j=l===a&&n.loop,L=t.createElement("div",{style:e,ref:c,className:D({[r.container]:!0})},j&&t.createElement("div",{className:r.loop},t.createElement("img",{src:F})),b&&t.createElement("div",null,t.createElement("div",{style:u,className:r.attribute},T(s,[{value:"",key:"\u65E0\u5C5E\u6027"},...i]))),x&&t.createElement(I,{ellipsis:{rows:2},className:r.text,style:u},"\u6587\u672C:",v));return t.createElement(t.Fragment,null,S.createPortal(L,C))};export{M as default};
1
+ import t,{useRef as w}from"react";import N from"react-dom";import{useAudioClipStore as _}from"../../audioAnnotate/audioContext/index.js";import{getAttributeColor as O,getAttributeFontColor as F,updateColorOpacity as P,getAttributeShowText as D}from"../../../utils/audio.js";import I from"../../../assets/annotation/audio/loop.svg.js";import{Typography as M}from"antd";import{useClickAway as q}from"ahooks";import{classnames as z}from"../../../utils/index.js";import r from"./index.module.scss.js";import{useTranslation as B}from"react-i18next";const{Paragraph:G}=M,H=x=>{const{t:C}=B(),{audioClipState:v,setAudioClipState:y}=_(),{clipAttributeList:i,clipAttributeConfigurable:h,clipTextConfigurable:A,selectedRegion:c,clipTextList:d}=v,u=w(null),{el:E,region:p,edgeAdsorption:R,clipping:k,instance:m}=x,{attribute:s="",text:J="",id:a,start:L,end:j}=p,{id:n}=c,o=O(s,i),f={color:F(s,i),backgroundColor:o},e={border:`2px solid ${o}`};if(a===n)e.backgroundColor=P(o,.6),e.borderLeft=`2px solid ${o}`,e.borderRight=`2px solid ${o}`;else if(m==null||m.setLoop(!1),e.borderLeft=`2px solid ${o}`,e.borderRight=`2px solid ${o}`,k){const l=Object.values(R);l.includes(L)&&(e.borderLeft="3px dashed #fff"),l.includes(j)&&(e.borderRight="3px dashed #fff")}q(()=>{a===n&&y({selectedRegion:{}})},u,["contextmenu"]);const T=a===n&&c.loop,S=t.createElement("div",{style:e,ref:u,className:z({[r.container]:!0})},T&&t.createElement("div",{className:r.loop},t.createElement("img",{src:I})),h&&t.createElement("div",null,t.createElement("div",{style:f,className:r.attribute},D(s,[{value:"",key:"\u65E0\u5C5E\u6027"},...i]))),A&&(d==null?void 0:d.map((l,$)=>{var b,g;return t.createElement(G,{ellipsis:{rows:2},className:r.text,style:f,key:$},(b=l==null?void 0:l.label)!=null?b:C("textTool"),":",(g=p[l==null?void 0:l.key])!=null?g:"")})));return t.createElement(t.Fragment,null,N.createPortal(S,E))};export{H as default};
@@ -1 +1 @@
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
+ import i,{useState as b,useRef as H,useEffect as P}from"react";import{getWebPcm2WavBase64 as er}from"../audioAnnotate/utils/getWebPcm2Wac.js";import tr,{debounce as rr,sortBy as or}from"lodash";import{PauseOutlined as nr,CaretRightOutlined as ir}from"@ant-design/icons";import{cKeyCode as lr,cTool as sr,EventBus as E,TagUtils as ar}from"@labelbee/lb-annotation";import{i18n as Ve}from"@labelbee/lb-utils";import{Button as ur}from"antd";import cr from"../invalidPage/index.js";import dr from"../imageError/index.js";import{classnames as U}from"../../utils/index.js";import mr,{EPlayerType as pr}from"../videoPlayer/components/SpeedController/index.js";import fr from"@labelbee/wavesurfer";import vr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import gr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import br,{audioZoomInfo as Ge}from"./zoomSlider/index.js";import yr from"./labelDisplayToggle/index.js";import _r from"./clipRegion/index.js";import{useAudioClipStore as Er}from"../audioAnnotate/audioContext/index.js";import{useLatest as X,useUpdate as hr,useDeepCompareEffect as Ye,useThrottleFn as Sr}from"ahooks";import Pr from"./useAudioScroll/index.js";import y from"./index.module.scss.js";import{getAttributeColor as Cr,formatTime as Je,timeFormat as Qe,dispatchResizeEvent as Rr,precisionMinus as et,isDoubleClick as wr,getCanMoveRange as Tr}from"../../utils/audio.js";import Ar from"./progressDot/index.js";import xr from"./clipTip/index.js";import jr from"./useSwitchHotkey/index.js";import Dr from"./useAudioCombine/index.js";import kr from"./useAudioSegment/index.js";import Lr from"./combineTip/index.js";import Mr from"./segmentTip/index.js";import Ir from"../../views/MainView/toolFooter/index.js";import{decimalReserved as Z}from"../videoPlayer/utils.js";import{I18nextProvider as Br}from"react-i18next";var Or=Object.defineProperty,Nr=Object.defineProperties,Wr=Object.getOwnPropertyDescriptors,tt=Object.getOwnPropertySymbols,Fr=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,rt=(p,u,d)=>u in p?Or(p,u,{enumerable:!0,configurable:!0,writable:!0,value:d}):p[u]=d,de=(p,u)=>{for(var d in u||(u={}))Fr.call(u,d)&&rt(p,d,u[d]);if(tt)for(var d of tt(u))zr.call(u,d)&&rt(p,d,u[d]);return p},ot=(p,u)=>Nr(p,Wr(u));const{EToolName:nt}=sr,q=lr.default,it=.1,lt=i.createContext({count:0,isEdit:!1,toolName:nt.Empty,imgIndex:0}),st=({fileData:p={},onLoaded:u,context:d,invalid:at,height:ut,hideError:ct,onError:me,updateRegion:j,removeRegion:N,regions:D=[],activeToolPanel:dt,clipConfigurable:mt,clipTextConfigurable:pe,clipAttributeList:pt,clipAttributeConfigurable:fe,secondaryAttributeConfigurable:ft,subAttributeList:vt,isCheck:C,hoverRegionId:K,footer:gt,drawLayerSlot:ve,clipTextList:bt,lang:ge})=>{var be,ye;const{url:W,path:_e}=p,[V,G]=b(!1),[Ee,he]=b(!1),[R,yt]=b(0),[_t,Se]=b(!1),[F,Pe]=b(0),n=H(null),w=H(null),Ce=H(R),Y=e=>{Ce.current=e,yt(e)},[Re,Et]=b(0),[z,ht]=b(1),J=H(null),[we,St]=b({}),{audioClipState:Q,setAudioClipState:M}=Er(),[ee,te]=b(!1),c=X(Q),Te=X(we),Ae=X(V),k=X(D),xe=hr(),[je,Pt]=b([]),[De,Ct]=b({}),Rt=rr(()=>{E.emit("audioZoom")},500),ke=e=>{e<Ge.min||e>Ge.max||(ht(e),Rr(),Rt())};Pr({container:J.current,target:document.querySelector(`[data-id=${(ye=(be=c.current)==null?void 0:be.selectedRegion)==null?void 0:ye.id}]`),clipping:ee,zoom:z,zoomHandler:ke});const $=()=>{let e=k.current;const{attributeLockList:r}=c.current;r.length&&(e=e.filter(t=>r.includes(t.attribute))),oe(),e.forEach(t=>{var o;(o=n.current)==null||o.addRegion(ot(de({},t),{drag:!C,resize:!C,color:"rgba(0, 0, 0, 0)"}))}),xe()},f=e=>{var r,t,o,l,a,v,g;const{id:s,loop:m=!0,playImmediately:_=!1,isLoopStatus:L}=e,A=L?Ae.current:m;if(s){const x=(o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{};Object.entries(x).forEach(([,S])=>{const{id:O}=S;s===O?S.select():S.cancelSelect()}),M({selectedRegion:{id:s,loop:A},selectedAttribute:(v=(a=(l=k.current)==null?void 0:l.find(S=>S.id===s))==null?void 0:a.attribute)!=null?v:""}),A&&_&&((g=I(s))==null||g.playLoop())}else M({selectedRegion:{}})},{combineInstance:wt}=Dr({waveRef:n,sortByStartRegions:je,regionMap:De,updateRegion:j,removeRegion:N,generateRegions:$,setSelectedRegion:f}),{segmentInstance:Tt,onRegionMouseMove:At,segmentTimeTip:xt}=kr({waveRef:n,regionMap:De,updateRegion:j,removeRegion:N,generateRegions:$,setSelectedRegion:f}),Le={clipTextConfigurable:pe,clipAttributeList:pt,clipAttributeConfigurable:fe,clipConfigurable:mt,secondaryAttributeConfigurable:ft,subAttributeList:vt,clipTextList:bt};P(()=>{var e;ge&&((e=Ve)==null||e.changeLanguage(ge))},[]),P(()=>{M({selectedAttribute:""})},[fe]),P(()=>{re()},[Q.selectedAttribute]),P(()=>{$()},[Q.attributeLockList]),Ye(()=>{M(Le),setTimeout(()=>{Me()})},[Le]),Ye(()=>{Pt(or(D,["start"])),Ct(D.reduce((e,r)=>{const{id:t}=r;return ot(de({},e),{[t]:r})},{}))},[D]),P(()=>{if(K){const e=Ae.current;f({id:K,loop:e,playImmediately:!0})}else f({})},[K]);const Me=()=>{var e,r;c.current.clipConfigurable?(!C&&n.current&&((e=n.current)==null||e.enableDragSelection({slop:5})),$()):((r=n.current)==null||r.disableDragSelection(),oe()),re()},re=()=>{var e,r,t,o,l;let a="";c.current.clipConfigurable?a=Cr(c.current.selectedAttribute,(e=c.current.clipAttributeList)!=null?e:[]):a="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 ${a}`}))},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]},Ie=()=>{var e,r;if(W){const t=((r=(e=_e==null?void 0:_e.split("."))==null?void 0:e.pop())==null?void 0:r.toLowerCase())==="pcm";Se(!1),t?er(W).then(o=>{Be(o)}):Be(W)}},Be=e=>{var r;e&&(he(!0),Y(0),Pe(0),(r=n==null?void 0:n.current)==null||r.load(e))},oe=()=>{var e;(e=n.current)==null||e.clearRegions()},ne=e=>{const r=I(e);r&&(te(!1),r==null||r.remove(),N==null||N(e),f({}))},{run:Oe}=Sr(f,{wait:500});jr({sortByStartRegions:je,setSelectedRegion:f});const jt=e=>{const{start:r,end:t}=Te.current;return(r||t)&&e.update(Te.current),e},Dt=({action:e,id:r,eventDownTime:t})=>{var o,l;if(!c.current.clipConfigurable)return;r&&f({id:r});const a=I((r!=null?r:(o=c.current.selectedRegion)==null?void 0:o.id)||""),v=[];(e==="create"?k.current:(l=k.current)==null?void 0:l.filter(m=>m.id!==a.id)).forEach(m=>{const{start:_,end:L,attribute:A}=m;A===c.current.selectedAttribute&&[_,L].forEach(x=>{v.includes(x)||v.push(x)})});const s=Tr(v.sort((m,_)=>m-_),t);n.current.range=s},kt=e=>{re(),setTimeout(()=>{te(!1)});const r=jt(e),{id:t,start:o,end:l}=r;f({id:t,playImmediately:!0});const a={id:t,start:Z(o,3),end:Z(l,3)};j==null||j(a),xe()},Lt=()=>{const e=fr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:ut||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[vr.create({regions:D,dragSelection:{slop:5},canMove:!1}),gr.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),r=()=>{var t;Y(((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;Pe(o),r(),u==null||u({duration:Math.round(o)}),he(!1),B(),E.on("setCurrentTimeByPosition",le),E.on("clearRegions",oe),E.on("removeRegionById",ne),E.on("setSelectedRegion",Oe),e.on("regions-eventDown",Dt),Me()}),e.on("audioprocess",()=>{r()}),e.on("play",()=>{G(!0)}),e.on("pause",()=>{G(!1)}),e.on("finish",()=>{G(!1)}),e.on("seek",()=>{r()}),e.on("error",()=>{Se(!0),u==null||u({hasError:!0}),me==null||me()}),e.on("region-created",t=>{var o;const{id:l,start:a,end:v}=t;if(k.current.find(s=>s.id===l))return;const g={id:l,start:Z(a,3),end:Z(v,3),attribute:c.current.selectedAttribute,text:""};if(c.current.secondaryAttributeConfigurable){const s=ar.getDefaultResultByConfig((o=c.current.subAttributeList)!=null?o:[]);g.subAttribute=s!=null?s:{}}pe&&c.current.clipTextList.forEach((m,_)=>{_===0?Object.assign(g,{text:m==null?void 0:m.default}):Object.assign(g,{[m.key]:m==null?void 0:m.default})}),j==null||j(g)}),e.on("region-updated",(t,o)=>{var l,a,v,g,s,m,_,L,A,x;const S=o==null?void 0:o.action;M({combined:!1,segment:!1}),S==="resize"&&((a=(l=n==null?void 0:n.current)==null?void 0:l.cursor)==null||a.setStyle({borderStyle:"solid"})),S==="drag"&&((g=(v=n==null?void 0:n.current)==null?void 0:v.cursor)==null||g.setStyle({borderColor:"transparent"}));const O={},se=[],ae={},Xt=(s=k.current)==null?void 0:s.filter(h=>h.id!==t.id),Zt=(L=(_=(m=n.current)==null?void 0:m.regions)==null?void 0:_.list)!=null?L:{};Xt.forEach(h=>{var Ze,qe;const{element:ue}=(Ze=Zt[h.id])!=null?Ze:{},{start:Vt,end:Gt}=h;if(ue){const{x:Ke,width:Yt}=((qe=ue.getBoundingClientRect)==null?void 0:qe.call(ue))||{},Jt=Ke+Yt;[Ke,Jt].forEach((ce,Qt)=>{se.includes(ce)||(se.push(ce),ae[ce]=Qt===0?Vt:Gt)})}});const{x:Xe,width:qt}=((x=(A=t.element).getBoundingClientRect)==null?void 0:x.call(A))||{},Kt=Xe+qt;se.forEach(h=>{Math.abs(et(h,Xe))<5&&(O.start=ae[h]),Math.abs(et(h,Kt))<5&&(O.end=ae[h])}),St(O),Oe({id:t.id}),te(!0)}),e.on("region-update-end",t=>{kt(t)}),e.on("region-contextmenu",(t,o)=>{if(!C){if(o.preventDefault(),o.stopPropagation(),wr(o)){ne(t.id);return}f({id:t.id,playImmediately:!0})}}),e.on("region-click",(t,o,l)=>{if(!C){if(o.preventDefault(),o.stopPropagation(),c.current.combined){wt(t);return}if(c.current.segment){Tt(t,l);return}f({id:t.id,playImmediately:!0})}}),e.on("region-mousemove",At),n.current=e},Mt=V?i.createElement(nr,null):i.createElement(ir,null),Ne=e=>e?`${parseFloat((e/F*100).toFixed(4))}%`:"0%",We=Ne(R),It=Ne(Re),T=()=>{if(!Ee)return n==null?void 0:n.current},Bt=()=>{var e;(e=T())==null||e.skipForward(it)},Ot=()=>{var e;(e=T())==null||e.skipBackward(it)},B=()=>{var e;(e=T())==null||e.playPause(),f({})},Fe=e=>{var r;switch(e.keyCode){case q.Right:Bt();break;case q.Left:Ot();break;case q.Space:e.preventDefault(),B();break;case q.Delete:if(!C){const{id:t}=((r=c.current)==null?void 0:r.selectedRegion)||{};t&&ne(t)}break}},Nt=e=>{le(e)},ze=tr.throttle(Nt,50);let ie=!1;const $e=()=>{ie&&(B(),ie=!1),document.removeEventListener("mousemove",ze),document.removeEventListener("mouseup",$e)},Wt=e=>{le(e),V&&(ie=!0,B()),document.addEventListener("mousemove",ze),document.addEventListener("mouseup",$e)},Ft=()=>{Ie()};P(()=>(Lt(),()=>{var e;(e=n==null?void 0:n.current)==null||e.destroy(),n.current=null,E.unbindAll("setCurrentTimeByPosition"),E.unbindAll("clearRegions"),E.unbindAll("removeRegionById"),E.unbindAll("setSelectedRegion")}),[]);const zt=e=>{var r,t,o;(r=T())==null||r.playPause(),(t=T())==null||t.setPlaybackRate(e),(o=T())==null||o.playPause()};P(()=>(document.addEventListener("keydown",Fe),()=>{document.removeEventListener("keydown",Fe)})),P(()=>{f({}),Ie()},[W]);const He=e=>{var r,t,o,l;if((n==null?void 0:n.current)&&(w==null?void 0:w.current)){const a=(t=(r=n==null?void 0:n.current)==null?void 0:r.getDuration())!=null?t:0,v=(o=w==null?void 0:w.current)==null?void 0:o.getBoundingClientRect();let s=(e.clientX-v.left)/(((l=w==null?void 0:w.current)==null?void 0:l.clientWidth)||0)*a;return s>a&&(s=a),s}return 0},le=e=>{var r;const t=He(e);(r=n==null?void 0:n.current)==null||r.skip(t-Ce.current),Y(t)},$t=e=>{Et(He(e))},Ht=F?Math.max(F-R,0):0,Ut=(d==null?void 0:d.toolName)!==nt.Empty&&(d==null?void 0:d.isEdit)!==!0&&(dt==="remark"||C),Ue=i.createElement("div",{className:y.audioPlayer},_t&&!ct&&i.createElement(dr,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:Ft,backgroundColor:"#ffffffbb"}),i.createElement(xr,{getRegionInstanceById:I,clipping:ee}),i.createElement(Lr,{container:J.current}),i.createElement(Mr,{segmentTimeTip:xt}),i.createElement("div",{className:y.waveformContainer,ref:J},i.createElement("div",{id:"waveform",style:{width:`${z*100}%`},className:U({[y.waveform]:!0,"bee-audio-combined":c.current.combined,"bee-audio-clip":c.current.clipConfigurable})},at&&i.createElement(cr,{isAudio:!0}),i.createElement("div",{ref:w,className:y.progress,onMouseDown:Wt,onMouseMove:$t},i.createElement("div",{className:U({[y.radioTooltip]:!0}),style:{left:We}},Je(R)),i.createElement("div",{className:U({[y.radioTooltip]:!0,[y.mouseTooltip]:!0}),style:{left:It}},Je(Re)),i.createElement(Ar,{playPercentage:We})),Ut&&(ve==null?void 0:ve({currentTime:R,remainingTime:Ht,audioPlayer:T()})))),i.createElement("div",{className:y.controlBar},i.createElement(ur,{type:"link",icon:Mt,onClick:()=>{B()},className:U({[y.playButton]:!0,[y.playButtonDisabled]:Ee})}),i.createElement("span",{className:y.time},`${Qe(R,"ss.SSS")} / -${Qe(F-R,"ss.SSS")}`),i.createElement(mr,{playerType:pr.Audio,onChange:e=>{zt(e)}}),i.createElement(br,{onChange:e=>{ke(e)},zoom:z}),i.createElement(yr,{EventBus:E})));return d?i.createElement(lt.Provider,{value:d},Ue,D.map(e=>{const{id:r}=e,t=document.querySelector(`[data-id=${r}]`);return t?i.createElement(_r,{el:t,key:r,region:e,edgeAdsorption:we,clipping:ee,zoom:z,instance:I(r)}):null}),i.createElement(Ir,{footer:gt})):Ue},$r=p=>i.createElement(Br,{i18n:Ve},i.createElement(st,de({},p)));export{st as AudioPlayer,lt as AudioPlayerContext,$r as WrapAudioPlayer};
@@ -1,2 +1,3 @@
1
- import{message as a}from"antd";import{cKeyCode as k}from"@labelbee/lb-annotation";import{useAudioClipStore as w}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as b,useEventListener as $}from"ahooks";import{useEffect as K}from"react";const _=k.default,j=g=>{const{waveRef:p,sortByStartRegions:x,regionMap:d,updateRegion:c,removeRegion:u,generateRegions:C,setSelectedRegion:B}=g,{audioClipState:E,setAudioClipState:s}=w(),{selectedRegion:v,clipConfigurable:y,combined:R}=E,{id:n}=v,A=b(i=>{var l;if(!n)return;const e=d[n],o=d[i.id];if(e.attribute!==o.attribute){a.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const f=x.filter(t=>t.attribute===e.attribute),F=f.findIndex(t=>t.id===n),I=f.findIndex(t=>t.id===i.id);if(Math.abs(F-I)!==1){a.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const r=[];["start","end"].forEach(t=>{r.push(e[t]),r.push(o[t])});const M=Math.min(...r),S=Math.max(...r),m={id:(l=p.current)==null?void 0:l.util.getId("combined_"),start:M,end:S,attribute:e.attribute,text:[e.text,o.text].includes("")?`${e.text}${o.text}`:`${e.text}
2
- ${o.text}`};c==null||c(m),u==null||u(n),u==null||u(o.id),C(),s({combined:!1}),B({id:m.id,playImmediately:!0})}),h=b(i=>{if(!!y&&i.altKey&&i.keyCode===_.Z){if(!n){a.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5408\u5E76\u7684\u533A\u95F4");return}s({combined:!0,segment:!1})}});return K(()=>{R&&s({combined:!1})},[n]),$("keydown",h),{combineInstance:A}};export{j as default};
1
+ import{message as b}from"antd";import{cKeyCode as K}from"@labelbee/lb-annotation";import{useAudioClipStore as _}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as C,useEventListener as D}from"ahooks";import{useEffect as L}from"react";import{cloneDeep as O}from"lodash";const z=K.default,Z=y=>{const{waveRef:E,sortByStartRegions:B,regionMap:g,updateRegion:x,removeRegion:a,generateRegions:h,setSelectedRegion:A}=y,{audioClipState:R,setAudioClipState:m}=_(),{selectedRegion:v,clipConfigurable:$,combined:k,clipTextList:F}=R,{id:i}=v,I=(o,d,c)=>{const t=O(o);return F.forEach((e,l)=>{const u=d[e.key],s=c[e.key],f=[u,s].includes("")?`${u}${s}`:`${u}
2
+ ${s}`;l===0?Object.assign(t,{text:f}):Object.assign(t,{[e.key]:f})}),t},w=C(o=>{var d,c;if(!i)return;const t=g[i],e=g[o.id];if(t.attribute!==e.attribute){b.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const l=B.filter(n=>n.attribute===t.attribute),u=l.findIndex(n=>n.id===i),s=l.findIndex(n=>n.id===o.id);if(Math.abs(u-s)!==1){b.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const r=[];["start","end"].forEach(n=>{r.push(t[n]),r.push(e[n])});const S=Math.min(...r),T=Math.max(...r),j={id:(d=E.current)==null?void 0:d.util.getId("combined_"),start:S,end:T,attribute:t.attribute,text:[t.text,e.text].includes("")?`${t.text}${e.text}`:`${t.text}
3
+ ${e.text}`,subAttribute:(c=e.subAttribute)!=null?c:{}},p=I(j,t,e);x==null||x(p),a==null||a(i),a==null||a(e.id),h(),m({combined:!1}),A({id:p.id,playImmediately:!0})}),M=C(o=>{if(!!$&&o.altKey&&o.keyCode===z.Z){if(!i){b.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5408\u5E76\u7684\u533A\u95F4");return}m({combined:!0,segment:!1})}});return L(()=>{k&&m({combined:!1})},[i]),D("keydown",M),{combineInstance:w}};export{Z as default};
@@ -1 +1 @@
1
- import{useRef as _,useEffect as R}from"react";import{message as y}from"antd";import{cKeyCode as h}from"@labelbee/lb-annotation";import{useAudioClipStore as K}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as v,useEventListener as D}from"ahooks";const L=h.default,j=C=>{const{waveRef:o,regionMap:p,updateRegion:s,removeRegion:b,generateRegions:E,setSelectedRegion:x}=C,{audioClipState:A,setAudioClipState:c}=K(),{selectedRegion:F,clipConfigurable:S,segment:g}=A,{id:e}=F,m=_(null),a=_(null);R(()=>{var t,u,r,i,n,l,d;if(a.current&&o.current&&g&&e){const f=(l=(r=(u=(t=o.current)==null?void 0:t.regions)==null?void 0:u.util)==null?void 0:r.getRegionSnapToGridValue)==null?void 0:l.call(r,((i=o.current)==null?void 0:i.drawer.handleEvent(a.current))*((n=o.current)==null?void 0:n.getDuration())),B=(d=p[e])!=null?d:{},{start:I,end:M}=B;if(f>I&&f<M){m.current=f;return}}m.current=null},[a.current,g]);const T=v((t,u)=>{var r,i;if(!e||e!==t.id){y.info("\u8BF7\u70B9\u51FB\u6240\u9009\u533A\u95F4");return}const n=p[e],l={id:(r=o.current)==null?void 0:r.util.getId("segment_"),start:n.start,end:u,attribute:n.attribute,text:n.text},d={id:(i=o.current)==null?void 0:i.util.getId("segment_"),start:u,end:n.end,attribute:n.attribute,text:""};s==null||s(l),s==null||s(d),b==null||b(e),E(),c({segment:!1}),x({id:l.id,playImmediately:!0})}),k=v(t=>{if(!!S&&t.altKey&&t.keyCode===L.X){if(!e){y.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5206\u5272\u7684\u533A\u95F4");return}c({segment:!0,combined:!1})}}),w=v((t,u)=>{a.current=u});return D("keydown",k),R(()=>{g&&c({segment:!1})},[e]),{segmentInstance:T,onRegionMouseMove:w,segmentTimeTip:m.current}};export{j as default};
1
+ import{useRef as O,useEffect as P}from"react";import{message as T}from"antd";import{cKeyCode as z,TagUtils as G}from"@labelbee/lb-annotation";import{useAudioClipStore as N}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as y,useEventListener as U}from"ahooks";import R from"../../audioAnnotate/utils/dataTransform.js";var X=Object.defineProperty,q=Object.defineProperties,H=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,S=(r,e,t)=>e in r?X(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,x=(r,e)=>{for(var t in e||(e={}))J.call(e,t)&&S(r,t,e[t]);if(E)for(var t of E(e))Q.call(e,t)&&S(r,t,e[t]);return r},B=(r,e)=>q(r,H(e));const W=z.default,Y=r=>{const{waveRef:e,regionMap:t,updateRegion:d,removeRegion:C,generateRegions:D,setSelectedRegion:j}=r,{audioClipState:F,setAudioClipState:p}=N(),{selectedRegion:I,clipConfigurable:h,segment:m,clipTextList:w,subAttributeList:A,secondaryAttributeConfigurable:L=!1}=F,{id:n}=I,v=O(null),f=O(null);P(()=>{var o,u,i,a,c,s,g;if(f.current&&e.current&&m&&n){const l=(s=(i=(u=(o=e.current)==null?void 0:o.regions)==null?void 0:u.util)==null?void 0:i.getRegionSnapToGridValue)==null?void 0:s.call(i,((a=e.current)==null?void 0:a.drawer.handleEvent(f.current))*((c=e.current)==null?void 0:c.getDuration())),_=(g=t[n])!=null?g:{},{start:b,end:V}=_;if(l>b&&l<V){v.current=l;return}}v.current=null},[f.current,m]);const M=y((o,u)=>{var i,a,c;if(!n||n!==o.id){T.info("\u8BF7\u70B9\u51FB\u6240\u9009\u533A\u95F4");return}const s=t[n],g=R.getClipTextByConfig(s,w),l=B(x({},g),{id:(i=e.current)==null?void 0:i.util.getId("segment_"),end:u,subAttribute:(a=s.subAttribute)!=null?a:{}}),_=R.getClipTextByConfig(s,w,!0),b=B(x({},_),{id:(c=e.current)==null?void 0:c.util.getId("segment_"),start:u,subAttribute:G.getDefaultResultByConfig(L?A!=null?A:[]:[])});d==null||d(l),d==null||d(b),C==null||C(n),D(),p({segment:!1}),j({id:l.id,playImmediately:!0})}),K=y(o=>{if(!!h&&o.altKey&&o.keyCode===W.X){if(!n){T.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5206\u5272\u7684\u533A\u95F4");return}p({segment:!0,combined:!1})}}),k=y((o,u)=>{f.current=u});return U("keydown",K),P(()=>{m&&p({segment:!1})},[n]),{segmentInstance:M,onRegionMouseMove:k,segmentTimeTip:v.current}};export{Y as default};
@@ -1 +1 @@
1
- import n,{useRef as P}from"react";import{Popover as m,Tooltip as x}from"antd";import{useSize as E}from"ahooks";import{prefix as g}from"../../constant/index.js";import{SearchOutlined as h}from"@ant-design/icons";var T=Object.defineProperty,b=Object.defineProperties,N=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,d=(r,e,t)=>e in r?T(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_=(r,e)=>{for(var t in e||(e={}))$.call(e,t)&&d(r,t,e[t]);if(v)for(var t of v(e))j.call(e,t)&&d(r,t,e[t]);return r},S=(r,e)=>b(r,N(e));const l=`${g}-longText`,C=r=>{var e,t;const{text:o,placement:c="bottom",icon:y=n.createElement(h,null),openByText:O,style:f,isToolTips:w,wordCount:p}=r,a=P(null);E(a);const i=a.current&&((e=a.current)==null?void 0:e.clientWidth)<((t=a.current)==null?void 0:t.scrollWidth);if(p)if((o==null?void 0:o.length)>p){const s=o.slice(0,p);return n.createElement(m,{placement:c,overlayClassName:`${l}-popover`,content:o},n.createElement("span",{style:{cursor:"pointer",whiteSpace:"pre-wrap"}},s,"..."))}else return n.createElement("div",{style:{whiteSpace:"pre-wrap"}}," ",o);if(O){let s={placement:c,overlayClassName:`${l}-popover`,content:o,key:`${i}`};i||Object.assign(s,{open:!1});const u=n.createElement("div",{className:`${l}-text`,style:f,ref:a},o);return w?n.createElement(x,S(_({},s),{title:o}),u):n.createElement(m,_({},s),u)}return n.createElement("div",{className:l,style:f},n.createElement("div",{className:`${l}-text`,ref:a},o),i&&n.createElement(m,{placement:c,overlayClassName:`${l}-popover`,content:o},y))};export{C as default};
1
+ import l,{forwardRef as h,useRef as E,useMemo as S}from"react";import{Tooltip as T,Popover as x}from"antd";import{useSize as j}from"ahooks";import{prefix as L}from"../../constant/index.js";import{SearchOutlined as C}from"@ant-design/icons";var M=Object.defineProperty,N=Object.defineProperties,R=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,b=(t,e,r)=>e in t?M(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&b(t,r,e[r]);if(v)for(var r of v(e))P.call(e,r)&&b(t,r,e[r]);return t},W=(t,e)=>N(t,R(e)),$=(t,e)=>{var r={};for(var n in t)g.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&v)for(var n of v(t))e.indexOf(n)<0&&P.call(t,n)&&(r[n]=t[n]);return r};const u=`${L}-longText`,_=h((t,e)=>{var r=t,{text:n,overflowMaxLines:p,style:i}=r,m=$(r,["text","overflowMaxLines","style"]);const a={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},o={display:"-webkit-box",WebkitLineClamp:p,WebkitBoxOrient:"vertical",overflow:"hidden"},d=p>1?o:a,c=f(f({},d),i!=null?i:{});return l.createElement("div",f({style:c,ref:e},m),n)}),k=t=>{const{text:e,placement:r="bottom",icon:n=l.createElement(C,null),openByText:p,style:i,isToolTips:m,overflowMaxLines:a=1}=t,o=E(null),d=j(o),c=S(()=>{var s,y,O,w;return a>1?o.current&&((s=o.current)==null?void 0:s.clientHeight)<((y=o.current)==null?void 0:y.scrollHeight):o.current&&((O=o.current)==null?void 0:O.clientWidth)<((w=o.current)==null?void 0:w.scrollWidth)},[d]);if(p){let s={placement:r,overlayClassName:`${u}-popover`,content:e,key:`${c}`};return c||Object.assign(s,{open:!1}),m?l.createElement(T,W(f({},s),{title:e}),l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e})):l.createElement(x,f({},s),l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e}))}return l.createElement("div",{className:u,style:i},l.createElement(_,{overflowMaxLines:a,style:i,ref:o,text:e}),c&&l.createElement(x,{placement:r,overlayClassName:`${u}-popover`,content:e},n))};export{k as default};
@@ -1 +1 @@
1
- import{useLatest as B}from"ahooks";import{Spin as M}from"antd/es";import d,{useContext as N,useRef as w,useState as U,useEffect as u}from"react";import{connect as F}from"react-redux";import{usePointCloudViews as T}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as $}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as q}from"../../store/annotation/map.js";import{LabelBeeContext as A}from"../../store/ctx.js";import{PointCloud2DRectOperation as G,ImgUtils as H}from"@labelbee/lb-annotation";var J=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,O=(o,e,t)=>e in o?J(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,f=(o,e)=>{for(var t in e||(e={}))W.call(e,t)&&O(o,t,e[t]);if(C)for(var t of C(e))X.call(e,t)&&O(o,t,e[t]);return o},R=(o,e)=>K(o,Q(e));const Y=o=>{var e;const{mappingData:t,size:l,config:b,checkMode:D,afterImgOnLoad:h}=o,s=(e=t==null?void 0:t.url)!=null?e:"",{pointCloudBoxList:c,setPointCloudResult:x}=N($),{update2DViewRect:y}=T(),p=d.useRef(null),n=w(null),m=B(y),_=w(null),[I,V]=U(!0),v=r=>{var a;const i=(a=m.current)==null?void 0:a.call(m,r);_.current=i,x(i)},j=()=>{var r;let a=[];c.forEach(i=>{const{rects:S=[],id:P,attribute:E,trackID:L}=i,g=S.find(z=>z.imageName===(t==null?void 0:t.path)),k=P+"_"+(t==null?void 0:t.path);g&&(a=[...a,R(f({},g),{boxID:P,id:k,attribute:E,order:L})])}),(r=n.current)==null||r.setResult(a)};return u(()=>{if(p.current){const r=new G({container:p.current,size:l,config:R(f({},b),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:D});return n.current=r,n.current.init(),n.current.on("updateDragResult",v),()=>{var a,i;(a=n.current)==null||a.unbind("updateDragResult",v),(i=n.current)==null||i.destroy()}}},[]),u(()=>{n.current&&s&&H.load(s).then(r=>{n.current.setImgNode(r),h(r),V(!1)})},[s]),u(()=>{var r;(r=n.current)==null||r.setSize(l)},[l]),u(()=>{c!==_.current&&j()},[c,s]),d.createElement(M,{spinning:I},d.createElement("div",{ref:p,style:f({position:"relative"},l)}))};var Z=F(q,null,null,{context:A})(Y);export{Z as default};
1
+ import{useLatest as q,useMemoizedFn as U}from"ahooks";import{Spin as le}from"antd/es";import k,{useContext as ie,useRef as G,useState as ce,useMemo as ue,useCallback as se,useEffect as f}from"react";import{connect as ae}from"react-redux";import{usePointCloudViews as de}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as fe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as pe}from"../../store/annotation/map.js";import{LabelBeeContext as me}from"../../store/ctx.js";import{PointCloud2DRectOperation as ve,ImgUtils as ge}from"@labelbee/lb-annotation";import{selectSpecifiedRectsFromTopViewSelectedIds as Re}from"./util.js";import{useUpdateRectList as _e}from"./useUpdateRectList.js";import{useToolStyleContext as De}from"../../hooks/useToolStyle.js";var Ie=Object.defineProperty,he=Object.defineProperties,be=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,K=(u,i,c)=>i in u?Ie(u,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):u[i]=c,m=(u,i)=>{for(var c in i||(i={}))we.call(i,c)&&K(u,c,i[c]);if(H)for(var c of H(i))ye.call(i,c)&&K(u,c,i[c]);return u},h=(u,i)=>he(u,be(i)),A=(u,i,c)=>new Promise((s,v)=>{var _=a=>{try{D(c.next(a))}catch(g){v(g)}},S=a=>{try{D(c.throw(a))}catch(g){v(g)}},D=a=>a.done?s(a.value):Promise.resolve(a.value).then(_,S);D((c=c.apply(u,i)).next())});const Pe=u=>{var i,c;const{mappingData:s,size:v,config:_,checkMode:S,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:a}=u,g=(i=s==null?void 0:s.url)!=null?i:"",b=(c=s==null?void 0:s.fallbackUrl)!=null?c:"",{pointCloudBoxList:C,setPointCloudResult:O,defaultAttribute:L,rectList:V,addRectIn2DView:Q,updateRectIn2DView:W,removeRectIn2DView:X,updateRectListByReducer:Y,selectedIDs:w,setSelectedIDs:T}=ie(fe),{value:j}=De(),Z=q(w),{update2DViewRect:ee,remove2DViewRect:te}=de(),E=k.useRef(null),o=G(null),F=U(ee),y=U(te),P=G(null),[ne,M]=ce(!0),N=ue(()=>V==null?void 0:V.filter(e=>e.imageName===(s==null?void 0:s.path)),[s==null?void 0:s.path,V]),x=q(s==null?void 0:s.path),B=se(e=>A(void 0,null,function*(){try{const r=Z.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(r.length){const n=new Set(r),l=t.filter(d=>n.has(d.id)).map(d=>d.id);T(l)}return t}catch(r){}}),[T]),z=e=>{const{boxID:r}=e;if(!a&&r){B(()=>{const t=F==null?void 0:F(e);return t?(P.current=t,O(t),t):null});return}W(e,!0)},J=e=>{x.current&&Q(h(m({},e),{imageName:x.current}))},$=e=>{if(e.length===0)return;if(!a){const t=e.find(n=>n.boxID);if(t){B(()=>{const n=y==null?void 0:y(t);return n?(P.current=n,O(n),R(),n):null});return}}const r=e.find(t=>t.extId);r&&B(()=>{const{imageName:t,extId:n}=r,l=y==null?void 0:y({boxID:n,imageName:t});return l?(P.current=l,O(l),l):null}),X(e)},re=U(()=>{let e=[];return C.forEach(r=>{const{rects:t=[],id:n,attribute:l,trackID:d}=r,p=t.find(oe=>oe.imageName===x.current),I=n+"_"+x.current;p&&(e=[...e,h(m({},p),{boxID:n,id:I,attribute:l,order:d})])}),e}),R=_e(()=>{var e,r,t;const n=a?[]:re(),l=(e=o.current)==null?void 0:e.selectedRectID,d=w.slice(0),p=Re(d,n,N);(r=o.current)==null||r.setResult(p),l&&((t=o.current)==null||t.setSelectedRectID(l))});return f(()=>{if(E.current){const e=new ve({container:E.current,size:v,config:h(m({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:S});return o.current=e,o.current.init(),o.current.on("updateDragResult",z),o.current.on("afterAddingDrawingRect",J),o.current.on("deleteSelectedRects",$),()=>{var r,t,n,l;(r=o.current)==null||r.unbind("updateDragResult",z),(t=o.current)==null||t.unbind("afterAddingDrawingRect",J),(n=o.current)==null||n.unbind("deleteSelectedRects",$),(l=o.current)==null||l.destroy()}}},[]),f(()=>{const e=t=>A(void 0,null,function*(){try{return yield ge.load(t)}catch(n){return console.error("Error loading image:",n),null}}),r=()=>A(void 0,null,function*(){var t;M(!0);let n=yield e(g);!n&&b&&(n=yield e(b)),n&&((t=o.current)==null||t.setImgNode(n),D(n)),M(!1)});o.current&&(g||b)&&r()},[g,b]),f(()=>{var e;(e=o.current)==null||e.setSize(v)},[v]),f(()=>{C!==P.current&&R()},[C]),f(()=>{var e,r;const t=N.find(n=>n.id===o.current.selectedRectID);(r=(e=o.current)==null?void 0:e.setDefaultAttribute)==null||r.call(e,L),t&&Y(n=>{var l;const d=[];let p=null;return n.forEach(I=>{I.id!==o.current.selectedRectID?d.push(I):p=I}),t.extId===void 0&&(p=(l=o.current)==null?void 0:l.selectedRect),[...d,h(m({},p||{}),{attribute:L})]}),R()},[L]),f(()=>{R()},[N]),f(()=>{R()},[a]),f(()=>{var e,r,t,n;const l=(r=(e=o.current)==null?void 0:e.config)!=null?r:{},d=h(m({},l),{attributeList:(t=_.attributeList)!=null?t:[]});(n=o.current)==null||n.setConfig(JSON.stringify(d))},[_.attributeList]),f(()=>{var e;(e=o.current)==null||e.setEnableAddRect(w.length===0),R()},[w]),f(()=>{const{hiddenText:e}=j||{};if(e===void 0)return;const r=o.current;if(!r)return;const t=m(m({},r.style),j);r.setStyle(t)},[j]),k.createElement(le,{spinning:ne},k.createElement("div",{ref:E,style:m({position:"relative"},v)}))};var xe=ae(pe,null,null,{context:me})(Pe);export{xe as default};
@@ -0,0 +1 @@
1
+ import{useDebounceFn as o}from"ahooks";const n=t=>{const{run:e}=o(t,{wait:100});return e};export{n as useUpdateRectList};
@@ -0,0 +1 @@
1
+ const c=(t,r,n)=>{if(t.length){const f=new Set(t),l=r.filter(({boxID:e})=>f.has(e)),o=n.filter(e=>e.extId&&f.has(e.extId));return[...l,...o]}return[...r,...n]};export{c as selectSpecifiedRectsFromTopViewSelectedIds};
@@ -1 +1 @@
1
- import{getClassName as H}from"../../utils/dom.js";import u,{useRef as y,useState as L,useContext as R,useCallback as O,useEffect as N}from"react";import w from"../AnnotationView/index.js";import A from"../../hooks/useSize.js";import{useSingleBox as q}from"./hooks/useSingleBox.js";import{useHighlight as F}from"./hooks/useHighlight.js";import G from"./components/HighlightVisible/index.js";import{PointCloudContext as J}from"./PointCloudContext.js";import K from"../pointCloud2DRectOperationView/index.js";var M=(t,s,e)=>new Promise((d,a)=>{var m=o=>{try{i(e.next(o))}catch(n){a(n)}},r=o=>{try{i(e.throw(o))}catch(n){a(n)}},i=o=>o.done?d(o.value):Promise.resolve(o.value).then(m,r);i((e=e.apply(t,s)).next())});const Q=({view2dData:t,setSelectedID:s,currentData:e,showEnlarge:d,checkMode:a=!1,measureVisible:m})=>{var r;const i=y(null),o=y(),{selectedBox:n}=q(),p=A(i),{url:h,calib:g,path:j}=t,{toggle2dVisible:P,isHighlightVisible:S}=F({currentData:e}),[k,x]=L(!1),{cuboidBoxIn2DView:_,cacheImageNodeSize:z}=R(J),B=!t,b=c=>{f(),z({path:j,imgNode:c})},f=O(()=>{var c,C;const v=(c=o.current)==null?void 0:c.toolInstance;if(s(""),!n||!v)return;const l=t.annotations.find(E=>E.annotation.id===n.info.id);let V="";l&&((C=l==null?void 0:l.annotation.pointList)==null?void 0:C.length)>0&&(v.focusPositionByPointList(l==null?void 0:l.annotation.pointList),V=n.info.id,s(V))},[n,o.current,t.annotations]);N(()=>{f()},[f]);const I=()=>M(void 0,null,function*(){x(!0),yield P(h,g),x(!1)});return u.createElement("div",{className:H("point-cloud-2d-image"),ref:i},_?u.createElement(w,{src:(r=t==null?void 0:t.url)!=null?r:"",annotations:t.annotations,size:p,ref:o,globalStyle:{display:B?"none":"block"},afterImgOnLoad:b,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:m}):u.createElement(K,{mappingData:t,size:p,checkMode:a,afterImgOnLoad:b}),g&&u.createElement(G,{visible:S(h),onClick:I,loading:k,style:{position:"absolute",right:16,top:16,zIndex:d?-1:101}}))};export{Q as default};
1
+ import{getClassName as F}from"../../utils/dom.js";import s,{useRef as j,useState as T,useContext as q,useMemo as w,useCallback as D,useEffect as G}from"react";import J from"../AnnotationView/index.js";import K from"../../hooks/useSize.js";import{useSingleBox as M}from"./hooks/useSingleBox.js";import{useHighlight as Q}from"./hooks/useHighlight.js";import W from"./components/HighlightVisible/index.js";import{PointCloudContext as X}from"./PointCloudContext.js";import Y from"./hooks/useDataLinkSwitch.js";import Z from"../pointCloud2DRectOperationView/index.js";var $=(t,u,i)=>new Promise((a,r)=>{var f=o=>{try{e(i.next(o))}catch(n){r(n)}},d=o=>{try{e(i.throw(o))}catch(n){r(n)}},e=o=>o.done?a(o.value):Promise.resolve(o.value).then(f,d);e((i=i.apply(t,u)).next())});const tt=({view2dData:t,setSelectedID:u,currentData:i,showEnlarge:a,checkMode:r=!1,measureVisible:f})=>{var d,e;const o=j(null),n=j(),{selectedBox:m}=M(),p=K(o),{url:b,fallbackUrl:k,calib:x,path:_}=t,{toggle2dVisible:v,isHighlightVisible:z}=Q({currentData:i}),[B,C]=T(!1),{highlight2DLoading:I,setHighlight2DLoading:L,cuboidBoxIn2DView:h,cacheImageNodeSize:O}=q(X),H=!t,R=w(()=>({zIndex:a?-1:101,is2DView:!h,imageName:t.path}),[a,h,t.path]),{rendered:E,isLinking:N}=Y(R),S=l=>{g(),O({path:_,imgNode:l})},g=D(()=>{var l,y;const V=(l=n.current)==null?void 0:l.toolInstance;if(u(""),!m||!V)return;const c=t.annotations.find(A=>A.annotation.id===m.info.id);let P="";c&&((y=c==null?void 0:c.annotation.pointList)==null?void 0:y.length)>0&&(V.focusPositionByPointList(c==null?void 0:c.annotation.pointList),P=m.info.id,u(P))},[m,n.current,t.annotations]);G(()=>{g()},[g]);const U=()=>$(void 0,null,function*(){C(!0),L(!0);try{yield v(b,k!=null?k:"",x)}catch(l){console.error("highlightOnClick error:",l)}finally{C(!1),L(!1)}});return s.createElement("div",{className:F("point-cloud-2d-image"),ref:o},h?s.createElement(J,{src:(d=t==null?void 0:t.url)!=null?d:"",fallbackSrc:(e=t==null?void 0:t.fallbackUrl)!=null?e:"",annotations:t.annotations,size:p,ref:n,globalStyle:{display:H?"none":"block"},afterImgOnLoad:S,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:f}):s.createElement(s.Fragment,null,s.createElement(Z,{shouldExcludePointCloudBoxListUpdate:!N,mappingData:t,size:p,checkMode:r,afterImgOnLoad:S}),!r&&E),x&&s.createElement(W,{visible:z(b),onClick:U,loading:B,disabled:I,style:{position:"absolute",right:16,top:16,zIndex:a?-1:101}}))};export{tt as default};
@@ -1 +1 @@
1
- import{getClassName as J}from"../../utils/dom.js";import i,{useState as L,useContext as ie,useEffect as Q}from"react";import{PointCloudContainer as le}from"./PointCloudLayout.js";import{PointCloudContext as re}from"./PointCloudContext.js";import{connect as se}from"react-redux";import{cKeyCode as ae,pointCloudLidar2image as ue,pointListLidar2Img as ce}from"@labelbee/lb-annotation";import{LabelBeeContext as de}from"../../store/ctx.js";import{a2MapStateToProps as me}from"../../store/annotation/map.js";import{toolStyleConverter as U}from"@labelbee/lb-utils";import fe from"./PointCloud2DSingleView.js";import W from"./components/TitleButton/index.js";import{LeftOutlined as pe}from"@ant-design/icons";import ge from"classnames";import ve from"../../assets/annotation/common/icon_esc.svg.js";import be from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ye from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as Ee}from"lodash";var _e=Object.defineProperty,he=Object.defineProperties,we=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Y=(e,n,t)=>n in e?_e(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,f=(e,n)=>{for(var t in n||(n={}))Ce.call(n,t)&&Y(e,t,n[t]);if(X)for(var t of X(n))Pe.call(n,t)&&Y(e,t,n[t]);return e},p=(e,n)=>he(e,we(n));const I=ae.default,Le=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:y,setCurIndex:g,curIndex:E=0,index:x,annotations2d:_})=>n?i.createElement(W,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(pe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{y(!1),g(void 0)}}),i.createElement("span",null,t==null?void 0:t.calName),i.createElement("span",{style:{marginLeft:"8px"}},E+1,"/",_==null?void 0:_.length)):i.createElement(W,{title:t==null?void 0:t.calName,onClick:()=>{y(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),xe=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:y,highlightAttribute:g,loadPCDFileLoading:E,checkMode:x,measureVisible:_})=>{var O;const[d,Z]=L([]),{topViewInstance:B,displayPointCloudList:j,polygonList:S,imageSizes:N,selectedIDs:V}=ie(re),[F,D]=L(""),[h,k]=L(!1),[a,w]=L(void 0);Q(()=>{var l;if(!E&&B&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(o=>{var v,T,K;const $=j.reduce((m,c)=>{var b,u;const C=c.id===F||g===c.attribute,{transferViewData:H,viewRangePointList:P}=(b=ue(c,o.calib,{createRange:C}))!=null?b:{};if(!H||!P)return[];const M=(u=U.getColorFromConfig({attribute:c.attribute},p(f({},n),{attributeConfigurable:!0}),{}))==null?void 0:u.stroke,ne=ee({viewDataPointList:H,pointCloudBox:c,defaultViewStyle:r,stroke:M}),G=[...m,...ne];return(P==null?void 0:P.length)>0&&G.unshift({type:"polygon",annotation:p(f({id:F,pointList:P},r),{stroke:M,fill:"rgba(255, 255, 255, 0.6)"})}),G},[]),q=N[(v=o==null?void 0:o.path)!=null?v:""];q&&Ee((T=o==null?void 0:o.calib)==null?void 0:T.groundHeight)&&S.forEach(m=>{const c=m.pointList.map(u=>{var C;return p(f({},u),{z:(C=o==null?void 0:o.calib)==null?void 0:C.groundHeight})}),b=ce(c,o==null?void 0:o.calib,q);if(b){const u=U.getColorFromConfig({attribute:m.attribute},p(f({},n),{attributeConfigurable:!0}),{});$.push({type:"polygon",annotation:p(f({id:m.id,pointList:b},r),{stroke:u==null?void 0:u.stroke,fill:V.includes(m.id)?u==null?void 0:u.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:$,url:o==null?void 0:o.url,calName:(K=o==null?void 0:o.calib)==null?void 0:K.calName,calib:o==null?void 0:o.calib,path:o==null?void 0:o.path})}),Z(s)}},[j,e==null?void 0:e.mappingImgList,F,g,E,S,N,V]),Q(()=>(window.addEventListener("keydown",R),()=>{window.removeEventListener("keydown",R)}),[a]);const R=l=>{const{keyCode:r}=l;switch(r){case I.Esc:h&&k(!1);break;case I.Left:A();break;case I.Right:z();break}},A=()=>{a===void 0||!h||Number(a)>0&&w(a-1)},z=()=>{a===void 0||!h||Number(a)<(d==null?void 0:d.length)-1&&w(a+1)},ee=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:o})=>l?l.map(v=>({type:v.type,annotation:p(f({id:r.id,pointList:v.pointList},s),{stroke:o})})):[],te=!e||!(e==null?void 0:e.mappingImgList)||!(((O=e==null?void 0:e.mappingImgList)==null?void 0:O.length)>0),oe=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:be,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>A()}),i.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),i.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),i.createElement("img",{src:ye,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>z()}),i.createElement("img",{src:ve,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),w(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(d==null?void 0:d.length)>0?i.createElement(i.Fragment,null,d.map((l,r)=>{const s=h&&r===a;return i.createElement(le,{className:ge({[J("point-cloud-2d-container")]:!0,[J("point-cloud-container","zoom")]:s}),title:i.createElement(Le,{showEnlarge:s,isEnlargeTopView:y,data:l,setIsEnlarge:k,setCurIndex:w,curIndex:a,index:r,annotations2d:d}),titleOnSurface:!s,style:{display:te?"none":"flex",width:s?"100%":t},key:r,toolbar:oe},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(fe,{currentData:e,view2dData:l,setSelectedID:D,showEnlarge:s,checkMode:x,measureVisible:_}))})):null};var Fe=se(me,null,null,{context:de})(xe);export{Fe as default};
1
+ import{getClassName as W}from"../../utils/dom.js";import l,{useState as L,useContext as me,useCallback as pe,useEffect as X}from"react";import{PointCloudContainer as fe}from"./PointCloudLayout.js";import{PointCloudContext as ge}from"./PointCloudContext.js";import{connect as ve}from"react-redux";import{cKeyCode as be,EventBus as ye,pointCloudLidar2image as Ee,pointListLidar2Img as he}from"@labelbee/lb-annotation";import{LabelBeeContext as _e}from"../../store/ctx.js";import{a2MapStateToProps as we}from"../../store/annotation/map.js";import{toolStyleConverter as Y}from"@labelbee/lb-utils";import Ce from"./PointCloud2DSingleView.js";import Z from"./components/TitleButton/index.js";import{LeftOutlined as Pe}from"@ant-design/icons";import Le from"classnames";import xe from"../../assets/annotation/common/icon_esc.svg.js";import Ie from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import ke from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as Fe}from"lodash";import{getBoundingRect as Oe,isBoundingRectInImage as je}from"../../utils/index.js";import{useLatest as Se}from"ahooks";var Ne=Object.defineProperty,Re=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable,ee=(e,i,n)=>i in e?Ne(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,m=(e,i)=>{for(var n in i||(i={}))Ae.call(i,n)&&ee(e,n,i[n]);if(D)for(var n of D(i))Te.call(i,n)&&ee(e,n,i[n]);return e},p=(e,i)=>Re(e,Ve(i));const S=be.default,ze=({showEnlarge:e,isEnlargeTopView:i,data:n,setIsEnlarge:y,setCurIndex:g,curIndex:E=0,index:x,annotations2d:h})=>i?l.createElement(Z,{title:n==null?void 0:n.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement(Pe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{y(!1),g(void 0)}}),l.createElement("span",null,n==null?void 0:n.calName),l.createElement("span",{style:{marginLeft:"8px"}},E+1,"/",h==null?void 0:h.length)):l.createElement(Z,{title:n==null?void 0:n.calName,onClick:()=>{y(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),qe=({currentData:e,config:i,thumbnailWidth:n,isEnlargeTopView:y,highlightAttribute:g,loadPCDFileLoading:E,checkMode:x,measureVisible:h})=>{var N;const[f,te]=L([]),{topViewInstance:oe,displayPointCloudList:R,polygonList:V,imageSizes:I,selectedIDs:A,windowKeydownListenerHook:k}=me(ge),[F,ne]=L(""),[_,ie]=L(!1),[u,w]=L(void 0),O=pe(o=>{ie(o),ye.emit("2d-image:enlarge",o)},[]),le=({viewDataPointList:o,pointCloudBox:r,defaultViewStyle:s,stroke:t})=>o?o.map(v=>({type:v.type,annotation:p(m({id:r.id,pointList:v.pointList},s),{stroke:t})})):[],T=()=>{var o;if(!E&&oe&&(e==null?void 0:e.mappingImgList)&&((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(t=>{var v,H,K,$;const B=R.reduce((c,d)=>{var b,a;const C=d.id===F||g===d.attribute,{transferViewData:j,viewRangePointList:P}=(b=Ee(d,t.calib,{createRange:C}))!=null?b:{};if(!j||!P)return[];const ue=j.reduce((J,Q)=>Q.type==="line"?[...J,...Q.pointList]:J,[]),ce=p(m({},Oe(ue)),{imageName:t.path});if(!je(ce,t.path,I))return c;const M=(a=Y.getColorFromConfig({attribute:d.attribute},p(m({},i),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,de=le({viewDataPointList:j,pointCloudBox:d,defaultViewStyle:r,stroke:M}),G=[...c,...de];return(P==null?void 0:P.length)>0&&G.unshift({type:"polygon",annotation:p(m({id:F,pointList:P},r),{stroke:M,fill:"rgba(255, 255, 255, 0.6)"})}),G},[]),U=I[(v=t==null?void 0:t.path)!=null?v:""];U&&Fe((H=t==null?void 0:t.calib)==null?void 0:H.groundHeight)&&V.forEach(c=>{const d=c.pointList.map(a=>{var C;return p(m({},a),{z:(C=t==null?void 0:t.calib)==null?void 0:C.groundHeight})}),b=he(d,t==null?void 0:t.calib,U);if(b){const a=Y.getColorFromConfig({attribute:c.attribute},p(m({},i),{attributeConfigurable:!0}),{});B.push({type:"polygon",annotation:p(m({id:c.id,pointList:b},r),{stroke:a==null?void 0:a.stroke,fill:A.includes(c.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:B,url:t==null?void 0:t.url,fallbackUrl:(K=t==null?void 0:t.fallbackUrl)!=null?K:"",calName:($=t==null?void 0:t.calib)==null?void 0:$.calName,calib:t==null?void 0:t.calib,path:t==null?void 0:t.path})}),te(s)}};X(()=>{window.requestIdleCallback?window.requestIdleCallback(T):setTimeout(T,1)},[R,e==null?void 0:e.mappingImgList,F,g,E,V,I,A]);const re=Se(o=>{if(!_)return;const r=()=>{o.stopImmediatePropagation()};switch(o.keyCode){case S.Esc:{O(!1),r();break}case S.Left:{z(),r();break}case S.Right:{q(),r();break}}}),z=()=>{u===void 0||!_||Number(u)>0&&w(u-1)},q=()=>{u===void 0||!_||Number(u)<(f==null?void 0:f.length)-1&&w(u+1)};X(()=>{const o=s=>re.current(s);return k.preappendEventListener(o)},[k,k.preappendEventListener]);const se=!e||!(e==null?void 0:e.mappingImgList)||!(((N=e==null?void 0:e.mappingImgList)==null?void 0:N.length)>0),ae=l.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},l.createElement("img",{src:Ie,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>z()}),l.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),l.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),l.createElement("img",{src:ke,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>q()}),l.createElement("img",{src:xe,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{O(!1),w(void 0)}}),l.createElement("span",null,"\u952E\u9000\u51FA"));return(f==null?void 0:f.length)>0?l.createElement(l.Fragment,null,f.map((o,r)=>{const s=_&&r===u;return l.createElement(fe,{className:Le({[W("point-cloud-2d-container")]:!0,[W("point-cloud-container","zoom")]:s}),title:l.createElement(ze,{showEnlarge:s,isEnlargeTopView:y,data:o,setIsEnlarge:O,setCurIndex:w,curIndex:u,index:r,annotations2d:f}),titleOnSurface:!s,style:{display:se?"none":"flex",width:s?"100%":n},key:r,toolbar:ae},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&l.createElement(Ce,{key:o.url,currentData:e,view2dData:o,setSelectedID:ne,showEnlarge:s,checkMode:x,measureVisible:h}))})):null};var He=ve(we,null,null,{context:_e})(qe);export{He as default};
@@ -1 +1 @@
1
- import{getClassName as m}from"../../utils/dom.js";import{cKeyCode as K,PointCloud as M}from"@labelbee/lb-annotation";import{PointCloudUtils as B,toolStyleConverter as Z,EPerspectiveView as E}from"@labelbee/lb-utils";import j from"classnames";import e,{useContext as b,useState as O,useRef as H,useEffect as u,useMemo as U}from"react";import{PointCloudContainer as q}from"./PointCloudLayout.js";import{PointCloudContext as G}from"./PointCloudContext.js";import{a2MapStateToProps as J}from"../../store/annotation/map.js";import{connect as Q}from"react-redux";import{jsonParser as W}from"../../utils/index.js";import{useSingleBox as X}from"./hooks/useSingleBox.js";import{useSphere as Y}from"./hooks/useSphere.js";import{Switch as $,Tooltip as ee}from"antd";import te from"../../hooks/useSize.js";import{usePointCloudViews as oe}from"./hooks/usePointCloudViews.js";import{useTranslation as L}from"react-i18next";import{LabelBeeContext as ne}from"../../store/ctx.js";import ie from"./components/PointCloudSizeSlider/index.js";import re from"./components/TitleButton/index.js";import{LeftOutlined as ae}from"@ant-design/icons";var le=Object.defineProperty,se=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,D=(n,r,a)=>r in n?le(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a,N=(n,r)=>{for(var a in r||(r={}))me.call(r,a)&&D(n,a,r[a]);if(z)for(var a of z(r))ue.call(r,a)&&D(n,a,r[a]);return n},de=(n,r)=>se(n,ce(r));const pe=K.default,we="LABELBEE-POINTCLOUD",P=e.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),d=({perspectiveView:n})=>{const{isActive:r,setTarget3DView:a}=b(P),o=p=>j({[m("point-cloud-3d-view",p)]:!0,active:r});return e.createElement("span",{onClick:()=>{a(E[n])},className:o(n.toLocaleLowerCase())})},k=({isEnlarge:n})=>{const{reset3DView:r,followTopView:a}=b(P),{t:o}=L(),p=e.createElement(e.Fragment,null,e.createElement(d,{perspectiveView:"Top"}),e.createElement(d,{perspectiveView:"Front"}),e.createElement(d,{perspectiveView:"Left"}),e.createElement(d,{perspectiveView:"Back"}),e.createElement(d,{perspectiveView:"Right"}),e.createElement(d,{perspectiveView:"LFT"}),e.createElement(d,{perspectiveView:"RBT"})),V=e.createElement(e.Fragment,null,e.createElement(ee,{title:o("CameraFollowTopView")},e.createElement("span",{onClick:()=>{a()},className:m("point-cloud-3d-view","followTop")})),e.createElement("span",{onClick:()=>{r()},className:m("point-cloud-3d-view","reset")}));return n?e.createElement("div",{className:m("point-cloud-3d-sidebarZoom")},V,p):e.createElement("div",{className:m("point-cloud-3d-sidebar")},p,V)},ve=({currentData:n,config:r,highlightAttribute:a})=>{const o=b(G),[p,V]=O(!0),[v,_]=O(!1),f=H(null),{initPointCloud3d:S}=oe(),C=te(f),{t:h}=L();u(()=>{!o.mainViewInstance||S==null||S(C)},[C]);const{selectedBox:w}=X(),{selectedSphere:g}=Y(),x=t=>{var i,l;const s=w==null?void 0:w.info;if(s){const c=N({},s.center);c.x=c.x-.01,c.z=1e3;const I=t===E.Top;(i=o.mainViewInstance)==null||i.updateCameraByBox(s,t,I?c:void 0)}g&&((l=o.mainViewInstance)==null||l.updateCameraBySphere(g,t))},R=()=>{var t;(t=o.mainViewInstance)==null||t.resetCamera()},F=()=>{var t,i;const l=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance.camera;l&&((i=o.mainViewInstance)==null||i.applyCameraTarget(l))};u(()=>{if(f.current&&(n==null?void 0:n.url)){let t=o.mainViewInstance;!t&&C.width&&(t=new M({container:f.current,isOrthographicCamera:!0,orthographicParams:B.getDefaultOrthographicParams(C),config:r}),o.setMainViewInstance(t))}},[C,n]),u(()=>{var t;if(f.current&&(n==null?void 0:n.url)&&n.result&&o.mainViewInstance){let i=o.mainViewInstance;const l=B.getBoxParamsFromResultList(n.result);l.forEach(s=>{var c;const I=(c=Z.getColorFromConfig({attribute:s.attribute},de(N({},r),{attributeConfigurable:!0}),{}))==null?void 0:c.hex;i==null||i.addBoxToSense(s,I)}),i.render(),o.setPointCloudResult(l),o.setPointCloudValid((t=W(n.result))==null?void 0:t.valid)}},[n,o.mainViewInstance]),u(()=>{var t,i,l,s;if(w){x(E.Top);const c=(l=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[w]),u(()=>{var t,i,l,s;if(g){x(E.Top);const c=(l=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?l:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[g]),u(()=>(window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}),[]);const T=t=>{if(t.keyCode===pe.Esc){_(!1);return}},y=U(()=>({reset3DView:R,setTarget3DView:x,isActive:!!w,followTopView:F}),[w,o.mainViewInstance]);u(()=>{var t,i,l;const s=o.pointCloudBoxList.filter(c=>c.attribute===a);(s==null?void 0:s.length)>0&&((t=o.mainViewInstance)==null||t.clearHighlightBoxes(),(i=o.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((l=o.mainViewInstance)==null||l.clearHighlightBoxesAndRender())},[a,o.mainViewInstance]);const A=e.createElement(e.Fragment,null,e.createElement(ie,{onChange:t=>{var i;(i=o.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),e.createElement("span",{style:{marginRight:8}},h("ShowArrows")),e.createElement($,{size:"small",checked:p,onChange:t=>{var i;V(t),(i=o.mainViewInstance)==null||i.setShowDirection(t)}}),v&&e.createElement(P.Provider,{value:y},e.createElement(k,{isEnlarge:v})));return e.createElement(q,{className:j({[m("point-cloud-3d-container")]:!0,[m("point-cloud-container","zoom")]:v}),title:v?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement(ae,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{_(!1)}}),h("3DView")):e.createElement(re,{title:h("3DView"),onClick:()=>{_(!0)}}),toolbar:A},e.createElement("div",{className:m("point-cloud-3d-content")},!v&&e.createElement(P.Provider,{value:y},e.createElement(k,null)),e.createElement("div",{className:m("point-cloud-3d-view"),id:we,ref:f})))};var fe=Q(J,null,null,{context:ne})(ve);export{fe as default};
1
+ import{getClassName as m}from"../../utils/dom.js";import{cKeyCode as Z,PointCloud as H}from"@labelbee/lb-annotation";import{PointCloudUtils as S,toolStyleConverter as U,EPerspectiveView as E}from"@labelbee/lb-utils";import j from"classnames";import e,{useContext as T,useState as O,useRef as q,useEffect as u,useMemo as G}from"react";import{PointCloudContainer as J}from"./PointCloudLayout.js";import{PointCloudContext as Q}from"./PointCloudContext.js";import{a2MapStateToProps as W}from"../../store/annotation/map.js";import{connect as X}from"react-redux";import{jsonParser as Y}from"../../utils/index.js";import{useSingleBox as $}from"./hooks/useSingleBox.js";import{useSphere as ee}from"./hooks/useSphere.js";import{Switch as te,Tooltip as oe}from"antd";import ne from"../../hooks/useSize.js";import{usePointCloudViews as ie}from"./hooks/usePointCloudViews.js";import{useTranslation as z}from"react-i18next";import{LabelBeeContext as re}from"../../store/ctx.js";import le from"./components/PointCloudSizeSlider/index.js";import ae from"./components/TitleButton/index.js";import{LeftOutlined as se}from"@ant-design/icons";var ce=Object.defineProperty,me=Object.defineProperties,de=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,N=(n,r,l)=>r in n?ce(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,k=(n,r)=>{for(var l in r||(r={}))ue.call(r,l)&&N(n,l,r[l]);if(D)for(var l of D(r))pe.call(r,l)&&N(n,l,r[l]);return n},ve=(n,r)=>me(n,de(r));const we=Z.default,fe="LABELBEE-POINTCLOUD",_=e.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),p=({perspectiveView:n})=>{const{isActive:r,setTarget3DView:l}=T(_),v=o=>j({[m("point-cloud-3d-view",o)]:!0,active:r});return e.createElement("span",{onClick:()=>{l(E[n])},className:v(n.toLocaleLowerCase())})},R=({isEnlarge:n})=>{const{reset3DView:r,followTopView:l}=T(_),{t:v}=z(),o=e.createElement(e.Fragment,null,e.createElement(p,{perspectiveView:"Top"}),e.createElement(p,{perspectiveView:"Front"}),e.createElement(p,{perspectiveView:"Left"}),e.createElement(p,{perspectiveView:"Back"}),e.createElement(p,{perspectiveView:"Right"}),e.createElement(p,{perspectiveView:"LFT"}),e.createElement(p,{perspectiveView:"RBT"})),g=e.createElement(e.Fragment,null,e.createElement(oe,{title:v("CameraFollowTopView")},e.createElement("span",{onClick:()=>{l()},className:m("point-cloud-3d-view","followTop")})),e.createElement("span",{onClick:()=>{r()},className:m("point-cloud-3d-view","reset")}));return n?e.createElement("div",{className:m("point-cloud-3d-sidebarZoom")},g,o):e.createElement("div",{className:m("point-cloud-3d-sidebar")},o,g)},Ce=({currentData:n,config:r,highlightAttribute:l})=>{var v;const o=T(Q),[g,F]=O(!0),[w,h]=O(!1),f=q(null),{initPointCloud3d:y}=ie(),C=ne(f),{t:I}=z();u(()=>{!o.mainViewInstance||y==null||y(C)},[C]);const{selectedBox:d}=$(),{selectedSphere:P}=ee(),x=t=>{var i,a;const s=d==null?void 0:d.info;if(s){const c=k({},s.center);c.x=c.x-.01,c.z=1e3;const V=t===E.Top;(i=o.mainViewInstance)==null||i.updateCameraByBox(s,t,V?c:void 0)}P&&((a=o.mainViewInstance)==null||a.updateCameraBySphere(P,t))},A=()=>{var t;(t=o.mainViewInstance)==null||t.resetCamera()},K=()=>{var t,i;const a=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance.camera;a&&((i=o.mainViewInstance)==null||i.applyCameraTarget(a))};u(()=>{if(f.current&&(n==null?void 0:n.url)){let t=o.mainViewInstance;!t&&C.width&&(t=new H({container:f.current,isOrthographicCamera:!0,orthographicParams:S.getDefaultOrthographicParams(C),config:r}),o.setMainViewInstance(t))}},[C,n]),u(()=>{var t;if(f.current&&(n==null?void 0:n.url)&&n.result&&o.mainViewInstance){let i=o.mainViewInstance;const a=S.getBoxParamsFromResultList(n.result);a.forEach(c=>{var V;const b=(V=U.getColorFromConfig({attribute:c.attribute},ve(k({},r),{attributeConfigurable:!0}),{}))==null?void 0:V.hex;i==null||i.addBoxToSense(c,b)}),i.render(),o.setPointCloudResult(a);const s=S.getRectParamsFromResultList(n.result);o.setRectList(s),o.setPointCloudValid((t=Y(n.result))==null?void 0:t.valid)}},[n,o.mainViewInstance]),u(()=>{var t,i,a,s,c;if(((t=d==null?void 0:d.info)==null?void 0:t.id)!==void 0){x(E.Top);const b=(s=(a=(i=o.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?s:1;(c=o.mainViewInstance)==null||c.updateCameraZoom(b)}},[(v=d==null?void 0:d.info)==null?void 0:v.id]),u(()=>{var t,i,a,s;if(P){x(E.Top);const c=(a=(i=(t=o.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?a:1;(s=o.mainViewInstance)==null||s.updateCameraZoom(c)}},[P]),u(()=>(window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B)}),[]);const B=t=>{if(t.keyCode===we.Esc){h(!1);return}},L=G(()=>({reset3DView:A,setTarget3DView:x,isActive:!!d,followTopView:K}),[d,o.mainViewInstance]);u(()=>{var t,i,a;const s=o.pointCloudBoxList.filter(c=>c.attribute===l);(s==null?void 0:s.length)>0&&((t=o.mainViewInstance)==null||t.clearHighlightBoxes(),(i=o.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((a=o.mainViewInstance)==null||a.clearHighlightBoxesAndRender())},[l,o.mainViewInstance]);const M=e.createElement(e.Fragment,null,e.createElement(le,{onChange:t=>{var i;(i=o.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),e.createElement("span",{style:{marginRight:8}},I("ShowArrows")),e.createElement(te,{size:"small",checked:g,onChange:t=>{var i;F(t),(i=o.mainViewInstance)==null||i.setShowDirection(t)}}),w&&e.createElement(_.Provider,{value:L},e.createElement(R,{isEnlarge:w})));return e.createElement(J,{className:j({[m("point-cloud-3d-container")]:!0,[m("point-cloud-container","zoom")]:w}),title:w?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement(se,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{h(!1)}}),I("3DView")):e.createElement(ae,{title:I("3DView"),onClick:()=>{h(!0)}}),toolbar:M},e.createElement("div",{className:m("point-cloud-3d-content")},!w&&e.createElement(_.Provider,{value:L},e.createElement(R,null)),e.createElement("div",{className:m("point-cloud-3d-view"),id:fe,ref:f})))};var Ve=X(W,null,null,{context:re})(Ce);export{Ve as default};
@@ -1 +1 @@
1
- import{EPointCloudPattern as z}from"@labelbee/lb-utils";import nt,{useState as n,useRef as Vt,useMemo as it,useEffect as E}from"react";import{ActionsHistory as st,EToolName as G}from"@labelbee/lb-annotation";import{useDispatch as Bt}from"../../store/ctx.js";import{ChangeSave as Ot}from"../../store/annotation/actionCreators.js";import Ht from"../../store/annotatedBox/index.js";var Rt=Object.defineProperty,jt=Object.defineProperties,zt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,rt=(a,e,i)=>e in a?Rt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i,Nt=(a,e)=>{for(var i in e||(e={}))Et.call(e,i)&&rt(a,i,e[i]);if(lt)for(var i of lt(e))Gt.call(e,i)&&rt(a,i,e[i]);return a},Ft=(a,e)=>jt(a,zt(e)),Mt=(a,e,i)=>new Promise((m,C)=>{var S=v=>{try{f(i.next(v))}catch(s){C(s)}},_=v=>{try{f(i.throw(v))}catch(s){C(s)}},f=v=>v.done?m(v.value):Promise.resolve(v.value).then(S,_);f((i=i.apply(a,e)).next())});const at=nt.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new st,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:G.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:z.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:a=>{},imageSizes:{},cacheImageNodeSize:()=>{}}),Tt=({children:a})=>{const[e,i]=n([]),[m,C]=n([]),[S,_]=n([]),[f,v]=n([]),[s,x]=n([]),[y,V]=n([]),[N,dt]=n(!0),[F,ct]=n(!0),[M,ut]=n(1),[d,T]=n(),[Z,k]=n(),[q,J]=n(),[l,K]=n(),[Q,pt]=n(""),[B,gt]=n(G.Rect),ht=Vt(new st).current,[p,O]=n([]),[U,vt]=n(""),[H,Pt]=n(z.Detection),[b,W]=n(void 0),[R,ft]=n([]),[j,mt]=n([]),g=Ht(),[X,bt]=n({}),It=Bt(),Ct=r=>{const{imgNode:c,path:u}=r;u&&c&&bt(P=>Ft(Nt({},P),{[u]:{width:c.width,height:c.height}}))},Y=it(()=>s.length===1?s[0]:"",[s]),w=it(()=>{const r=e.find(t=>t.id===Y),c=t=>{const o=e.concat(t);return i(o),o},u=t=>{const o=m.concat(t);return C(o),o},P=t=>{dt(t!==!1)},h=t=>{t===void 0&&x([]),typeof t=="string"&&x([t]),Array.isArray(t)&&x(Array.from(new Set(t)))},yt=t=>{s.includes(t)?h(s.filter(o=>o!==t)):h([...s,t])},Lt=t=>{y.includes(t)?V([]):V([t])},Dt=()=>{if(B===G.Rect){const t=e.map(o=>o.id);h(t),d==null||d.pointCloud2dOperation.setSelectedIDs(t)}},wt=t=>{h(e.filter(o=>o.attribute===t).map(o=>o.id))},$=e.filter(t=>!p.includes(t.attribute)),tt=m.filter(t=>!p.includes(t.attribute)),et=f.filter(t=>t.attribute&&!p.includes(t.attribute)),At=t=>{if(p.includes(t))O(p.filter(o=>o!==t));else{const o=p.concat(t);O(o)}},_t=(t=$,o=S,L=tt,A=et,D=R)=>{var I;l==null||l.clearAllBox(),l==null||l.clearAllSphere(),d==null||d.updatePolygonList(t,o),d==null||d.updatePointList(L),d==null||d.updateLineList(A),l==null||l.generateBoxes(t),l==null||l.generateSpheres(L),(I=b==null?void 0:b.store)==null||I.updateCurrentSegment(D),ot(t)},xt=()=>{T(void 0),k(void 0),J(void 0),K(void 0)},ot=(t,o)=>Mt(void 0,null,function*(){var L;if(!l)return;const A=l.pointCloudObject;if(!!A)try{const D=yield l.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:j,points:A.geometry.attributes.position.array}),I=yield l==null?void 0:l.highlightOriginPointCloud(t,D);return I&&((L=d==null?void 0:d.pointCloudInstance)==null||L.updateColor(I)),I}catch(D){console.error(D)}});return{selectedID:Y,pointCloudBoxList:e,pointCloudSphereList:m,displayPointCloudList:$,displaySphereList:tt,displayLineList:et,selectedIDs:s,setPointCloudResult:i,setSelectedIDs:h,addPointCloudBox:c,addPointCloudSphere:u,setPointCloudSphereList:C,valid:N,selectedPointCloudBox:r,setPointCloudValid:P,addSelectedID:yt,addHighlightID:Lt,selectedAllBoxes:Dt,topViewInstance:d,setTopViewInstance:T,sideViewInstance:Z,setSideViewInstance:k,backViewInstance:q,setBackViewInstance:J,mainViewInstance:l,setMainViewInstance:K,polygonList:S,setPolygonList:_,lineList:f,setLineList:v,zoom:M,setZoom:ut,history:ht,toggleAttributesVisible:At,hideAttributes:p,setHideAttributes:O,reRender:_t,attrPanelLayout:U,setAttrPanelLayout:vt,syncAllViewPointCloudColor:ot,defaultAttribute:Q,setDefaultAttribute:pt,pointCloudPattern:B,setPointCloudPattern:gt,selectSpecAttr:wt,globalPattern:H,setGlobalPattern:t=>{H!==t&&(It(Ot),Pt(t),t===z.Detection&&W(void 0))},ptSegmentInstance:b,setPtSegmentInstance:W,segmentation:R,setSegmentation:ft,clearAllDetectionInstance:xt,highlight2DDataList:j,setHighlight2DDataList:mt,cuboidBoxIn2DView:F,setCuboidBoxIn2DView:ct,imageSizes:X,cacheImageNodeSize:Ct,highlightIDs:y,setHighlightIDs:V}},[N,s,e,m,S,f,d,Z,q,l,M,p,U,Q,B,H,b,R,j,F,X,y]);E(()=>{var r,c,u;(r=g==null?void 0:g.setPointCloudBoxList)==null||r.call(g,e),(c=g==null?void 0:g.setHighlightIDs)==null||c.call(g,y),(u=g==null?void 0:g.setSelectedIDs)==null||u.call(g,s)},[e,s,y]),E(()=>{var r;(r=g==null?void 0:g.setPtCtx)==null||r.call(g,w)},[w]);const St=()=>{const r=e.filter(h=>p.includes(h.attribute)),{setSelectedIDs:c,reRender:u}=w,P=r.map(h=>h.id);P.length>0&&c(s.filter(h=>!P.includes(h))),u()};return E(()=>{var r,c,u,P;St(),(c=(r=d==null?void 0:d.toolInstance)==null?void 0:r.setHiddenAttributes)==null||c.call(r,p),(P=(u=b==null?void 0:b.store)==null?void 0:u.setHiddenAttributes)==null||P.call(u,p)},[p]),nt.createElement(at.Provider,{value:w},a)};export{at as PointCloudContext,Tt as PointCloudProvider};
1
+ import{EPointCloudPattern as J}from"@labelbee/lb-utils";import Se,{useState as r,useRef as ct,useMemo as R,useCallback as a,useEffect as Q}from"react";import{EPointCloudBoxRenderTrigger as M,calcResetAreasAndBoxIds as ut}from"../../utils/ToolPointCloudBoxRenderHelper.js";import{ActionsHistory as be,EToolName as X,uuid as gt}from"@labelbee/lb-annotation";import{useDispatch as pt}from"../../store/ctx.js";import{ChangeSave as ft}from"../../store/annotation/actionCreators.js";import mt from"../../store/annotatedBox/index.js";import Le from"lodash";import{addMapIndirectWeakSetItem as xe}from"./utils/map.js";import ht from"./hooks/useTimeoutFunc.js";import It,{getEmptyUseWindowKeydownListener as vt}from"./hooks/useWindowKeydownListener.js";var Pt=Object.defineProperty,wt=Object.defineProperties,yt=Object.getOwnPropertyDescriptors,De=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,Ae=(d,n,u)=>n in d?Pt(d,n,{enumerable:!0,configurable:!0,writable:!0,value:u}):d[n]=u,k=(d,n)=>{for(var u in n||(n={}))Ct.call(n,u)&&Ae(d,u,n[u]);if(De)for(var u of De(n))Rt.call(n,u)&&Ae(d,u,n[u]);return d},Be=(d,n)=>wt(d,yt(n)),St=(d,n,u)=>new Promise((S,x)=>{var D=p=>{try{m(u.next(p))}catch(b){x(b)}},E=p=>{try{m(u.throw(p))}catch(b){x(b)}},m=p=>p.done?S(p.value):Promise.resolve(p.value).then(D,E);m((u=u.apply(d,n)).next())});const F=d=>Le.pick(d,["id","attribute","width","height","x","y","imageName"]),_e=Se.createContext({rectList:[],pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],displayLineList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],highlightIDs:[],setHighlightIDs:()=>{},valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},addHighlightID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setRectList:()=>{},addRectIn2DView:()=>{},removeRectIn2DView:()=>{},updateRectIn2DView:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new be,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>Promise.resolve(),defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:X.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{},globalPattern:J.Detection,setGlobalPattern:()=>{},setPtSegmentInstance:()=>{},segmentation:[],setSegmentation:()=>{},clearAllDetectionInstance:()=>{},highlight2DDataList:[],setHighlight2DDataList:()=>{},highlight2DLoading:!1,setHighlight2DLoading:()=>{},cuboidBoxIn2DView:!0,setCuboidBoxIn2DView:d=>{},imageSizes:{},cacheImageNodeSize:()=>{},addRectFromPointCloudBoxByImageName:d=>!1,removeRectBySpecifyId:(d,n,u)=>!1,removeRectByPointCloudBoxId:d=>!1,rectRotateSensitivity:2,setRectRotateSensitivity:()=>{},imageNamePointCloudBoxMap:new Map,linkageImageNameRectMap:new Map,updateRectListByReducer:()=>{},windowKeydownListenerHook:vt()}),bt=({children:d})=>{const[n,u]=r([]),[S,x]=r([]),[D,E]=r([]),[m,p]=r([]),[b,Ve]=r([]),[I,_]=r([]),[L,z]=r([]),[Y,Ne]=r(!0),[$,He]=r(2),[ee,Oe]=r(!0),[te,je]=r(1),[g,oe]=r(),[ne,ie]=r(),[se,re]=r(),[c,le]=r(),[ae,Me]=r(""),[V,ke]=r(X.Rect),N=ct(new be).current,[f,K]=r([]),[de,Fe]=r(""),[H,Ee]=r(J.Detection),[C,ce]=r(void 0),[T,ze]=r([]),[W,Ke]=r([]),[ue,Te]=r(!1),h=mt(),[ge,We]=r({}),Ge=pt(),Ze=e=>{const{imgNode:t,path:o}=e;o&&t&&We(i=>Be(k({},i),{[o]:{width:t.width,height:t.height}}))},G=R(()=>I.length===1?I[0]:"",[I]),pe=It(),O=a((e,t,o="extId")=>{const i=o||"id",s=new Set(t);return p(l=>{let w=!1;const v=l.filter(B=>{const y=B[i],P=s.has(y)?B.imageName!==e:!0;return P||(w=!0),P});return w?v:l}),!0},[]),fe=a(e=>{const t=n.map(o=>o.id);return O(e,t,"extId")},[n,O]),me=a(e=>{if(!e)return!1;const t=n.filter(o=>Array.isArray(o.rects)).map(o=>{const{id:i,attribute:s,trackID:l}=o,w=o.rects.find(v=>v.imageName===e);if(w){const v=Le.pick(w,["width","height","x","y","imageName"]);return Be(k({},v),{id:gt(),attribute:s,order:l,extId:i,lineDash:[]})}return null}).filter(o=>o!==null);return t.length?(p(o=>{const i=new Set(o.filter(l=>e===l.imageName).map(l=>l.extId)),s=t.filter(l=>i.has(l.extId)===!1);return s.length?[...o,...s]:o}),!0):!1},[n]),he=R(()=>n.filter(t=>Array.isArray(t.rects)&&t.rects.length>0).reduce((t,o)=>{var i;return(i=o.rects)==null||i.forEach(s=>{const{imageName:l}=s;if(!l){console.warn("Missing image name"),console.trace(s,o);return}xe(t,l,o.id,o)}),t},new Map),[n]),Ie=a(e=>{p(t=>e(t,F))},[F]),ve=R(()=>m.filter(e=>e.extId!==void 0&&e.id!==void 0).reduce((e,t)=>{const o=t.imageName;return o?(xe(e,o,t.extId,t),e):(console.warn("missing image name"),console.log(t,m),e)},new Map),[m]),{fn:Ue}=ht(e=>{_(t=>{const o=e,i=new Set(o);let s=!1;const l=t.filter(w=>{const v=i.has(w);return v||(s=!0),v});return s?l:t})},200),Pe=a(e=>{const t=e.map(o=>o.id);u(e),Ue(t)},[]),we=R(()=>n.find(e=>e.id===G),[n,G]),Z=R(()=>n.filter(e=>!f.includes(e.attribute)),[n,f]),U=R(()=>S.filter(e=>!f.includes(e.attribute)),[S,f]),q=R(()=>b.filter(e=>e.attribute&&!f.includes(e.attribute)),[b,f]),qe=a(e=>{const t=n.concat(e);return Pe(t),t},[n]),Je=a(e=>{const t=S.concat(e);return x(t),t},[S]),Qe=a(e=>{Ne(e!==!1)},[]),A=a(e=>{e===void 0&&_([]),typeof e=="string"&&_([e]),Array.isArray(e)&&_(Array.from(new Set(e)))},[]),Xe=a(e=>{I.includes(e)?A(I.filter(t=>t!==e)):A([...I,e])},[I]),Ye=a(e=>{const t=F(e);p(o=>[...o,t])},[m]),$e=a((e,t=!1)=>{const o=F(e);p(i=>i.map(s=>s.id===e.id?t?k(k({},s),o):o:s))},[m]),et=a(e=>{p(t=>t.filter(o=>!e.find(i=>i.id===o.id)))},[m]),tt=a(e=>{L.includes(e)?z([]):z([e])},[L]),ot=a(()=>{if(V===X.Rect){const e=n.map(t=>t.id);A(e),g==null||g.pointCloud2dOperation.setSelectedIDs(e)}},[V,n,g,g==null?void 0:g.pointCloud2dOperation]),nt=a(e=>{A(n.filter(t=>t.attribute===e).map(t=>t.id))},[n]),it=a(e=>{if(f.includes(e))K(f.filter(t=>t!==e));else{const t=f.concat(e);K(t)}},[f]),st=a((e=Z,t=D,o=U,i=q,s=T)=>{var l;c==null||c.clearAllBox(),c==null||c.clearAllSphere(),g==null||g.updatePolygonList(e,t),g==null||g.updatePointList(o),g==null||g.updateLineList(i),c==null||c.generateBoxes(e),c==null||c.generateSpheres(o),(l=C==null?void 0:C.store)==null||l.updateCurrentSegment(s),ye(M.Default,e)},[c,g,C,C==null?void 0:C.store]),rt=a(()=>{oe(void 0),ie(void 0),re(void 0),le(void 0)},[]),ye=a((e,t,o)=>St(void 0,null,function*(){var i,s,l;if(!c)return;const w=c.pointCloudObject;if(!w)return;let v=[],B=[];try{if(t&&N.record.length){const{record:y,recordIndex:P}=N;let Ce=P;P>0&&(e===M.SingleToggleValid||e===M.SingleRotate||e===M.Single&&t.length===((i=y[P])==null?void 0:i.pointCloudBoxList.length))&&(Ce=P-1);let dt=(s=y[Ce])==null?void 0:s.pointCloudBoxList;const Re=ut(e,t,dt);v=Re.modifiedBoxIds,B=Re.resetAreas}}catch(y){console.error("call calcResetAreasAndBoxIds error",y)}try{const y=yield c.getHighlightIndexByMappingImgList({mappingImgList:o!=null?o:W,points:w.geometry.attributes.position.array}),P=yield c==null?void 0:c.highlightOriginPointCloud(t,y,{modifiedBoxIds:v,resetAreas:B});return P&&((l=g==null?void 0:g.pointCloudInstance)==null||l.updateColor(P)),P}catch(y){console.error("call highlightOriginPointCloud error",y)}}),[c,c==null?void 0:c.pointCloudObject,N]),lt=a(e=>{H!==e&&(Ge(ft),Ee(e),e===J.Detection&&ce(void 0))},[H]),j=R(()=>({selectedID:G,pointCloudBoxList:n,pointCloudSphereList:S,displayPointCloudList:Z,displaySphereList:U,displayLineList:q,selectedIDs:I,setPointCloudResult:Pe,setSelectedIDs:A,addPointCloudBox:qe,addPointCloudSphere:Je,setPointCloudSphereList:x,valid:Y,selectedPointCloudBox:we,setPointCloudValid:Qe,addSelectedID:Xe,addHighlightID:tt,selectedAllBoxes:ot,topViewInstance:g,setTopViewInstance:oe,sideViewInstance:ne,setSideViewInstance:ie,backViewInstance:se,setBackViewInstance:re,mainViewInstance:c,setMainViewInstance:le,polygonList:D,setPolygonList:E,rectList:m,setRectList:p,addRectIn2DView:Ye,removeRectIn2DView:et,updateRectIn2DView:$e,lineList:b,setLineList:Ve,zoom:te,setZoom:je,history:N,toggleAttributesVisible:it,hideAttributes:f,setHideAttributes:K,reRender:st,attrPanelLayout:de,setAttrPanelLayout:Fe,syncAllViewPointCloudColor:ye,defaultAttribute:ae,setDefaultAttribute:Me,pointCloudPattern:V,setPointCloudPattern:ke,selectSpecAttr:nt,globalPattern:H,setGlobalPattern:lt,ptSegmentInstance:C,setPtSegmentInstance:ce,segmentation:T,setSegmentation:ze,clearAllDetectionInstance:rt,highlight2DDataList:W,setHighlight2DDataList:Ke,highlight2DLoading:ue,setHighlight2DLoading:Te,cuboidBoxIn2DView:ee,setCuboidBoxIn2DView:Oe,imageSizes:ge,cacheImageNodeSize:Ze,highlightIDs:L,setHighlightIDs:z,removeRectByPointCloudBoxId:fe,removeRectBySpecifyId:O,addRectFromPointCloudBoxByImageName:me,rectRotateSensitivity:$,setRectRotateSensitivity:He,imageNamePointCloudBoxMap:he,linkageImageNameRectMap:ve,updateRectListByReducer:Ie,windowKeydownListenerHook:pe}),[Y,we,Z,U,q,D,m,g,ne,se,c,te,de,ae,V,H,C,T,W,ue,ee,ge,L,fe,O,me,$,he,ve,Ie,pe]);Q(()=>{var e,t,o;(e=h==null?void 0:h.setPointCloudBoxList)==null||e.call(h,n),(t=h==null?void 0:h.setHighlightIDs)==null||t.call(h,L),(o=h==null?void 0:h.setSelectedIDs)==null||o.call(h,I)},[n,I,L]),Q(()=>{var e;(e=h==null?void 0:h.setPtCtx)==null||e.call(h,j)},[j]);const at=()=>{const e=n.filter(s=>f.includes(s.attribute)),{setSelectedIDs:t,reRender:o}=j,i=e.map(s=>s.id);i.length>0&&t(I.filter(s=>!i.includes(s))),o()};return Q(()=>{var e,t,o,i;at(),(t=(e=g==null?void 0:g.toolInstance)==null?void 0:e.setHiddenAttributes)==null||t.call(e,f),(i=(o=C==null?void 0:C.store)==null?void 0:o.setHiddenAttributes)==null||i.call(o,f)},[f]),Se.createElement(_e.Provider,{value:j},d)};export{_e as PointCloudContext,bt as PointCloudProvider};
@@ -1 +1 @@
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),d=e.find(u=>u.id===t),l=x(),{t:s}=l;if(t&&d){const{length:u,width:f,height:i}=v.transferBox2Kitti(d),b=o===k.Back?[{label:s("Width"),value:f},{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)"})},b.map((c,n)=>r.createElement("span",{key:n,style:{marginRight:n===0?16:0}},`${c.label}: ${c.value.toFixed(a)}`)))}return null},M=({checkMode:o,config:e,style:t})=>{const d=r.useContext(m),{selectedBox:l}=$(),[s,u]=D([]),f=x(),{t:i,i18n:b}=f,c=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=d.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,b.language]),l?r.createElement("div",{style:t||F(B({position:"absolute"},A),{right:8,bottom:8})},s.map(n=>c?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
+ 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),d=e.find(u=>u.id===t),l=x(),{t:s}=l;if(t&&d){const{length:u,width:f,height:i}=v.transferBox2Kitti(d),b=o===k.Back?[{label:s("Width"),value:f},{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)",pointerEvents:"none"})},b.map((c,n)=>r.createElement("span",{key:n,style:{marginRight:n===0?16:0}},`${c.label}: ${c.value.toFixed(a)}`)))}return null},M=({checkMode:o,config:e,style:t})=>{const d=r.useContext(m),{selectedBox:l}=$(),[s,u]=D([]),f=x(),{t:i,i18n:b}=f,c=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:E}=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:E==null?void 0:E.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=d.mainViewInstance)==null||g.filterPointsByBox(l.info).then(j=>{var w,O;if(!j){u(p);return}p.push({label:i("PointCount"),value:`${(O=(w=l.info)==null?void 0:w.count)!=null?O:0}`}),o===!0&&l.info.subAttribute&&e&&v.getSubAttributeName(l.info.subAttribute,e).forEach(z=>p.push(z)),u(p)})},[l,b.language]),l?r.createElement("div",{style:t||F(B({position:"absolute"},A),{right:8,bottom:8})},s.map(n=>c?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};