@labelbee/lb-components 1.24.0-alpha.50 → 1.24.0-alpha.52

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 (28) hide show
  1. package/dist/_virtual/2DViewWorker.js +1 -1
  2. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  3. package/dist/components/pointCloudView/hooks/useConfig.js +1 -1
  4. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  5. package/dist/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.js +2 -1
  6. package/dist/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -1
  7. package/dist/components/videoAnnotate/videoClipTool/components/videoTrack/index.js +1 -1
  8. package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
  9. package/dist/index.css +20 -6
  10. package/dist/types/components/pointCloudView/hooks/useConfig.d.ts +2 -1
  11. package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +6 -0
  12. package/dist/types/views/MainView/sidebar/VideoClipToolAttributeList/index.d.ts +11 -0
  13. package/dist/views/MainView/sidebar/SwitchAttributeList/index.js +1 -1
  14. package/dist/views/MainView/sidebar/VideoClipToolAttributeList/index.js +1 -0
  15. package/dist/views/MainView/sidebar/index.js +1 -1
  16. package/es/_virtual/2DViewWorker.js +1 -1
  17. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  18. package/es/components/pointCloudView/hooks/useConfig.js +1 -1
  19. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  20. package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.js +2 -1
  21. package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -1
  22. package/es/components/videoAnnotate/videoClipTool/components/videoTrack/index.js +1 -1
  23. package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
  24. package/es/index.css +20 -6
  25. package/es/views/MainView/sidebar/SwitchAttributeList/index.js +1 -1
  26. package/es/views/MainView/sidebar/VideoClipToolAttributeList/index.js +1 -0
  27. package/es/views/MainView/sidebar/index.js +1 -1
  28. package/package.json +3 -3
@@ -1 +1 @@
1
- "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),useUpdatePointCloudColor=require("./hooks/useUpdatePointCloudColor.js"),reactI18next=require("react-i18next"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(a,r,u)=>r in a?__defProp(a,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[r]=u,__spreadValues=(a,r)=>{for(var u in r||(r={}))__hasOwnProp.call(r,u)&&__defNormalProp(a,u,r[u]);if(__getOwnPropSymbols)for(var u of __getOwnPropSymbols(r))__propIsEnum.call(r,u)&&__defNormalProp(a,u,r[u]);return a},__spreadProps=(a,r)=>__defProps(a,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:a,config:r,checkMode:u,configString:x,imgIndex:g,toolInstanceRef:i,setResourceLoading:w,isBatchSetValid:k})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:V,selectNextBox:_,selectPrevBox:E,updateSelectedBox:B,deleteSelectedPointCloudBoxAndPolygon:I}=useSingleBox.useSingleBox(),{selectedSphere:v,updatePointCloudSphere:q}=useSphere.useSphere(),{clearAllResult:b,updatePointCloudPattern:L}=useStatus.useStatus(),{copySelectedBoxes:O,pasteSelectedBoxes:j,copiedBoxes:Y}=useBoxes.useBoxes({config:r,currentData:a}),{updateRotate:C}=useRotate.useRotate({currentData:a}),{updateRotateEdge:A}=useRotateEdge.useRotateEdge({currentData:a}),{updatePointCloudData:d,topViewSelectedChanged:T}=usePointCloudViews.usePointCloudViews({setResourceLoading:w}),{redo:y,undo:h,pushHistoryWithList:D,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:N}=useHistory.useHistory(),{syncThreeViewsAttribute:f}=useAttribute.useAttribute(),{syncAllViewsConfig:K,reRenderTopViewRange:R}=useConfig.useConfig(),{selectedPolygon:m}=usePolygon.usePolygon(),{selectedLine:S}=useLine.useLine(),{t:P}=reactI18next.useTranslation(),{updatePointCloudColor:U}=useUpdatePointCloudColor.useUpdatePointCloudColor(w,r),z=ahooks.useLatest(a),p=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},F=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{C(e.rectRotateSensitivity);break}case"e":C(-Number(e.rectRotateSensitivity));break;case"g":A(-90);break;case"u":{const c=l.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;L(c);const W={[lbAnnotation.EToolName.Polygon]:P("PolygonPattern"),[lbAnnotation.EToolName.Rect]:P("RectPattern")};antd.message.success(P("ChangePatternMsg",{pattern:W[c]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":k?(antd.Modal.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){E();break}_(),o.preventDefault();break;case"f":V();break;case"arrowup":p({y:-1});break;case"arrowdown":p({y:1});break;case"arrowleft":p({x:-1});break;case"arrowright":p({x:1});break;case"delete":I(z.current);break}},M=(t,o)=>{switch(t){case"c":O();break;case"v":j();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?y():h();break}}},G=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||u===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){M(o,t);return}F(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>G.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{K(r)},[x]),React.useEffect(()=>{(r==null?void 0:r.radius)&&R(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{d==null||d()},[g,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[g]),React.useEffect(()=>{i.current.setAttrChangeTrigger=t=>{var o;(o=e.topViewInstance)==null||o.toolInstance.setAttrChangeTrigger(t)},i.current.setDefaultAttribute=t=>{var o;if(f(t),U(t),m&&H(__spreadProps(__spreadValues({},m),{attribute:t})),S&&N(__spreadProps(__spreadValues({},S),{attribute:t})),v){const s=q(__spreadProps(__spreadValues({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),T({newSelectedSphere:v,newSphereList:s}))}},i.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=__spreadProps(__spreadValues({},l),{[t]:o}),B(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},i.current.clearResult=()=>{b==null||b()},i.current.redo=()=>{y()},i.current.undo=()=>{h()},i.current.setValid=t=>{i.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t)})},i.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},i.current.asyncData=t=>{setTimeout(()=>{d==null||d(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{i.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},i.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{i.current.history={pushHistory:t=>{D({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||u)return;const s=c=>{f(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
1
+ "use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useRotateEdge=require("./hooks/useRotateEdge.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),useStatus=require("./hooks/useStatus.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),useUpdatePointCloudColor=require("./hooks/useUpdatePointCloudColor.js"),reactI18next=require("react-i18next"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(a,r,u)=>r in a?__defProp(a,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[r]=u,__spreadValues=(a,r)=>{for(var u in r||(r={}))__hasOwnProp.call(r,u)&&__defNormalProp(a,u,r[u]);if(__getOwnPropSymbols)for(var u of __getOwnPropSymbols(r))__propIsEnum.call(r,u)&&__defNormalProp(a,u,r[u]);return a},__spreadProps=(a,r)=>__defProps(a,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:a,config:r,checkMode:u,configString:x,imgIndex:w,toolInstanceRef:i,setResourceLoading:b,isBatchSetValid:k})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:V,selectNextBox:_,selectPrevBox:E,updateSelectedBox:L,deleteSelectedPointCloudBoxAndPolygon:B}=useSingleBox.useSingleBox(),{selectedSphere:v,updatePointCloudSphere:I}=useSphere.useSphere(),{clearAllResult:C,updatePointCloudPattern:q}=useStatus.useStatus(),{copySelectedBoxes:O,pasteSelectedBoxes:T,copiedBoxes:$}=useBoxes.useBoxes({config:r,currentData:a}),{updateRotate:y}=useRotate.useRotate({currentData:a}),{updateRotateEdge:j}=useRotateEdge.useRotateEdge({currentData:a}),{updatePointCloudData:d,topViewSelectedChanged:A}=usePointCloudViews.usePointCloudViews({setResourceLoading:b}),{redo:h,undo:g,pushHistoryWithList:D,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:N}=useHistory.useHistory(),{syncThreeViewsAttribute:S}=useAttribute.useAttribute(),{syncAllViewsConfig:R,reRenderTopViewRange:K,reRenderTopViewTipScopeList:U}=useConfig.useConfig(),{selectedPolygon:m}=usePolygon.usePolygon(),{selectedLine:f}=useLine.useLine(),{t:P}=reactI18next.useTranslation(),{updatePointCloudColor:z}=useUpdatePointCloudColor.useUpdatePointCloudColor(b,r),F=ahooks.useLatest(a),p=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},M=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{y(e.rectRotateSensitivity);break}case"e":y(-Number(e.rectRotateSensitivity));break;case"g":j(-90);break;case"u":{const c=l.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;q(c);const Y={[lbAnnotation.EToolName.Polygon]:P("PolygonPattern"),[lbAnnotation.EToolName.Rect]:P("RectPattern")};antd.message.success(P("ChangePatternMsg",{pattern:Y[c]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":k?(antd.Modal.destroyAll(),e.setBatchSetValidModal(!e.visibleBatchSetValid)):e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){E();break}_(),o.preventDefault();break;case"f":V();break;case"arrowup":p({y:-1});break;case"arrowdown":p({y:1});break;case"arrowleft":p({x:-1});break;case"arrowright":p({x:1});break;case"delete":B(F.current);break}},G=(t,o)=>{switch(t){case"c":O();break;case"v":T();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?h():g();break}}},W=ahooks.useLatest(t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t)||u===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){G(o,t);return}M(o,t)});return React.useEffect(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>W.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),React.useEffect(()=>{R(r)},[x]),React.useEffect(()=>{(r==null?void 0:r.radius)&&K(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{(r==null?void 0:r.tipScopeList)&&U(r==null?void 0:r.tipScopeList)},[r==null?void 0:r.tipScopeList]),React.useEffect(()=>{d==null||d()},[w,e.mainViewInstance]),React.useEffect(()=>{e.setHideAttributes([])},[w]),React.useEffect(()=>{i.current.setAttrChangeTrigger=t=>{var o;(o=e.topViewInstance)==null||o.toolInstance.setAttrChangeTrigger(t)},i.current.setDefaultAttribute=t=>{var o;if(S(t),z(t),m&&H(__spreadProps(__spreadValues({},m),{attribute:t})),f&&N(__spreadProps(__spreadValues({},f),{attribute:t})),v){const s=I(__spreadProps(__spreadValues({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),A({newSelectedSphere:v,newSphereList:s}))}},i.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=__spreadProps(__spreadValues({},l),{[t]:o}),L(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},i.current.clearResult=()=>{C==null||C()},i.current.redo=()=>{h()},i.current.undo=()=>{g()},i.current.setValid=t=>{i.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t)})},i.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},i.current.asyncData=t=>{setTimeout(()=>{d==null||d(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),React.useEffect(()=>{i.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},i.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),React.useEffect(()=>{i.current.history={pushHistory:t=>{D({pointCloudBoxList:t})},initRecord:()=>{}}},[]),React.useEffect(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||u)return;const s=c=>{S(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../PointCloudContext.js"),React=require("react");const useConfig=()=>{const{topViewInstance:n,sideViewInstance:r,backViewInstance:a,mainViewInstance:i}=React.useContext(PointCloudContext.PointCloudContext);return{syncAllViewsConfig:t=>{[n,r,a].forEach(e=>{var o,l;e==null||e.updateConfig(t);const u=(l=(o=t==null?void 0:t.attributeList)==null?void 0:o[0])==null?void 0:l.value;u&&(e==null||e.pointCloud2dOperation.setDefaultAttribute(u))}),i==null||i.setConfig(t)},reRenderTopViewRange:t=>{var e,o,l;(o=(e=n==null?void 0:n.pointCloudInstance)==null?void 0:e.generateRange)==null||o.call(e,t),(l=n==null?void 0:n.pointCloudInstance)==null||l.render()}}};exports.useConfig=useConfig;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../PointCloudContext.js"),React=require("react");const useConfig=()=>{const{topViewInstance:n,sideViewInstance:r,backViewInstance:d,mainViewInstance:i}=React.useContext(PointCloudContext.PointCloudContext);return{syncAllViewsConfig:o=>{[n,r,d].forEach(e=>{var t,l;e==null||e.updateConfig(o);const u=(l=(t=o==null?void 0:o.attributeList)==null?void 0:t[0])==null?void 0:l.value;u&&(e==null||e.pointCloud2dOperation.setDefaultAttribute(u))}),i==null||i.setConfig(o)},reRenderTopViewRange:o=>{var e,t,l;(t=(e=n==null?void 0:n.pointCloudInstance)==null?void 0:e.generateRange)==null||t.call(e,o),(l=n==null?void 0:n.pointCloudInstance)==null||l.render()},reRenderTopViewTipScopeList:(o=[])=>{var e,t,l;(t=(e=n==null?void 0:n.pointCloudInstance)==null?void 0:e.generateTipScopeList)==null||t.call(e,o),(l=n==null?void 0:n.pointCloudInstance)==null||l.render()}}};exports.useConfig=useConfig;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),_=require("lodash"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,n,t)=>n in o?__defProp(o,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[n]=t,__spreadValues=(o,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(o,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(o,t,n[t]);return o},__spreadProps=(o,n)=>__defProps(o,__getOwnPropDescs(n)),__async=(o,n,t)=>new Promise((a,p)=>{var e=d=>{try{c(t.next(d))}catch(x){p(x)}},P=d=>{try{c(t.throw(d))}catch(x){p(x)}},c=d=>d.done?a(d.value):Promise.resolve(d.value).then(e,P);c((t=t.apply(o,n)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,n,t,a,p)=>{const{x:e,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,n),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:e,y:P,z:c},id:o.id},x=a?__spreadValues(__spreadValues({},a),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},topViewPolygon2PointCloud=(o,n,t,a,p,e)=>{let P=o.pointList.map(w=>lbUtils.PointCloudUtils.transferCanvas2World(w,n)),c=0,d=1,x={};if(t){const w=t.getSensesPointZAxisInPolygon(P,void 0,e);e&&w.fittedCoordinates.length>0&&(P=w.fittedCoordinates),c=(w.maxZ+w.minZ)/2,d=w.maxZ-w.minZ,x={count:w.zCount}}const[f,v,R]=P,I=lbAnnotation.MathUtils.getLineCenterPoint([f,R]),S=lbAnnotation.MathUtils.getLineLength(f,v),V=lbAnnotation.MathUtils.getLineLength(v,R),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);a&&(c=a.center.z,d=a.depth);const T={center:{x:I.x,y:I.y,z:c},width:e?V+INTELLIGENT_FIT_MARGIN:V,height:e?S+INTELLIGENT_FIT_MARGIN:S,depth:d,rotation:k,id:o.id},A=__spreadValues(a?__spreadValues(__spreadValues({},a),T):__spreadProps(__spreadValues({},T),{attribute:"",valid:!0}),x);p&&Object.assign(A,p);const O=P.map(w=>lbUtils.PointCloudUtils.transferWorld2Canvas(w,n));return{boxParams:A,newPointList:O}},sideViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x-a.x,y:t.center.y,z:t.center.z-a.y}})},sideViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A,{newBoxParams:w}=a.getNewBoxBySideUpdate(I,O,k,t);return w},backViewPoint2PointCloud=(o,n,t)=>{const a={x:o.x-n.x,y:o.y-n.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x,y:t.center.y-a.x,z:t.center.z-a.y}})},backViewPolygon2PointCloud=(o,n,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=n.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A;let{newBoxParams:w}=a.getNewBoxByBackUpdate(I,O,k,t);return w},syncSideViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(d);const{point2d:x,zoom:f}=c.getSphereSidePoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},n),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(n.id)},synchronizeSideView=(o,n,t,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxSidePolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncBackViewByPoint=(o,n,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(d);const{point2d:x,zoom:f}=c.getSphereBackPoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},n),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(n.id)},synchronizeBackView=(o,n,t,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxBackPolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:n.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],n.id)},syncTopViewByPoint=(o,n,t,a)=>{if(!t||!a)return;a.generateSphere(o),a.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:p,pointCloudInstance:e}=t,{point2d:P}=e.getSphereTopPoint2DCoordinate(o),c=[...p.pointList].map(d=>d.id===n.id?__spreadProps(__spreadValues(__spreadValues({},n),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);p.setResult(c),p.setSelectedID(n.id)},synchronizeTopView=(o,n,t,a)=>{var p,e;if(!t||!a)return;a.generateBox(o),a.setHighlightColor(o.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=t,{polygon2d:d}=c.getBoxTopPolygon2DCoordinate(o),x=[...P.polygonList],f=x.find(v=>v.id===n.id);f?(f.pointList=d,f.valid=(p=o.valid)!=null?p:!0):x.push({id:n.id,pointList:d,textAttribute:"",isRect:!0,valid:(e=o.valid)!=null?e:!0}),P.setResultAndSelectedID(x,n.id)},usePointCloudViews=o=>{const n=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:a,backViewInstance:p,mainViewInstance:e,addPointCloudBox:P,addPointCloudSphere:c,setSelectedIDs:d,selectedIDs:x,pointCloudBoxList:f,pointCloudSphereList:v,hideAttributes:R,setHighlight2DDataList:I,cuboidBoxIn2DView:S,imageSizes:V,history:k,linkageImageNameRectMap:T}=n,{addHistory:A,initHistory:O,pushHistoryUnderUpdatePolygon:w}=useHistory.useHistory(),{selectedPolygon:ot}=usePolygon.usePolygon(),{getPointCloudSphereByID:nt,updatePointCloudSphere:X,selectedSphere:F}=useSphere.useSphere(),{currentData:E,config:y}=ctx.useSelector(s=>{const{stepList:i,step:u,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:index.jsonParser(StepUtils.getCurrentStepInfo(u,i).config)}}),M=ctx.useDispatch(),it=ahooks.useLatest(S),st=ahooks.useLatest(T),rt=React.useCallback((s,i)=>{const u=st.current,l=i.id;return s.filter(r=>{if(!r)return!1;const h=u.get(r.imageName);return h===void 0?!0:Boolean(h.get(l))})},[]),Z=s=>{const{enableAutoMap2DRect:i=!1}=y;if(!it.current||i){const{mappingImgList:u=[]}=E;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:u,imageSizes:V},{prepareRectsFn:rt})}},{selectedBox:U,updateSelectedBox:lt,updateSelectedBoxes:G,getPointCloudByID:at}=useSingleBox.useSingleBox({generateRects:Z}),Y=U==null?void 0:U.info;if(!t||!a||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:J}=t,dt=s=>{e==null||e.generateSphere(s),e==null||e.controls.update(),e==null||e.render()},ut=({newPoint:s,size:i,zoom:u,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const h=topViewPoint2PointCloud(s,i,J,void 0,r);d(s.id);const C=c(h);H(PointCloudView.Top,s,h,u,C,y),A({newSphereParams:h})},ct=({polygon:s,size:i,imgList:u,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var h,C,b;const D={attribute:(h=t.toolInstance.defaultAttribute)!=null?h:""};l===!0&&Object.assign(D,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:f,extraSphereList:v})}),t==null||t.toolInstance;const L=__spreadValues({},s);let{boxParams:B,newPointList:m}=topViewPolygon2PointCloud(L,i,J,void 0,D,r);B=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(m==null?void 0:m.length)&&(L.pointList=m);const N=R.includes(L.attribute);Z(B);const z=P(B),Q=(C=n==null?void 0:n.polygonList)!=null?C:[];B.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(b=y==null?void 0:y.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(z!=null?z:[],Q,!1),N?d([]):(d(B.id),r&&synchronizeTopView(B,L,t,e)),A({newBoxParams:B})},pt=s=>{const{boxID:i,imageName:u,width:l,height:g,x:r,y:h}=s,C=f.find(m=>m.id===i);if(!(C==null?void 0:C.rects)||!C.rects.find(m=>m.imageName===u))return;const D=C.rects.map(m=>m.imageName===u?__spreadProps(__spreadValues({},m),{width:l,height:g,x:r,y:h}):m),L=__spreadProps(__spreadValues({},C),{rects:D}),B=f.map(m=>m.id===i?L:m);return t==null||t.updatePolygonList(B!=null?B:[]),B},gt=s=>{const{boxID:i,imageName:u}=s,l=f.find(C=>C.id===i);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==u),r=__spreadProps(__spreadValues({},l),{rects:g}),h=f.map(C=>C.id===i?r:C);return t==null||t.updatePolygonList(h!=null?h:[]),h},Pt=({newSelectedBox:s,newPointCloudList:i,newSelectedSphere:u,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(x.length===0||!r)){if(s||(U==null?void 0:U.info)){const h=s!=null?s:U==null?void 0:U.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(x[0]);const C=r.selectedPolygon;if(x.length===1&&h){q({omitView:PointCloudView.Top,polygon:C,boxParams:h,newPointCloudBoxList:i});return}}if((u||F)&&x.length===1){const h=u!=null?u:F;r.setSelectedID(x[0]);const C=r.selectedPoint;h&&H(PointCloudView.Top,C,h,void 0,l,y)}}},K=(s,i,u,l=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{if(Y){let g,r;switch(u){case PointCloudView.Back:g=backViewPolygon2PointCloud;break;case PointCloudView.Side:g=sideViewPolygon2PointCloud;break;default:g=sideViewPolygon2PointCloud;break}if(r=g(s,i,Y,a.pointCloudInstance),e){const{count:L}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:L})}const C=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],b=r.valid!==C.valid;r=C;const D=lt(r);return r=D.find(L=>L.id===r.id),q({omitView:b?void 0:u,polygon:s,boxParams:r,newPointCloudBoxList:D},l),D}},$=(s,i,u)=>{if(F){let l,g;switch(u){case PointCloudView.Back:l=backViewPoint2PointCloud;break;case PointCloudView.Side:l=sideViewPoint2PointCloud;break;default:l=sideViewPoint2PointCloud;break}g=l(s,i,F);const r=X(g);return H(u,s,g,void 0,r,y),r}},Ct=(s,i)=>{$(s,i,PointCloudView.Side)},ft=(s,i)=>{$(s,i,PointCloudView.Back)},ht=(s,i)=>{K(s,i,PointCloudView.Side,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},xt=(s,i)=>{K(s,i,PointCloudView.Back,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},vt=(s,i)=>{const u=nt(s.id),l=topViewPoint2PointCloud(s,i,J,u),g=X(l);H(PointCloudView.Top,s,l,void 0,g,y)},Lt=(s,i)=>{if(ot){const l=__spreadValues({},s[0].newPolygon);l.pointList=l.pointList.map(g=>lbUtils.PointCloudUtils.transferCanvas2World(g,i)),w(l);return}let u=s.map(({newPolygon:l})=>{const g=at(l.id),{boxParams:r}=topViewPolygon2PointCloud(l,i,t.pointCloudInstance,g);return r});if(u=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:u,stepConfig:y,action:"viewUpdateBox"})),u.length===1){const{newPolygon:l}=s[0],g=G(u);q({polygon:l,boxParams:u[0],newPointCloudBoxList:g},ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)}else{const l=G(u);l&&n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,l)}},yt=s=>{var i,u,l,g,r;if(U){const h=Number(s.widthDefault),C=Number(s.depthDefault),b=Number(s.heightDefault),D=U==null?void 0:U.info.trackID,B=((i=t==null?void 0:t.toolInstance)==null?void 0:i.polygonList).find(W=>(W==null?void 0:W.trackID)===D),m={width:(l=(u=t==null?void 0:t.toolInstance)==null?void 0:u.basicImgInfo)==null?void 0:l.width,height:(r=(g=t==null?void 0:t.toolInstance)==null?void 0:g.basicImgInfo)==null?void 0:r.height},j=B.pointList.map(W=>lbUtils.PointCloudUtils.transferCanvas2World(W,m)),N=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(j,b,h),z=N[0],Q=N[2],tt=lbAnnotation.MathUtils.getLineCenterPoint([z,Q]),mt=U.info.center.z-U.info.depth/2,et=__spreadProps(__spreadValues({},U.info),{center:{x:tt.x,y:tt.y,z:mt+C/2},width:h,height:b,depth:C,valid:!0}),Bt=G([et]);q({omitView:PointCloudView["3D"],polygon:B,boxParams:et,newPointCloudBoxList:Bt})}},H=(s,i,u,l,g,r)=>__async(void 0,null,function*(){const h=E==null?void 0:E.url,C={[PointCloudView.Side]:()=>{syncSideViewByPoint(u,i,a,h,r)},[PointCloudView.Back]:()=>{p&&syncBackViewByPoint(u,i,p,h,r)},[PointCloudView.Top]:()=>{syncTopViewByPoint(u,i,t,e)}};Object.keys(C).forEach(b=>{b!==s&&C[b]()}),l&&(e==null||e.updateCameraZoom(l)),dt(u)}),q=(s,i=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{const{omitView:u,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:h}=s,C=E==null?void 0:E.url;h&&n.syncAllViewPointCloudColor(i,h);const b={[PointCloudView.Side]:()=>{synchronizeSideView(g,l,a,C)},[PointCloudView.Back]:()=>{p&&synchronizeBackView(g,l,p,C)},[PointCloudView.Top]:()=>{synchronizeTopView(g,l,t,e)}};Object.keys(b).forEach(D=>{D!==u&&b[D]()}),r&&(e==null||e.updateCameraZoom(r))};return{topViewAddSphere:ut,topViewAddBox:ct,topViewSelectedChanged:Pt,topViewUpdatePoint:vt,sideViewUpdatePoint:Ct,backViewUpdatePoint:ft,topViewUpdateBox:Lt,sideViewUpdateBox:ht,backViewUpdateBox:xt,syncPointCloudViews:q,syncPointCloudPoint:H,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),e==null||e.generateBoxes(s)},initPointCloud3d:s=>{if(!e)return;const i=lbUtils.PointCloudUtils.getDefaultOrthographicParams(s);e.initOrthographicCamera(i),e.initRenderer(),e.render()},updatePointCloudData:(...s)=>__async(void 0,[...s],function*(i=E){var u,l,g,r,h,C,b,D;if(!(i==null?void 0:i.url)||!e)return;I([]),actionCreators.SetAnnotationLoading(M,!0),actionCreators.SetLoadPCDFileLoading(M,!0),(u=o==null?void 0:o.setResourceLoading)==null||u.call(o,!0),yield e.loadPCDFile(i.url,(l=y==null?void 0:y.radius)!=null?l:DEFAULT_RADIUS),e==null||e.clearAllBox(),e==null||e.clearAllSphere();let L=[],B=[],m=[],j=[];e.updateTopCamera();const N=(r=(g=index.jsonParser(i.result))==null?void 0:g.valid)!=null?r:!0;if(n.setPointCloudValid(N),(h=n.sideViewInstance)==null||h.clearAllData(),(C=n.backViewInstance)==null||C.clearAllData(),i.result){if(L=lbUtils.PointCloudUtils.getBoxParamsFromResultList(i.result),(L==null?void 0:L.length)>0&&i.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){L=yield e==null?void 0:e.filterPreResult(i.url,y,L);const z=index.jsonParser(i.result);z[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=L,i.result=JSON.stringify(z),n.setPointCloudResult(L)}m=lbUtils.PointCloudUtils.getPolygonListFromResultList(i.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(i.result),j=lbUtils.PointCloudUtils.getSphereParamsFromResultList(i.result),t.updateData(i.url,i.result,{radius:(b=y==null?void 0:y.radius)!=null?b:DEFAULT_RADIUS}),e==null||e.generateBoxes(L),e==null||e.generateSpheres(j),yield n.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,L,[])}O({pointCloudBoxList:L,polygonList:m,lineList:B,pointCloudSphereList:j}),actionCreators.SetAnnotationLoading(M,!1),actionCreators.SetLoadPCDFileLoading(M,!1),(D=o==null?void 0:o.setResourceLoading)==null||D.call(o,!1)}),updateViewsByDefaultSize:yt,generateRects:Z,update2DViewRect:pt,remove2DViewRect:gt}},useSyncRectPositionDimensionToPointCloudList=()=>{const{pointCloudBoxList:o,rectList:n,setPointCloudResult:t}=React.useContext(PointCloudContext.PointCloudContext),a=ahooks.useLatest(o),p=ahooks.useLatest(n);return{syncToPointCloudBoxList:React.useCallback(()=>{const P=a.current,c=p.current;if(c.length===0)return null;const d=new Map,x=new Set;if(c.filter(f=>f.extId!==void 0).forEach(f=>{const v=f.extId,R=f.imageName,I=_.pick(f,["x","y","width","height"]);let S=d.get(v);S||(S=new Map,d.set(v,S)),S.set(R,I),x.add(v)}),d.size){const f=P.map(v=>{var R;const I=v.id;if(x.has(I)){const S=__spreadValues({},v);return(R=S.rects)==null||R.forEach(V=>{var k;const T=V.imageName;Object.assign(V,(k=d.get(I))==null?void 0:k.get(T))}),S}return v});return t(f),f}return null},[])}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews,exports.useSyncRectPositionDimensionToPointCloudList=useSyncRectPositionDimensionToPointCloudList;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),_=require("lodash"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),ToolPointCloudBoxRenderHelper=require("../../../utils/ToolPointCloudBoxRenderHelper.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,i,t)=>i in o?__defProp(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,__spreadValues=(o,i)=>{for(var t in i||(i={}))__hasOwnProp.call(i,t)&&__defNormalProp(o,t,i[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(i))__propIsEnum.call(i,t)&&__defNormalProp(o,t,i[t]);return o},__spreadProps=(o,i)=>__defProps(o,__getOwnPropDescs(i)),__async=(o,i,t)=>new Promise((a,p)=>{var e=d=>{try{c(t.next(d))}catch(x){p(x)}},P=d=>{try{c(t.throw(d))}catch(x){p(x)}},c=d=>d.done?a(d.value):Promise.resolve(d.value).then(e,P);c((t=t.apply(o,i)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(o,i,t,a,p)=>{const{x:e,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(o,i),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,d={center:{x:e,y:P,z:c},id:o.id},x=a?__spreadValues(__spreadValues({},a),d):__spreadProps(__spreadValues({},d),{attribute:"",valid:!0});return p&&Object.assign(x,p),x},topViewPolygon2PointCloud=(o,i,t,a,p,e)=>{let P=o.pointList.map(w=>lbUtils.PointCloudUtils.transferCanvas2World(w,i)),c=0,d=1,x={};if(t){const w=t.getSensesPointZAxisInPolygon(P,void 0,e);e&&w.fittedCoordinates.length>0&&(P=w.fittedCoordinates),c=(w.maxZ+w.minZ)/2,d=w.maxZ-w.minZ,x={count:w.zCount}}const[f,v,R]=P,I=lbAnnotation.MathUtils.getLineCenterPoint([f,R]),S=lbAnnotation.MathUtils.getLineLength(f,v),V=lbAnnotation.MathUtils.getLineLength(v,R),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(o.pointList);a&&(c=a.center.z,d=a.depth);const T={center:{x:I.x,y:I.y,z:c},width:e?V+INTELLIGENT_FIT_MARGIN:V,height:e?S+INTELLIGENT_FIT_MARGIN:S,depth:d,rotation:k,id:o.id},A=__spreadValues(a?__spreadValues(__spreadValues({},a),T):__spreadProps(__spreadValues({},T),{attribute:"",valid:!0}),x);p&&Object.assign(A,p);const O=P.map(w=>lbUtils.PointCloudUtils.transferWorld2Canvas(w,i));return{boxParams:A,newPointList:O}},sideViewPoint2PointCloud=(o,i,t)=>{const a={x:o.x-i.x,y:o.y-i.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x-a.x,y:t.center.y,z:t.center.z-a.y}})},sideViewPolygon2PointCloud=(o,i,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=i.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A,{newBoxParams:w}=a.getNewBoxBySideUpdate(I,O,k,t);return w},backViewPoint2PointCloud=(o,i,t)=>{const a={x:o.x-i.x,y:o.y-i.y};return __spreadProps(__spreadValues({},t),{center:{x:t.center.x,y:t.center.y-a.x,z:t.center.z-a.y}})},backViewPolygon2PointCloud=(o,i,t,a)=>{const[p,e,P]=o.pointList,[c,d,x]=i.pointList,f=lbAnnotation.MathUtils.getLineCenterPoint([p,P]),v=lbAnnotation.MathUtils.getLineCenterPoint([c,x]),I={x:{x:f.x-v.x,y:f.y-v.y}.x,y:0,z:f.y-v.y},S=lbAnnotation.MathUtils.getLineLength(p,e),V=lbAnnotation.MathUtils.getLineLength(c,d),k=S-V,T=lbAnnotation.MathUtils.getLineLength(e,P),A=lbAnnotation.MathUtils.getLineLength(d,x),O=T-A;let{newBoxParams:w}=a.getNewBoxByBackUpdate(I,O,k,t);return w},syncSideViewByPoint=(o,i,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(d);const{point2d:x,zoom:f}=c.getSphereSidePoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},i),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(i.id)},synchronizeSideView=(o,i,t,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Left);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxSidePolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:i.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],i.id)},syncBackViewByPoint=(o,i,t,a,p)=>{var e;if(!t)return;const{toolInstance:P,pointCloudInstance:c}=t;c.loadPCDFile(a,(e=p==null?void 0:p.radius)!=null?e:DEFAULT_RADIUS);const{cameraPositionVector:d}=c.updateOrthoCameraBySphere(o,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(d);const{point2d:x,zoom:f}=c.getSphereBackPoint2DCoordinate(o);c.camera.zoom=f,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(f),P.setResult([__spreadProps(__spreadValues(__spreadValues({},i),x),{valid:o.valid,textAttribute:"",attribute:o.attribute})]),P.setSelectedID(i.id)},synchronizeBackView=(o,i,t,a)=>{if(!t)return;const{pointCloud2dOperation:p,pointCloudInstance:e}=t;e.loadPCDFileByBox(a,o,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=e.updateOrthoCamera(o,lbUtils.EPerspectiveView.Back);e.setInitCameraPosition(P);const{polygon2d:c,zoom:d}=e.getBoxBackPolygon2DCoordinate(o);e.camera.zoom=d,e.camera.updateProjectionMatrix(),e.render(),p.initPosition(),p.zoomChangeOnCenter(d),p.setResultAndSelectedID([{id:i.id,valid:o.valid,pointList:c,textAttribute:"",isRect:!0,attribute:o.attribute}],i.id)},syncTopViewByPoint=(o,i,t,a)=>{if(!t||!a)return;a.generateSphere(o),a.updateCameraBySphere(o,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:p,pointCloudInstance:e}=t,{point2d:P}=e.getSphereTopPoint2DCoordinate(o),c=[...p.pointList].map(d=>d.id===i.id?__spreadProps(__spreadValues(__spreadValues({},i),P),{valid:o.valid,textAttribute:"",attribute:o.attribute}):d);p.setResult(c),p.setSelectedID(i.id)},synchronizeTopView=(o,i,t,a)=>{var p,e;if(!t||!a)return;a.generateBox(o),a.setHighlightColor(o.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=t,{polygon2d:d}=c.getBoxTopPolygon2DCoordinate(o),x=[...P.polygonList],f=x.find(v=>v.id===i.id);f?(f.pointList=d,f.valid=(p=o.valid)!=null?p:!0):x.push({id:i.id,pointList:d,textAttribute:"",isRect:!0,valid:(e=o.valid)!=null?e:!0}),P.setResultAndSelectedID(x,i.id)},usePointCloudViews=o=>{const i=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:a,backViewInstance:p,mainViewInstance:e,addPointCloudBox:P,addPointCloudSphere:c,setSelectedIDs:d,selectedIDs:x,pointCloudBoxList:f,pointCloudSphereList:v,hideAttributes:R,setHighlight2DDataList:I,cuboidBoxIn2DView:S,imageSizes:V,history:k,linkageImageNameRectMap:T}=i,{addHistory:A,initHistory:O,pushHistoryUnderUpdatePolygon:w}=useHistory.useHistory(),{selectedPolygon:ot}=usePolygon.usePolygon(),{getPointCloudSphereByID:it,updatePointCloudSphere:X,selectedSphere:F}=useSphere.useSphere(),{currentData:E,config:y}=ctx.useSelector(s=>{const{stepList:n,step:u,imgList:l,imgIndex:g}=s.annotation;return{currentData:l[g],config:index.jsonParser(StepUtils.getCurrentStepInfo(u,n).config)}}),M=ctx.useDispatch(),nt=ahooks.useLatest(S),st=ahooks.useLatest(T),rt=React.useCallback((s,n)=>{const u=st.current,l=n.id;return s.filter(r=>{if(!r)return!1;const h=u.get(r.imageName);return h===void 0?!0:Boolean(h.get(l))})},[]),Z=s=>{const{enableAutoMap2DRect:n=!1}=y;if(!nt.current||n){const{mappingImgList:u=[]}=E;index.generatePointCloudBoxRects({pointCloudBox:s,mappingImgList:u,imageSizes:V},{prepareRectsFn:rt})}},{selectedBox:U,updateSelectedBox:lt,updateSelectedBoxes:G,getPointCloudByID:at}=useSingleBox.useSingleBox({generateRects:Z}),Y=U==null?void 0:U.info;if(!t||!a||!p)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:J}=t,dt=s=>{e==null||e.generateSphere(s),e==null||e.controls.update(),e==null||e.render()},ut=({newPoint:s,size:n,zoom:u,trackConfigurable:l})=>{var g;const r={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};l===!0&&Object.assign(r,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const h=topViewPoint2PointCloud(s,n,J,void 0,r);d(s.id);const C=c(h);H(PointCloudView.Top,s,h,u,C,y),A({newSphereParams:h})},ct=({polygon:s,size:n,imgList:u,trackConfigurable:l,zoom:g,intelligentFit:r})=>{var h,C,b;const D={attribute:(h=t.toolInstance.defaultAttribute)!=null?h:""};l===!0&&Object.assign(D,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:f,extraSphereList:v})}),t==null||t.toolInstance;const L=__spreadValues({},s);let{boxParams:B,newPointList:m}=topViewPolygon2PointCloud(L,n,J,void 0,D,r);B=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[B],stepConfig:y,action:"viewUpdateBox"}))[0],r&&(m==null?void 0:m.length)&&(L.pointList=m);const N=R.includes(L.attribute);Z(B);const z=P(B),Q=(C=i==null?void 0:i.polygonList)!=null?C:[];B.subAttribute=lbAnnotation.TagUtils.getDefaultResultByConfig((y==null?void 0:y.secondaryAttributeConfigurable)?(b=y==null?void 0:y.inputList)!=null?b:[]:[]),t==null||t.updatePolygonList(z!=null?z:[],Q,!1),N?d([]):(d(B.id),r&&synchronizeTopView(B,L,t,e)),A({newBoxParams:B})},pt=s=>{const{boxID:n,imageName:u,width:l,height:g,x:r,y:h}=s,C=f.find(m=>m.id===n);if(!(C==null?void 0:C.rects)||!C.rects.find(m=>m.imageName===u))return;const D=C.rects.map(m=>m.imageName===u?__spreadProps(__spreadValues({},m),{width:l,height:g,x:r,y:h}):m),L=__spreadProps(__spreadValues({},C),{rects:D}),B=f.map(m=>m.id===n?L:m);return t==null||t.updatePolygonList(B!=null?B:[]),B},gt=s=>{const{boxID:n,imageName:u}=s,l=f.find(C=>C.id===n);if(!(l==null?void 0:l.rects))return;const g=l.rects.filter(C=>C.imageName!==u),r=__spreadProps(__spreadValues({},l),{rects:g}),h=f.map(C=>C.id===n?r:C);return t==null||t.updatePolygonList(h!=null?h:[]),h},Pt=({newSelectedBox:s,newPointCloudList:n,newSelectedSphere:u,newSphereList:l})=>{var g;const r=t==null?void 0:t.toolInstance;if(!(x.length===0||!r)){if(s||(U==null?void 0:U.info)){const h=s!=null?s:U==null?void 0:U.info;(g=r==null?void 0:r.selection)==null||g.setSelectedIDs(x[0]);const C=r.selectedPolygon;if(x.length===1&&h){q({omitView:PointCloudView.Top,polygon:C,boxParams:h,newPointCloudBoxList:n});return}}if((u||F)&&x.length===1){const h=u!=null?u:F;r.setSelectedID(x[0]);const C=r.selectedPoint;h&&H(PointCloudView.Top,C,h,void 0,l,y)}}},K=(s,n,u,l=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{if(Y){let g,r;switch(u){case PointCloudView.Back:g=backViewPolygon2PointCloud;break;case PointCloudView.Side:g=sideViewPolygon2PointCloud;break;default:g=sideViewPolygon2PointCloud;break}if(r=g(s,n,Y,a.pointCloudInstance),e){const{count:L}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(r).polygonPointList,[r.center.z-r.depth/2,r.center.z+r.depth/2]);r=__spreadProps(__spreadValues({},r),{count:L})}const C=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[r],stepConfig:y,action:"viewUpdateBox"}))[0],b=r.valid!==C.valid;r=C;const D=lt(r);return r=D.find(L=>L.id===r.id),q({omitView:b?void 0:u,polygon:s,boxParams:r,newPointCloudBoxList:D},l),D}},$=(s,n,u)=>{if(F){let l,g;switch(u){case PointCloudView.Back:l=backViewPoint2PointCloud;break;case PointCloudView.Side:l=sideViewPoint2PointCloud;break;default:l=sideViewPoint2PointCloud;break}g=l(s,n,F);const r=X(g);return H(u,s,g,void 0,r,y),r}},Ct=(s,n)=>{$(s,n,PointCloudView.Side)},ft=(s,n)=>{$(s,n,PointCloudView.Back)},ht=(s,n)=>{K(s,n,PointCloudView.Side,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},xt=(s,n)=>{K(s,n,PointCloudView.Back,ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)},vt=(s,n)=>{const u=it(s.id),l=topViewPoint2PointCloud(s,n,J,u),g=X(l);H(PointCloudView.Top,s,l,void 0,g,y)},Lt=(s,n)=>{if(ot){const l=__spreadValues({},s[0].newPolygon);l.pointList=l.pointList.map(g=>lbUtils.PointCloudUtils.transferCanvas2World(g,n)),w(l);return}let u=s.map(({newPolygon:l})=>{const g=at(l.id),{boxParams:r}=topViewPolygon2PointCloud(l,n,t.pointCloudInstance,g);return r});if(u=M(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:u,stepConfig:y,action:"viewUpdateBox"})),u.length===1){const{newPolygon:l}=s[0],g=G(u);q({polygon:l,boxParams:u[0],newPointCloudBoxList:g},ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Single)}else{const l=G(u);l&&i.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.MultiMove,l)}},yt=s=>{var n,u,l,g,r;if(U){const h=Number(s.widthDefault),C=Number(s.depthDefault),b=Number(s.heightDefault),D=U==null?void 0:U.info.trackID,B=((n=t==null?void 0:t.toolInstance)==null?void 0:n.polygonList).find(W=>(W==null?void 0:W.trackID)===D),m={width:(l=(u=t==null?void 0:t.toolInstance)==null?void 0:u.basicImgInfo)==null?void 0:l.width,height:(r=(g=t==null?void 0:t.toolInstance)==null?void 0:g.basicImgInfo)==null?void 0:r.height},j=B.pointList.map(W=>lbUtils.PointCloudUtils.transferCanvas2World(W,m)),N=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(j,b,h),z=N[0],Q=N[2],tt=lbAnnotation.MathUtils.getLineCenterPoint([z,Q]),mt=U.info.center.z-U.info.depth/2,et=__spreadProps(__spreadValues({},U.info),{center:{x:tt.x,y:tt.y,z:mt+C/2},width:h,height:b,depth:C,valid:!0}),Bt=G([et]);q({omitView:PointCloudView["3D"],polygon:B,boxParams:et,newPointCloudBoxList:Bt})}},H=(s,n,u,l,g,r)=>__async(void 0,null,function*(){const h=E==null?void 0:E.url,C={[PointCloudView.Side]:()=>{syncSideViewByPoint(u,n,a,h,r)},[PointCloudView.Back]:()=>{p&&syncBackViewByPoint(u,n,p,h,r)},[PointCloudView.Top]:()=>{syncTopViewByPoint(u,n,t,e)}};Object.keys(C).forEach(b=>{b!==s&&C[b]()}),l&&(e==null||e.updateCameraZoom(l)),dt(u)}),q=(s,n=ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default)=>{const{omitView:u,polygon:l,boxParams:g,zoom:r,newPointCloudBoxList:h}=s,C=E==null?void 0:E.url;h&&i.syncAllViewPointCloudColor(n,h);const b={[PointCloudView.Side]:()=>{synchronizeSideView(g,l,a,C)},[PointCloudView.Back]:()=>{p&&synchronizeBackView(g,l,p,C)},[PointCloudView.Top]:()=>{synchronizeTopView(g,l,t,e)}};Object.keys(b).forEach(D=>{D!==u&&b[D]()}),r&&(e==null||e.updateCameraZoom(r))};return{topViewAddSphere:ut,topViewAddBox:ct,topViewSelectedChanged:Pt,topViewUpdatePoint:vt,sideViewUpdatePoint:Ct,backViewUpdatePoint:ft,topViewUpdateBox:Lt,sideViewUpdateBox:ht,backViewUpdateBox:xt,syncPointCloudViews:q,syncPointCloudPoint:H,pointCloudBoxListUpdated:s=>{t.updatePolygonList(s),e==null||e.generateBoxes(s)},initPointCloud3d:s=>{if(!e)return;const n=lbUtils.PointCloudUtils.getDefaultOrthographicParams(s);e.initOrthographicCamera(n),e.initRenderer(),e.render()},updatePointCloudData:(...s)=>__async(void 0,[...s],function*(n=E){var u,l,g,r,h,C,b,D;if(!(n==null?void 0:n.url)||!e)return;I([]),actionCreators.SetAnnotationLoading(M,!0),actionCreators.SetLoadPCDFileLoading(M,!0),(u=o==null?void 0:o.setResourceLoading)==null||u.call(o,!0),yield e.loadPCDFile(n.url,(l=y==null?void 0:y.radius)!=null?l:DEFAULT_RADIUS,y==null?void 0:y.tipScopeList),e==null||e.clearAllBox(),e==null||e.clearAllSphere();let L=[],B=[],m=[],j=[];e.updateTopCamera();const N=(r=(g=index.jsonParser(n.result))==null?void 0:g.valid)!=null?r:!0;if(i.setPointCloudValid(N),(h=i.sideViewInstance)==null||h.clearAllData(),(C=i.backViewInstance)==null||C.clearAllData(),n.result){if(L=lbUtils.PointCloudUtils.getBoxParamsFromResultList(n.result),(L==null?void 0:L.length)>0&&n.isPreResult&&(y==null?void 0:y.lowerLimitPointsNumInBox)>0){L=yield e==null?void 0:e.filterPreResult(n.url,y,L);const z=index.jsonParser(n.result);z[lbUtils.POINT_CLOUD_DEFAULT_STEP].result=L,n.result=JSON.stringify(z),i.setPointCloudResult(L)}m=lbUtils.PointCloudUtils.getPolygonListFromResultList(n.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(n.result),j=lbUtils.PointCloudUtils.getSphereParamsFromResultList(n.result),t.updateData(n.url,n.result,{radius:(b=y==null?void 0:y.radius)!=null?b:DEFAULT_RADIUS}),e==null||e.generateBoxes(L),e==null||e.generateSpheres(j),yield i.syncAllViewPointCloudColor(ToolPointCloudBoxRenderHelper.EPointCloudBoxRenderTrigger.Default,L,[])}O({pointCloudBoxList:L,polygonList:m,lineList:B,pointCloudSphereList:j}),actionCreators.SetAnnotationLoading(M,!1),actionCreators.SetLoadPCDFileLoading(M,!1),(D=o==null?void 0:o.setResourceLoading)==null||D.call(o,!1)}),updateViewsByDefaultSize:yt,generateRects:Z,update2DViewRect:pt,remove2DViewRect:gt}},useSyncRectPositionDimensionToPointCloudList=()=>{const{pointCloudBoxList:o,rectList:i,setPointCloudResult:t}=React.useContext(PointCloudContext.PointCloudContext),a=ahooks.useLatest(o),p=ahooks.useLatest(i);return{syncToPointCloudBoxList:React.useCallback(()=>{const P=a.current,c=p.current;if(c.length===0)return null;const d=new Map,x=new Set;if(c.filter(f=>f.extId!==void 0).forEach(f=>{const v=f.extId,R=f.imageName,I=_.pick(f,["x","y","width","height"]);let S=d.get(v);S||(S=new Map,d.set(v,S)),S.set(R,I),x.add(v)}),d.size){const f=P.map(v=>{var R;const I=v.id;if(x.has(I)){const S=__spreadValues({},v);return(R=S.rects)==null||R.forEach(V=>{var k;const T=V.imageName;Object.assign(V,(k=d.get(I))==null?void 0:k.get(T))}),S}return v});return t(f),f}return null},[])}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews,exports.useSyncRectPositionDimensionToPointCloudList=useSyncRectPositionDimensionToPointCloudList;
@@ -1 +1,2 @@
1
- "use strict";var index=require("../../../../../utils/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),React=require("react"),reactTransitionGroup=require("react-transition-group"),constant=require("../../constant.js"),index_module=require("./index.module.scss.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__spreadValues=(e,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(e,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(e,i,t[i]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const VideoTimeSlicesOverVideo=e=>{const{attributeList:t,result:i,currentTime:l,extraStyle:u}=e,m=r=>{const{type:a,start:s,end:c}=r;let n=!1;return a===constant.ETimeSliceType.Time?n=lbAnnotation.MathUtils.isInRange(l,[s-.1,s+.1]):n=c===null||lbAnnotation.MathUtils.isInRange(l,[s,c]),n},d=[],o=[];i.forEach(r=>{(m(r)?o:d).push(r)});const p=o.sort((r,a)=>r.start-a.start).map(r=>__spreadProps(__spreadValues({},r),{withinTime:!0})).map(r=>React__default.default.createElement(reactTransitionGroup.CSSTransition,{classNames:"fade",key:r.id,timeout:500},React__default.default.createElement("div",{className:index.classnames({[index_module.timeSliceWrapper]:!0,[index_module.active]:r.withinTime})},React__default.default.createElement("div",{className:index_module.timeSliceItemAttribute,style:{textAlign:"right"}},React__default.default.createElement("span",{style:{backgroundColor:lbAnnotation.AttributeUtils.getAttributeColor(r.attribute,t)}},`${constant.TIME_SLICE_TYPE[r.type]}: ${lbAnnotation.AttributeUtils.getAttributeShowText(r.attribute,t)||"\u65E0\u5C5E\u6027"}`)),r.textAttribute&&React__default.default.createElement("div",{className:index_module.timeSliceItemText},`\u6587\u672C: ${r.textAttribute}`))));return React__default.default.createElement("div",{className:index_module.videoTimeSlices,style:u},React__default.default.createElement(reactTransitionGroup.TransitionGroup,{className:"fade-group"},p))};module.exports=VideoTimeSlicesOverVideo;
1
+ "use strict";var index=require("../../../../../utils/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),React=require("react"),reactTransitionGroup=require("react-transition-group"),constant=require("../../constant.js"),index_module=require("./index.module.scss.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,r,i)=>r in t?__defProp(t,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[r]=i,__spreadValues=(t,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(t,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(t,i,r[i]);return t},__spreadProps=(t,r)=>__defProps(t,__getOwnPropDescs(r));const VideoTimeSlicesOverVideo=t=>{const{attributeList:r,result:i,currentTime:u,extraStyle:m,inputList:o=[]}=t,d=e=>{const{type:a,start:s,end:n}=e;let l=!1;return a===constant.ETimeSliceType.Time?l=lbAnnotation.MathUtils.isInRange(u,[s-.1,s+.1]):l=n===null||lbAnnotation.MathUtils.isInRange(u,[s,n]),l},p=[],c=[];i.forEach(e=>{(d(e)?c:p).push(e)});const f=c.sort((e,a)=>e.start-a.start).map(e=>__spreadProps(__spreadValues({},e),{withinTime:!0})).map(e=>React__default.default.createElement(reactTransitionGroup.CSSTransition,{classNames:"fade",key:e.id,timeout:500},React__default.default.createElement("div",{className:index.classnames({[index_module.timeSliceWrapper]:!0,[index_module.active]:e.withinTime})},React__default.default.createElement("div",{className:index_module.timeSliceItemAttribute,style:{backgroundColor:lbAnnotation.AttributeUtils.getAttributeColor(e.attribute,r)}},`${constant.TIME_SLICE_TYPE[e.type]}: ${lbAnnotation.AttributeUtils.getAttributeShowText(e.attribute,r)||"\u65E0\u5C5E\u6027"}`),(e==null?void 0:e.subAttribute)&&o.length>0&&(()=>{const a=lbAnnotation.TagUtils.getTagNameList(e.subAttribute,o);return a.length>0?React__default.default.createElement("div",{className:index_module.timeSliceItemSubAttribute,style:{backgroundColor:lbAnnotation.AttributeUtils.getAttributeColor(e.attribute,r)}},a.map((s,n)=>React__default.default.createElement("div",{key:n},`${s.keyName}\uFF1A${s.value.join(`
2
+ `)}`))):null})(),e.textAttribute&&React__default.default.createElement("div",{className:index_module.timeSliceItemText},`\u6587\u672C: ${e.textAttribute}`))));return React__default.default.createElement("div",{className:index_module.videoTimeSlices,style:m},React__default.default.createElement(reactTransitionGroup.TransitionGroup,{className:"fade-group"},f))};module.exports=VideoTimeSlicesOverVideo;
@@ -1 +1 @@
1
- "use strict";var styles={videoTimeSlices:"index-module_videoTimeSlices__v-2k1",timeSliceWrapper:"index-module_timeSliceWrapper__kebC3",timeSliceItemText:"index-module_timeSliceItemText__FJFwH",timeSliceItemAttribute:"index-module_timeSliceItemAttribute__--3E1"};module.exports=styles;
1
+ "use strict";var styles={videoTimeSlices:"index-module_videoTimeSlices__v-2k1",timeSliceWrapper:"index-module_timeSliceWrapper__kebC3",timeSliceItemText:"index-module_timeSliceItemText__FJFwH",timeSliceItemAttribute:"index-module_timeSliceItemAttribute__--3E1",timeSliceItemSubAttribute:"index-module_timeSliceItemSubAttribute__MtsgS"};module.exports=styles;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var audio=require("../../../../../utils/audio.js"),lbAnnotation=require("@labelbee/lb-annotation"),icons=require("@ant-design/icons"),React=require("react"),index$1=require("../resizableSnippet/index.js"),constant=require("../../constant.js"),ToolTipForClip=require("../ToolTipForClip.js"),index_module=require("./index.module.scss.js"),utils=require("../../../../videoPlayer/utils.js"),VideoClipToolContext=require("../../VideoClipToolContext.js"),index=require("../../../../videoPlayer/index.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,a,e)=>a in r?__defProp(r,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[a]=e,__spreadValues=(r,a)=>{for(var e in a||(a={}))__hasOwnProp.call(a,e)&&__defNormalProp(r,e,a[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(a))__propIsEnum.call(a,e)&&__defNormalProp(r,e,a[e]);return r},__spreadProps=(r,a)=>__defProps(r,__getOwnPropDescs(a));const getDisplayContent=(r,a)=>{const{t:e}=reactI18next.useTranslation(),{attribute:u,textAttribute:n}=r;return[lbAnnotation.AttributeUtils.getAttributeShowText(u,a)||e("NoAttribute"),n?`${e("textTool")}: ${n}`:""].filter(m=>m).join("\uFF0C")},sortTrack=(r,a)=>{const e=(r||[]).filter(n=>n).map(()=>[]);r.forEach(n=>{if(n.id!==a){const l=e.findIndex(m=>{const i=n.start,s=n.end;return m.every(p=>{const v=[p.start,p.end],d=[i,s];return!lbAnnotation.MathUtils.isInRange(i,v)&&!lbAnnotation.MathUtils.isInRange(s,v)&&!lbAnnotation.MathUtils.isInRange(p.start,d)&&!lbAnnotation.MathUtils.isInRange(p.end,d)})});l>-1&&e[l].push(n)}});const u=fillArrayLen(e.filter(n=>n.length>0));return u==null?void 0:u.map(n=>({data:n,id:utils.hashCode(n==null?void 0:n.map(l=>l.id).join("_"))}))},fillArrayLen=(r,a=2)=>{let e=r;return e.length-a<0&&(e=e.concat(Array.from({length:a-e.length}))),e},VideoTrack=r=>{var a;const{currentTime:e,readonly:u,onTrackResizeStart:n}=r,{result:l,selectedAttribute:m,attributeList:i,selectedID:s,clipStatus:p,contextToCancel:v}=React.useContext(VideoClipToolContext.VideoClipToolContext),{duration:d}=React.useContext(index.VideoPlayerCtx),y=React.useRef(null),k=e/d,T=(t,o=4)=>`${utils.decimalReserved(t*100,o)}%`,x=t=>{if(t){const o=lbAnnotation.AttributeUtils.getAttributeColor(t.attribute,i),f=Math.max((t.end||e)-t.start,0)/d,c={backgroundColor:o,left:T(t.start/d,2),width:T(t.end?Math.max(f,.001):f,2),position:"absolute",borderRadius:5};return t.type===constant.ETimeSliceType.Time&&(delete c.width,delete c.backgroundColor,c.top="50%",c.transform="translate(-50%)",c.color=o),c}return{}},b=lbAnnotation.AttributeUtils.getAttributeColor(m,i),g=((a=y.current)==null?void 0:a.clientWidth)||0,C=utils.decimalReserved(Math.max(g*k,0),0),E=utils.decimalReserved(Math.min(C,Math.floor(g-68)),0),_=t=>{if(t)return t.type===constant.ETimeSliceType.Time?React__default.default.createElement(ToolTipForClip,{slot:React__default.default.createElement(icons.EnvironmentFilled,{style:x(t)}),item:__spreadProps(__spreadValues({},t),{end:t.end===null?e:t.end}),attributeList:i}):React__default.default.createElement(index$1,{track:t,currentTime:e,style:x(t),onResize:(o,f)=>r.onTrackResize(t.id,o,f),onTrackResizeStart:n,onClipping:p===constant.EClipStatus.Clipping,isSelected:t.id===s,readonly:u,attributeList:i})},P=React.useMemo(()=>{const t=sortTrack(l,s);return t==null?void 0:t.map((o,f)=>{var c;return React__default.default.createElement("div",{className:index_module.track,key:(o==null?void 0:o.id)||f},(c=o.data)==null?void 0:c.map(h=>_(h)))})},[l,s,d,JSON.stringify(i)]),j=React.useMemo(()=>{const t=l.find(o=>(o==null?void 0:o.id)===s);return s&&t?React__default.default.createElement("div",{className:index_module.track,key:t==null?void 0:t.id},_(t)):null},[l,s,d,e,JSON.stringify(i)]);return React__default.default.createElement("div",{className:index_module.videoTrackContainer,ref:y,onContextMenu:v},React__default.default.createElement("div",{className:index_module.timeTrack}),React__default.default.createElement("div",{className:index_module.videoTrack},j,P),React__default.default.createElement("div",{className:index_module.timeline,style:{transform:`translate3d(${C}px, 0px, 0px)`,backgroundColor:b}}),React__default.default.createElement("div",{className:index_module.displayTime,style:{backgroundColor:b,transform:`translateX(${E}px, 0px, 0px)`}},audio.timeFormat(e)))};var VideoTrack$1=VideoTrack;exports.default=VideoTrack$1,exports.getDisplayContent=getDisplayContent;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var audio=require("../../../../../utils/audio.js"),lbAnnotation=require("@labelbee/lb-annotation"),icons=require("@ant-design/icons"),React=require("react"),index$1=require("../resizableSnippet/index.js"),constant=require("../../constant.js"),ToolTipForClip=require("../ToolTipForClip.js"),index_module=require("./index.module.scss.js"),utils=require("../../../../videoPlayer/utils.js"),VideoClipToolContext=require("../../VideoClipToolContext.js"),index=require("../../../../videoPlayer/index.js"),reactI18next=require("react-i18next");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,a,e)=>a in r?__defProp(r,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[a]=e,__spreadValues=(r,a)=>{for(var e in a||(a={}))__hasOwnProp.call(a,e)&&__defNormalProp(r,e,a[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(a))__propIsEnum.call(a,e)&&__defNormalProp(r,e,a[e]);return r},__spreadProps=(r,a)=>__defProps(r,__getOwnPropDescs(a));const getDisplayContent=(r,a)=>{const{t:e}=reactI18next.useTranslation(),{attribute:u,textAttribute:n}=r;return[lbAnnotation.AttributeUtils.getAttributeShowText(u,a)||e("NoAttribute"),n?`${e("textTool")}: ${n}`:""].filter(m=>m).join("\uFF0C")},sortTrack=(r,a)=>{const e=(r||[]).filter(n=>n).map(()=>[]);r.forEach(n=>{if(n.id!==a){const l=e.findIndex(m=>{const i=n.start,s=n.end;return m.every(p=>{const v=[p.start,p.end],d=[i,s];return!lbAnnotation.MathUtils.isInRange(i,v)&&!lbAnnotation.MathUtils.isInRange(s,v)&&!lbAnnotation.MathUtils.isInRange(p.start,d)&&!lbAnnotation.MathUtils.isInRange(p.end,d)})});l>-1&&e[l].push(n)}});const u=fillArrayLen(e.filter(n=>n.length>0));return u==null?void 0:u.map(n=>({data:n,id:utils.hashCode(n==null?void 0:n.map(l=>l.id).join("_"))}))},fillArrayLen=(r,a=2)=>{let e=r;return e.length-a<0&&(e=e.concat(Array.from({length:a-e.length}))),e},VideoTrack=r=>{var a;const{currentTime:e,readonly:u,onTrackResizeStart:n}=r,{result:l,selectedAttribute:m,attributeList:i,selectedID:s,clipStatus:p,contextToCancel:v}=React.useContext(VideoClipToolContext.VideoClipToolContext),{duration:d}=React.useContext(index.VideoPlayerCtx),T=React.useRef(null),k=e/d,g=(t,o=4)=>`${utils.decimalReserved(t*100,o)}%`,x=t=>{if(t){const o=lbAnnotation.AttributeUtils.getAttributeColor(t.attribute,i),f=Math.max((t.end||e)-t.start,0)/d,c={backgroundColor:o,left:g(t.start/d,2),width:g(t.end?Math.max(f,.001):f,2),position:"absolute",borderRadius:5};return t.type===constant.ETimeSliceType.Time&&(delete c.width,delete c.backgroundColor,c.top="50%",c.transform="translate(-50%)",c.color=o),c}return{}},b=lbAnnotation.AttributeUtils.getAttributeColor(m,i),C=((a=T.current)==null?void 0:a.clientWidth)||0,_=utils.decimalReserved(Math.max(C*k,0),0),E=utils.decimalReserved(Math.min(_,Math.floor(C-68)),0),h=t=>{if(t)return t.type===constant.ETimeSliceType.Time?React__default.default.createElement(ToolTipForClip,{slot:React__default.default.createElement(icons.EnvironmentFilled,{style:x(t)}),item:__spreadProps(__spreadValues({},t),{end:t.end===null?e:t.end}),attributeList:i}):React__default.default.createElement(index$1,{track:t,currentTime:e,style:x(t),onResize:(o,f)=>r.onTrackResize(t.id,o,f),onTrackResizeStart:n,onClipping:p===constant.EClipStatus.Clipping,isSelected:t.id===s,readonly:u,attributeList:i})},P=React.useMemo(()=>{const t=sortTrack(l,s);return t==null?void 0:t.map((o,f)=>{var c;return React__default.default.createElement("div",{className:index_module.track,key:(o==null?void 0:o.id)||f},(c=o.data)==null?void 0:c.map((y,R)=>React__default.default.createElement(React__default.default.Fragment,{key:(y==null?void 0:y.id)||`${o==null?void 0:o.id}_${R}`},h(y))))})},[l,s,d,JSON.stringify(i)]),O=React.useMemo(()=>{const t=l.find(o=>(o==null?void 0:o.id)===s);return s&&t?React__default.default.createElement("div",{className:index_module.track,key:t==null?void 0:t.id},h(t)):null},[l,s,d,e,JSON.stringify(i)]);return React__default.default.createElement("div",{className:index_module.videoTrackContainer,ref:T,onContextMenu:v},React__default.default.createElement("div",{className:index_module.timeTrack}),React__default.default.createElement("div",{className:index_module.videoTrack},O,P),React__default.default.createElement("div",{className:index_module.timeline,style:{transform:`translate3d(${_}px, 0px, 0px)`,backgroundColor:b}}),React__default.default.createElement("div",{className:index_module.displayTime,style:{backgroundColor:b,transform:`translateX(${E}px, 0px, 0px)`}},audio.timeFormat(e)))};var VideoTrack$1=VideoTrack;exports.default=VideoTrack$1,exports.getDisplayContent=getDisplayContent;
@@ -1 +1 @@
1
- "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index$2=require("../../../utils/index.js"),audio=require("../../../utils/audio.js"),antd=require("antd"),_=require("lodash"),React=require("react"),index_module=require("./index.module.scss.js"),VideoClipToolContext=require("./VideoClipToolContext.js"),constant=require("./constant.js"),index=require("../../videoPlayer/index.js"),index$1=require("./components/videoTimeSlicesOverVideo/index.js"),icon_videoCutting=require("../../../assets/annotation/video/icon_videoCutting.svg.js"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(S){return S&&typeof S=="object"&&"default"in S?S:{default:S}}var ___default=_interopDefaultLegacy(_),React__default=_interopDefaultLegacy(React);class VideoClipTool extends React__default.default.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=___default.default.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar"),this.emitEvent("updateTextAttribute"),this.emitEvent("changeAttributeSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:a,start:n,type:l}=this.state.result[this.selectedSliceIndex],u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[0,audio.precisionMinus(l===constant.ETimeSliceType.Time?s:a,constant.PER_SLICE_CHANGE)]);this.updateSelectedSliceTimeProperty(u,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],a=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===constant.ETimeSliceType.Time){antd.message.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:n,start:l}=s,u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[audio.precisionAdd(l,constant.PER_SLICE_CHANGE),a]);this.updateSelectedSliceTimeProperty(u,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:___default.default.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-constant.PER_SLICE_CHANGE);break;case"=":this.updateSelectedSliceTimeStartByPer(constant.PER_SLICE_CHANGE);break;case"[":this.updateSelectedSliceTimeEndByPer(-constant.PER_SLICE_CHANGE);break;case"]":this.updateSelectedSliceTimeEndByPer(constant.PER_SLICE_CHANGE);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===constant.EClipStatus.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==constant.EClipStatus.Clipping)return;const s=t.findIndex(a=>a.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:constant.EClipStatus.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i;if(typeof((e=this.props)==null?void 0:e.annotationBefore)=="function"){(i=this.props)==null||i.annotationBefore(()=>this.setClipResult(t));return}this.setClipResult(t)},this.setClipResult=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:n}=this.state,l=a!==constant.EClipStatus.Clipping;let u=l?constant.EClipStatus.Clipping:constant.EClipStatus.Stop,{result:d,selectedID:o,textValue:p}=this.state;const c=___default.default.cloneDeep(d),h=t||((e=this.videoPlayer)==null?void 0:e.currentTime),v=(i=this.videoPlayer)==null?void 0:i.duration;if(v===void 0||h===void 0)return;const C=utils.decimalReserved(h,2);if(l){const f=lbAnnotation.uuid();o=f,c.push({start:C,end:null,attribute:n,textAttribute:this.defaultTextAttribute,duration:v,id:f,type:constant.ETimeSliceType.Period}),p=this.defaultTextAttribute}else{const f=c.findIndex(g=>g.id===o),m=c[f];m&&(h-m.start<constant.SLICE_MIN_TIME?(c.splice(f,1),antd.message.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${constant.SLICE_MIN_TIME}s`),u=constant.EClipStatus.Stop,o="",p=""):(c[f].end=utils.decimalReserved(h,2),(s=this.videoPlayer)==null||s.pause(),antd.message.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:u,result:c,selectedID:o,textValue:p}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:n,selectedID:l}=this.state,u=lbAnnotation.uuid(),d=___default.default.cloneDeep(a),o=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:o,end:o,attribute:n,textAttribute:this.defaultTextAttribute,id:u,type:constant.ETimeSliceType.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const p={result:d,selectedID:u,textValue:this.defaultTextAttribute},c=d.find(h=>h.id===l);this.isClipping&&c?(delete p.selectedID,delete p.textValue,antd.message.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(p),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===constant.EClipStatus.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,a;const{result:n}=this.state,l=n.find(u=>u.id===t);if(l){const u=l.duration,d=e==="left",o=d?"start":"end",p=d?-u*i:u*i,c=d?[0,Math.max(((s=l.end)!=null?s:0)-constant.SLICE_MIN_TIME,0)]:[l.start+constant.SLICE_MIN_TIME,u],h=lbAnnotation.MathUtils.withinRange(p+((a=l==null?void 0:l[o])!=null?a:0),c);l[o]=h,this.throttledUpdateTime(h)}this.setState({result:[...n]}),this.updateSidebar()},this.renderMediaContent=()=>{var t;const{pageForward:e,pageJump:i,pageBackward:s}=this.props,{result:a,videoError:n,valid:l,currentTime:u}=this.state;return React__default.default.createElement("div",{className:index_module.clipContainer},React__default.default.createElement(index.VideoPlayer,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:s,pageForward:e,pageJump:i,valid:l,setVideoRef:d=>{this.videoPlayer=d},showVideoTrack:!n,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),React__default.default.createElement(index$1,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:a,currentTime:u,attributeList:this.props.config.attributeList,extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&React__default.default.createElement("i",{className:index_module.clipping,style:{backgroundImage:icon_videoCutting}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute,currentTime:t.start}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(a=>a.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const n=index$2.jsonParser(s[i].result)[`step_${this.stepInfo().step}`],l=(n==null?void 0:n.result)||[],u=audio.isImageValue(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:constant.EClipStatus.Stop,valid:u},()=>{this.updateSidebar(),u||antd.message.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(a=>a.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.textChange=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:constant.EClipStatus.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===constant.EClipStatus.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return lbAnnotation.AttributeUtils.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedID(){return this.state.selectedID}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}get config(){var r;return index$2.jsonParser((r=this.props.stepInfo)==null?void 0:r.config)}get selectedText(){var r,t;return(t=(r=this.state.result)==null?void 0:r[this.selectedSliceIndex])==null?void 0:t.textAttribute}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return React__default.default.createElement(VideoClipToolContext.VideoClipToolContextProvider,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}module.exports=VideoClipTool;
1
+ "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index$2=require("../../../utils/index.js"),audio=require("../../../utils/audio.js"),antd=require("antd"),_=require("lodash"),React=require("react"),index_module=require("./index.module.scss.js"),VideoClipToolContext=require("./VideoClipToolContext.js"),constant=require("./constant.js"),index=require("../../videoPlayer/index.js"),index$1=require("./components/videoTimeSlicesOverVideo/index.js"),icon_videoCutting=require("../../../assets/annotation/video/icon_videoCutting.svg.js"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(S){return S&&typeof S=="object"&&"default"in S?S:{default:S}}var ___default=_interopDefaultLegacy(_),React__default=_interopDefaultLegacy(React);class VideoClipTool extends React__default.default.Component{constructor(r){super(r);this.fns=new Map,this.throttledUpdateTime=___default.default.throttle(t=>{this.videoPlayer.currentTime=t},100,{trailing:!0}),this.stepInfo=()=>this.props.stepInfo,this.emitEvent=t=>{const e=this.fns.get(t);e&&e.forEach(i=>{i&&i()})},this.setValid=t=>{this.setState({valid:t}),t===!1&&(this.clearResult(),this.updateSidebar())},this.updateSidebar=()=>{this.emitEvent("changeClipSidebar"),this.emitEvent("updateTextAttribute"),this.emitEvent("changeAttributeSidebar")},this.exportData=()=>{var t,e;const i=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0;return[this.state.result.filter(s=>s.end!==null),{valid:this.state.valid,duration:i}]},this.updateSelectedSliceTimeStartByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,{end:a,start:n,type:l}=this.state.result[this.selectedSliceIndex],u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[0,audio.precisionMinus(l===constant.ETimeSliceType.Time?s:a,constant.PER_SLICE_CHANGE)]);this.updateSelectedSliceTimeProperty(u,"start")}},this.updateSelectedSliceTimeEndByPer=t=>{var e,i;if(this.state.clipStatus===constant.EClipStatus.Clipping){antd.message.info("\u622A\u53D6\u4E2D\u4E0D\u652F\u6301\u8C03\u6574\u7ED3\u675F\u65F6\u95F4");return}if(this.selectedSliceIndex>-1){const s=this.state.result[this.selectedSliceIndex],a=(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0;if(s.type===constant.ETimeSliceType.Time){antd.message.info("\u65F6\u95F4\u70B9\u4EC5\u652F\u6301\u8C03\u6574\u5F00\u59CB\u65F6\u95F4");return}const{end:n,start:l}=s,u=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(n,t),[audio.precisionAdd(l,constant.PER_SLICE_CHANGE),a]);this.updateSelectedSliceTimeProperty(u,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:___default.default.cloneDeep(i)}),this.updateSidebar()}},this.keyDownEvents=t=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(t))return;const e=t.target;switch(e&&(e==null?void 0:e.tag)==="INPUT"&&(e==null?void 0:e.type)==="radio"&&t.preventDefault(),t.key.toLocaleLowerCase()){case"x":this.toggleClipStatus();break;case"e":this.addTime();break;case"escape":this.cancelClipped();break;case"-":this.updateSelectedSliceTimeStartByPer(-constant.PER_SLICE_CHANGE);break;case"=":this.updateSelectedSliceTimeStartByPer(constant.PER_SLICE_CHANGE);break;case"[":this.updateSelectedSliceTimeEndByPer(-constant.PER_SLICE_CHANGE);break;case"]":this.updateSelectedSliceTimeEndByPer(constant.PER_SLICE_CHANGE);break}},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===constant.EClipStatus.Clipping&&this.toggleClipStatus(i)}this.setState({videoError:t,loading:!1})},this.clearResult=()=>{this.setState({result:[],selectedID:"",textValue:""}),this.updateSidebar()},this.cancelClipped=()=>{const{result:t,selectedID:e,clipStatus:i}=this.state;if(i!==constant.EClipStatus.Clipping)return;const s=t.findIndex(a=>a.id===e);s>-1&&(t.splice(s,1),this.setState({result:t,selectedID:"",clipStatus:constant.EClipStatus.Stop}),this.updateSidebar())},this.toggleClipStatus=t=>{var e,i;if(typeof((e=this.props)==null?void 0:e.annotationBefore)=="function"){(i=this.props)==null||i.annotationBefore(()=>this.setClipResult(t));return}this.setClipResult(t)},this.setClipResult=t=>{var e,i,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:n}=this.state,l=a!==constant.EClipStatus.Clipping;let u=l?constant.EClipStatus.Clipping:constant.EClipStatus.Stop,{result:d,selectedID:o,textValue:c}=this.state;const p=___default.default.cloneDeep(d),h=t||((e=this.videoPlayer)==null?void 0:e.currentTime),v=(i=this.videoPlayer)==null?void 0:i.duration;if(v===void 0||h===void 0)return;const b=utils.decimalReserved(h,2);if(l){const f=lbAnnotation.uuid();o=f,p.push({start:b,end:null,attribute:n,textAttribute:this.defaultTextAttribute,duration:v,id:f,type:constant.ETimeSliceType.Period,subAttribute:{}}),c=this.defaultTextAttribute}else{const f=p.findIndex(m=>m.id===o),g=p[f];g&&(h-g.start<constant.SLICE_MIN_TIME?(p.splice(f,1),antd.message.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${constant.SLICE_MIN_TIME}s`),u=constant.EClipStatus.Stop,o="",c=""):(p[f].end=utils.decimalReserved(h,2),(s=this.videoPlayer)==null||s.pause(),antd.message.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${d.length}`)))}this.setState({clipStatus:u,result:p,selectedID:o,textValue:c}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:n,selectedID:l}=this.state,u=lbAnnotation.uuid(),d=___default.default.cloneDeep(a),o=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;d.push({start:o,end:o,attribute:n,textAttribute:this.defaultTextAttribute,id:u,type:constant.ETimeSliceType.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0,subAttribute:{}});const c={result:d,selectedID:u,textValue:this.defaultTextAttribute},p=d.find(h=>h.id===l);this.isClipping&&p?(delete c.selectedID,delete c.textValue,antd.message.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${d.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(c),this.updateSidebar()},this.updateCurrentTime=t=>{this.setState({currentTime:t})},this.contextToCancel=t=>{this.state.clipStatus===constant.EClipStatus.Stop&&(t.preventDefault(),this.setState({selectedID:""}),this.updateSidebar())},this.onTrackResize=(t,e,i)=>{var s,a;const{result:n}=this.state,l=n.find(u=>u.id===t);if(l){const u=l.duration,d=e==="left",o=d?"start":"end",c=d?-u*i:u*i,p=d?[0,Math.max(((s=l.end)!=null?s:0)-constant.SLICE_MIN_TIME,0)]:[l.start+constant.SLICE_MIN_TIME,u],h=lbAnnotation.MathUtils.withinRange(c+((a=l==null?void 0:l[o])!=null?a:0),p);l[o]=h,this.throttledUpdateTime(h)}this.setState({result:[...n]}),this.updateSidebar()},this.renderMediaContent=()=>{var t,e,i;const{pageForward:s,pageJump:a,pageBackward:n}=this.props,{result:l,videoError:u,valid:d,currentTime:o}=this.state;return React__default.default.createElement("div",{className:index_module.clipContainer},React__default.default.createElement(index.VideoPlayer,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:n,pageForward:s,pageJump:a,valid:d,setVideoRef:c=>{this.videoPlayer=c},showVideoTrack:!u,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded,toggleClipStatus:this.toggleClipStatus,addTime:this.addTime,updateCurrentTime:this.updateCurrentTime}),React__default.default.createElement(index$1,{key:(t=this.videoPlayer)==null?void 0:t.currentTime,result:l,currentTime:o,attributeList:this.props.config.attributeList,inputList:(i=(e=this.props.config)==null?void 0:e.inputList)!=null?i:[],extraStyle:{top:this.props.drawLayerSlot?40:0}}),this.isClipping&&React__default.default.createElement("i",{className:index_module.clipping,style:{backgroundImage:icon_videoCutting}}))},this.onSelectedTimeSlice=t=>{var e;this.isClipping||(this.setState({selectedID:t.id,selectedAttribute:t.attribute,textValue:t.textAttribute,currentTime:t.start}),this.updateSidebar(),(e=this.videoPlayer)==null||e.pause(),this.videoPlayer.currentTime=t.start)},this.removeTimeSlice=t=>{const{result:e}=this.state,i=this.state.selectedID===t.id?"":this.state.selectedID,s=e.findIndex(a=>a.id===t.id);s>-1&&(e.splice(s,1),this.setState({result:[...e],selectedID:i}),this.updateSidebar())},this.setResult=(t=!0,e=this.props)=>{try{const{imgIndex:i,imgList:s}=e;if(!s[i])return;const n=index$2.jsonParser(s[i].result)[`step_${this.stepInfo().step}`],l=(n==null?void 0:n.result)||[],u=audio.isImageValue(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:constant.EClipStatus.Stop,valid:u},()=>{this.updateSidebar(),u||antd.message.info("\u65E0\u6548\u89C6\u9891\uFF0C\u8BF7\u8DF3\u8FC7")})}catch(i){console.error("\u6570\u636E\u89E3\u6790\u5931\u8D25"),this.setState({result:[],loading:!1,selectedID:"",textValue:"",selectedAttribute:"",valid:!0},()=>{this.updateSidebar()})}},this.setDefaultAttribute=t=>{const{result:e,selectedID:i}=this.state,s=e.find(a=>a.id===i);s&&i&&(s.attribute=t),this.setState({selectedAttribute:t,result:[...e]}),this.updateSidebar()},this.setSubAttribute=(t,e)=>{const{result:i,selectedID:s}=this.state;if(s){const a=i.find(n=>n.id===s);a&&(a.subAttribute||(a.subAttribute={}),a.subAttribute[t]=e,this.setState({result:[...i]}),this.updateSidebar())}},this.textChange=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus:constant.EClipStatus.Stop,selectedID:"",loading:!1,videoError:!1,remainingTime:0,currentTime:0,configLoading:!1,valid:!0}}get videoUrl(){var r;const{imgIndex:t,imgList:e}=this.props;return((r=e[t])==null?void 0:r.url)||""}get isClipping(){return this.state.clipStatus===constant.EClipStatus.Clipping}get resultJSON(){const{imgIndex:r,imgList:t}=this.props;return t.length===0||!t[r]?"[]":t[r].result}get disabled(){return!this.state.valid||this.state.videoError}get loading(){return this.state.loading||this.state.configLoading}get defaultTextAttribute(){return lbAnnotation.AttributeUtils.getTextAttribute(this.state.result,this.props.config.textCheckType)}get defaultAttribute(){return this.state.selectedAttribute}get selectedID(){return this.state.selectedID}get selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}get config(){var r;return index$2.jsonParser((r=this.props.stepInfo)==null?void 0:r.config)}get selectedText(){var r,t;return(t=(r=this.state.result)==null?void 0:r[this.selectedSliceIndex])==null?void 0:t.textAttribute}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return React__default.default.createElement(VideoClipToolContext.VideoClipToolContextProvider,{value:{videoPlayer:this.videoPlayer,result:t,selectedID:r,attributeList:this.props.config.attributeList,clipStatus:e,selectedAttribute:i,contextToCancel:this.contextToCancel}},this.renderMediaContent())}}module.exports=VideoClipTool;
package/dist/index.css CHANGED
@@ -521,14 +521,28 @@
521
521
  word-break: break-all;
522
522
  }
523
523
  .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemText__FJFwH {
524
- background-color: #CCC;
524
+ width: 100%;
525
525
  padding: 8px 24px;
526
+ background-color: #ccc;
526
527
  }
527
- .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemAttribute__--3E1 span {
528
- display: inline-block;
529
- height: 40px;
530
- line-height: 40px;
531
- padding: 0 24px;
528
+ .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemAttribute__--3E1 {
529
+ width: 100%;
530
+ padding: 8px 24px;
531
+ text-align: left;
532
+ }
533
+ .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemSubAttribute__MtsgS {
534
+ font-size: 14px;
535
+ color: #fff;
536
+ padding: 8px 24px;
537
+ word-break: break-all;
538
+ line-height: 1.5;
539
+ width: 100%;
540
+ }
541
+ .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemSubAttribute__MtsgS div {
542
+ margin-bottom: 4px;
543
+ }
544
+ .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemSubAttribute__MtsgS div:last-child {
545
+ margin-bottom: 0;
532
546
  }
533
547
  .index-module_speedControllerWrap__aFz7r {
534
548
  display: flex;
@@ -1,5 +1,6 @@
1
- import { IPointCloudConfig } from '@labelbee/lb-utils';
1
+ import { IPointCloudConfig, ITipScopeParams } from '@labelbee/lb-utils';
2
2
  export declare const useConfig: () => {
3
3
  syncAllViewsConfig: (config: IPointCloudConfig) => void;
4
4
  reRenderTopViewRange: (radius: number) => void;
5
+ reRenderTopViewTipScopeList: (tipScopeList?: ITipScopeParams[]) => void;
5
6
  };
@@ -127,6 +127,12 @@ declare class VideoClipTool extends React.Component<IVideoClipProps, IState> {
127
127
  * @param attribute
128
128
  */
129
129
  setDefaultAttribute: (attribute: string) => void;
130
+ /**
131
+ * Set the sub attributes of the currently selected segment
132
+ * @param key subAttribute key
133
+ * @param value subAttribute value
134
+ */
135
+ setSubAttribute: (key: string, value: string) => void;
130
136
  /**
131
137
  * 设置当前选中片段的文本
132
138
  * @param textValue
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { GraphToolInstance } from 'src/store/annotation/types';
3
+ import { IStepInfo } from '@/types/step';
4
+ interface IProps {
5
+ toolInstance?: GraphToolInstance;
6
+ stepInfo?: IStepInfo;
7
+ }
8
+ declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
9
+ children?: React.ReactNode;
10
+ }, "toolInstance" | "stepInfo">>;
11
+ export default _default;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),reactRedux=require("react-redux"),index$1=require("../../../../components/attributeList/index.js"),StepUtils=require("../../../../utils/StepUtils.js"),index=require("../../../../utils/index.js"),reactI18next=require("react-i18next"),ToolType=require("../../../../data/enums/ToolType.js"),ctx=require("../../../../store/ctx.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const SwitchAttributeList=t=>{var i;const[s,l]=React.useState(0),o=React.useRef(null),{toolInstance:e}=t,{t:f}=reactI18next.useTranslation(),b=r=>{e==null||e.setAttributeLockList(r)};if(React.useEffect(()=>(e&&e.singleOn("changeAttributeSidebar",r=>{var a;l(n=>n+1),!!o.current&&((a=o.current.children[r])==null||a.scrollIntoView({block:"center"}))}),()=>{e==null||e.unbindAll("changeAttributeSidebar")}),[e,o]),!t.stepInfo)return null;const u=index.jsonParser(t.stepInfo.config),c=t.stepInfo.tool===ToolType.EToolName.ScribbleTool;if(u.attributeConfigurable!==!0&&!c)return null;if((u.attributeConfigurable===!0||c)&&(u==null?void 0:u.attributeList)){const r=u.attributeList.map(n=>({label:n.key,value:n.value,color:n==null?void 0:n.color}));c||r.unshift({label:f("NoAttribute"),value:""});const a=n=>{e&&(e.setDefaultAttribute(n),l(d=>d+1))};return React__default.default.createElement(index$1.default,{list:r,attributeChanged:a,selectedAttribute:(i=e==null?void 0:e.defaultAttribute)!=null?i:"",ref:o,attributeLockChange:b})}return null},mapStateToProps=t=>{var i,s;const l=StepUtils.getCurrentStepInfo((i=t.annotation)==null?void 0:i.step,(s=t.annotation)==null?void 0:s.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:l}};var SwitchAttributeList$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(SwitchAttributeList);module.exports=SwitchAttributeList$1;
1
+ "use strict";var React=require("react"),reactRedux=require("react-redux"),index$1=require("../../../../components/attributeList/index.js"),StepUtils=require("../../../../utils/StepUtils.js"),index=require("../../../../utils/index.js"),reactI18next=require("react-i18next"),ToolType=require("../../../../data/enums/ToolType.js"),ctx=require("../../../../store/ctx.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const SwitchAttributeList=t=>{var i;const[s,o]=React.useState(0),l=React.useRef(null),{toolInstance:e}=t,{t:b}=reactI18next.useTranslation(),d=n=>{e==null||e.setAttributeLockList(n)};if(React.useEffect(()=>(e&&e.singleOn("changeAttributeSidebar",n=>{var a;o(f=>f+1),!!l.current&&((a=l.current.children[n])==null||a.scrollIntoView({block:"center"}))}),()=>{e==null||e.unbindAll("changeAttributeSidebar")}),[e,l]),!t.stepInfo)return null;const u=index.jsonParser(t.stepInfo.config),c=t.stepInfo.tool===ToolType.EToolName.ScribbleTool;if(u.attributeConfigurable!==!0&&!c)return null;if((u.attributeConfigurable===!0||c)&&(u==null?void 0:u.attributeList)){const n=u.attributeList.map(r=>({label:r.key,value:r.value,color:r==null?void 0:r.color}));c||n.unshift({label:b("NoAttribute"),value:""});const a=r=>{e&&(e.setDefaultAttribute(r),o(v=>v+1))},f=(i=e==null?void 0:e.defaultAttribute)!=null?i:"";return React__default.default.createElement(index$1.default,{list:n,attributeChanged:a,selectedAttribute:f,ref:l,attributeLockChange:d})}return null},mapStateToProps=t=>{var i,s;const o=StepUtils.getCurrentStepInfo((i=t.annotation)==null?void 0:i.step,(s=t.annotation)==null?void 0:s.stepList);return{toolInstance:t.annotation.toolInstance,stepInfo:o}};var SwitchAttributeList$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(SwitchAttributeList);module.exports=SwitchAttributeList$1;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),reactRedux=require("react-redux"),index$1=require("../../../../components/attributeList/index.js"),StepUtils=require("../../../../utils/StepUtils.js"),index=require("../../../../utils/index.js"),reactI18next=require("react-i18next"),ctx=require("../../../../store/ctx.js"),index$2=require("../../../../components/subAttributeList/index.js"),antd=require("antd");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const VideoClipToolAttributeList=n=>{var i,l;const[v,d]=React.useState(0),o=React.useRef(null),{toolInstance:t}=n,{t:p}=reactI18next.useTranslation(),r=n.stepInfo?index.jsonParser(n.stepInfo.config):{},A=(i=t==null?void 0:t.defaultAttribute)!=null?i:"",a=t==null?void 0:t.exportContext,s=a==null?void 0:a.selectedID,b=a==null?void 0:a.result,x=(l=r==null?void 0:r.inputList)!=null?l:[],c=React.useMemo(()=>{if(s&&b)return b.find(e=>e.id===s)},[s,b]),L=e=>{t==null||t.setAttributeLockList(e)};if(React.useEffect(()=>(t&&t.singleOn("changeAttributeSidebar",e=>{var u;d(f=>f+1),!!o.current&&((u=o.current.children[e])==null||u.scrollIntoView({block:"center"}))}),()=>{t==null||t.unbindAll("changeAttributeSidebar")}),[t,o]),!n.stepInfo||r.attributeConfigurable!==!0||!(r==null?void 0:r.attributeList))return null;const g=r.attributeList.map(e=>({label:e.key,value:e.value,color:e==null?void 0:e.color}));g.unshift({label:p("NoAttribute"),value:""});const m=e=>{t&&(t.setDefaultAttribute(e),d(u=>u+1))},S=(e,u)=>{t&&t.setSubAttribute&&(t.setSubAttribute(e,u),d(f=>f+1))},h=e=>{if(c==null?void 0:c.subAttribute)return c.subAttribute[e.value]},I=A&&s&&c&&x.length>0&&(r==null?void 0:r.secondaryAttributeConfigurable)===!0;return React__default.default.createElement("div",{style:{height:0,flex:1,overflowY:"auto",overflowX:"hidden"}},React__default.default.createElement(index$1.default,{list:g,attributeChanged:m,selectedAttribute:A,ref:o,attributeLockChange:L}),I&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Divider,{style:{margin:0}}),React__default.default.createElement(index$2,{subAttributeList:x,setSubAttribute:S,getValue:h,lang:"cn"})))},mapStateToProps=n=>{var i,l;const v=StepUtils.getCurrentStepInfo((i=n.annotation)==null?void 0:i.step,(l=n.annotation)==null?void 0:l.stepList);return{toolInstance:n.annotation.toolInstance,stepInfo:v}};var VideoClipToolAttributeList$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(VideoClipToolAttributeList);module.exports=VideoClipToolAttributeList$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("../../../constant/index.js"),ToolType=require("../../../data/enums/ToolType.js"),StepUtils=require("../../../utils/StepUtils.js"),es=require("antd/es"),React=require("react"),reactI18next=require("react-i18next"),index$9=require("./AnnotationText/index.js"),index$2=require("./ClearIcon/index.js"),index$7=require("./GeneralOperation/index.js"),index$3=require("./ImgAttributeInfo/index.js"),index$8=require("./SwitchAttributeList/index.js"),index$1=require("./TagSidebar/index.js"),index$4=require("./TextToolSidebar/index.js"),index$6=require("./PointCloudToolSidebar/index.js"),index$f=require("./ToolStyle/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$a=require("./ScribbleSidebar/index.js"),ToolIcons=require("./ToolIcons.js"),ctx=require("../../../store/ctx.js"),antd=require("antd"),index$5=require("../../../utils/index.js"),icon_menu_fold=require("../../../assets/annotation/common/icon_menu_fold.svg.js"),index$c=require("../../../components/LLMToolView/sidebar/index.js"),index$d=require("../../../components/LLMMultiWheelView/sidebar/index.js"),index$e=require("./NLPSidebar/index.js"),index$b=require("../../../components/videoAnnotate/videoClipTool/components/annotatedList/index.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React);const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,{Panel}=es.Collapse,sidebarCls=`${index.prefix}-sidebar`,Sidebar=({sider:t,enableColorPicker:N,setSiderWidth:u,propsSiderWidth:h,checkMode:o,setBatchSetValid:$})=>{const s=ctx.useSelector(a=>StepUtils.getCurrentStepInfo(a.annotation.step,a.annotation.stepList)),[i,S]=React.useState(!0),e=s==null?void 0:s.tool,{t:c}=reactI18next.useTranslation();if(!e)return null;const g=a=>{const r=React__default.default.createElement(index$f,null);return React__default.default.createElement(Panel,{header:c("Style"),className:"panel",key:a},r)},f=React__default.default.createElement(ToolIcons.ToolIcons,{toolName:e,onChange:()=>{}}),l=React__default.default.createElement(index$8,null),m=React__default.default.createElement(index$9,null),x=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},g("1")),p=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},React__default.default.createElement(Panel,{header:React__default.default.createElement("div",null,c("Adjust"),React__default.default.createElement(index$2,null)),className:"panel",key:"imgAttribute"},React__default.default.createElement(index$3,null))),n=React__default.default.createElement(index$7.default,null),_=React__default.default.createElement(index$1.default,null),q=a=>React__default.default.createElement(index$4.default,{disabled:a}),E=React__default.default.createElement(index$a,{onChange:(a,r)=>{}}),v=React__default.default.createElement(index$b,null),b=React__default.default.createElement(index$c.default,{checkMode:o}),y=React__default.default.createElement(index$d,{checkMode:o}),T=React__default.default.createElement(index$e.default,{checkMode:o}),d=React__default.default.createElement("div",{className:`${sidebarCls}__horizontal`}),C=React__default.default.createElement(index$6.default,{enableColorPicker:N}),j=React__default.default.createElement(index$7.PointCloudOperation,{setBatchSetValid:$});if(t)return typeof t=="function"?React__default.default.createElement("div",{className:`${sidebarCls}`},t({toolIcon:f,attributeList:l,annotationText:m,toolStyle:x,imageAttributeInfo:p,operation:n,tagToolSideBar:_,textToolSideBar:q,horizontal:d,pointCloudToolSidebar:C,pointCloudOperation:j,scribbleSidebar:E,LLMSidebar:b,LLMMultiWheelSidebar:y,videoClipSidebar:v,NLPSidebar:T})):t;if([ToolType.EToolName.Rect,ToolType.EToolName.Point,ToolType.EToolName.Line,ToolType.EToolName.Rect,ToolType.EToolName.Polygon,ToolType.EToolName.Cuboid].includes(e))return React__default.default.createElement("div",{className:`${sidebarCls}`},f,d,l,m,d,React__default.default.createElement("div",{className:`${sidebarCls}__content`},x,p),n);if(e===ToolType.EToolName.Tag)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$1.default,null));if(e===EVideoToolName.VideoClipTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},v,l),n);if(e===EVideoToolName.VideoTagTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$1.default,null)),n);if(e===EVideoToolName.VideoTextTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$4.default,null));if(e===ToolType.EToolName.Text)return React__default.default.createElement("div",{className:`${sidebarCls}`},"s",React__default.default.createElement(index$4.default,null));if(e===EPointCloudName.PointCloud){const a=()=>{S(!i),u&&u(i?48:void 0)},r=React__default.default.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},React__default.default.createElement("span",{onClick:()=>a()},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:icon_menu_fold})));return i?React__default.default.createElement(antd.Tabs,{type:"card",activeKey:"1",className:index$5.classnames({[`${sidebarCls}`]:!0,[`${sidebarCls}__pointCloud`]:!0}),tabBarExtraContent:{left:React__default.default.createElement("span",{onClick:()=>a(),style:{padding:"0px 4px"}},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:icon_menu_fold}))}},React__default.default.createElement(antd.Tabs.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$6.default,null)),React__default.default.createElement(index$7.PointCloudOperation,null))):r}return e===ToolType.EToolName.ScribbleTool?React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},E,l),n):e===ToolType.EToolName.LLM?b:e===ToolType.EToolName.NLP?T:null};exports.default=Sidebar,exports.sidebarCls=sidebarCls;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("../../../constant/index.js"),ToolType=require("../../../data/enums/ToolType.js"),StepUtils=require("../../../utils/StepUtils.js"),es=require("antd/es"),React=require("react"),reactI18next=require("react-i18next"),index$a=require("./AnnotationText/index.js"),index$2=require("./ClearIcon/index.js"),index$7=require("./GeneralOperation/index.js"),index$3=require("./ImgAttributeInfo/index.js"),index$8=require("./SwitchAttributeList/index.js"),index$1=require("./TagSidebar/index.js"),index$4=require("./TextToolSidebar/index.js"),index$6=require("./PointCloudToolSidebar/index.js"),index$g=require("./ToolStyle/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$b=require("./ScribbleSidebar/index.js"),ToolIcons=require("./ToolIcons.js"),ctx=require("../../../store/ctx.js"),antd=require("antd"),index$5=require("../../../utils/index.js"),icon_menu_fold=require("../../../assets/annotation/common/icon_menu_fold.svg.js"),index$d=require("../../../components/LLMToolView/sidebar/index.js"),index$e=require("../../../components/LLMMultiWheelView/sidebar/index.js"),index$f=require("./NLPSidebar/index.js"),index$c=require("../../../components/videoAnnotate/videoClipTool/components/annotatedList/index.js"),index$9=require("./VideoClipToolAttributeList/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,{Panel}=es.Collapse,sidebarCls=`${index.prefix}-sidebar`,getAttributeListComponent=e=>{var l;return e&&(l={[EVideoToolName.VideoClipTool]:React__default.default.createElement(index$9,null)}[e])!=null?l:React__default.default.createElement(index$8,null)},Sidebar=({sider:e,enableColorPicker:l,setSiderWidth:i,propsSiderWidth:h,checkMode:d,setBatchSetValid:$})=>{const c=ctx.useSelector(a=>StepUtils.getCurrentStepInfo(a.annotation.step,a.annotation.stepList)),[u,S]=React.useState(!0),t=c==null?void 0:c.tool,{t:f}=reactI18next.useTranslation();if(!t)return null;const g=a=>{const o=React__default.default.createElement(index$g,null);return React__default.default.createElement(Panel,{header:f("Style"),className:"panel",key:a},o)},m=React__default.default.createElement(ToolIcons.ToolIcons,{toolName:t,onChange:()=>{}}),r=getAttributeListComponent(t),p=React__default.default.createElement(index$a,null),x=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},g("1")),E=React__default.default.createElement(es.Collapse,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${sidebarCls}__content`,expandIcon:index$1.expandIconFuc},React__default.default.createElement(Panel,{header:React__default.default.createElement("div",null,f("Adjust"),React__default.default.createElement(index$2,null)),className:"panel",key:"imgAttribute"},React__default.default.createElement(index$3,null))),n=React__default.default.createElement(index$7.default,null),C=React__default.default.createElement(index$1.default,null),_=a=>React__default.default.createElement(index$4.default,{disabled:a}),v=React__default.default.createElement(index$b,{onChange:(a,o)=>{}}),b=React__default.default.createElement(index$c,null),T=React__default.default.createElement(index$d.default,{checkMode:d}),q=React__default.default.createElement(index$e,{checkMode:d}),N=React__default.default.createElement(index$f.default,{checkMode:d}),s=React__default.default.createElement("div",{className:`${sidebarCls}__horizontal`}),j=React__default.default.createElement(index$6.default,{enableColorPicker:l}),y=React__default.default.createElement(index$7.PointCloudOperation,{setBatchSetValid:$});if(e)return typeof e=="function"?React__default.default.createElement("div",{className:`${sidebarCls}`},e({toolIcon:m,attributeList:r,annotationText:p,toolStyle:x,imageAttributeInfo:E,operation:n,tagToolSideBar:C,textToolSideBar:_,horizontal:s,pointCloudToolSidebar:j,pointCloudOperation:y,scribbleSidebar:v,LLMSidebar:T,LLMMultiWheelSidebar:q,videoClipSidebar:b,NLPSidebar:N})):e;if([ToolType.EToolName.Rect,ToolType.EToolName.Point,ToolType.EToolName.Line,ToolType.EToolName.Rect,ToolType.EToolName.Polygon,ToolType.EToolName.Cuboid].includes(t))return React__default.default.createElement("div",{className:`${sidebarCls}`},m,s,r,p,s,React__default.default.createElement("div",{className:`${sidebarCls}__content`},x,E),n);if(t===ToolType.EToolName.Tag)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$1.default,null));if(t===EVideoToolName.VideoClipTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},b,r),n);if(t===EVideoToolName.VideoTagTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$1.default,null)),n);if(t===EVideoToolName.VideoTextTool)return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement(index$4.default,null));if(t===ToolType.EToolName.Text)return React__default.default.createElement("div",{className:`${sidebarCls}`},"s",React__default.default.createElement(index$4.default,null));if(t===EPointCloudName.PointCloud){const a=()=>{S(!u),i&&i(u?48:void 0)},o=React__default.default.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},React__default.default.createElement("span",{onClick:()=>a()},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:icon_menu_fold})));return u?React__default.default.createElement(antd.Tabs,{type:"card",activeKey:"1",className:index$5.classnames({[`${sidebarCls}`]:!0,[`${sidebarCls}__pointCloud`]:!0}),tabBarExtraContent:{left:React__default.default.createElement("span",{onClick:()=>a(),style:{padding:"0px 4px"}},React__default.default.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:icon_menu_fold}))}},React__default.default.createElement(antd.Tabs.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},React__default.default.createElement("div",{className:`${sidebarCls}__content`},React__default.default.createElement(index$6.default,null)),React__default.default.createElement(index$7.PointCloudOperation,null))):o}return t===ToolType.EToolName.ScribbleTool?React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},v,r),n):t===ToolType.EToolName.LLM?T:t===ToolType.EToolName.NLP?N:null};exports.default=Sidebar,exports.sidebarCls=sidebarCls;