@labelbee/lb-components 1.21.0 → 1.22.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/components/AnnotationView/index.js +1 -1
  2. package/dist/components/LLMToolView/questionView/components/imgView/index.js +1 -1
  3. package/dist/components/LLMToolView/questionView/index.js +1 -1
  4. package/dist/components/measureCanvas/index.js +1 -0
  5. package/dist/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  6. package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
  7. package/dist/components/pointCloudView/index.js +1 -1
  8. package/dist/components/videoAnnotate/index.js +1 -1
  9. package/dist/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js +1 -1
  10. package/dist/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -1
  11. package/dist/components/videoAnnotate/videoClipTool/index.js +1 -1
  12. package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  13. package/dist/components/videoAnnotate/videoTextTool/index.js +1 -1
  14. package/dist/components/videoPlayer/components/controller/index.js +1 -1
  15. package/dist/components/videoPlayer/index.js +1 -1
  16. package/dist/index.css +8 -9
  17. package/dist/index.js +1 -1
  18. package/dist/store/annotation/reducer.js +1 -1
  19. package/dist/types/components/AnnotationView/index.d.ts +1 -0
  20. package/dist/types/components/measureCanvas/index.d.ts +18 -0
  21. package/dist/types/components/pointCloudView/PointCloud2DSingleView.d.ts +2 -1
  22. package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +2 -1
  23. package/dist/types/components/pointCloudView/hooks/useRotate.d.ts +1 -0
  24. package/dist/types/components/pointCloudView/index.d.ts +1 -0
  25. package/dist/types/components/videoAnnotate/index.d.ts +2 -1
  26. package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +7 -2
  27. package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +9 -3
  28. package/dist/types/components/videoAnnotate/videoTextTool/index.d.ts +10 -7
  29. package/dist/types/components/videoPlayer/index.d.ts +2 -1
  30. package/dist/types/index.d.ts +2 -1
  31. package/dist/types/views/MainView/index.d.ts +1 -0
  32. package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +1 -0
  33. package/dist/views/MainView/index.js +1 -1
  34. package/dist/views/MainView/sidebar/AnnotationText/index.js +1 -1
  35. package/dist/views/MainView/sidebar/SwitchAttributeList/index.js +1 -1
  36. package/dist/views/MainView/sidebar/TagSidebar/index.js +1 -1
  37. package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  38. package/dist/views/MainView/sidebar/index.js +1 -1
  39. package/es/components/AnnotationView/index.js +1 -1
  40. package/es/components/LLMToolView/questionView/components/imgView/index.js +1 -1
  41. package/es/components/LLMToolView/questionView/index.js +1 -1
  42. package/es/components/measureCanvas/index.js +1 -0
  43. package/es/components/pointCloudView/PointCloud2DSingleView.js +1 -1
  44. package/es/components/pointCloudView/PointCloud2DView.js +1 -1
  45. package/es/components/pointCloudView/index.js +1 -1
  46. package/es/components/videoAnnotate/index.js +1 -1
  47. package/es/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js +1 -1
  48. package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -1
  49. package/es/components/videoAnnotate/videoClipTool/index.js +1 -1
  50. package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
  51. package/es/components/videoAnnotate/videoTextTool/index.js +1 -1
  52. package/es/components/videoPlayer/components/controller/index.js +1 -1
  53. package/es/components/videoPlayer/index.js +1 -1
  54. package/es/index.css +8 -9
  55. package/es/index.js +1 -1
  56. package/es/store/annotation/reducer.js +1 -1
  57. package/es/views/MainView/index.js +1 -1
  58. package/es/views/MainView/sidebar/AnnotationText/index.js +1 -1
  59. package/es/views/MainView/sidebar/SwitchAttributeList/index.js +1 -1
  60. package/es/views/MainView/sidebar/TagSidebar/index.js +1 -1
  61. package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
  62. package/es/views/MainView/sidebar/index.js +1 -1
  63. package/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,a)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,__spreadValues=(e,n)=>{for(var a in n||(n={}))__hasOwnProp.call(n,a)&&__defNormalProp(e,a,n[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(n))__propIsEnum.call(n,a)&&__defNormalProp(e,a,n[a]);return e};const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const n=__spreadValues({},e);return n.width||(n.width=DEFAULT_SIZE.width),n.height||(n.height=DEFAULT_SIZE.height),n},AnnotationView=(e,n)=>{var a,_;const{src:m,annotations:c=[],style:w={stroke:"blue",thickness:3},zoomChange:f,backgroundStyle:b={},onChange:d,showLoading:y=!1,globalStyle:I,afterImgOnLoad:R}=e,h=sizeInitialized(e.size),[O,v]=React.useState(!1),g=React.useRef(null),r=React.useRef(),p=useRefCache(R),l=React.useRef([]),s=React.useRef(!0);React.useImperativeHandle(n,()=>{const t=r.current;return t?{zoomIn:()=>t.zoomChanged(!0),zoomOut:()=>t.zoomChanged(!1),initImgPos:()=>t.initImgPos(),toolInstance:t}:{}},[r.current]),React.useEffect(()=>(g.current&&(r.current=new lbAnnotation.ViewOperation({container:g.current,size:h,style:w,annotations:c,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode}),r.current.init()),()=>{var t;(t=r.current)==null||t.destroy()}),[]),React.useEffect(()=>{var t;r.current&&(v(!0),(t=r.current)==null||t.setLoading(!0),lbAnnotation.ImgUtils.load(m).then(i=>{var o,u;(o=r.current)==null||o.setLoading(!1),v(!1),(u=r.current)==null||u.setImgNode(i),p.current&&p.current(i)}).catch(()=>{var i;(i=r.current)==null||i.setLoading(!1),v(!1)}))},[m]),React.useEffect(()=>{if(s.current===!1){l.current.push(c);return}const t=()=>{s.current=!0,l.current=[]},i=()=>{var o;const u=l.current.length;if(u>0){const E=l.current[u-1];l.current=[],(o=r.current)==null||o.updateData(E).then(i).catch(t)}else s.current=!0};r.current&&(s.current=!1,r.current.updateData(c).then(i).catch(t))},[c]),React.useEffect(()=>{const t=r.current;(t==null?void 0:t.setSize)&&(t.setSize(h),t.initPosition())},[(a=e.size)==null?void 0:a.width,(_=e.size)==null?void 0:_.height]),React.useEffect(()=>{var t,i;return r.current&&((t=r.current)==null||t.on("onChange",(...o)=>{d==null||d.apply(null,o)}),(i=r.current)==null||i.on("renderZoom",o=>{f&&f(o)})),()=>{var o,u;(o=r.current)==null||o.unbindAll("onChange"),(u=r.current)==null||u.unbindAll("renderZoom")}},[f,d]);const z=React__default.default.createElement("div",{ref:g,style:__spreadValues(__spreadValues({position:"relative"},h),b)});return React__default.default.createElement(es.Spin,{spinning:y||O,delay:300,style:I},z)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
1
+ "use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index=require("../measureCanvas/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,a)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,__spreadValues=(e,r)=>{for(var a in r||(r={}))__hasOwnProp.call(r,a)&&__defNormalProp(e,a,r[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(r))__propIsEnum.call(r,a)&&__defNormalProp(e,a,r[a]);return e};const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const r=__spreadValues({},e);return r.width||(r.width=DEFAULT_SIZE.width),r.height||(r.height=DEFAULT_SIZE.height),r},AnnotationView=(e,r)=>{var a,_;const{src:p,annotations:c=[],style:y={stroke:"blue",thickness:3},zoomChange:d,backgroundStyle:I={},onChange:v,showLoading:R=!1,globalStyle:z,afterImgOnLoad:O,measureVisible:h}=e,s=sizeInitialized(e.size),[E,g]=React.useState(!1),m=React.useRef(null),n=React.useRef(),w=useRefCache(O),l=React.useRef([]),f=React.useRef(!0);React.useImperativeHandle(r,()=>{const t=n.current;return t?{zoomIn:()=>t.zoomChanged(!0),zoomOut:()=>t.zoomChanged(!1),initImgPos:()=>t.initImgPos(),toolInstance:t}:{}},[n.current]),React.useEffect(()=>(m.current&&(n.current=new lbAnnotation.ViewOperation({container:m.current,size:s,style:y,annotations:c,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode}),n.current.init()),()=>{var t;(t=n.current)==null||t.destroy()}),[h]),React.useEffect(()=>{var t;n.current&&(g(!0),(t=n.current)==null||t.setLoading(!0),lbAnnotation.ImgUtils.load(p).then(i=>{var o,u;(o=n.current)==null||o.setLoading(!1),g(!1),(u=n.current)==null||u.setImgNode(i),w.current&&w.current(i)}).catch(()=>{var i;(i=n.current)==null||i.setLoading(!1),g(!1)}))},[p,h]),React.useEffect(()=>{if(f.current===!1){l.current.push(c);return}const t=()=>{f.current=!0,l.current=[]},i=()=>{var o;const u=l.current.length;if(u>0){const L=l.current[u-1];l.current=[],(o=n.current)==null||o.updateData(L).then(i).catch(t)}else f.current=!0};n.current&&(f.current=!1,n.current.updateData(c).then(i).catch(t))},[c]),React.useEffect(()=>{const t=n.current;(t==null?void 0:t.setSize)&&(t.setSize(s),t.initPosition())},[(a=e.size)==null?void 0:a.width,(_=e.size)==null?void 0:_.height]),React.useEffect(()=>{var t,i;return n.current&&((t=n.current)==null||t.on("onChange",(...o)=>{v==null||v.apply(null,o)}),(i=n.current)==null||i.on("renderZoom",o=>{d&&d(o)})),()=>{var o,u;(o=n.current)==null||o.unbindAll("onChange"),(u=n.current)==null||u.unbindAll("renderZoom")}},[d,v]);const P=React__default.default.createElement("div",{ref:m,style:__spreadValues(__spreadValues({position:"relative"},s),I)}),{imgNode:b,zoom:S,currentPos:C}=n.current||{};return React__default.default.createElement(es.Spin,{spinning:R||E,delay:300,style:z},h&&b?React__default.default.createElement(index,{size:s,imgNode:b,zoom:S,currentPos:C}):P)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),antd=require("antd"),index=require("../../../../../constant/index.js"),classNames=require("classnames"),imgFail_cn=require("../../../../../assets/annotation/LLMTool/imgFail_cn.svg.js"),imgFail_en=require("../../../../../assets/annotation/LLMTool/imgFail_en.svg.js"),lbUtils=require("@labelbee/lb-utils"),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),classNames__default=_interopDefaultLegacy(classNames);const LLMViewCls=`${index.prefix}-LLMView`,ImgView=e=>{const{answerList:t,hoverKey:r}=e,l=lbUtils.i18n.language==="en"?imgFail_en:imgFail_cn;return React__default.default.createElement("div",{className:index_module.imgView},t.map((a,s)=>React__default.default.createElement("div",{key:s,className:index_module.item},React__default.default.createElement(antd.Tag,{className:`${LLMViewCls}__tag`},a==null?void 0:a.order),React__default.default.createElement("div",{className:classNames__default.default({[`${index_module.image}`]:!0,[`${LLMViewCls}__contentActive`]:r===(a==null?void 0:a.order)})},React__default.default.createElement(antd.Image,{src:a==null?void 0:a.url,fallback:l})))))};module.exports=ImgView;
1
+ "use strict";var React=require("react"),antd=require("antd"),index=require("../../../../../constant/index.js"),classNames=require("classnames"),imgFail_cn=require("../../../../../assets/annotation/LLMTool/imgFail_cn.svg.js"),imgFail_en=require("../../../../../assets/annotation/LLMTool/imgFail_en.svg.js"),lbUtils=require("@labelbee/lb-utils"),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),classNames__default=_interopDefaultLegacy(classNames);const LLMViewCls=`${index.prefix}-LLMView`,ImgView=e=>{const{answerList:t,hoverKey:r}=e,l=lbUtils.i18n.language==="en"?imgFail_en:imgFail_cn;return React__default.default.createElement("div",{className:index_module.imgView},t.map((a,s)=>React__default.default.createElement("div",{key:s,className:index_module.item},React__default.default.createElement(antd.Tag,{className:`${LLMViewCls}-tag`},a==null?void 0:a.order),React__default.default.createElement("div",{className:classNames__default.default({[`${index_module.image}`]:!0,[`${LLMViewCls}__contentActive`]:r===(a==null?void 0:a.order)})},React__default.default.createElement(antd.Image,{src:a==null?void 0:a.url,fallback:l})))))};module.exports=ImgView;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),index=require("../../../constant/index.js"),classNames=require("classnames"),reactI18next=require("react-i18next"),lbUtils=require("@labelbee/lb-utils"),index$4=require("../../markdownView/index.js"),index$1=require("../modelAPIView/index.js"),index$5=require("../../diffMatchPatchComponent/index.js"),index$2=require("./components/header/index.js"),index$3=require("./components/imgView/index.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e};const LLMViewCls=`${index.prefix}-LLMView`,RenderAnswer=({i:e,dataFormatType:t,isTextControl:r})=>{var l;return t===index.EDataFormatType.Markdown?React__default.default.createElement(index$4,{value:(l=e==null?void 0:e.newAnswer)!=null?l:e==null?void 0:e.answer}):r?React__default.default.createElement("div",{style:{width:"100%",overflowWrap:"break-word"}},React__default.default.createElement(index$5,{originString:e==null?void 0:e.answer,currentString:e==null?void 0:e.newAnswer})):React__default.default.createElement("div",{style:{whiteSpace:"pre-wrap"}},e==null?void 0:e.answer)},QuestionView=e=>{var t,r;const{hoverKey:l,answerList:u,question:i,lang:d,modelAPIResponse:f,setModelAPIResponse:m,checkMode:p=!0,LLMConfig:n,answerHeaderSlot:w}=e,[s,x]=React.useState(index.EDataFormatType.Default),E=((t=n==null?void 0:n.dataType)==null?void 0:t.prompt)===index.ELLMDataType.Picture,y=((r=n==null?void 0:n.dataType)==null?void 0:r.response)===index.ELLMDataType.Picture,{t:g}=reactI18next.useTranslation();React.useEffect(()=>{var a;d&&((a=lbUtils.i18n)==null||a.changeLanguage(d))},[]);const L=a=>{var o;return(n==null?void 0:n.isTextEdit)?!!((o=((n==null?void 0:n.textEdit)||[]).filter(v=>(v==null?void 0:v.title)===a.order)[0])==null?void 0:o.textControl):!1},P=React__default.default.createElement("div",null,u.map((a,o)=>{const c=L(a);return React__default.default.createElement("div",{className:classNames__default.default({[`${LLMViewCls}__content`]:!0,[`${LLMViewCls}__contentActive`]:l===(a==null?void 0:a.order)}),key:o},React__default.default.createElement(antd.Tag,{className:`${LLMViewCls}__tag`},a==null?void 0:a.order),React__default.default.createElement(RenderAnswer,{i:a,isTextControl:c,dataFormatType:s}))}),_.isString(i)&&React__default.default.createElement(index$1,{dataFormatType:s,modelAPIResponse:f,question:i,setModelAPIResponse:m,checkMode:p,annotation:e.annotation}));return React__default.default.createElement("div",{className:LLMViewCls},React__default.default.createElement(index$2,{question:i,dataFormatType:s,setDataFormatType:x,isImg:E}),React__default.default.createElement("div",{className:`${LLMViewCls}__textBox`},React__default.default.createElement("div",{className:`${LLMViewCls}__title`},g("Answer")," ",w),y?React__default.default.createElement(index$3,{hoverKey:l,answerList:u}):P))},WrapQuestionView=e=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(QuestionView,__spreadValues({},e)));exports.LLMViewCls=LLMViewCls,exports.default=WrapQuestionView;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),index=require("../../../constant/index.js"),classNames=require("classnames"),reactI18next=require("react-i18next"),lbUtils=require("@labelbee/lb-utils"),index$4=require("../../markdownView/index.js"),index$1=require("../modelAPIView/index.js"),index$5=require("../../diffMatchPatchComponent/index.js"),index$2=require("./components/header/index.js"),index$3=require("./components/imgView/index.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e};const LLMViewCls=`${index.prefix}-LLMView`,RenderAnswer=({i:e,dataFormatType:t,isTextControl:r})=>{var l;return t===index.EDataFormatType.Markdown?React__default.default.createElement(index$4,{value:(l=e==null?void 0:e.newAnswer)!=null?l:e==null?void 0:e.answer}):r?React__default.default.createElement("div",{style:{width:"100%",overflowWrap:"break-word"}},React__default.default.createElement(index$5,{originString:e==null?void 0:e.answer,currentString:e==null?void 0:e.newAnswer})):React__default.default.createElement("div",{style:{whiteSpace:"pre-wrap"}},(e==null?void 0:e.newAnswer)||(e==null?void 0:e.answer))},QuestionView=e=>{var t,r;const{hoverKey:l,answerList:u,question:i,lang:d,modelAPIResponse:f,setModelAPIResponse:m,checkMode:p=!0,LLMConfig:n,answerHeaderSlot:w}=e,[s,x]=React.useState(index.EDataFormatType.Default),E=((t=n==null?void 0:n.dataType)==null?void 0:t.prompt)===index.ELLMDataType.Picture,y=((r=n==null?void 0:n.dataType)==null?void 0:r.response)===index.ELLMDataType.Picture,{t:g}=reactI18next.useTranslation();React.useEffect(()=>{var a;d&&((a=lbUtils.i18n)==null||a.changeLanguage(d))},[]);const L=a=>{var o;return(n==null?void 0:n.isTextEdit)?!!((o=((n==null?void 0:n.textEdit)||[]).filter(v=>(v==null?void 0:v.title)===a.order)[0])==null?void 0:o.textControl):!1},P=React__default.default.createElement("div",null,u.map((a,o)=>{const c=L(a);return React__default.default.createElement("div",{className:classNames__default.default({[`${LLMViewCls}__content`]:!0,[`${LLMViewCls}__contentActive`]:l===(a==null?void 0:a.order)}),key:o},React__default.default.createElement(antd.Tag,{className:`${LLMViewCls}-tag`},a==null?void 0:a.order),React__default.default.createElement(RenderAnswer,{i:a,isTextControl:c,dataFormatType:s}))}),_.isString(i)&&React__default.default.createElement(index$1,{dataFormatType:s,modelAPIResponse:f,question:i,setModelAPIResponse:m,checkMode:p,annotation:e.annotation}));return React__default.default.createElement("div",{className:LLMViewCls},React__default.default.createElement(index$2,{question:i,dataFormatType:s,setDataFormatType:x,isImg:E}),React__default.default.createElement("div",{className:`${LLMViewCls}__textBox`},React__default.default.createElement("div",{className:`${LLMViewCls}__title`},g("Answer")," ",w),y?React__default.default.createElement(index$3,{hoverKey:l,answerList:u}):P))},WrapQuestionView=e=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(QuestionView,__spreadValues({},e)));exports.LLMViewCls=LLMViewCls,exports.default=WrapQuestionView;
@@ -0,0 +1 @@
1
+ "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),React=require("react");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(n,e,t)=>e in n?__defProp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,__spreadValues=(n,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(n,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(n,t,e[t]);return n};const MeasureCanvas=n=>{const{size:e,imgNode:t,zoom:u,currentPos:a}=n,i=React.useRef(null),o=React.useRef(null);return React.useEffect(()=>{if(i.current&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&t&&u){const r=new lbAnnotation.MeasureOperation({container:i.current,size:e,imgNode:t});r.init(),o.current=r,r.updatePosition({zoom:u,currentPos:a})}return()=>{if(o.current){const r=o.current;r==null||r.destroy(),lbAnnotation.EventBus.emit("updatePosition",{currentPos:r.currentPos,zoom:r.zoom})}}},[i]),React.useEffect(()=>{var r;o.current&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&((r=o.current)==null||r.setSize(e))},[e==null?void 0:e.width,e==null?void 0:e.height]),React.useEffect(()=>{if(o.current&&t&&u&&a){const r=o.current;r==null||r.setImgNode(t),r.updatePosition({zoom:u,currentPos:a}),r.setResult([])}},[t]),React__default.default.createElement("div",{style:__spreadValues({position:"relative"},e),id:"measureOperation",ref:i})};module.exports=MeasureCanvas;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,s,o)=>new Promise((d,a)=>{var u=t=>{try{n(o.next(t))}catch(i){a(i)}},r=t=>{try{n(o.throw(t))}catch(i){a(i)}},n=t=>t.done?d(t.value):Promise.resolve(t.value).then(u,r);n((o=o.apply(e,s)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:s,currentData:o,showEnlarge:d,checkMode:a=!1})=>{var u;const r=React.useRef(null),n=React.useRef(),{selectedBox:t}=useSingleBox.useSingleBox(),i=useSize(r),{url:g,calib:h,path:b}=e,{toggle2dVisible:y,isHighlightVisible:j}=useHighlight.useHighlight({currentData:o}),[q,v]=React.useState(!1),{cuboidBoxIn2DView:S,cacheImageNodeSize:P}=React.useContext(PointCloudContext.PointCloudContext),_=!e,m=c=>{f(),P({path:b,imgNode:c})},f=React.useCallback(()=>{var c,x;const p=(c=n.current)==null?void 0:c.toolInstance;if(s(""),!t||!p)return;const l=e.annotations.find(B=>B.annotation.id===t.info.id);let C="";l&&((x=l==null?void 0:l.annotation.pointList)==null?void 0:x.length)>0&&(p.focusPositionByPointList(l==null?void 0:l.annotation.pointList),C=t.info.id,s(C))},[t,n.current,e.annotations]);React.useEffect(()=>{f()},[f]);const k=()=>__async(void 0,null,function*(){v(!0),yield y(g,h),v(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:r},S?React__default.default.createElement(index,{src:(u=e==null?void 0:e.url)!=null?u:"",annotations:e.annotations,size:i,ref:n,globalStyle:{display:_?"none":"block"},afterImgOnLoad:m,zoomInfo:{min:.01,max:1e3,ratio:.4}}):React__default.default.createElement(index$1,{mappingData:e,size:i,checkMode:a,afterImgOnLoad:m}),h&&React__default.default.createElement(index$2,{visible:j(g),onClick:k,loading:q,style:{position:"absolute",right:16,top:16,zIndex:d?-1:101}}))};module.exports=PointCloud2DSingleView;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),index=require("../AnnotationView/index.js"),useSize=require("../../hooks/useSize.js"),useSingleBox=require("./hooks/useSingleBox.js"),useHighlight=require("./hooks/useHighlight.js"),index$2=require("./components/HighlightVisible/index.js"),PointCloudContext=require("./PointCloudContext.js"),index$1=require("../pointCloud2DRectOperationView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__async=(e,s,o)=>new Promise((c,a)=>{var d=t=>{try{i(o.next(t))}catch(n){a(n)}},u=t=>{try{i(o.throw(t))}catch(n){a(n)}},i=t=>t.done?c(t.value):Promise.resolve(t.value).then(d,u);i((o=o.apply(e,s)).next())});const PointCloud2DSingleView=({view2dData:e,setSelectedID:s,currentData:o,showEnlarge:c,checkMode:a=!1,measureVisible:d})=>{var u;const i=React.useRef(null),t=React.useRef(),{selectedBox:n}=useSingleBox.useSingleBox(),g=useSize(i),{url:h,calib:v,path:y}=e,{toggle2dVisible:j,isHighlightVisible:q}=useHighlight.useHighlight({currentData:o}),[S,m]=React.useState(!1),{cuboidBoxIn2DView:P,cacheImageNodeSize:_}=React.useContext(PointCloudContext.PointCloudContext),k=!e,x=r=>{f(),_({path:y,imgNode:r})},f=React.useCallback(()=>{var r,p;const C=(r=t.current)==null?void 0:r.toolInstance;if(s(""),!n||!C)return;const l=e.annotations.find(V=>V.annotation.id===n.info.id);let b="";l&&((p=l==null?void 0:l.annotation.pointList)==null?void 0:p.length)>0&&(C.focusPositionByPointList(l==null?void 0:l.annotation.pointList),b=n.info.id,s(b))},[n,t.current,e.annotations]);React.useEffect(()=>{f()},[f]);const B=()=>__async(void 0,null,function*(){m(!0),yield j(h,v),m(!1)});return React__default.default.createElement("div",{className:dom.getClassName("point-cloud-2d-image"),ref:i},P?React__default.default.createElement(index,{src:(u=e==null?void 0:e.url)!=null?u:"",annotations:e.annotations,size:g,ref:t,globalStyle:{display:k?"none":"block"},afterImgOnLoad:x,zoomInfo:{min:.01,max:1e3,ratio:.4},measureVisible:d}):React__default.default.createElement(index$1,{mappingData:e,size:g,checkMode:a,afterImgOnLoad:x}),v&&React__default.default.createElement(index$2,{visible:q(h),onClick:B,loading:S,style:{position:"absolute",right:16,top:16,zIndex:c?-1:101}}))};module.exports=PointCloud2DSingleView;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,t)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,__spreadValues=(e,l)=>{for(var t in l||(l={}))__hasOwnProp.call(l,t)&&__defNormalProp(e,t,l[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(l))__propIsEnum.call(l,t)&&__defNormalProp(e,t,l[t]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:l,data:t,setIsEnlarge:p,setCurIndex:f,curIndex:b=0,index:w,annotations2d:v})=>l?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{p(!1),f(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},b+1,"/",v==null?void 0:v.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{p(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:l,thumbnailWidth:t,isEnlargeTopView:p,highlightAttribute:f,loadPCDFileLoading:b,checkMode:w})=>{var v;const[c,K]=React.useState([]),{topViewInstance:H,displayPointCloudList:L,polygonList:q,imageSizes:F,selectedIDs:O}=React.useContext(PointCloudContext.PointCloudContext),[x,M]=React.useState(""),[y,P]=React.useState(!1),[s,E]=React.useState(void 0);React.useEffect(()=>{var o;if(!b&&H&&(e==null?void 0:e.mappingImgList)&&((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)>0){const i={fill:"transparent",color:"green"};let r=[];e==null||e.mappingImgList.forEach(n=>{var m,j,N;const R=L.reduce((d,u)=>{var g,a;const C=u.id===x||f===u.attribute,{transferViewData:A,viewRangePointList:h}=(g=lbAnnotation.pointCloudLidar2image(u,n.calib,{createRange:C}))!=null?g:{};if(!A||!h)return[];const z=(a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:u.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,J=U({viewDataPointList:A,pointCloudBox:u,defaultViewStyle:i,stroke:z}),T=[...d,...J];return(h==null?void 0:h.length)>0&&T.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:x,pointList:h},i),{stroke:z,fill:"rgba(255, 255, 255, 0.6)"})}),T},[]),V=F[(m=n==null?void 0:n.path)!=null?m:""];V&&_.isNumber((j=n==null?void 0:n.calib)==null?void 0:j.groundHeight)&&q.forEach(d=>{const u=d.pointList.map(a=>{var C;return __spreadProps(__spreadValues({},a),{z:(C=n==null?void 0:n.calib)==null?void 0:C.groundHeight})}),g=lbAnnotation.pointListLidar2Img(u,n==null?void 0:n.calib,V);if(g){const a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{});R.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:d.id,pointList:g},i),{stroke:a==null?void 0:a.stroke,fill:O.includes(d.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),r.push({annotations:R,url:n==null?void 0:n.url,calName:(N=n==null?void 0:n.calib)==null?void 0:N.calName,calib:n==null?void 0:n.calib,path:n==null?void 0:n.path})}),K(r)}},[L,e==null?void 0:e.mappingImgList,x,f,b,q,F,O]),React.useEffect(()=>(window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}),[s]);const S=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:y&&P(!1);break;case EKeyCode.Left:k();break;case EKeyCode.Right:I();break}},k=()=>{s===void 0||!y||Number(s)>0&&E(s-1)},I=()=>{s===void 0||!y||Number(s)<(c==null?void 0:c.length)-1&&E(s+1)},U=({viewDataPointList:o,pointCloudBox:i,defaultViewStyle:r,stroke:n})=>o?o.map(m=>({type:m.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:m.pointList},r),{stroke:n})})):[],$=!e||!(e==null?void 0:e.mappingImgList)||!(((v=e==null?void 0:e.mappingImgList)==null?void 0:v.length)>0),G=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>k()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>I()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{P(!1),E(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(c==null?void 0:c.length)>0?React__default.default.createElement(React__default.default.Fragment,null,c.map((o,i)=>{const r=y&&i===s;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:r}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:r,isEnlargeTopView:p,data:o,setIsEnlarge:P,setCurIndex:E,curIndex:s,index:i,annotations2d:c}),titleOnSurface:!r,style:{display:$?"none":"flex",width:r?"100%":t},key:i,toolbar:G},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:o,setSelectedID:M,showEnlarge:r,checkMode:w}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,t)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,__spreadValues=(e,l)=>{for(var t in l||(l={}))__hasOwnProp.call(l,t)&&__defNormalProp(e,t,l[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(l))__propIsEnum.call(l,t)&&__defNormalProp(e,t,l[t]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:l,data:t,setIsEnlarge:g,setCurIndex:f,curIndex:p=0,index:w,annotations2d:b})=>l?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{g(!1),f(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},p+1,"/",b==null?void 0:b.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{g(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:l,thumbnailWidth:t,isEnlargeTopView:g,highlightAttribute:f,loadPCDFileLoading:p,checkMode:w,measureVisible:b})=>{var L;const[c,H]=React.useState([]),{topViewInstance:M,displayPointCloudList:q,polygonList:F,imageSizes:O,selectedIDs:S}=React.useContext(PointCloudContext.PointCloudContext),[x,U]=React.useState(""),[y,P]=React.useState(!1),[s,E]=React.useState(void 0);React.useEffect(()=>{var o;if(!p&&M&&(e==null?void 0:e.mappingImgList)&&((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)>0){const i={fill:"transparent",color:"green"};let r=[];e==null||e.mappingImgList.forEach(n=>{var v,N,R;const V=q.reduce((d,u)=>{var m,a;const C=u.id===x||f===u.attribute,{transferViewData:z,viewRangePointList:h}=(m=lbAnnotation.pointCloudLidar2image(u,n.calib,{createRange:C}))!=null?m:{};if(!z||!h)return[];const T=(a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:u.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,Q=$({viewDataPointList:z,pointCloudBox:u,defaultViewStyle:i,stroke:T}),K=[...d,...Q];return(h==null?void 0:h.length)>0&&K.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:x,pointList:h},i),{stroke:T,fill:"rgba(255, 255, 255, 0.6)"})}),K},[]),A=O[(v=n==null?void 0:n.path)!=null?v:""];A&&_.isNumber((N=n==null?void 0:n.calib)==null?void 0:N.groundHeight)&&F.forEach(d=>{const u=d.pointList.map(a=>{var C;return __spreadProps(__spreadValues({},a),{z:(C=n==null?void 0:n.calib)==null?void 0:C.groundHeight})}),m=lbAnnotation.pointListLidar2Img(u,n==null?void 0:n.calib,A);if(m){const a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{});V.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:d.id,pointList:m},i),{stroke:a==null?void 0:a.stroke,fill:S.includes(d.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),r.push({annotations:V,url:n==null?void 0:n.url,calName:(R=n==null?void 0:n.calib)==null?void 0:R.calName,calib:n==null?void 0:n.calib,path:n==null?void 0:n.path})}),H(r)}},[q,e==null?void 0:e.mappingImgList,x,f,p,F,O,S]),React.useEffect(()=>(window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}),[s]);const k=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:y&&P(!1);break;case EKeyCode.Left:I();break;case EKeyCode.Right:j();break}},I=()=>{s===void 0||!y||Number(s)>0&&E(s-1)},j=()=>{s===void 0||!y||Number(s)<(c==null?void 0:c.length)-1&&E(s+1)},$=({viewDataPointList:o,pointCloudBox:i,defaultViewStyle:r,stroke:n})=>o?o.map(v=>({type:v.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:v.pointList},r),{stroke:n})})):[],G=!e||!(e==null?void 0:e.mappingImgList)||!(((L=e==null?void 0:e.mappingImgList)==null?void 0:L.length)>0),J=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>I()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>j()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{P(!1),E(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(c==null?void 0:c.length)>0?React__default.default.createElement(React__default.default.Fragment,null,c.map((o,i)=>{const r=y&&i===s;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:r}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:r,isEnlargeTopView:g,data:o,setIsEnlarge:P,setCurIndex:E,curIndex:s,index:i,annotations2d:c}),titleOnSurface:!r,style:{display:G?"none":"flex",width:r?"100%":t},key:i,toolbar:J},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:o,setSelectedID:U,showEnlarge:r,checkMode:w,measureVisible:b}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
@@ -1 +1 @@
1
- "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),PointCloudSegment2DView=require("./PointCloudSegment2DView.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=({currentData:t,imgList:f,drawLayerSlot:s,checkMode:l,intelligentFit:g,imgIndex:P,loadPCDFileLoading:S,config:v})=>{const e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:d,setGlobalPattern:p,selectedIDs:c}=e,E=ctx.useDispatch(),[a,m]=React.useState(!1),x=(c==null?void 0:c.length)>0&&a,L=index.jsonParser(t.result),{toolInstanceRef:o,clearToolInstance:q}=annotation.useCustomToolInstance({basicInfo:L});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=n=>{n!==d&&(p(n),e.clearAllDetectionInstance(),q())}},[d]),React.useEffect(()=>{var n;if(actionCreators.SetLoadPCDFileLoading(E,!0),t){const{boxParamsList:i,polygonList:r,lineList:u,sphereParamsList:b,segmentation:j}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((n=t==null?void 0:t.result)!=null?n:"");e.setPointCloudResult(i),e.setPolygonList(r),e.setLineList(u),e.setPointCloudSphereList(b),e.setSegmentation(j)}},[P]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var n,i,r,u;return{resultPolygon:(n=e.polygonList)!=null?n:[],resultLine:(i=e.lineList)!=null?i:[],resultPoint:(r=e.pointCloudSphereList)!=null?r:[],segmentation:(u=e.segmentation)!=null?u:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),f.length===0)return null;if(d===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:l,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout")},React__default.default.createElement(PointCloudSegment,{checkMode:l}),React__default.default.createElement(PointCloudSegment2DView,null)),React__default.default.createElement(PointCloudSegmentStatus,{config:v}),s==null?void 0:s({direct:!0}));let C=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:l}),React__default.default.createElement(PointCloudSideView,{checkMode:l}));return a&&(C=React__default.default.createElement(index$2,{selectAndEnlarge:x,checkMode:l})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:l,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:n=>n.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),C),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:a})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:s,checkMode:l,intelligentFit:g,setIsEnlargeTopView:m,onExitZoom:()=>{m(!1)},isEnlargeTopView:a}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!a,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:a})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:a,thumbnailWidth:a?300:455,checkMode:l})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
1
+ "use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloud3DView=require("./PointCloud3DView.js"),PointCloudBackView=require("./PointCloudBackView.js"),PointCloudTopView=require("./PointCloudTopView.js"),PointCloudSideView=require("./PointCloudSideView.js"),PointCloud2DView=require("./PointCloud2DView.js"),PointCloudListener=require("./PointCloudListener.js"),PointCloudSegmentListener=require("./PointCloudSegmentListener.js"),PointCloudSegment=require("./PointCloudSegment.js"),PointCloudSegmentStatus=require("./PointCloudSegmentStatus.js"),PointCloudSegmentToolbar=require("./PointCloudSegmentToolbar.js"),PointCloudSegment2DView=require("./PointCloudSegment2DView.js"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),index$1=require("../../views/MainView/toolFooter/AnnotatedAttributes/index.js"),PointCloudContext=require("./PointCloudContext.js"),lbUtils=require("@labelbee/lb-utils"),annotation=require("../../hooks/annotation.js"),index=require("../../utils/index.js"),map=require("../../store/annotation/map.js"),classNames=require("classnames"),index$2=require("./components/sideAndBackOverView/index.js"),actionCreators=require("../../store/annotation/actionCreators.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const PointCloudView=l=>{const{currentData:i,imgList:g,drawLayerSlot:d,checkMode:n,intelligentFit:P,imgIndex:v,config:p,measureVisible:E}=l,e=React.useContext(PointCloudContext.PointCloudContext),{globalPattern:c,setGlobalPattern:L,selectedIDs:m}=e,x=ctx.useDispatch(),[a,C]=React.useState(!1),S=(m==null?void 0:m.length)>0&&a,q=index.jsonParser(i.result),{toolInstanceRef:o,clearToolInstance:b}=annotation.useCustomToolInstance({basicInfo:q});if(React.useEffect(()=>{o.current.setPointCloudGlobalPattern=t=>{t!==c&&(L(t),e.clearAllDetectionInstance(),b())}},[c]),React.useEffect(()=>{var t;if(actionCreators.SetLoadPCDFileLoading(x,!0),i){const{boxParamsList:r,polygonList:u,lineList:s,sphereParamsList:j,segmentation:w}=lbUtils.PointCloudUtils.parsePointCloudCurrentResult((t=i==null?void 0:i.result)!=null?t:"");e.setPointCloudResult(r),e.setPolygonList(u),e.setLineList(s),e.setPointCloudSphereList(j),e.setSegmentation(w)}},[v]),React.useEffect(()=>{o.current.exportData=()=>[e.pointCloudBoxList,{valid:e.valid}],o.current.exportCustomData=()=>{var t,r,u,s;return{resultPolygon:(t=e.polygonList)!=null?t:[],resultLine:(r=e.lineList)!=null?r:[],resultPoint:(u=e.pointCloudSphereList)!=null?u:[],segmentation:(s=e.segmentation)!=null?s:[]}}},[e.pointCloudBoxList,e.valid,e.polygonList,e.lineList,e.pointCloudSphereList,e.ptSegmentInstance,e.segmentation]),g.length===0)return null;if(c===lbUtils.EPointCloudPattern.Segmentation)return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudSegmentListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement(PointCloudSegmentToolbar,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout")},React__default.default.createElement(PointCloudSegment,{checkMode:n}),React__default.default.createElement(PointCloudSegment2DView,null)),React__default.default.createElement(PointCloudSegmentStatus,{config:p}),d==null?void 0:d({direct:!0}));let f=React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left-bottom")},React__default.default.createElement(PointCloudBackView,{checkMode:n}),React__default.default.createElement(PointCloudSideView,{checkMode:n}));return a&&(f=React__default.default.createElement(index$2,{selectAndEnlarge:S,checkMode:n})),React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(PointCloudListener,{checkMode:n,toolInstanceRef:o}),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-layout"),onContextMenu:t=>t.preventDefault()},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-wrapper")},React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedLeft,null),React__default.default.createElement("div",{className:dom.getClassName("point-cloud-content")},React__default.default.createElement("div",{className:dom.getClassName("point-cloud-container","left")},React__default.default.createElement(PointCloud3DView,null),f),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right")]:!0,[dom.getClassName("point-cloud-container","rightZoom")]:a})},React__default.default.createElement(PointCloudTopView,{drawLayerSlot:d,checkMode:n,intelligentFit:P,setIsEnlargeTopView:C,onExitZoom:()=>{C(!1)},isEnlargeTopView:a}),React__default.default.createElement("div",{className:classNames__default.default({[dom.getClassName("point-cloud-container","right-bottom")]:!a,[dom.getClassName("point-cloud-container","right-bottom-floatLeft")]:a})},React__default.default.createElement(PointCloud2DView,{isEnlargeTopView:a,thumbnailWidth:a?300:455,checkMode:n,measureVisible:E})))),React__default.default.createElement(index$1.AnnotatedAttributesPanelFixedRight,null))))};var PointCloudView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudView);module.exports=PointCloudView$1;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),Actions=require("../../store/Actions.js"),actionCreators=require("../../store/annotation/actionCreators.js"),TagToolInstanceAdaptor=require("./videoTagTool/TagToolInstanceAdaptor.js"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("./videoClipTool/index.js"),StepUtils=require("../../utils/StepUtils.js"),index$2=require("../../utils/index.js"),index$1=require("./videoTextTool/index.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,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e},__spreadProps=(e,r)=>__defProps(e,__getOwnPropDescs(r));const{EVideoToolName}=lbAnnotation.cTool,VideoAnnotate=e=>{const{stepInfo:r}=e,t=r==null?void 0:r.tool,o=ctx.useDispatch(),n=a=>{o({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:a}})},i=()=>{o({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:void 0}})};return t===EVideoToolName.VideoClipTool?React__default.default.createElement(index,__spreadProps(__spreadValues({},e),{pageBackward:()=>o(actionCreators.PageBackward()),pageForward:()=>o(actionCreators.PageForward()),pageJump:a=>o(actionCreators.PageJump(~~a)),onMounted:n,onUnmounted:i})):t===EVideoToolName.VideoTextTool?React__default.default.createElement(index$1.VideoTextTool,__spreadProps(__spreadValues({},e),{pageBackward:()=>o(actionCreators.PageBackward()),pageForward:()=>o(actionCreators.PageForward()),pageJump:a=>o(actionCreators.PageJump(~~a)),onMounted:n,onUnmounted:i})):t===EVideoToolName.VideoTagTool?React__default.default.createElement(TagToolInstanceAdaptor.TagToolInstanceAdaptor,__spreadProps(__spreadValues({},e),{pageBackward:()=>o(actionCreators.PageBackward()),pageForward:()=>o(actionCreators.PageForward()),pageJump:a=>o(actionCreators.PageJump(~~a)),onMounted:n,onUnmounted:i})):null},mapStateToProps=e=>{var r,t,o,n,i;const{annotation:{imgList:a,imgIndex:u,step:d,stepList:c,loading:p}}=e,s=StepUtils.getCurrentStepInfo((r=e.annotation)==null?void 0:r.step,(t=e.annotation)==null?void 0:t.stepList),l=(o=a[u])!=null?o:{};return{imgIndex:u,imgList:a,stepInfo:s,config:index$2.jsonParser(s==null?void 0:s.config),step:d,stepList:c,path:(i=(n=l==null?void 0:l.path)!=null?n:l==null?void 0:l.url)!=null?i:"",loading:p}};var VideoAnnotate$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(VideoAnnotate);module.exports=VideoAnnotate$1;
1
+ "use strict";var React=require("react"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),Actions=require("../../store/Actions.js"),actionCreators=require("../../store/annotation/actionCreators.js"),TagToolInstanceAdaptor=require("./videoTagTool/TagToolInstanceAdaptor.js"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("./videoClipTool/index.js"),StepUtils=require("../../utils/StepUtils.js"),index$2=require("../../utils/index.js"),index$1=require("./videoTextTool/index.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,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const{EVideoToolName}=lbAnnotation.cTool,VideoAnnotate=e=>{const{stepInfo:t,skipBeforePageTurning:o}=e,n=t==null?void 0:t.tool,r=ctx.useDispatch(),i=a=>{r({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:a}})},l=()=>{r({type:Actions.ANNOTATION_ACTIONS.SET_TOOL,payload:{instance:void 0}})},s=()=>{r({type:Actions.ANNOTATION_ACTIONS.SET_LOADING,payload:{loading:!1}})},u=()=>{if(o){o(()=>r(actionCreators.PageBackward()));return}r(actionCreators.PageBackward())},d=()=>{if(o){o(()=>r(actionCreators.PageForward()));return}r(actionCreators.PageForward())};return n===EVideoToolName.VideoClipTool?React__default.default.createElement(index,__spreadProps(__spreadValues({},e),{pageBackward:u,pageForward:d,pageJump:a=>r(actionCreators.PageJump(~~a-1)),onMounted:i,onUnmounted:l,onVideoLoaded:s})):n===EVideoToolName.VideoTextTool?React__default.default.createElement(index$1.VideoTextTool,__spreadProps(__spreadValues({},e),{pageBackward:u,pageForward:d,pageJump:a=>r(actionCreators.PageJump(~~a-1)),onMounted:i,onUnmounted:l,onVideoLoaded:s})):n===EVideoToolName.VideoTagTool?React__default.default.createElement(TagToolInstanceAdaptor.TagToolInstanceAdaptor,__spreadProps(__spreadValues({},e),{pageBackward:u,pageForward:d,pageJump:a=>r(actionCreators.PageJump(~~a-1)),onMounted:i,onUnmounted:l,onVideoLoaded:s})):null},mapStateToProps=e=>{var t,o,n,r,i;const{annotation:{imgList:l,imgIndex:s,step:u,stepList:d,loading:a,skipBeforePageTurning:T}}=e,p=StepUtils.getCurrentStepInfo((t=e.annotation)==null?void 0:t.step,(o=e.annotation)==null?void 0:o.stepList),c=(n=l[s])!=null?n:{};return{imgIndex:s,imgList:l,stepInfo:p,config:index$2.jsonParser(p==null?void 0:p.config),step:u,stepList:d,path:(i=(r=c==null?void 0:c.path)!=null?r:c==null?void 0:c.url)!=null?i:"",loading:a,skipBeforePageTurning:T}};var VideoAnnotate$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(VideoAnnotate);module.exports=VideoAnnotate$1;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),index_module=require("./index.module.scss.js"),icon_videoCut=require("../../../../../assets/annotation/video/icon_videoCut.svg.js"),icon_timePoint=require("../../../../../assets/annotation/video/icon_timePoint.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const VideoClipToolHotkey=({toggleClipStatus:e,addTime:t})=>React__default.default.createElement("div",{className:index_module.clipToolbar},React__default.default.createElement("span",{className:index_module.buttonWrapper},React__default.default.createElement("i",{className:index_module.cutButton,onClick:()=>{e==null||e()},style:{backgroundImage:icon_videoCut}}),"\u622A\u53D6"),React__default.default.createElement("span",{className:index_module.buttonWrapper},React__default.default.createElement("i",{className:index_module.localButton,onClick:t,style:{backgroundImage:icon_timePoint}}),"\u6807\u65F6\u95F4\u70B9"));module.exports=VideoClipToolHotkey;
1
+ "use strict";var React=require("react"),index_module=require("./index.module.scss.js"),icon_videoCut=require("../../../../../assets/annotation/video/icon_videoCut.svg.js"),icon_timePoint=require("../../../../../assets/annotation/video/icon_timePoint.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const VideoClipToolHotkey=({toggleClipStatus:e,addTime:t})=>React__default.default.createElement("div",{className:index_module.clipToolbar},React__default.default.createElement("span",{className:index_module.buttonWrapper},React__default.default.createElement("img",{src:icon_videoCut,className:index_module.cutButton,onClick:()=>{e==null||e()}}),"\u622A\u53D6"),React__default.default.createElement("span",{className:index_module.buttonWrapper},React__default.default.createElement("img",{src:icon_timePoint,className:index_module.localButton,onClick:t}),"\u6807\u65F6\u95F4\u70B9"));module.exports=VideoClipToolHotkey;
@@ -1 +1 @@
1
- "use strict";var styles={videoTimeSlices:"index-module_videoTimeSlices__v-2k1",timeSliceWrapper:"index-module_timeSliceWrapper__kebC3",active:"index-module_active__cIGVq",timeSliceItemText:"index-module_timeSliceItemText__FJFwH",timeSliceItemAttribute:"index-module_timeSliceItemAttribute__--3E1"};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"};module.exports=styles;
@@ -1 +1 @@
1
- "use strict";var lbAnnotation=require("@labelbee/lb-annotation"),index=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$1=require("../../videoPlayer/index.js"),index$2=require("./components/videoTimeSlicesOverVideo/index.js"),icon_videoCutting=require("../../../assets/annotation/video/icon_videoCutting.svg.js"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(d){return d&&typeof d=="object"&&"default"in d?d:{default:d}}var ___default=_interopDefaultLegacy(_),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=(d,r,t)=>r in d?__defProp(d,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[r]=t,__spreadValues=(d,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(d,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(d,t,r[t]);return d},__spreadProps=(d,r)=>__defProps(d,__getOwnPropDescs(r));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.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:u,type:l}=this.state.result[this.selectedSliceIndex],n=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(u,t),[0,audio.precisionMinus(l===constant.ETimeSliceType.Time?s:a,constant.PER_SLICE_CHANGE)]);this.updateSelectedSliceTimeProperty(n,"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:u,start:l}=s,n=lbAnnotation.MathUtils.withinRange(audio.precisionAdd(u,t),[audio.precisionAdd(l,constant.PER_SLICE_CHANGE),a]);this.updateSelectedSliceTimeProperty(n,"end")}},this.updateSelectedSliceTimeProperty=(t,e)=>{if(this.selectedSliceIndex>-1){const{result:i}=this.state;i[this.selectedSliceIndex][e]=t,this.setState({result:___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.videoLoaded=t=>{var e;const i=this.resultJSON,s=i&&!["","{}"].includes(i),a=t?parseFloat(t.toFixed(2)):0,u={loading:!1};((e=index.jsonParser(i))==null?void 0:e.duration)||Object.assign(u,{result:JSON.stringify(__spreadProps(__spreadValues({},index.jsonParser(i)),{duration:a}))}),s||Object.assign(u,{result:JSON.stringify({width:0,height:0,rotate:0,valid:!0,duration:a})}),this.setState({loading:!1})},this.setVideoError=(t,e,i)=>{if(t){const{clipStatus:s}=this.state;s===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,s;if(this.disabled)return;const{clipStatus:a,selectedAttribute:u}=this.state,l=a!==constant.EClipStatus.Clipping;let n=l?constant.EClipStatus.Clipping:constant.EClipStatus.Stop,{result:o,selectedID:c,textValue:h}=this.state;const p=___default.default.cloneDeep(o),S=t||((e=this.videoPlayer)==null?void 0:e.currentTime),v=(i=this.videoPlayer)==null?void 0:i.duration;if(v===void 0||S===void 0)return;const C=utils.decimalReserved(S,2);if(l){const f=lbAnnotation.uuid();c=f,p.push({start:C,end:null,attribute:u,textAttribute:this.defaultTextAttribute,duration:v,id:f,type:constant.ETimeSliceType.Period}),h=this.defaultTextAttribute}else{const f=p.findIndex(m=>m.id===c),g=p[f];g&&(S-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`),n=constant.EClipStatus.Stop,c="",h=""):(p[f].end=utils.decimalReserved(S,2),(s=this.videoPlayer)==null||s.pause(),antd.message.success(`\u5DF2\u622A\u53D6\u7247\u6BB5${o.length}`)))}this.setState({clipStatus:n,result:p,selectedID:c,textValue:h}),this.updateSidebar()},this.addTime=()=>{var t,e,i,s;if(this.disabled)return;const{result:a,selectedAttribute:u,selectedID:l}=this.state,n=lbAnnotation.uuid(),o=___default.default.cloneDeep(a),c=((t=this.videoPlayer)==null?void 0:t.currentTime)||0;o.push({start:c,end:c,attribute:u,textAttribute:this.defaultTextAttribute,id:n,type:constant.ETimeSliceType.Time,duration:(i=(e=this.videoPlayer)==null?void 0:e.duration)!=null?i:0});const h={result:o,selectedID:n,textValue:this.defaultTextAttribute},p=o.find(S=>S.id===l);this.isClipping&&p?(delete h.selectedID,delete h.textValue,antd.message.success(`\u5DF2\u622A\u53D6\u65F6\u95F4\u70B9${o.length-1}`)):(s=this.videoPlayer)==null||s.pause(),this.setState(h),this.updateSidebar()},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:u}=this.state,l=u.find(n=>n.id===t);if(l){const n=l.duration,o=e==="left",c=o?"start":"end",h=o?-n*i:n*i,p=o?[0,Math.max(((s=l.end)!=null?s:0)-constant.SLICE_MIN_TIME,0)]:[l.start+constant.SLICE_MIN_TIME,n],S=lbAnnotation.MathUtils.withinRange(h+((a=l==null?void 0:l[c])!=null?a:0),p);l[c]=S,this.throttledUpdateTime(S)}this.setState({result:[...u]}),this.updateSidebar()},this.renderMediaContent=()=>{const{pageForward:t,pageJump:e,pageBackward:i}=this.props,{result:s,currentTime:a,videoError:u,valid:l}=this.state;return React__default.default.createElement("div",{className:index_module.clipContainer},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:this.props.imgIndex,imgList:this.props.imgList,pageBackward:i,pageForward:t,pageJump:e,valid:l,setVideoRef:n=>{this.videoPlayer=n},showVideoTrack:!u,onTrackResize:this.onTrackResize,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.videoLoaded}),React__default.default.createElement(index$2,{result:s,currentTime:a,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}),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 u=index.jsonParser(s[i].result)[`step_${this.stepInfo().step}`],l=(u==null?void 0:u.result)||[],n=audio.isImageValue(s[i].result||"[]");this.setState({result:l,loading:t,selectedID:"",textValue:"",selectedAttribute:"",clipStatus:constant.EClipStatus.Stop,valid:n},()=>{this.updateSidebar(),n||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.setTextAttribute=t=>{const{result:e,selectedID:i}=this.state;if(this.setState({textValue:t}),i){const s=e.find(a=>a.id===i);s&&(s.textAttribute=t,this.setState({result:[...e]}),this.updateSidebar())}},this.state={result:[],selectedAttribute:"",textValue:"",clipStatus: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 selectedSliceIndex(){return this.state.result.findIndex(r=>r.id===this.state.selectedID)}get exportContext(){return{selectedID:this.state.selectedID,result:this.state.result,clipStatus:this.state.clipStatus,videoPlayer:this.videoPlayer,attributeList:this.props.config.attributeList,onSelectedTimeSlice:this.onSelectedTimeSlice,removeTimeSlice:this.removeTimeSlice,updateSelectedSliceTimeProperty:this.updateSelectedSliceTimeProperty}}get valid(){return this.state.valid}componentDidMount(){this.setState({loading:!1}),this.setResult(!1),this.props.onMounted(this),window.addEventListener("keydown",this.keyDownEvents)}componentWillUnmount(){this.props.onUnmounted(),window.removeEventListener("keydown",this.keyDownEvents)}shouldComponentUpdate(r,t){const e=r.imgIndex-this.props.imgIndex,i=r.step-this.props.step;return(e!==0||i!==0)&&(this.setResult(!0,r),i!==0&&this.setState({loading:!1})),!0}singleOn(r,t){this.fns.set(r,[t])}on(r,t){this.singleOn(r,t)}unbindAll(r){this.fns.delete(r)}render(){const{selectedID:r,result:t,clipStatus:e,selectedAttribute:i}=this.state;return 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,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),f=(i=this.videoPlayer)==null?void 0:i.duration;if(f===void 0||h===void 0)return;const C=utils.decimalReserved(h,2);if(l){const m=lbAnnotation.uuid();o=m,c.push({start:C,end:null,attribute:n,textAttribute:this.defaultTextAttribute,duration:f,id:m,type:constant.ETimeSliceType.Period}),p=this.defaultTextAttribute}else{const m=c.findIndex(v=>v.id===o),g=c[m];g&&(h-g.start<constant.SLICE_MIN_TIME?(c.splice(m,1),antd.message.info(`\u622A\u53D6\u7247\u6BB5\u4E0D\u80FD\u77ED\u4E8E${constant.SLICE_MIN_TIME}s`),u=constant.EClipStatus.Stop,o="",p=""):(c[m].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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(s){super(s);this.fns={},this.labelSelectedList=[],this.clearResult=(e=!0,t)=>{const i=t?this.state.tagResult.map(l=>((l==null?void 0:l.result[t])&&delete l.result[t],l)):[];this.setState({tagResult:i},()=>this.emitEvent("render"))},this.exportData=()=>{var e,t,i,l,o,n,r;const a=(t=(e=this.videoPlayer)==null?void 0:e.duration)!=null?t:0,d=(i=this.videoPlayer)==null?void 0:i.getVideoPlaybackQuality(),u=d==null?void 0:d.totalVideoFrames,c=(o=(l=this.videoPlayer)==null?void 0:l.videoWidth)!=null?o:0,v=(r=(n=this.videoPlayer)==null?void 0:n.videoHeight)!=null?r:0;return[this.state.tagResult,{valid:this.state.valid,duration:a,frames:u,videoWidth:c,videoHeight:v}]},this.emitEvent=e=>{this.fns[e]&&this.fns[e]()},this.combineResult=(e,t={})=>{var i,l;const{isMulti:o}=e,{key:n,value:r}=e.value;if(o){let a=(l=(i=t[n])==null?void 0:i.split(";"))!=null?l:[];a.includes(r)?a=a.filter(u=>u!==r):a.push(r);const d=new Set(a);return t[n]=Array.from(d).join(";"),___default.default.pickBy(t,u=>u)}return t[n]=t[n]===r?void 0:r,___default.default.pickBy(t,a=>a)},this.setResult=e=>{this.setState({tagResult:e}),this.fns.render&&this.fns.render()},this.setLabel=(e,t)=>{this.setLabelBySelectedList(e,t)},this.keydown=e=>{const t=utils.getKeyCodeNumber(e.keyCode);if(t){const i=t-1;if(this.config.inputList.length===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=e=>{this.setState({valid:e}),e===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=e=>{var t;const{imgList:i,imgIndex:l,step:o}=e;if(!i[l])return;const n=index.jsonParser(i[l].result),r=n[`step_${o}`];this.setState({tagResult:(t=r==null?void 0:r.result)!=null?t:[],valid:(n==null?void 0:n.valid)===void 0?!0:n.valid})},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var s;return index.jsonParser((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var s;return(s=this.state.tagResult[0])!=null?s:{}}get valid(){return this.state.valid}singleOn(s,e){this.fns[s]=e}on(s,e){this.singleOn(s,e)}unbindAll(s){delete this.fns[s]}getTagResultByCode(s,e){var t,i,l;try{const o=(i=(t=this.config)==null?void 0:t.inputList)!=null?i:[],n=o.length>1,r=e!==void 0?s:0,a=e!==void 0?e:s,d=n?o[r]:o[0],u=((l=d.subSelected)!=null?l:[])[a];if(d&&u)return{value:{key:d.value,value:u.value},isMulti:d.isMulti}}catch(o){return}}setLabelBySelectedList(s,e){var t,i,l,o;const n=this.getTagResultByCode(s,e);if(n){const r=this.combineResult(n,(i=(t=this.state.tagResult[0])==null?void 0:t.result)!=null?i:{}),a=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(o=(l=this.currentTagResult)==null?void 0:l.id)!=null?o:lbAnnotation.uuid(8,62),result:r}];this.setState({tagResult:a},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s;const{imgIndex:e,imgList:t,pageForward:i,pageJump:l,pageBackward:o}=this.props,{tagResult:n,valid:r}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:e,imgList:t,pageBackward:o,pageForward:i,pageJump:l,valid:r,setVideoRef:a=>{this.videoPlayer=a},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),React__default.default.createElement(VideoTagLayer.VideoTagLayer,{result:n,inputList:(s=this.config)==null?void 0:s.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}exports.TagToolInstanceAdaptor=TagToolInstanceAdaptor;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(d){return d&&typeof d=="object"&&"default"in d?d:{default:d}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(s){super(s);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const l=e?this.state.tagResult.map(i=>((i==null?void 0:i.result[e])&&delete i.result[e],i)):[];this.setState({tagResult:l},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e;const l=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[this.state.tagResult,{valid:this.state.valid,duration:l}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var l,i;const{isMulti:n}=t,{key:r,value:a}=t.value;if(n){let o=(i=(l=e[r])==null?void 0:l.split(";"))!=null?i:[];o.includes(a)?o=o.filter(h=>h!==a):o.push(a);const u=new Set(o);return e[r]=Array.from(u).join(";"),___default.default.pickBy(e,h=>h)}return e[r]=e[r]===a?void 0:a,___default.default.pickBy(e,o=>o)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,e)=>{this.setLabelBySelectedList(t,e)},this.keydown=t=>{var e;const l=utils.getKeyCodeNumber(t.keyCode);if(l){const i=l-1;if(((e=this.config.inputList)==null?void 0:e.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:e,imgIndex:l,stepInfo:i}=t;if(!e[l])return;const n=index.jsonParser(e[l].result),r=n[`step_${i.step}`],a=this.getInitResultList();this.setState({tagResult:r?r==null?void 0:r.result:a,valid:(n==null?void 0:n.valid)===void 0?!0:n.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return lbAnnotation.TagUtils.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var s;return index.jsonParser((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var s;return(s=this.state.tagResult[0])!=null?s:{}}get valid(){return this.state.valid}singleOn(s,t){this.fns[s]=t}on(s,t){this.singleOn(s,t)}unbindAll(s){delete this.fns[s]}getTagResultByCode(s,t){var e,l,i;try{const n=(l=(e=this.config)==null?void 0:e.inputList)!=null?l:[],r=(n==null?void 0:n.length)>1,a=t!==void 0?s:0,o=t!==void 0?t:s,u=r?n[a]:n[0],h=((i=u.subSelected)!=null?i:[])[o];if(u&&h)return{value:{key:u.value,value:h.value},isMulti:u.isMulti}}catch(n){return}}setLabelBySelectedList(s,t){var e,l,i,n;const r=this.getTagResultByCode(s,t);if(r){const a=this.combineResult(r,(l=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?l:{}),o=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(n=(i=this.currentTagResult)==null?void 0:i.id)!=null?n:lbAnnotation.uuid(8,62),result:a}];this.setState({tagResult:o},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s;const{imgIndex:t,imgList:e,pageForward:l,pageJump:i,pageBackward:n}=this.props,{tagResult:r,valid:a}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:t,imgList:e,pageBackward:n,pageForward:l,pageJump:i,valid:a,setVideoRef:o=>{this.videoPlayer=o},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),React__default.default.createElement(VideoTagLayer.VideoTagLayer,{result:r,inputList:(s=this.config)==null?void 0:s.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}exports.TagToolInstanceAdaptor=TagToolInstanceAdaptor;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),_=require("lodash"),VideoTextLayer=require("../../videoPlayer/VideoTextLayer.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class VideoTextTool extends React__default.default.Component{constructor(e){super(e);this.fns={},this.clearResult=(t=!0)=>{this.setState({result:{}},()=>this.updateSidebar())},this.exportData=()=>{var t,l,s,r,i,n,o;const d=(l=(t=this.videoPlayer)==null?void 0:t.duration)!=null?l:0,u=(s=this.videoPlayer)==null?void 0:s.getVideoPlaybackQuality(),h=u==null?void 0:u.totalVideoFrames,v=(i=(r=this.videoPlayer)==null?void 0:r.videoWidth)!=null?i:0,p=(o=(n=this.videoPlayer)==null?void 0:n.videoHeight)!=null?o:0;return[[this.state.result],{valid:this.state.valid,duration:d,frames:h,videoWidth:v,videoHeight:p}]},this.toggleShowText=t=>{this.setState({showText:t})},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.updateSidebar=()=>{this.emitEvent("valueUpdated")},this.updateTextValue=(t,l,s)=>{var r;const i=___default.default.cloneDeep(s!=null?s:{});i.value=Object.assign((r=i.value)!=null?r:{},{[t]:l}),this.setState({result:i},()=>this.updateSidebar())},this.setResult=t=>{this.setState({result:t}),this.fns.render&&this.fns.render()},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({result:{}}),this.emitEvent("render")},this.setResultFromImgList=t=>{var l,s;const{imgList:r,imgIndex:i,step:n}=t;if(!r[i])return;const o=index.jsonParser(r[i].result),d=o[`step_${n}`];this.setState({result:(s=(l=d==null?void 0:d.result)==null?void 0:l[0])!=null?s:{},valid:(o==null?void 0:o.valid)===void 0?!0:o.valid},()=>this.updateSidebar())},this.state={result:{},valid:!0,showText:!0}}get config(){var e;return index.jsonParser((e=this.props.stepInfo)==null?void 0:e.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get valid(){return this.state.valid}get textList(){return[this.state.result]}getColor(e=this.config,t=""){return lbUtils.toolStyleConverter.getColorByConfig({attribute:t,config:e})}singleOn(e,t){this.fns[e]=t}on(e,t){this.singleOn(e,t)}unbindAll(e){delete this.fns[e]}componentDidMount(){this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){this.props.onUnmounted()}shouldComponentUpdate(e){return e.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(e),!0}render(){var e,t;const{imgIndex:l,imgList:s,pageForward:r,pageJump:i,pageBackward:n}=this.props,{result:o,valid:d,showText:u}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},u&&o.value&&React__default.default.createElement(VideoTextLayer.VideoTextLayer,{value:o.value,toolColor:(t=(e=this.getColor(this.config))==null?void 0:e.valid)==null?void 0:t.fill,configList:this.config.configList,hasPromptLayer:!!this.props.drawLayerSlot}),React__default.default.createElement(index$1.VideoPlayer,{imgIndex:l,imgList:s,pageBackward:n,pageForward:r,pageJump:i,valid:d,setVideoRef:h=>{this.videoPlayer=h},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}))}}exports.VideoTextTool=VideoTextTool;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),_=require("lodash"),VideoTextLayer=require("../../videoPlayer/VideoTextLayer.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class VideoTextTool extends React__default.default.Component{constructor(s){super(s);this.fns={},this.clearResult=(t=!0)=>{this.setState({result:{}},()=>this.updateSidebar())},this.exportData=()=>{var t,e;const i=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[[this.state.result],{valid:this.state.valid,duration:i}]},this.toggleShowText=t=>{this.setState({showText:t})},this.singleOn=(t,e)=>{this.fns[t]=e},this.on=(t,e)=>{this.singleOn(t,e)},this.unbindAll=t=>{delete this.fns[t]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.updateSidebar=()=>{this.emitEvent("valueUpdated")},this.updateTextValue=(t,e,i,r)=>{var o;const l=___default.default.cloneDeep(r!=null?r:{});l.value=Object.assign((o=l.value)!=null?o:{},{[t]:e}),this.setState({result:l},()=>i&&this.updateSidebar())},this.setResult=t=>{this.setState({result:t}),this.fns.render&&this.fns.render()},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({result:{}}),this.emitEvent("render")},this.setResultFromImgList=t=>{var e,i;const{imgList:r,imgIndex:o,stepInfo:l}=t;if(!r[o])return;const a=index.jsonParser(r[o].result),u=a[`step_${l.step}`],d={value:this.getInitTextValue()};this.setState({result:u?(i=(e=u==null?void 0:u.result)==null?void 0:e[0])!=null?i:{}:d,valid:(a==null?void 0:a.valid)===void 0?!0:a.valid},()=>this.updateSidebar())},this.getInitTextValue=()=>{let t={};return this.config.configList.forEach(e=>{var i;t[e.key]=(i=e.default)!=null?i:""}),t},this.state={result:{},valid:!0,showText:!0}}get config(){var s;return index.jsonParser((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get valid(){return this.state.valid}get needConfirm(){var s;const{result:t}=this.state;return(s=this.config.configList)==null?void 0:s.some(e=>{var i;return e.required&&!((i=t==null?void 0:t.value)==null?void 0:i[e.key])})}get textList(){return[this.state.result]}getColor(s=this.config,t=""){return lbUtils.toolStyleConverter.getColorByConfig({attribute:t,config:s})}componentDidMount(){this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s,t;const{imgIndex:e,imgList:i,pageForward:r,pageJump:o,pageBackward:l}=this.props,{result:a,valid:u,showText:d}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},d&&a.value&&React__default.default.createElement(VideoTextLayer.VideoTextLayer,{value:a.value,toolColor:(t=(s=this.getColor(this.config))==null?void 0:s.valid)==null?void 0:t.fill,configList:this.config.configList,hasPromptLayer:!!this.props.drawLayerSlot}),React__default.default.createElement(index$1.VideoPlayer,{imgIndex:e,imgList:i,pageBackward:l,pageForward:r,pageJump:o,valid:u,setVideoRef:h=>{this.videoPlayer=h},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded}))}}exports.VideoTextTool=VideoTextTool;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),dom=require("../../../../utils/dom.js"),icons=require("@ant-design/icons"),index=require("../../index.js"),Pagination=require("../../../../views/MainView/toolFooter/Pagination.js"),icon_keyboard_h=require("../../../../assets/annotation/video/icon_keyboard_h.svg.js"),index$2=require("../../../../views/MainView/toolFooter/FooterTips/ToolHotKey/index.js"),reactI18next=require("react-i18next"),utils=require("../../utils.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$1=require("../../../videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js"),VideoClipToolContext=require("../../../videoAnnotate/videoClipTool/VideoClipToolContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{EVideoToolName}=lbAnnotation.cTool,videoTimeFormat=e=>{const t=Math.floor(e/60),a=~~(e%60).toFixed(),o=(e*10).toString().split("").pop(),l=s=>s<10?`0${s}`:s;return`${l(t)}:${l(a)}:${o}`};exports.EPlayerType=void 0,function(e){e[e.Video=0]="Video",e[e.Audio=1]="Audio"}(exports.EPlayerType||(exports.EPlayerType={}));const VideoProgress=()=>{const{currentTime:e,duration:t,buffered:a,setCurrentTime:o}=React__default.default.useContext(index.VideoPlayerCtx),l=React__default.default.useRef(null),s=React.useMemo(()=>`${utils.decimalReserved(a/t*100,1)}%`,[a,t]),r=React.useMemo(()=>`${utils.decimalReserved(e/t*100,1)}%`,[e,t]),d=n=>{if(l.current){const c=n.clientX,u=l.current.clientWidth,i=utils.decimalReserved(c/u*t,1);o(i)}};return React__default.default.createElement("div",{className:dom.getClassName("video-progress"),ref:l,onClick:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),d(n)}},React__default.default.createElement("div",{className:dom.getClassName("video-slider")},React__default.default.createElement("div",{className:dom.getClassName("video-slider","played"),style:{width:r}}),React__default.default.createElement("div",{className:dom.getClassName("video-slider","loaded"),style:{width:s}}),React__default.default.createElement("div",{className:dom.getClassName("video-slider","played"),style:{width:r}})),React__default.default.createElement("div",{className:dom.getClassName("video-slider-bar"),style:{left:r}}))},VideoSpeedButton=()=>{const{updateNextPlaybackRate:e,playbackRate:t}=React__default.default.useContext(index.VideoPlayerCtx),{t:a}=reactI18next.useTranslation();return React__default.default.createElement("span",{className:dom.getClassName("video-controller","speed")},React__default.default.createElement("span",null,a("Speed")),React__default.default.createElement("span",{className:dom.getClassName("video-controller","speedNum")},`${t}x`),React__default.default.createElement("span",{className:dom.getClassName("video-controller","speedButton")},React__default.default.createElement(icons.CaretUpOutlined,{onClick:()=>{e()}}),React__default.default.createElement(icons.CaretDownOutlined,{onClick:()=>{e(!1)}})))},VideoHotKeys=()=>{const{t:e}=reactI18next.useTranslation();return React__default.default.createElement(index$2.default,{title:React__default.default.createElement("span",{className:dom.getClassName("video-controller","hotkey")},React__default.default.createElement("img",{src:icon_keyboard_h}),e("Hotkeys")),style:{},toolName:EVideoToolName.VideoTagTool})},VideoPageChange=()=>{const{imgIndex:e,imgList:t,pageBackward:a,pageJump:o,pageForward:l}=React__default.default.useContext(index.VideoPlayerCtx);return React__default.default.createElement(Pagination.Pagination,{isVideo:!0,pageBackward:a,imgIndex:e,pageJump:o,totalPage:t.length,pageForward:l,footerCls:dom.getClassName("video-controller")})},VideoTime=()=>{const{currentTime:e,duration:t}=React__default.default.useContext(index.VideoPlayerCtx),a=t*10-e*10,o=(a>0?a:0)/10;return React__default.default.createElement("div",{className:dom.getClassName("video-controller","time")},`${videoTimeFormat(e)} / -${videoTimeFormat(o)}`)},VideoPlay=e=>{const{playPause:t,isPlay:a}=e;return React__default.default.createElement("span",{onClick:()=>{t()},className:dom.getClassName("video-controller","playButton")},a?React__default.default.createElement(icons.PauseOutlined,null):React__default.default.createElement(icons.CaretRightOutlined,null))},VideoController=e=>{var t,a;const{footer:o}=e,{playPause:l,isPlay:s,addTime:r,toggleClipStatus:d}=React__default.default.useContext(index.VideoPlayerCtx),{result:n}=React.useContext(VideoClipToolContext.VideoClipToolContext),c=(a=(t=n==null?void 0:n.filter(x=>x.end!==null))==null?void 0:t.length)!=null?a:0,{t:u}=reactI18next.useTranslation(),i=React__default.default.createElement(VideoProgress,null),m=React__default.default.createElement(VideoPlay,{playPause:l,isPlay:s}),f=React__default.default.createElement(VideoTime,null),v=React__default.default.createElement(VideoSpeedButton,null),p=React__default.default.createElement(VideoPageChange,null),C=React__default.default.createElement(VideoHotKeys,null),y=React__default.default.createElement(index$1,{addTime:r,toggleClipStatus:d}),g=React__default.default.createElement("span",{style:{margin:"0px 8px",fontSize:12}},`${u("ItemsOfThisPage")}: ${c}`);return o?typeof o=="function"?o({videoProgress:i,videoPlayIcon:m,videoTime:f,videoSpeed:v,videoPageChange:p,videoHotKeys:C,videoClipHotKey:y,videoResultCount:g}):o:React__default.default.createElement("div",{className:dom.getClassName("video-controller","wrapper")},i,React__default.default.createElement("div",{className:dom.getClassName("video-controller")},m,f,v,React__default.default.createElement("div",{className:dom.getClassName("video-controller","holder")}),g,p,C))};exports.default=VideoController,exports.videoTimeFormat=videoTimeFormat;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),dom=require("../../../../utils/dom.js"),icons=require("@ant-design/icons"),index=require("../../index.js"),Pagination=require("../../../../views/MainView/toolFooter/Pagination.js"),icon_keyboard_h=require("../../../../assets/annotation/video/icon_keyboard_h.svg.js"),index$2=require("../../../../views/MainView/toolFooter/FooterTips/ToolHotKey/index.js"),reactI18next=require("react-i18next"),utils=require("../../utils.js"),lbAnnotation=require("@labelbee/lb-annotation"),index$1=require("../../../videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js"),VideoClipToolContext=require("../../../videoAnnotate/videoClipTool/VideoClipToolContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{EVideoToolName}=lbAnnotation.cTool,videoTimeFormat=e=>{const t=Math.floor(e/60),a=~~Math.floor(e%60),o=(e*10).toString().split("").pop(),l=s=>s<10?`0${s}`:s;return`${l(t)}:${l(a)}:${o}`};exports.EPlayerType=void 0,function(e){e[e.Video=0]="Video",e[e.Audio=1]="Audio"}(exports.EPlayerType||(exports.EPlayerType={}));const VideoProgress=()=>{const{currentTime:e,duration:t,buffered:a,setCurrentTime:o}=React__default.default.useContext(index.VideoPlayerCtx),l=React__default.default.useRef(null),s=React.useMemo(()=>`${utils.decimalReserved(a/t*100,1)}%`,[a,t]),r=React.useMemo(()=>`${utils.decimalReserved(e/t*100,1)}%`,[e,t]),d=n=>{if(l.current){const c=n.clientX,u=l.current.clientWidth,i=utils.decimalReserved(c/u*t,1);o(i)}};return React__default.default.createElement("div",{className:dom.getClassName("video-progress"),ref:l,onMouseUp:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation(),d(n)}},React__default.default.createElement("div",{className:dom.getClassName("video-slider")},React__default.default.createElement("div",{className:dom.getClassName("video-slider","played"),style:{width:r}}),React__default.default.createElement("div",{className:dom.getClassName("video-slider","loaded"),style:{width:s}}),React__default.default.createElement("div",{className:dom.getClassName("video-slider","played"),style:{width:r}})),React__default.default.createElement("div",{className:dom.getClassName("video-slider-bar"),style:{left:r}}))},VideoSpeedButton=()=>{const{updateNextPlaybackRate:e,playbackRate:t}=React__default.default.useContext(index.VideoPlayerCtx),{t:a}=reactI18next.useTranslation();return React__default.default.createElement("span",{className:dom.getClassName("video-controller","speed")},React__default.default.createElement("span",null,a("Speed")),React__default.default.createElement("span",{className:dom.getClassName("video-controller","speedNum")},`${t}x`),React__default.default.createElement("span",{className:dom.getClassName("video-controller","speedButton")},React__default.default.createElement(icons.CaretUpOutlined,{onClick:()=>{e()}}),React__default.default.createElement(icons.CaretDownOutlined,{onClick:()=>{e(!1)}})))},VideoHotKeys=()=>{const{t:e}=reactI18next.useTranslation();return React__default.default.createElement(index$2.default,{title:React__default.default.createElement("span",{className:dom.getClassName("video-controller","hotkey")},React__default.default.createElement("img",{src:icon_keyboard_h}),e("Hotkeys")),style:{},toolName:EVideoToolName.VideoTagTool})},VideoPageChange=()=>{const{imgIndex:e,imgList:t,pageBackward:a,pageJump:o,pageForward:l}=React__default.default.useContext(index.VideoPlayerCtx);return React__default.default.createElement(Pagination.Pagination,{isVideo:!0,pageBackward:a,imgIndex:e,pageJump:o,totalPage:t.length,pageForward:l,footerCls:dom.getClassName("video-controller")})},VideoTime=()=>{const{currentTime:e,duration:t}=React__default.default.useContext(index.VideoPlayerCtx),a=t*10-e*10,o=(a>0?a:0)/10;return React__default.default.createElement("div",{className:dom.getClassName("video-controller","time")},`${videoTimeFormat(e)} / -${videoTimeFormat(o)}`)},VideoPlay=e=>{const{playPause:t,isPlay:a}=e;return React__default.default.createElement("span",{onClick:()=>{t()},className:dom.getClassName("video-controller","playButton")},a?React__default.default.createElement(icons.PauseOutlined,null):React__default.default.createElement(icons.CaretRightOutlined,null))},VideoController=e=>{var t,a;const{footer:o}=e,{playPause:l,isPlay:s,addTime:r,toggleClipStatus:d}=React__default.default.useContext(index.VideoPlayerCtx),{result:n}=React.useContext(VideoClipToolContext.VideoClipToolContext),c=(a=(t=n==null?void 0:n.filter(N=>N.end!==null))==null?void 0:t.length)!=null?a:0,{t:u}=reactI18next.useTranslation(),i=React__default.default.createElement(VideoProgress,null),m=React__default.default.createElement(VideoPlay,{playPause:l,isPlay:s}),f=React__default.default.createElement(VideoTime,null),v=React__default.default.createElement(VideoSpeedButton,null),p=React__default.default.createElement(VideoPageChange,null),C=React__default.default.createElement(VideoHotKeys,null),g=React__default.default.createElement(index$1,{addTime:r,toggleClipStatus:d}),y=React__default.default.createElement("span",{style:{margin:"0px 8px",fontSize:12}},`${u("ItemsOfThisPage")}: ${c}`);return o?typeof o=="function"?o({videoProgress:i,videoPlayIcon:m,videoTime:f,videoSpeed:v,videoPageChange:p,videoHotKeys:C,videoClipHotKey:g,videoResultCount:y}):o:React__default.default.createElement("div",{className:dom.getClassName("video-controller","wrapper")},i,React__default.default.createElement("div",{className:dom.getClassName("video-controller")},m,f,v,g,React__default.default.createElement("div",{className:dom.getClassName("video-controller","holder")}),y,p,C))};exports.default=VideoController,exports.videoTimeFormat=videoTimeFormat;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),index$2=require("./components/controller/index.js"),index=require("../videoAnnotate/videoClipTool/components/videoTrack/index.js"),dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),utils=require("./utils.js"),index$1=require("../fileException/index.js");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React);const EKeyCode=lbAnnotation.cKeyCode.default,VideoPlayerCtx=React__default.default.createContext({isPlay:!1,playPause:()=>{},updateNextPlaybackRate:()=>{},playbackRate:1,currentTime:0,duration:0,buffered:0,setCurrentTime:()=>{},imgList:[],imgIndex:-1,pageBackward:()=>{},pageJump:o=>{},pageForward:()=>{},addTime:()=>{},toggleClipStatus:()=>{}}),PER_INTERVAL=50,PER_FORWARD=.1,PLAYBACK_RATES=[.5,1,1.5,2,4,6,8,16];class VideoPlayer extends React__default.default.Component{constructor(a){super(a);this.changePlaybackPate=e=>{this.videoElm&&(this.videoElm.playbackRate=e,this.setState({playbackRate:e}))},this.playPause=()=>{var e,t,i;((e=this.videoElm)==null?void 0:e.paused)?(t=this.videoElm)==null||t.play():(i=this.videoElm)==null||i.pause()},this.updateNextPlaybackRate=(e=!0)=>{const t=PLAYBACK_RATES.findIndex(r=>r===this.state.playbackRate);let i=e?Math.min(t+1,PLAYBACK_RATES.length-1):Math.max(t-1,0);this.changePlaybackPate(PLAYBACK_RATES[i])},this.fastForward=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime+PER_FORWARD)},this.rewind=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime-PER_FORWARD)},this.keydown=e=>{e.keyCode===EKeyCode.Space&&(e.preventDefault(),this.playPause()),e.keyCode===EKeyCode.Up&&(e.preventDefault(),this.updateNextPlaybackRate()),e.keyCode===EKeyCode.Down&&(e.preventDefault(),this.updateNextPlaybackRate(!1)),e.keyCode===EKeyCode.Left&&(e.preventDefault(),this.rewind()),e.keyCode===EKeyCode.Right&&(e.preventDefault(),this.fastForward())},this.onPlay=()=>{this.setState({isPlay:!0},this.onVideoStart)},this.onPause=()=>{this.onVideoStopped()},this.onTimeUpdate=()=>{var e;this.videoElm&&this.setState({currentTime:utils.decimalReserved((e=this.videoElm)==null?void 0:e.currentTime,1)})},this.onVideoStopped=()=>{this.setState({isPlay:!1}),this.timeInterval&&(clearInterval(this.timeInterval),this.timeInterval=void 0),this.videoElm&&this.setCurrentTime(this.videoElm.currentTime)},this.onVideoStart=()=>{this.timeInterval=window.setInterval(()=>{var e,t,i;if(this.videoElm)try{if(((e=this.videoElm)==null?void 0:e.buffered.length)>0){const r=(t=this.videoElm)==null?void 0:t.buffered.end(0);this.setState({currentTime:utils.decimalReserved((i=this.videoElm)==null?void 0:i.currentTime,1),buffered:r})}}catch(r){console.error(r)}},PER_INTERVAL)},this.resetVideoData=()=>{this.setState({currentTime:0,buffered:0,error:!1,isPlay:!1}),this.videoElm&&(this.videoElm.playbackRate=this.state.playbackRate),this.onVideoStopped()},this.setDuration=()=>{var e,t,i;if(this.videoElm){const r=utils.decimalReserved((e=this.videoElm)==null?void 0:e.duration,1);(i=(t=this.props).dataLoaded)==null||i.call(t,r),this.setState({duration:r})}},this.setCurrentTime=e=>{this.videoElm&&(this.videoElm.currentTime=e,this.setState({currentTime:e}))},this.reload=()=>{var e;(e=this.videoElm)==null||e.load()},this.onError=()=>{this.resetVideoData(),this.setState({error:!0})},this.state={playbackRate:1,currentTime:0,isPlay:!1,duration:0,buffered:0,error:!1},this.videoRef=React__default.default.createRef()}get videoElm(){var a;return(a=this.videoRef)==null?void 0:a.current}get videoSrc(){var a,e;const{imgIndex:t,imgList:i}=this.props;return t>-1&&(e=(a=i[t])==null?void 0:a.url)!=null?e:""}componentDidMount(){var a,e;window.addEventListener("keydown",this.keydown),((a=this.videoRef)==null?void 0:a.current)&&this.props.setVideoRef&&this.props.setVideoRef((e=this.videoRef)==null?void 0:e.current)}componentWillUnmount(){window.removeEventListener("keydown",this.keydown)}render(){const{isPlay:a,playbackRate:e,currentTime:t,duration:i,buffered:r,error:n}=this.state,{imgList:u,imgIndex:h,pageBackward:c,pageJump:m,pageForward:v,valid:f,footer:p,drawLayerSlot:s}=this.props,y=isNaN(i)?0:Math.max(utils.decimalReserved(i,1)-t,0),{playPause:d,updateNextPlaybackRate:E,onPause:g,onPlay:R,onTimeUpdate:P,resetVideoData:k,setDuration:T,setCurrentTime:b,onError:x,videoRef:C,videoSrc:w}=this;return React__default.default.createElement(VideoPlayerCtx.Provider,{value:{videoRef:this.videoRef,addTime:this.props.addTime,toggleClipStatus:this.props.toggleClipStatus,isPlay:a,playPause:d,updateNextPlaybackRate:E,playbackRate:e,currentTime:t,duration:i,buffered:r,setCurrentTime:b,imgIndex:h,imgList:u,pageBackward:c,pageJump:m,pageForward:v}},React__default.default.createElement(React__default.default.Fragment,null,s==null?void 0:s({currentTime:t,remainingTime:y,zoom:1,currentPos:{x:0,y:0}}),React__default.default.createElement("div",{className:dom.getClassName("video-wrapper")},React__default.default.createElement("div",{className:dom.getClassName("video-container")},React__default.default.createElement("video",{ref:C,className:dom.getClassName(this.props.showVideoTrack?"video-track":"video"),src:w,onPause:g,onPlay:R,onTimeUpdate:P,onLoadedMetadata:k,onError:x,onDurationChange:T,width:"100%",height:"100%",onClick:d}),this.props.showVideoTrack&&React__default.default.createElement(index.default,{currentTime:t,onTrackResize:this.props.onTrackResize,onTrackResizeStart:()=>{var l;(l=this.videoElm)==null||l.pause()},readonly:!1}),React__default.default.createElement(index$1,{fileType:"video",errorProps:{reloadImage:this.reload,backgroundColor:"#e2e2e2",ignoreOffsetY:!0,isError:n},invalidProps:{isValid:f}})),React__default.default.createElement(index$2.default,{footer:p}))))}}exports.VideoPlayer=VideoPlayer,exports.VideoPlayerCtx=VideoPlayerCtx,exports.default=VideoPlayer;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),index$2=require("./components/controller/index.js"),index=require("../videoAnnotate/videoClipTool/components/videoTrack/index.js"),dom=require("../../utils/dom.js"),lbAnnotation=require("@labelbee/lb-annotation"),utils=require("./utils.js"),index$1=require("../fileException/index.js");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React);const EKeyCode=lbAnnotation.cKeyCode.default,VideoPlayerCtx=React__default.default.createContext({isPlay:!1,playPause:()=>{},updateNextPlaybackRate:()=>{},playbackRate:1,currentTime:0,duration:0,buffered:0,setCurrentTime:()=>{},imgList:[],imgIndex:-1,pageBackward:()=>{},pageJump:o=>{},pageForward:()=>{},addTime:()=>{},toggleClipStatus:()=>{}}),PER_INTERVAL=50,PER_FORWARD=.1,PLAYBACK_RATES=[.5,1,1.5,2,4,6,8,16];class VideoPlayer extends React__default.default.Component{constructor(a){super(a);this.changePlaybackPate=e=>{this.videoElm&&(this.videoElm.playbackRate=e,this.setState({playbackRate:e}))},this.playPause=()=>{var e,t,i;((e=this.videoElm)==null?void 0:e.paused)?(t=this.videoElm)==null||t.play():(i=this.videoElm)==null||i.pause()},this.updateNextPlaybackRate=(e=!0)=>{const t=PLAYBACK_RATES.findIndex(r=>r===this.state.playbackRate);let i=e?Math.min(t+1,PLAYBACK_RATES.length-1):Math.max(t-1,0);this.changePlaybackPate(PLAYBACK_RATES[i])},this.fastForward=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime+PER_FORWARD)},this.rewind=()=>{this.videoElm&&this.setCurrentTime(this.videoElm.currentTime-PER_FORWARD)},this.keydown=e=>{e.keyCode===EKeyCode.Space&&(e.preventDefault(),this.playPause()),e.keyCode===EKeyCode.Up&&(e.preventDefault(),this.updateNextPlaybackRate()),e.keyCode===EKeyCode.Down&&(e.preventDefault(),this.updateNextPlaybackRate(!1)),e.keyCode===EKeyCode.Left&&(e.preventDefault(),this.rewind()),e.keyCode===EKeyCode.Right&&(e.preventDefault(),this.fastForward())},this.onPlay=()=>{this.setState({isPlay:!0},this.onVideoStart)},this.onPause=()=>{this.onVideoStopped()},this.onTimeUpdate=()=>{var e;this.videoElm&&this.setState({currentTime:utils.decimalReserved((e=this.videoElm)==null?void 0:e.currentTime,1)})},this.onVideoStopped=()=>{this.setState({isPlay:!1}),this.timeInterval&&(clearInterval(this.timeInterval),this.timeInterval=void 0),this.videoElm&&this.setCurrentTime(this.videoElm.currentTime)},this.onVideoStart=()=>{this.timeInterval=window.setInterval(()=>{var e,t,i;if(this.videoElm)try{if(((e=this.videoElm)==null?void 0:e.buffered.length)>0){const r=(t=this.videoElm)==null?void 0:t.buffered.end(0);this.setState({currentTime:utils.decimalReserved((i=this.videoElm)==null?void 0:i.currentTime,1),buffered:r})}}catch(r){console.error(r)}},PER_INTERVAL)},this.resetVideoData=()=>{this.setState({currentTime:0,buffered:0,error:!1,isPlay:!1}),this.videoElm&&(this.videoElm.playbackRate=this.state.playbackRate),this.onVideoStopped()},this.setDuration=()=>{var e,t,i;if(this.videoElm){const r=utils.decimalReserved((e=this.videoElm)==null?void 0:e.duration,1);(i=(t=this.props).dataLoaded)==null||i.call(t),this.setState({duration:r})}},this.setCurrentTime=e=>{var t,i;this.videoElm&&(this.videoElm.currentTime=e,this.setState({currentTime:e}),(i=(t=this.props).updateCurrentTime)==null||i.call(t,e))},this.reload=()=>{var e;(e=this.videoElm)==null||e.load()},this.onError=()=>{this.resetVideoData(),this.setState({error:!0})},this.state={playbackRate:1,currentTime:0,isPlay:!1,duration:0,buffered:0,error:!1},this.videoRef=React__default.default.createRef()}get videoElm(){var a;return(a=this.videoRef)==null?void 0:a.current}get videoSrc(){var a,e;const{imgIndex:t,imgList:i}=this.props;return t>-1&&(e=(a=i[t])==null?void 0:a.url)!=null?e:""}componentDidMount(){var a,e;window.addEventListener("keydown",this.keydown),((a=this.videoRef)==null?void 0:a.current)&&this.props.setVideoRef&&this.props.setVideoRef((e=this.videoRef)==null?void 0:e.current)}componentWillUnmount(){window.removeEventListener("keydown",this.keydown)}render(){const{isPlay:a,playbackRate:e,currentTime:t,duration:i,buffered:r,error:n}=this.state,{imgList:u,imgIndex:h,pageBackward:c,pageJump:v,pageForward:m,valid:p,footer:f,drawLayerSlot:s}=this.props,y=isNaN(i)?0:Math.max(utils.decimalReserved(i,1)-t,0),{playPause:d,updateNextPlaybackRate:E,onPause:g,onPlay:R,onTimeUpdate:P,resetVideoData:k,setDuration:b,setCurrentTime:T,onError:x,videoRef:C,videoSrc:_}=this;return React__default.default.createElement(VideoPlayerCtx.Provider,{value:{videoRef:this.videoRef,addTime:this.props.addTime,toggleClipStatus:this.props.toggleClipStatus,isPlay:a,playPause:d,updateNextPlaybackRate:E,playbackRate:e,currentTime:t,duration:i,buffered:r,setCurrentTime:T,imgIndex:h,imgList:u,pageBackward:c,pageJump:v,pageForward:m}},React__default.default.createElement(React__default.default.Fragment,null,s==null?void 0:s({currentTime:t,remainingTime:y,zoom:1,currentPos:{x:0,y:0}}),React__default.default.createElement("div",{className:dom.getClassName("video-wrapper")},React__default.default.createElement("div",{className:dom.getClassName("video-container")},React__default.default.createElement("video",{ref:C,className:dom.getClassName(this.props.showVideoTrack?"video-track":"video"),src:_,onPause:g,onPlay:R,onTimeUpdate:P,onLoadedMetadata:k,onError:x,onDurationChange:b,width:"100%",height:"100%",onClick:d}),this.props.showVideoTrack&&React__default.default.createElement(index.default,{currentTime:t,onTrackResize:this.props.onTrackResize,onTrackResizeStart:()=>{var l;(l=this.videoElm)==null||l.pause()},readonly:!1}),React__default.default.createElement(index$1,{fileType:"video",errorProps:{reloadImage:this.reload,backgroundColor:"#e2e2e2",ignoreOffsetY:!0,isError:n},invalidProps:{isValid:p}})),React__default.default.createElement(index$2.default,{footer:f}))))}}exports.VideoPlayer=VideoPlayer,exports.VideoPlayerCtx=VideoPlayerCtx,exports.default=VideoPlayer;
package/dist/index.css CHANGED
@@ -337,26 +337,25 @@
337
337
  position: absolute;
338
338
  top: 0;
339
339
  right: 0;
340
- max-height: calc(100% - 80px - 90px - 24px);
340
+ max-width: 416px;
341
+ max-height: 80%;
341
342
  padding-right: 4px;
342
343
  overflow: auto;
343
344
  z-index: 22;
344
345
  }
345
346
 
346
347
  .index-module_timeSliceWrapper__kebC3 {
347
- height: 80px;
348
+ min-height: 80px;
348
349
  margin-bottom: 8px;
349
350
  transition: opacity 0.4s ease-in-out;
350
- opacity: 0.3;
351
- }
352
- .index-module_timeSliceWrapper__kebC3.index-module_active__cIGVq {
353
- opacity: 1;
351
+ opacity: 0.9;
354
352
  }
355
353
  .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemText__FJFwH,
356
354
  .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemAttribute__--3E1 {
357
- height: 40px;
355
+ min-height: 40px;
358
356
  font-size: 16px;
359
357
  color: white;
358
+ word-break: break-all;
360
359
  }
361
360
  .index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemText__FJFwH {
362
361
  background-color: #CCC;
@@ -1964,7 +1963,7 @@
1964
1963
 
1965
1964
  .textInputContainer {
1966
1965
  padding: 20px;
1967
- height: 100%;
1966
+ height: auto;
1968
1967
  overflow-y: scroll;
1969
1968
  }
1970
1969
 
@@ -2827,7 +2826,7 @@
2827
2826
  margin-bottom: 24px;
2828
2827
  width: 100%;
2829
2828
  }
2830
- .bee-LLMView__tag {
2829
+ .bee-LLMView .bee-LLMView-tag {
2831
2830
  color: #666FFF;
2832
2831
  background: #eeefff;
2833
2832
  height: 20px;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$4=require("./components/predictTracking/predictTrackingIcon/index.js"),index$3=require("./components/LLMToolView/index.js"),index$5=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$6=require("./constant/index.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,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,a]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;a(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$4,exports.LLMToolView=index$3,exports.SwitchCuboidBoxIn2DView=index$5,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$6.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$6.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$6.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$6.ESubmitType}}),exports.componentCls=index$6.componentCls,exports.prefix=index$6.prefix,exports.default=index,exports.store=store;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$4=require("./components/predictTracking/predictTrackingIcon/index.js"),index$3=require("./components/LLMToolView/index.js"),index$5=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$6=require("./components/measureCanvas/index.js"),index$7=require("./constant/index.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,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,a]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;a(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$4,exports.LLMToolView=index$3,exports.SwitchCuboidBoxIn2DView=index$5,exports.MeasureCanvas=index$6,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$7.EDataFormatType}}),Object.defineProperty(exports,"ELLMDataType",{enumerable:!0,get:function(){return index$7.ELLMDataType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$7.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$7.ESubmitType}}),exports.componentCls=index$7.componentCls,exports.prefix=index$7.prefix,exports.default=index,exports.store=store;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$2=require("../../components/customResizeHook/index.js"),index$1=require("../../constant/index.js"),styleString=require("../../constant/styleString.js"),Actions=require("../Actions.js"),index=require("../../utils/index.js"),AnnotationDataUtils=require("../../utils/AnnotationDataUtils.js"),ConfigUtils=require("../../utils/ConfigUtils.js"),data=require("../../utils/data.js"),StepUtils=require("../../utils/StepUtils.js"),ToolUtils=require("../../utils/ToolUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),antd=require("antd"),es=require("antd/es"),_=require("lodash"),actionCreators=require("./actionCreators.js"),ToolType=require("../../data/enums/ToolType.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,s)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,__spreadValues=(e,t)=>{for(var s in t||(t={}))__hasOwnProp.call(t,s)&&__defNormalProp(e,s,t[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(t))__propIsEnum.call(t,s)&&__defNormalProp(e,s,t[s]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,s)=>new Promise((O,u)=>{var A=I=>{try{S(s.next(I))}catch(m){u(m)}},g=I=>{try{S(s.throw(I))}catch(m){u(m)}},S=I=>I.done?O(I.value):Promise.resolve(I.value).then(A,g);S((s=s.apply(e,t)).next())});const getStepConfig=(e,t)=>e.find(s=>s.step===t),initialState={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},getTotalPage=e=>{const{imgList:t,imgPageSize:s}=e;return Math.ceil(t.length/s)},calcStepProgress=(e,t)=>e.reduce((s,O)=>{if(O){const u=O.result;if(index.jsonParser(u)[`step_${t}`])return s+1}return s},0)/e.length,updateToolInstance=(e,t)=>{const{step:s,stepList:O}=e,u=StepUtils.getCurrentStepInfo(s,O),A=ConfigUtils.ConfigUtils.jsonParser(u.config);if(ToolUtils.isVideoTool(u==null?void 0:u.tool)||ToolUtils.isAudioTool(u==null?void 0:u.tool)||ToolUtils.isPointCloudTool(u==null?void 0:u.tool)||ToolType.EToolName.LLM===(u==null?void 0:u.tool))return;const g=document.getElementById("toolContainer");if(!g)throw"Not exist dom named id-toolContainer";const S=index$2.getFormatSize({width:window.innerWidth,height:window.innerHeight}),I=new lbAnnotation.AnnotationEngine({container:g,toolName:u.tool,size:S,imgNode:t,config:A,style:JSON.parse(styleString)});return{toolInstance:I==null?void 0:I.toolInstance,annotationEngine:I}},LoadFileAndFileData=(e,t)=>(s,O)=>__async(void 0,null,function*(){var u;const{stepList:A,step:g}=O().annotation,S=StepUtils.currentToolIsVideo(g,A),I=StepUtils.currentToolIsPointCloud(g,A),m=((u=StepUtils.getCurrentStepInfo(g,A))==null?void 0:u.tool)===ToolType.EToolName.LLM,D=StepUtils.currentToolIsAudio(g,A);if(actionCreators.SetAnnotationLoading(s,!0),yield s(TryGetFileDataByAPI(e)),S||I||m||D){s(AfterVideoLoaded(e));return}s(AfterImageLoaded(e,t))}),TryGetFileDataByAPI=e=>(t,s)=>__async(void 0,null,function*(){const{getFileData:O,imgList:u}=s().annotation;if(O){const A=yield O(u[e],e);t({type:Actions.ANNOTATION_ACTIONS.SET_FILE_DATA,payload:{fileData:A,index:e}})}}),AfterVideoLoaded=e=>t=>{actionCreators.SetAnnotationLoading(t,!1),t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterImageLoaded=(e,t)=>(s,O)=>{var u;const{toolInstance:A,imgList:g}=O().annotation,S=(u=g==null?void 0:g[e])==null?void 0:u.url;lbAnnotation.ImgUtils.load(S).then(I=>{actionCreators.SetAnnotationLoading(s,!1),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{imgNode:I,nextIndex:e,nextBasicIndex:t}})}).catch(()=>{actionCreators.SetAnnotationLoading(s,!1),A==null||A.setErrorImg(),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e,nextBasicIndex:t}})})},composeResultByToolInstance=({toolInstance:e,imgList:t,imgIndex:s,stepList:O,step:u=1})=>{var A,g,S,I;const m=((A=t[s])==null?void 0:A.result)||"",[D,b,U]=(g=e==null?void 0:e.exportData())!=null?g:[],x=(I=(S=e==null?void 0:e.exportCustomData)==null?void 0:S.call(e))!=null?I:{},B=data.composeResultWithBasicImgInfo(m,b),w=data.composeResult(B,{step:u,stepList:O},{rect:D},x);return t.map((R,F)=>F===s?__spreadValues(__spreadProps(__spreadValues({},R),{result:w}),U):__spreadValues({},R))},annotationReducer=(e=__spreadValues({},initialState),t)=>{var s,O,u,A,g,S,I,m,D,b,U,x,B,w,R,F,G,V,M,q,k,H,z,K,W;switch(t.type){case Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE:return __spreadValues(__spreadValues({},e),initialState);case Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE:return __spreadProps(__spreadValues({},e),{toolInstance:t.payload.toolInstance});case Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST:return __spreadProps(__spreadValues({},e),{imgList:t.payload.imgList});case Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS:{const{imgList:n,step:o}=e,i=calcStepProgress(n,o);return __spreadProps(__spreadValues({},e),{stepProgress:i})}case Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:o,step:i,stepList:l,toolInstance:a,onSubmit:r,resultList:N}=e;if(!a||!n[o])return e;const d=((s=n[o])==null?void 0:s.result)||"",[,c,T]=(O=a==null?void 0:a.exportData())!=null?O:[],p=(A=(u=a==null?void 0:a.exportCustomData)==null?void 0:u.call(a))!=null?A:{},f=data.composeResultWithBasicImgInfo(d,c),C=data.composeResult(f,{step:i,stepList:l},{rect:N},p),L=e.imgList.map((v,E)=>{if(E===o){const h=AnnotationDataUtils.dataCorrection(C,d,i,l);return __spreadValues(__spreadProps(__spreadValues({},v),{result:h}),T)}return v});if(((g=t.payload)==null?void 0:g.submitType)===index$1.ESubmitType.SyncImgList)return __spreadProps(__spreadValues({},e),{imgList:L});r&&r([L[o]],(S=t.payload)==null?void 0:S.submitType,o,L);const y=calcStepProgress(L,i);return __spreadProps(__spreadValues({},e),{stepProgress:y,imgList:L})}case Actions.ANNOTATION_ACTIONS.SAVE_RESULT:{const{imgList:n,imgIndex:o,onSave:i}=e;return i==null||i(n[o],o,n),__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT:{const{imgList:n,basicIndex:o,resultList:i,toolInstance:l,basicResultList:a}=e;if(!l)return e;const[r]=(I=l==null?void 0:l.exportData())!=null?I:[];let N=r;if((a==null?void 0:a.length)>0){const d=(m=a[o])==null?void 0:m.id,c=r.map(T=>__spreadProps(__spreadValues({},T),{sourceID:d}));N=___default.default.cloneDeep(i).filter(T=>T.sourceID!==d),N.push(...c)}return __spreadProps(__spreadValues({},e),{resultList:N,imgList:n})}case Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX:{const{toolInstance:n,step:o,imgList:i,imgIndex:l,stepList:a,annotationEngine:r,resultList:N,basicResultList:d}=e;if(!n||!r)return e;const c=t.payload.basicIndex,T=(D=d[c])==null?void 0:D.id,p=index.jsonParser((b=i[l])==null?void 0:b.result),f=(N||[]).filter(h=>h.sourceID===T),C=getStepConfig(a,o),{dataSourceStep:L,tool:y}=C,v=getStepConfig(a,L);let E=[];return L&&y&&(E=(U=p[`step_${L}`])==null?void 0:U.result,(E==null?void 0:E.length)>0?(r==null||r.setBasicInfo(v.tool,E[c]),r==null||r.launchOperation()):(r==null||r.setBasicInfo(v.tool),r==null||r.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),n==null||n.setResult(f),n==null||n.history.initRecord(f,!0),__spreadProps(__spreadValues({},e),{basicIndex:c})}case Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=t.payload;return __spreadProps(__spreadValues({},e),{triggerEventAfterIndexChanged:!!n})}case Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA:{const{imgList:n,step:o,toolInstance:i,annotationEngine:l,stepList:a}=e;if(!i)return __spreadProps(__spreadValues({},e),{imgIndex:t.payload.nextIndex});const r=StepUtils.getCurrentStepInfo(o,a),{nextIndex:N,imgNode:d,nextBasicIndex:c,imgError:T}=t.payload,p=c!=null?c:0,f=index.jsonParser((x=n[N])==null?void 0:x.result),C=f[`step_${r.step}`],L=!C,y={rotate:(B=f.rotate)!=null?B:0,valid:(w=f.valid)!=null?w:!0};d&&T!==!0?l==null||l.setImgNode(d,y):i==null||i.setValid(y.valid);const v=getStepConfig(a,r.step),{dataSourceStep:E,tool:h}=v,$=getStepConfig(a,E),Y=E&&h,P=(F=(R=f[`step_${E}`])==null?void 0:R.result)!=null?F:[],j=AnnotationDataUtils.getInitialResultList(C==null?void 0:C.result,i,v,P,L);if(l==null||l.launchOperation(),Y&&((P==null?void 0:P.length)>0?l==null||l.setBasicInfo($.tool,P[p]):(l==null||l.setBasicInfo($.tool),l==null||l.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),r.tool!=="check"){const J=(V=(G=P[p])==null?void 0:G.id)!=null?V:"",X=Y?j.filter(Z=>lbAnnotation.CommonToolUtils.isSameSourceID(Z.sourceID,J)):j;(M=i==null?void 0:i.history)==null||M.initRecord(j,!0),i==null||i.setResult(X)}return __spreadProps(__spreadValues({},e),{imgIndex:N,basicIndex:p,basicResultList:P,resultList:j})}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_CONFIG:return __spreadProps(__spreadValues({},e),{config:(q=t.payload.config)!=null?q:"{}"});case Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST:{const{stepList:n}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n})}case Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG:{const{stepList:n,step:o}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n,step:o})}case Actions.ANNOTATION_ACTIONS.INIT_TOOL:{const{imgNode:n}=e,o=updateToolInstance(e,n);if(o){const{toolInstance:i,annotationEngine:l}=o;return __spreadProps(__spreadValues({},e),{toolInstance:i,annotationEngine:l})}return __spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SET_TOOL:{const n=(k=t.payload)==null?void 0:k.instance;return n?__spreadProps(__spreadValues({},e),{toolInstance:n}):__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT:return __spreadProps(__spreadValues({},e),{onSubmit:t.payload.onSubmit});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE:return __spreadProps(__spreadValues({},e),{onSave:t.payload.onSave});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE:return __spreadProps(__spreadValues({},e),{onPageChange:t.payload.onPageChange});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT:return __spreadProps(__spreadValues({},e),{predictionResult:t.payload.result});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE:return __spreadProps(__spreadValues({},e),{predictionResultVisible:t.payload.visible});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE:return __spreadProps(__spreadValues({},e),{onStepChange:t.payload.onStepChange});case Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA:return __spreadProps(__spreadValues({},e),{getFileData:t.payload.getFileData});case Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE:return __spreadProps(__spreadValues({},e),{pageSize:t.payload.pageSize});case Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST:return __spreadProps(__spreadValues({},e),{loadFileList:t.payload.loadFileList});case Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE:return __spreadProps(__spreadValues({},e),{beforeRotate:t.payload.beforeRotate});case Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS:return __spreadProps(__spreadValues({},e),{preDataProcess:t.payload.preDataProcess});case Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING:return __spreadProps(__spreadValues({},e),{skipBeforePageTurning:t.payload.skipBeforePageTurning});case Actions.ANNOTATION_ACTIONS.SET_FILE_DATA:{const{fileData:n,index:o}=t.payload,{imgList:i}=e,l=[...i];return l[o]=__spreadValues(__spreadValues({},l[o]),n),__spreadProps(__spreadValues({},e),{imgList:l})}case Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:o}=e;return o&&o()===!1||(H=n==null?void 0:n.updateRotate)==null||H.call(n),e}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=e,o=(z=n==null?void 0:n.valid)!=null?z:!0;return antd.Modal.destroyAll(),antd.Modal.confirm({content:lbUtils.i18n.t(o?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!o)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")}),e}case Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:o,imgList:i,step:l}=e;if(!n)return e;if(o===0||o>=i.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),e;const a=i[o-1].result;if(!a)return e;const r=AnnotationDataUtils.copyResultChange(a,l,(K=i[o].result)!=null?K:"");i[o]=__spreadProps(__spreadValues({},i[o]),{result:r});const d=index.jsonParser(r)[`step_${l}`],c=(d==null?void 0:d.result)||[];return n==null||n.setResult(c),n==null||n.history.pushHistory(c),(W=n==null?void 0:n.asyncData)==null||W.call(n,i[o]),__spreadProps(__spreadValues({},e),{imgList:[...i]})}case Actions.ANNOTATION_ACTIONS.SET_STEP:{const{stepList:n,annotationEngine:o}=e,{toStep:i}=t.payload;if(!o)return e;const l=getStepConfig(n,i);return o==null||o.setToolName(l.tool,l.config),__spreadProps(__spreadValues({},e),{step:i,toolInstance:o==null?void 0:o.toolInstance})}case Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loadPCDFileLoading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_LOADING:{const{loading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{pointCloudLoading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE:{const{checkMode:n}=t.payload;return __spreadProps(__spreadValues({},e),{checkMode:!!n})}case Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=t.payload;return __spreadProps(__spreadValues({},e),{highlightAttribute:n})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:o,rangeIndex:i,imgList:l}=t.payload,{imgIndex:a,onSubmit:r}=e,N=[],d=l.map((c,T)=>{if(lbAnnotation.MathUtils.isInRange(T,i)){const p=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateTrackID({id:n,newID:o,result:c.result})});return N.push({imgIndex:T,newInfo:p}),p}return c});return r&&r([d[a]],index$1.ESubmitType.BatchUpdateTrackID,a,d,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:d})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:o,rangeIndex:i}=t.payload,{imgList:l,imgIndex:a,onSubmit:r}=e,N=[],d=l.map((c,T)=>{if(lbAnnotation.MathUtils.isInRange(T,i)){const p=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateResultByTrackID({id:n,newData:o,result:c.result})});return N.push({imgIndex:T,newInfo:p}),p}return c});return r&&r([d[a]],index$1.ESubmitType.BatchUpdateTrackID,a,d,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:d})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:o,stepList:i,step:l,predictionResult:a}=e,r={};a.forEach(T=>{const{index:p}=T;r[p]=___default.default.pick(T,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const N=`step_${l}`,d=[],c=o.map((T,p)=>{if(r[p]){const f=T.result==="{}"?index.jsonParser(data.composeResult("",{step:l,stepList:i},{rect:[]},{})):index.jsonParser(T.result);f[N].result.push(r[p]);const C=__spreadProps(__spreadValues({},T),{result:JSON.stringify(f)});return d.push({imgIndex:p,newInfo:C}),C}return T});return n==null||n(c,index$1.ESubmitType.BatchUpdateImgList,-1,c,{updateImgList:d}),__spreadProps(__spreadValues({},e),{imgList:c})}default:return e}};exports.LoadFileAndFileData=LoadFileAndFileData,exports.annotationReducer=annotationReducer,exports.composeResultByToolInstance=composeResultByToolInstance,exports.getStepConfig=getStepConfig,exports.getTotalPage=getTotalPage;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$2=require("../../components/customResizeHook/index.js"),index$1=require("../../constant/index.js"),styleString=require("../../constant/styleString.js"),Actions=require("../Actions.js"),index=require("../../utils/index.js"),AnnotationDataUtils=require("../../utils/AnnotationDataUtils.js"),ConfigUtils=require("../../utils/ConfigUtils.js"),data=require("../../utils/data.js"),StepUtils=require("../../utils/StepUtils.js"),ToolUtils=require("../../utils/ToolUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),antd=require("antd"),es=require("antd/es"),_=require("lodash"),actionCreators=require("./actionCreators.js"),ToolType=require("../../data/enums/ToolType.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,s)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,__spreadValues=(e,t)=>{for(var s in t||(t={}))__hasOwnProp.call(t,s)&&__defNormalProp(e,s,t[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(t))__propIsEnum.call(t,s)&&__defNormalProp(e,s,t[s]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,s)=>new Promise((O,a)=>{var A=I=>{try{S(s.next(I))}catch(m){a(m)}},g=I=>{try{S(s.throw(I))}catch(m){a(m)}},S=I=>I.done?O(I.value):Promise.resolve(I.value).then(A,g);S((s=s.apply(e,t)).next())});const getStepConfig=(e,t)=>e.find(s=>s.step===t),initialState={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},getTotalPage=e=>{const{imgList:t,imgPageSize:s}=e;return Math.ceil(t.length/s)},calcStepProgress=(e,t)=>e.reduce((s,O)=>{if(O){const a=O.result;if(index.jsonParser(a)[`step_${t}`])return s+1}return s},0)/e.length,updateToolInstance=(e,t)=>{const{step:s,stepList:O}=e,a=StepUtils.getCurrentStepInfo(s,O),A=ConfigUtils.ConfigUtils.jsonParser(a.config);if(ToolUtils.isVideoTool(a==null?void 0:a.tool)||ToolUtils.isAudioTool(a==null?void 0:a.tool)||ToolUtils.isPointCloudTool(a==null?void 0:a.tool)||ToolType.EToolName.LLM===(a==null?void 0:a.tool))return;const g=document.getElementById("toolContainer");if(!g)throw"Not exist dom named id-toolContainer";const S=index$2.getFormatSize({width:window.innerWidth,height:window.innerHeight}),I=new lbAnnotation.AnnotationEngine({container:g,toolName:a.tool,size:S,imgNode:t,config:A,style:JSON.parse(styleString)});return{toolInstance:I==null?void 0:I.toolInstance,annotationEngine:I}},LoadFileAndFileData=(e,t)=>(s,O)=>__async(void 0,null,function*(){var a;const{stepList:A,step:g}=O().annotation,S=StepUtils.currentToolIsVideo(g,A),I=StepUtils.currentToolIsPointCloud(g,A),m=((a=StepUtils.getCurrentStepInfo(g,A))==null?void 0:a.tool)===ToolType.EToolName.LLM,D=StepUtils.currentToolIsAudio(g,A);if(actionCreators.SetAnnotationLoading(s,!0),yield s(TryGetFileDataByAPI(e)),S){s(AfterVideoLoaded(e));return}if(I||m||D){s(AfterCommonLoaded(e));return}s(AfterImageLoaded(e,t))}),TryGetFileDataByAPI=e=>(t,s)=>__async(void 0,null,function*(){const{getFileData:O,imgList:a}=s().annotation;if(O){const A=yield O(a[e],e);t({type:Actions.ANNOTATION_ACTIONS.SET_FILE_DATA,payload:{fileData:A,index:e}})}}),AfterVideoLoaded=e=>t=>{t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterCommonLoaded=e=>t=>{actionCreators.SetAnnotationLoading(t,!1),t({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e}})},AfterImageLoaded=(e,t)=>(s,O)=>{var a;const{toolInstance:A,imgList:g}=O().annotation,S=(a=g==null?void 0:g[e])==null?void 0:a.url;lbAnnotation.ImgUtils.load(S).then(I=>{actionCreators.SetAnnotationLoading(s,!1),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{imgNode:I,nextIndex:e,nextBasicIndex:t}})}).catch(()=>{actionCreators.SetAnnotationLoading(s,!1),A==null||A.setErrorImg(),s({type:Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA,payload:{nextIndex:e,nextBasicIndex:t}})})},composeResultByToolInstance=({toolInstance:e,imgList:t,imgIndex:s,stepList:O,step:a=1})=>{var A,g,S,I;const m=((A=t[s])==null?void 0:A.result)||"",[D,b,U]=(g=e==null?void 0:e.exportData())!=null?g:[],x=(I=(S=e==null?void 0:e.exportCustomData)==null?void 0:S.call(e))!=null?I:{},B=data.composeResultWithBasicImgInfo(m,b),w=data.composeResult(B,{step:a,stepList:O},{rect:D},x);return t.map((R,F)=>F===s?__spreadValues(__spreadProps(__spreadValues({},R),{result:w}),U):__spreadValues({},R))},annotationReducer=(e=__spreadValues({},initialState),t)=>{var s,O,a,A,g,S,I,m,D,b,U,x,B,w,R,F,G,V,M,q,k,H,z,K,W;switch(t.type){case Actions.ANNOTATION_ACTIONS.INIT_ALL_STATE:return __spreadValues(__spreadValues({},e),initialState);case Actions.ANNOTATION_ACTIONS.UPDATE_TOOL_INSTANCE:return __spreadProps(__spreadValues({},e),{toolInstance:t.payload.toolInstance});case Actions.ANNOTATION_ACTIONS.UPDATE_IMG_LIST:return __spreadProps(__spreadValues({},e),{imgList:t.payload.imgList});case Actions.ANNOTATION_ACTIONS.CALC_STEP_PROGRESS:{const{imgList:n,step:o}=e,i=calcStepProgress(n,o);return __spreadProps(__spreadValues({},e),{stepProgress:i})}case Actions.ANNOTATION_ACTIONS.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:o,step:i,stepList:l,toolInstance:u,onSubmit:r,resultList:N}=e;if(!u||!n[o])return e;const d=((s=n[o])==null?void 0:s.result)||"",[,c,T]=(O=u==null?void 0:u.exportData())!=null?O:[],p=(A=(a=u==null?void 0:u.exportCustomData)==null?void 0:a.call(u))!=null?A:{},f=data.composeResultWithBasicImgInfo(d,c),C=data.composeResult(f,{step:i,stepList:l},{rect:N},p),L=e.imgList.map((v,E)=>{if(E===o){const h=AnnotationDataUtils.dataCorrection(C,d,i,l);return __spreadValues(__spreadProps(__spreadValues({},v),{result:h}),T)}return v});if(((g=t.payload)==null?void 0:g.submitType)===index$1.ESubmitType.SyncImgList)return __spreadProps(__spreadValues({},e),{imgList:L});r&&r([L[o]],(S=t.payload)==null?void 0:S.submitType,o,L);const y=calcStepProgress(L,i);return __spreadProps(__spreadValues({},e),{stepProgress:y,imgList:L})}case Actions.ANNOTATION_ACTIONS.SAVE_RESULT:{const{imgList:n,imgIndex:o,onSave:i}=e;return i==null||i(n[o],o,n),__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SUBMIT_RESULT:{const{imgList:n,basicIndex:o,resultList:i,toolInstance:l,basicResultList:u}=e;if(!l)return e;const[r]=(I=l==null?void 0:l.exportData())!=null?I:[];let N=r;if((u==null?void 0:u.length)>0){const d=(m=u[o])==null?void 0:m.id,c=r.map(T=>__spreadProps(__spreadValues({},T),{sourceID:d}));N=___default.default.cloneDeep(i).filter(T=>T.sourceID!==d),N.push(...c)}return __spreadProps(__spreadValues({},e),{resultList:N,imgList:n})}case Actions.ANNOTATION_ACTIONS.SET_BASIC_INDEX:{const{toolInstance:n,step:o,imgList:i,imgIndex:l,stepList:u,annotationEngine:r,resultList:N,basicResultList:d}=e;if(!n||!r)return e;const c=t.payload.basicIndex,T=(D=d[c])==null?void 0:D.id,p=index.jsonParser((b=i[l])==null?void 0:b.result),f=(N||[]).filter(h=>h.sourceID===T),C=getStepConfig(u,o),{dataSourceStep:L,tool:y}=C,v=getStepConfig(u,L);let E=[];return L&&y&&(E=(U=p[`step_${L}`])==null?void 0:U.result,(E==null?void 0:E.length)>0?(r==null||r.setBasicInfo(v.tool,E[c]),r==null||r.launchOperation()):(r==null||r.setBasicInfo(v.tool),r==null||r.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),n==null||n.setResult(f),n==null||n.history.initRecord(f,!0),__spreadProps(__spreadValues({},e),{basicIndex:c})}case Actions.ANNOTATION_ACTIONS.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=t.payload;return __spreadProps(__spreadValues({},e),{triggerEventAfterIndexChanged:!!n})}case Actions.ANNOTATION_ACTIONS.LOAD_FILE_DATA:{const{imgList:n,step:o,toolInstance:i,annotationEngine:l,stepList:u}=e;if(!i)return __spreadProps(__spreadValues({},e),{imgIndex:t.payload.nextIndex});const r=StepUtils.getCurrentStepInfo(o,u),{nextIndex:N,imgNode:d,nextBasicIndex:c,imgError:T}=t.payload,p=c!=null?c:0,f=index.jsonParser((x=n[N])==null?void 0:x.result),C=f[`step_${r.step}`],L=!C,y={rotate:(B=f.rotate)!=null?B:0,valid:(w=f.valid)!=null?w:!0};d&&T!==!0?l==null||l.setImgNode(d,y):i==null||i.setValid(y.valid);const v=getStepConfig(u,r.step),{dataSourceStep:E,tool:h}=v,$=getStepConfig(u,E),Y=E&&h,P=(F=(R=f[`step_${E}`])==null?void 0:R.result)!=null?F:[],j=AnnotationDataUtils.getInitialResultList(C==null?void 0:C.result,i,v,P,L);if(l==null||l.launchOperation(),Y&&((P==null?void 0:P.length)>0?l==null||l.setBasicInfo($.tool,P[p]):(l==null||l.setBasicInfo($.tool),l==null||l.forbidOperation(),es.message.info(lbUtils.i18n.t("NoDependency")))),r.tool!=="check"){const J=(V=(G=P[p])==null?void 0:G.id)!=null?V:"",X=Y?j.filter(Z=>lbAnnotation.CommonToolUtils.isSameSourceID(Z.sourceID,J)):j;(M=i==null?void 0:i.history)==null||M.initRecord(j,!0),i==null||i.setResult(X)}return __spreadProps(__spreadValues({},e),{imgIndex:N,basicIndex:p,basicResultList:P,resultList:j})}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_CONFIG:return __spreadProps(__spreadValues({},e),{config:(q=t.payload.config)!=null?q:"{}"});case Actions.ANNOTATION_ACTIONS.SET_TASK_STEP_LIST:{const{stepList:n}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n})}case Actions.ANNOTATION_ACTIONS.SET_TASK_CONFIG:{const{stepList:n,step:o}=t.payload;return __spreadProps(__spreadValues({},e),{stepList:n,step:o})}case Actions.ANNOTATION_ACTIONS.INIT_TOOL:{const{imgNode:n}=e,o=updateToolInstance(e,n);if(o){const{toolInstance:i,annotationEngine:l}=o;return __spreadProps(__spreadValues({},e),{toolInstance:i,annotationEngine:l})}return __spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.SET_TOOL:{const n=(k=t.payload)==null?void 0:k.instance;return n?__spreadProps(__spreadValues({},e),{toolInstance:n}):__spreadValues({},e)}case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SUBMIT:return __spreadProps(__spreadValues({},e),{onSubmit:t.payload.onSubmit});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_SAVE:return __spreadProps(__spreadValues({},e),{onSave:t.payload.onSave});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_PAGE_CHANGE:return __spreadProps(__spreadValues({},e),{onPageChange:t.payload.onPageChange});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT:return __spreadProps(__spreadValues({},e),{predictionResult:t.payload.result});case Actions.ANNOTATION_ACTIONS.SET_PREDICT_RESULT_VISIBLE:return __spreadProps(__spreadValues({},e),{predictionResultVisible:t.payload.visible});case Actions.ANNOTATION_ACTIONS.UPDATE_ON_STEP_CHANGE:return __spreadProps(__spreadValues({},e),{onStepChange:t.payload.onStepChange});case Actions.ANNOTATION_ACTIONS.UPDATE_GET_FILE_DATA:return __spreadProps(__spreadValues({},e),{getFileData:t.payload.getFileData});case Actions.ANNOTATION_ACTIONS.UPDATE_PAGE_SIZE:return __spreadProps(__spreadValues({},e),{pageSize:t.payload.pageSize});case Actions.ANNOTATION_ACTIONS.UPDATE_LOAD_FILE_LIST:return __spreadProps(__spreadValues({},e),{loadFileList:t.payload.loadFileList});case Actions.ANNOTATION_ACTIONS.UPDATE_BEFORE_ROTATE:return __spreadProps(__spreadValues({},e),{beforeRotate:t.payload.beforeRotate});case Actions.ANNOTATION_ACTIONS.UPDATE_PRE_DATA_PROCESS:return __spreadProps(__spreadValues({},e),{preDataProcess:t.payload.preDataProcess});case Actions.ANNOTATION_ACTIONS.SKIP_BEFORE_PAGE_TURNING:return __spreadProps(__spreadValues({},e),{skipBeforePageTurning:t.payload.skipBeforePageTurning});case Actions.ANNOTATION_ACTIONS.SET_FILE_DATA:{const{fileData:n,index:o}=t.payload,{imgList:i}=e,l=[...i];return l[o]=__spreadValues(__spreadValues({},l[o]),n),__spreadProps(__spreadValues({},e),{imgList:l})}case Actions.ANNOTATION_ACTIONS.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:o}=e;return o&&o()===!1||(H=n==null?void 0:n.updateRotate)==null||H.call(n),e}case Actions.ANNOTATION_ACTIONS.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=e,o=(z=n==null?void 0:n.valid)!=null?z:!0;return antd.Modal.destroyAll(),antd.Modal.confirm({content:lbUtils.i18n.t(o?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!o)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")}),e}case Actions.ANNOTATION_ACTIONS.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:o,imgList:i,step:l}=e;if(!n)return e;if(o===0||o>=i.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),e;const u=i[o-1].result;if(!u)return e;const r=AnnotationDataUtils.copyResultChange(u,l,(K=i[o].result)!=null?K:"");i[o]=__spreadProps(__spreadValues({},i[o]),{result:r});const d=index.jsonParser(r)[`step_${l}`],c=(d==null?void 0:d.result)||[];return n==null||n.setResult(c),n==null||n.history.pushHistory(c),(W=n==null?void 0:n.asyncData)==null||W.call(n,i[o]),__spreadProps(__spreadValues({},e),{imgList:[...i]})}case Actions.ANNOTATION_ACTIONS.SET_STEP:{const{stepList:n,annotationEngine:o}=e,{toStep:i}=t.payload;if(!o)return e;const l=getStepConfig(n,i);return o==null||o.setToolName(l.tool,l.config),__spreadProps(__spreadValues({},e),{step:i,toolInstance:o==null?void 0:o.toolInstance})}case Actions.ANNOTATION_ACTIONS.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loadPCDFileLoading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_LOADING:{const{loading:n}=t.payload;return __spreadProps(__spreadValues({},e),{loading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=t.payload;return __spreadProps(__spreadValues({},e),{pointCloudLoading:!!n})}case Actions.ANNOTATION_ACTIONS.SET_CHECK_MODE:{const{checkMode:n}=t.payload;return __spreadProps(__spreadValues({},e),{checkMode:!!n})}case Actions.ANNOTATION_ACTIONS.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=t.payload;return __spreadProps(__spreadValues({},e),{highlightAttribute:n})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:o,rangeIndex:i,imgList:l}=t.payload,{imgIndex:u,onSubmit:r}=e,N=[],d=l.map((c,T)=>{if(lbAnnotation.MathUtils.isInRange(T,i)){const p=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateTrackID({id:n,newID:o,result:c.result})});return N.push({imgIndex:T,newInfo:p}),p}return c});return r&&r([d[u]],index$1.ESubmitType.BatchUpdateTrackID,u,d,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:d})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:o,rangeIndex:i}=t.payload,{imgList:l,imgIndex:u,onSubmit:r}=e,N=[],d=l.map((c,T)=>{if(lbAnnotation.MathUtils.isInRange(T,i)){const p=__spreadProps(__spreadValues({},c),{result:lbUtils.PointCloudUtils.batchUpdateResultByTrackID({id:n,newData:o,result:c.result})});return N.push({imgIndex:T,newInfo:p}),p}return c});return r&&r([d[u]],index$1.ESubmitType.BatchUpdateTrackID,u,d,{updateImgList:N}),__spreadProps(__spreadValues({},e),{imgList:d})}case Actions.ANNOTATION_ACTIONS.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:o,stepList:i,step:l,predictionResult:u}=e,r={};u.forEach(T=>{const{index:p}=T;r[p]=___default.default.pick(T,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const N=`step_${l}`,d=[],c=o.map((T,p)=>{if(r[p]){const f=T.result==="{}"?index.jsonParser(data.composeResult("",{step:l,stepList:i},{rect:[]},{})):index.jsonParser(T.result);f[N].result.push(r[p]);const C=__spreadProps(__spreadValues({},T),{result:JSON.stringify(f)});return d.push({imgIndex:p,newInfo:C}),C}return T});return n==null||n(c,index$1.ESubmitType.BatchUpdateImgList,-1,c,{updateImgList:d}),__spreadProps(__spreadValues({},e),{imgList:c})}default:return e}};exports.LoadFileAndFileData=LoadFileAndFileData,exports.annotationReducer=annotationReducer,exports.composeResultByToolInstance=composeResultByToolInstance,exports.getStepConfig=getStepConfig,exports.getTotalPage=getTotalPage;
@@ -28,6 +28,7 @@ interface IProps {
28
28
  ratio: number;
29
29
  };
30
30
  staticMode?: boolean;
31
+ measureVisible?: boolean;
31
32
  }
32
33
  declare const _default: React.ForwardRefExoticComponent<IProps & React.RefAttributes<unknown>>;
33
34
  export default _default;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @file Measurer
3
+ * @author lixinghua <lixinghua_vendor@sensetime.com>
4
+ * @date 2024.01.16
5
+ */
6
+ import { ICoordinate } from '@labelbee/lb-utils';
7
+ import React from 'react';
8
+ interface IProps {
9
+ size?: {
10
+ width?: number;
11
+ height?: number;
12
+ };
13
+ imgNode?: HTMLImageElement;
14
+ zoom?: number;
15
+ currentPos: ICoordinate;
16
+ }
17
+ declare const MeasureCanvas: React.FC<IProps>;
18
+ export default MeasureCanvas;