@labelbee/lb-components 1.16.0-alpha.9 → 1.16.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.
@@ -1 +1 @@
1
- "use strict";var React=require("react"),index$3=require("../audioPlayer/index.js"),dom=require("../../utils/dom.js"),index$4=require("../predictTracking/previewResult/index.js"),es=require("antd/es"),antd=require("antd"),index$5=require("../../constant/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index_module=require("./index.module.scss.js"),index$2=require("./tagResultShow/index.js"),index$1=require("./audioContext/index.js"),index$6=require("./textInput/index.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),annotation=require("../../hooks/annotation.js"),index$7=require("../../views/MainView/sidebar/index.js"),index$8=require("./audioSide/labelSidebar/index.js"),index$9=require("./audioSide/clipSidebar/index.js"),tag=require("../../assets/annotation/audio/tag.svg.js"),tagA=require("../../assets/annotation/audio/tagA.svg.js"),clip=require("../../assets/annotation/audio/clip.svg.js"),clipA=require("../../assets/annotation/audio/clipA.svg.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,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const{EAudioToolName}=lbAnnotation.cTool,EKeyCode=lbAnnotation.cKeyCode.default,{Sider,Content}=es.Layout,layoutCls=`${index$5.prefix}-layout`,ToggleAudioOption=({setSideTab:e,sideTab:t})=>{const a=[{tab:"tag",commonSvg:tag,selectedSvg:tagA},{tab:"clip",commonSvg:clip,selectedSvg:clipA}];return React__default.default.createElement("div",{className:index_module.toggleAudioOption},a.map((f,b)=>{const{tab:u,selectedSvg:x,commonSvg:S}=f;return React__default.default.createElement("div",{key:b,className:index_module.option},React__default.default.createElement("img",{className:index_module.icon,src:t===u?x:S,onClick:()=>{t!==u&&e(u)}}))}))},AudioTextToolTextarea=({result:e,inputDisabled:t,updateText:a,configList:f,autofocus:b,preContext:u,isCheck:x,clipAttributeConfigurable:S,clipTextConfigurable:A,textConfigurable:v,updateRegion:y,clipAttributeList:d})=>React__default.default.createElement("div",{className:index_module.textareaContainer},React__default.default.createElement("div",{className:index_module.textareaContent},React__default.default.createElement(index$6.default,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:a,configList:f,autofocus:!t&&b,preContext:u,regions:e==null?void 0:e.regions,clipAttributeConfigurable:S,clipTextConfigurable:A,textConfigurable:v,updateRegion:y,clipAttributeList:d}))),AudioSideBar=e=>{var t,a;const{sider:f,config:b,result:u,updateTagResult:x,updateRegion:S,isEdit:A,tagConfigurable:v,clipConfigurable:y}=e;let d=(b==null?void 0:b.inputList)||[],E=(t=u==null?void 0:u.tag)!=null?t:{},i=(a=u==null?void 0:u.regions)!=null?a:[];const[D,L]=React.useState([]),[C,g]=React.useState("tag");React.useEffect(()=>{if(!v&&y){g("clip");return}g("tag")},[v,y]),React.useEffect(()=>(window.addEventListener("keydown",O),()=>{window.removeEventListener("keydown",O)}));const O=o=>{if(v&&y)switch(o.keyCode){case EKeyCode.L:g("tag");break;case EKeyCode.X:g("clip");break}if(C==="tag"){if(!lbAnnotation.CommonToolUtils.hotkeyFilter(o))return;lbAnnotation.CommonToolUtils.isMoveKey(o==null?void 0:o.keyCode)&&o.preventDefault();let l=o.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const s=D.slice();d.length===1?(_(0,l),L([0,l]),setTimeout(()=>{L([])},500)):s.length===1?(_(s[0],l),L([s[0],l]),setTimeout(()=>{L([])},500)):L([l])}}},_=(o,l)=>{if(o<d.length&&d[o].subSelected&&l<d[o].subSelected.length){const s=d[o].value,p=d[o].isMulti;let T=d[o].subSelected[l].value,M=0;const q=E;for(const w in E)if(w===d[o].value){if(M++,p===!0){const j=q[w].split(";").filter(U=>U!==""),$=j.indexOf(T);$===-1?j.push(T):j.splice($,1),T=j.join(";")}T===""?delete q[w]:q[w]=T}M===0&&Object.assign(E,{[s]:T}),x(E)}},P=o=>{delete E[o],x(E)},h=v&&y&&React__default.default.createElement(ToggleAudioOption,{setSideTab:g,sideTab:C}),N=C==="tag"&&React__default.default.createElement(index$8.default,{labelInfoSet:v?d:[],labelSelectedList:D,setLabel:_,tagResult:E,clearResult:P,isEdit:A,withPanelTab:!1}),I=C==="clip"&&React__default.default.createElement(index$9,{regions:i,updateRegion:S,useAudioClipStore:index$1.useAudioClipStore});return f?typeof f=="function"?React__default.default.createElement("div",{className:`${index$7.sidebarCls}`},f({toggleAudioOption:h,labelSidebar:N,clipSidebar:I})):f:React__default.default.createElement("div",{className:`${index$7.sidebarCls}`},React__default.default.createElement("div",{className:`${index$7.sidebarCls}__content`},h,N,I))},AudioAnnotate=e=>{var t,a,f,b,u,x,S,A,v;const y=(a=(t=e.style)==null?void 0:t.sider)==null?void 0:a.width,{step:d,stepList:E,audioContext:i,sider:D,drawLayerSlot:L,imgList:C,imgIndex:g,currentData:O,config:_,stepInfo:P}=e,h=lbAnnotation.CommonToolUtils.getCurrentStepToolAndConfig(d,E),N=index.jsonParser(O.result),{toolInstanceRef:I}=annotation.useCustomToolInstance({basicInfo:N}),[o,l]=React.useState(!0),[s,p]=React.useState(null),[T,M]=React.useState(!1);React.useEffect(()=>{l(!0),M(!0)},[g]),React.useEffect(()=>{o===!1&&Z()},[o]),React.useEffect(()=>{I.current.exportData=()=>[[s],{}],I.current.setResult=ae,I.current.clearResult=ie},[s]);const q=React.useMemo(()=>{const n=N[`step_${P==null?void 0:P.step}`];return(n==null?void 0:n.result)||[]},[_,N,P]),{tagConfigurable:w,textConfigurable:j=!0,clipConfigurable:$=!1,clipAttributeConfigurable:U=!1,clipAttributeList:F=[],clipTextConfigurable:V=!1,inputList:z=[],configList:G=[]}=React.useMemo(()=>{if(h)return lbAnnotation.CommonToolUtils.jsonParser(h==null?void 0:h.config)},[h]),H={clipConfigurable:$,clipAttributeConfigurable:U,clipAttributeList:F,clipTextConfigurable:V},K=i?i==null?void 0:i.valid:!0,J=(b=(f=lbAnnotation.CommonToolUtils.jsonParser(O.result))==null?void 0:f.duration)!=null?b:0,Q=K?J:0,Y=!K||o||![j,V].includes(!0);let W={};if(g!==-1&&(C==null?void 0:C.length)){const n=(u=C[g])==null?void 0:u.preResult,r=(i==null?void 0:i.isEdit)?(x=i==null?void 0:i.stepConfig)==null?void 0:x.loadPreStep:P==null?void 0:P.loadPreStep;if(n&&r){const c=lbAnnotation.CommonToolUtils.jsonParser(n),m=(A=(S=c==null?void 0:c.config)==null?void 0:S.context)!=null?A:{};Object.keys(m).forEach(R=>{R&&m[R]&&(W[R]={visible:!0,content:m[R],type:R})})}}const Z=()=>{(q==null?void 0:q.length)>0?p(q[0]):p({id:lbAnnotation.uuid(),sourceID:"",value:X(),tag:ee(),regions:[]})},X=(n=!0)=>{const r={};let c=_.configList||[];return c.length>0&&c.forEach(m=>{r[m.key]=n&&m.default||""}),r},ee=()=>lbAnnotation.TagUtils.getDefaultResultByConfig(_.inputList||[]),te=({duration:n,hasError:r})=>{l(!1)},ne=n=>{p(r=>__spreadProps(__spreadValues({},r),{regions:((r==null?void 0:r.regions)||[]).filter(c=>c.id!==n)}))},B=n=>{p(r=>{var c;const m=(c=r==null?void 0:r.regions)!=null?c:[],{id:R}=n;return m.find(k=>k.id===R)?__spreadProps(__spreadValues({},r),{regions:m.map(k=>R===k.id?__spreadValues(__spreadValues({},k),n):k)}):__spreadProps(__spreadValues({},r),{regions:[...m,n]})})},oe=(n,r)=>{p(c=>__spreadProps(__spreadValues({},c),{value:__spreadProps(__spreadValues({},c.value),{[r]:n})}))},le=n=>{p(r=>__spreadProps(__spreadValues({},r),{tag:n}))},ae=n=>{p(n)},ie=()=>{p(n=>__spreadProps(__spreadValues({},n),{value:X(),tag:{},regions:[]}))};return React__default.default.createElement(index$1.AudioClipProvider,null,React__default.default.createElement(antd.Spin,{spinning:o,wrapperClassName:"audio-tool-spinner"},React__default.default.createElement(es.Layout,{className:dom.getClassName("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,React__default.default.createElement(Content,{className:`${layoutCls}__content`},React__default.default.createElement("div",{className:index_module.containerWrapper},React__default.default.createElement("div",{className:index_module.audioWrapper},w&&React__default.default.createElement(index$2,{result:s==null?void 0:s.tag,labelInfoSet:z,hasPromptLayer:!!(i==null?void 0:i.promptLayer)}),i==null?void 0:i.promptLayer,React__default.default.createElement(index$3.AudioPlayer,__spreadValues({context:{isEdit:i==null?void 0:i.isEdit,count:Q,toolName:EAudioToolName.AudioTextTool,imgIndex:g},drawLayerSlot:L,fileData:O,onLoaded:te,invalid:!K,updateRegion:B,removeRegion:ne,regions:s==null?void 0:s.regions,activeToolPanel:i==null?void 0:i.activeToolPanel,footer:e.footer},H))),(j||V)&&React__default.default.createElement(AudioTextToolTextarea,{preContext:W,result:s,inputDisabled:Y,updateText:oe,updateRegion:B,configList:G,autofocus:T,textConfigurable:j,clipTextConfigurable:V,clipAttributeList:F,clipAttributeConfigurable:U}))),React__default.default.createElement(Sider,{className:`${layoutCls}__side`,width:y!=null?y:240,style:(v=e.style)==null?void 0:v.sider},React__default.default.createElement(AudioSideBar,{sider:D,config:_,result:s,updateTagResult:le,updateRegion:B,isEdit:i==null?void 0:i.isEdit,tagConfigurable:w,clipConfigurable:$})),React__default.default.createElement(index$4,null))))};var AudioAnnotate$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(AudioAnnotate);module.exports=AudioAnnotate$1;
1
+ "use strict";var React=require("react"),index$3=require("../audioPlayer/index.js"),dom=require("../../utils/dom.js"),index$4=require("../predictTracking/previewResult/index.js"),es=require("antd/es"),antd=require("antd"),index$5=require("../../constant/index.js"),lbAnnotation=require("@labelbee/lb-annotation"),index_module=require("./index.module.scss.js"),index$2=require("./tagResultShow/index.js"),index$1=require("./audioContext/index.js"),index$6=require("./textInput/index.js"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),annotation=require("../../hooks/annotation.js"),index$7=require("../../views/MainView/sidebar/index.js"),index$8=require("./audioSide/labelSidebar/index.js"),index$9=require("./audioSide/clipSidebar/index.js"),tag=require("../../assets/annotation/audio/tag.svg.js"),tagA=require("../../assets/annotation/audio/tagA.svg.js"),clip=require("../../assets/annotation/audio/clip.svg.js"),clipA=require("../../assets/annotation/audio/clipA.svg.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,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const{EAudioToolName}=lbAnnotation.cTool,EKeyCode=lbAnnotation.cKeyCode.default,{Sider,Content}=es.Layout,layoutCls=`${index$5.prefix}-layout`,ToggleAudioOption=({setSideTab:e,sideTab:t})=>{const a=[{tab:"tag",commonSvg:tag,selectedSvg:tagA},{tab:"clip",commonSvg:clip,selectedSvg:clipA}];return React__default.default.createElement("div",{className:index_module.toggleAudioOption},a.map((f,b)=>{const{tab:u,selectedSvg:x,commonSvg:S}=f;return React__default.default.createElement("div",{key:b,className:index_module.option},React__default.default.createElement("img",{className:index_module.icon,src:t===u?x:S,onClick:()=>{t!==u&&e(u)}}))}))},AudioTextToolTextarea=({result:e,inputDisabled:t,updateText:a,configList:f,autofocus:b,preContext:u,isCheck:x,clipAttributeConfigurable:S,clipTextConfigurable:q,textConfigurable:v,updateRegion:y,clipAttributeList:d})=>React__default.default.createElement("div",{className:index_module.textareaContainer},React__default.default.createElement("div",{className:index_module.textareaContent},React__default.default.createElement(index$6.default,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:a,configList:f,autofocus:!t&&b,preContext:u,regions:e==null?void 0:e.regions,clipAttributeConfigurable:S,clipTextConfigurable:q,textConfigurable:v,updateRegion:y,clipAttributeList:d}))),AudioSideBar=e=>{var t,a;const{sider:f,config:b,result:u,updateTagResult:x,updateRegion:S,isEdit:q,tagConfigurable:v,clipConfigurable:y}=e;let d=(b==null?void 0:b.inputList)||[],E=(t=u==null?void 0:u.tag)!=null?t:{},i=(a=u==null?void 0:u.regions)!=null?a:[];const[M,L]=React.useState([]),[C,g]=React.useState("tag");React.useEffect(()=>{if(!v&&y){g("clip");return}g("tag")},[v,y]),React.useEffect(()=>(window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}));const w=o=>{if(v&&y)switch(o.keyCode){case EKeyCode.L:g("tag");break;case EKeyCode.X:g("clip");break}if(C==="tag"){if(!lbAnnotation.CommonToolUtils.hotkeyFilter(o))return;lbAnnotation.CommonToolUtils.isMoveKey(o==null?void 0:o.keyCode)&&o.preventDefault();let l=o.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const s=M.slice();d.length===1?(_(0,l),L([0,l]),setTimeout(()=>{L([])},500)):s.length===1?(_(s[0],l),L([s[0],l]),setTimeout(()=>{L([])},500)):L([l])}}},_=(o,l)=>{if(o<d.length&&d[o].subSelected&&l<d[o].subSelected.length){const s=d[o].value,p=d[o].isMulti;let T=d[o].subSelected[l].value,U=0;const I=E;for(const N in E)if(N===d[o].value){if(U++,p===!0){const j=I[N].split(";").filter(k=>k!==""),$=j.indexOf(T);$===-1?j.push(T):j.splice($,1),T=j.join(";")}T===""?delete I[N]:I[N]=T}U===0&&Object.assign(E,{[s]:T}),x(E)}},P=o=>{delete E[o],x(E)},h=v&&y&&React__default.default.createElement(ToggleAudioOption,{setSideTab:g,sideTab:C}),A=C==="tag"&&React__default.default.createElement(index$8.default,{labelInfoSet:v?d:[],labelSelectedList:M,setLabel:_,tagResult:E,clearResult:P,isEdit:q,withPanelTab:!1}),O=C==="clip"&&React__default.default.createElement(index$9,{regions:i,updateRegion:S,useAudioClipStore:index$1.useAudioClipStore});return f?typeof f=="function"?React__default.default.createElement("div",{className:`${index$7.sidebarCls}`},f({toggleAudioOption:h,labelSidebar:A,clipSidebar:O})):f:React__default.default.createElement("div",{className:`${index$7.sidebarCls}`},React__default.default.createElement("div",{className:`${index$7.sidebarCls}__content`},h,A,O))},AudioAnnotate=e=>{var t,a,f,b,u,x,S,q,v;const y=(a=(t=e.style)==null?void 0:t.sider)==null?void 0:a.width,{step:d,stepList:E,audioContext:i,sider:M,drawLayerSlot:L,imgList:C,imgIndex:g,currentData:w,config:_,stepInfo:P}=e,h=lbAnnotation.CommonToolUtils.getCurrentStepToolAndConfig(d,E),A=index.jsonParser(w.result),{toolInstanceRef:O}=annotation.useCustomToolInstance({basicInfo:A}),[o,l]=React.useState(!0),[s,p]=React.useState(null),[T,U]=React.useState(!1),[I,N]=React.useState(0);React.useEffect(()=>{l(!0),U(!0)},[g]),React.useEffect(()=>{o===!1&&te()},[o]),React.useEffect(()=>{O.current.exportData=()=>[[s],{duration:I,valid:K}],O.current.setResult=re,O.current.clearResult=se},[s]);const j=React.useMemo(()=>{const n=A[`step_${P==null?void 0:P.step}`];return(n==null?void 0:n.result)||[]},[_,A,P]),{tagConfigurable:$,textConfigurable:k=!0,clipConfigurable:F=!1,clipAttributeConfigurable:W=!1,clipAttributeList:X=[],clipTextConfigurable:V=!1,inputList:H=[],configList:J=[]}=React.useMemo(()=>{if(h)return lbAnnotation.CommonToolUtils.jsonParser(h==null?void 0:h.config)},[h]),Q={clipConfigurable:F,clipAttributeConfigurable:W,clipAttributeList:X,clipTextConfigurable:V},K=i?i==null?void 0:i.valid:!0,Y=(b=(f=lbAnnotation.CommonToolUtils.jsonParser(w.result))==null?void 0:f.duration)!=null?b:0,Z=K?Y:0,ee=!K||o||![k,V].includes(!0);let z={};if(g!==-1&&(C==null?void 0:C.length)){const n=(u=C[g])==null?void 0:u.preResult,r=(i==null?void 0:i.isEdit)?(x=i==null?void 0:i.stepConfig)==null?void 0:x.loadPreStep:P==null?void 0:P.loadPreStep;if(n&&r){const c=lbAnnotation.CommonToolUtils.jsonParser(n),m=(q=(S=c==null?void 0:c.config)==null?void 0:S.context)!=null?q:{};Object.keys(m).forEach(R=>{R&&m[R]&&(z[R]={visible:!0,content:m[R],type:R})})}}const te=()=>{(j==null?void 0:j.length)>0?p(j[0]):p({id:lbAnnotation.uuid(),sourceID:"",value:G(),tag:ne(),regions:[]})},G=(n=!0)=>{const r={};let c=_.configList||[];return c.length>0&&c.forEach(m=>{r[m.key]=n&&m.default||""}),r},ne=()=>lbAnnotation.TagUtils.getDefaultResultByConfig(_.inputList||[]),oe=({duration:n,hasError:r})=>{l(!1),N(n)},le=n=>{p(r=>__spreadProps(__spreadValues({},r),{regions:((r==null?void 0:r.regions)||[]).filter(c=>c.id!==n)}))},B=n=>{p(r=>{var c;const m=(c=r==null?void 0:r.regions)!=null?c:[],{id:R}=n;return m.find(D=>D.id===R)?__spreadProps(__spreadValues({},r),{regions:m.map(D=>R===D.id?__spreadValues(__spreadValues({},D),n):D)}):__spreadProps(__spreadValues({},r),{regions:[...m,n]})})},ae=(n,r)=>{p(c=>__spreadProps(__spreadValues({},c),{value:__spreadProps(__spreadValues({},c.value),{[r]:n})}))},ie=n=>{p(r=>__spreadProps(__spreadValues({},r),{tag:n}))},re=n=>{p(n)},se=()=>{p(n=>__spreadProps(__spreadValues({},n),{value:G(),tag:{},regions:[]}))};return React__default.default.createElement(index$1.AudioClipProvider,null,React__default.default.createElement(antd.Spin,{spinning:o,wrapperClassName:"audio-tool-spinner"},React__default.default.createElement(es.Layout,{className:dom.getClassName("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,React__default.default.createElement(Content,{className:`${layoutCls}__content`},React__default.default.createElement("div",{className:index_module.containerWrapper},React__default.default.createElement("div",{className:index_module.audioWrapper},$&&React__default.default.createElement(index$2,{result:s==null?void 0:s.tag,labelInfoSet:H,hasPromptLayer:!!(i==null?void 0:i.promptLayer)}),i==null?void 0:i.promptLayer,React__default.default.createElement(index$3.AudioPlayer,__spreadValues({context:{isEdit:i==null?void 0:i.isEdit,count:Z,toolName:EAudioToolName.AudioTextTool,imgIndex:g},drawLayerSlot:L,fileData:w,onLoaded:oe,invalid:!K,updateRegion:B,removeRegion:le,regions:s==null?void 0:s.regions,activeToolPanel:i==null?void 0:i.activeToolPanel,footer:e.footer},Q))),(k||V)&&React__default.default.createElement(AudioTextToolTextarea,{preContext:z,result:s,inputDisabled:ee,updateText:ae,updateRegion:B,configList:J,autofocus:T,textConfigurable:k,clipTextConfigurable:V,clipAttributeList:X,clipAttributeConfigurable:W}))),React__default.default.createElement(Sider,{className:`${layoutCls}__side`,width:y!=null?y:240,style:(v=e.style)==null?void 0:v.sider},React__default.default.createElement(AudioSideBar,{sider:M,config:_,result:s,updateTagResult:ie,updateRegion:B,isEdit:i==null?void 0:i.isEdit,tagConfigurable:$,clipConfigurable:F})),React__default.default.createElement(index$4,null))))};var AudioAnnotate$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(AudioAnnotate);module.exports=AudioAnnotate$1;
@@ -1 +1 @@
1
- "use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");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 PointCloud2DRectOperationView=e=>{var r;const{mappingData:t,size:i,config:g,checkMode:C,afterImgOnLoad:b}=e,l=(r=t==null?void 0:t.url)!=null?r:"",{pointCloudBoxList:p,setPointCloudResult:w,selectedID:s}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:D}=usePointCloudViews.usePointCloudViews(),c=React__default.default.useRef(null),a=React.useRef(null),f=ahooks.useLatest(D),[O,R]=React.useState(!0),v=n=>{var o;const u=(o=f.current)==null?void 0:o.call(f,n);w(u)},m=()=>{var n;let o=[];p.forEach(u=>{const{rects:d=[],id:_,attribute:x,trackID:h}=u,P=d.find(y=>y.imageName===(t==null?void 0:t.path)),I=_+"_"+(t==null?void 0:t.path);P&&(o=[...o,__spreadProps(__spreadValues({},P),{boxID:_,id:I,attribute:x,order:h})])}),(n=a.current)==null||n.setResult(o)};return React.useEffect(()=>{if(c.current){const n=new lbAnnotation.PointCloud2DRectOperation({container:c.current,size:i,config:__spreadProps(__spreadValues({},g),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:C});return a.current=n,a.current.init(),a.current.on("updateDragResult",v),()=>{var o,u;(o=a.current)==null||o.unbind("updateDragResult",v),(u=a.current)==null||u.destroy()}}},[]),React.useEffect(()=>{a.current&&l&&lbAnnotation.ImgUtils.load(l).then(n=>{a.current.setImgNode(n),b(n),R(!1)})},[l]),React.useEffect(()=>{var n;(n=a.current)==null||n.setSize(i)},[i]),React.useEffect(()=>{var n,o;if(m(),s){const u=(n=a.current)==null?void 0:n.rectList.find(d=>d.boxID===s);u&&((o=a.current)==null||o.setSelectedID(u.id))}},[p,s,l]),React__default.default.createElement(es.Spin,{spinning:O},React__default.default.createElement("div",{ref:c,style:__spreadValues({position:"relative"},i)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
1
+ "use strict";var ahooks=require("ahooks"),es=require("antd/es"),React=require("react"),reactRedux=require("react-redux"),usePointCloudViews=require("../pointCloudView/hooks/usePointCloudViews.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),map=require("../../store/annotation/map.js"),ctx=require("../../store/ctx.js"),lbAnnotation=require("@labelbee/lb-annotation");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 PointCloud2DRectOperationView=e=>{var r;const{mappingData:t,size:i,config:P,checkMode:C,afterImgOnLoad:g}=e,l=(r=t==null?void 0:t.url)!=null?r:"",{pointCloudBoxList:s,setPointCloudResult:w}=React.useContext(PointCloudContext.PointCloudContext),{update2DViewRect:R}=usePointCloudViews.usePointCloudViews(),c=React__default.default.useRef(null),o=React.useRef(null),d=ahooks.useLatest(R),p=React.useRef(null),[O,b]=React.useState(!0),f=n=>{var a;const u=(a=d.current)==null?void 0:a.call(d,n);p.current=u,w(u)},m=()=>{var n;let a=[];s.forEach(u=>{const{rects:D=[],id:v,attribute:x,trackID:h}=u,_=D.find(V=>V.imageName===(t==null?void 0:t.path)),y=v+"_"+(t==null?void 0:t.path);_&&(a=[...a,__spreadProps(__spreadValues({},_),{boxID:v,id:y,attribute:x,order:h})])}),(n=o.current)==null||n.setResult(a)};return React.useEffect(()=>{if(c.current){const n=new lbAnnotation.PointCloud2DRectOperation({container:c.current,size:i,config:__spreadProps(__spreadValues({},P),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:C});return o.current=n,o.current.init(),o.current.on("updateDragResult",f),()=>{var a,u;(a=o.current)==null||a.unbind("updateDragResult",f),(u=o.current)==null||u.destroy()}}},[]),React.useEffect(()=>{o.current&&l&&lbAnnotation.ImgUtils.load(l).then(n=>{o.current.setImgNode(n),g(n),b(!1)})},[l]),React.useEffect(()=>{var n;(n=o.current)==null||n.setSize(i)},[i]),React.useEffect(()=>{s!==p.current&&m()},[s,l]),React__default.default.createElement(es.Spin,{spinning:O},React__default.default.createElement("div",{ref:c,style:__spreadValues({position:"relative"},i)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__spreadValues=(e,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(e,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(e,i,t[i]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,i)=>new Promise((a,o)=>{var d=u=>{try{c(i.next(u))}catch(h){o(h)}},P=u=>{try{c(i.throw(u))}catch(h){o(h)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(d,P);c((i=i.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,i,a,o)=>{const{x:d,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,u={center:{x:d,y:P,z:c},id:e.id},h=a?__spreadValues(__spreadValues({},a),u):__spreadProps(__spreadValues({},u),{attribute:"",valid:!0});return o&&Object.assign(h,o),h},topViewPolygon2PointCloud=(e,t,i,a,o,d)=>{let P=e.pointList.map(L=>lbUtils.PointCloudUtils.transferCanvas2World(L,t)),c=0,u=1,h={};if(i){const L=i.getSensesPointZAxisInPolygon(P,void 0,d);d&&L.fittedCoordinates.length>0&&(P=L.fittedCoordinates),c=(L.maxZ+L.minZ)/2,u=L.maxZ-L.minZ,h={count:L.zCount}}const[v,b,T]=P,V=lbAnnotation.MathUtils.getLineCenterPoint([v,T]),_=lbAnnotation.MathUtils.getLineLength(v,b),D=lbAnnotation.MathUtils.getLineLength(b,T),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);a&&(c=a.center.z,u=a.depth);const O={center:{x:V.x,y:V.y,z:c},width:d?D+INTELLIGENT_FIT_MARGIN:D,height:d?_+INTELLIGENT_FIT_MARGIN:_,depth:u,rotation:A,id:e.id},k=__spreadValues(a?__spreadValues(__spreadValues({},a),O):__spreadProps(__spreadValues({},O),{attribute:"",valid:!0}),h);o&&Object.assign(k,o);const z=P.map(L=>lbUtils.PointCloudUtils.transferWorld2Canvas(L,t));return{boxParams:k,newPointList:z}},sideViewPoint2PointCloud=(e,t,i)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-a.x,y:i.center.y,z:i.center.z-a.y}})},sideViewPolygon2PointCloud=(e,t,i,a)=>{const[o,d,P]=e.pointList,[c,u,h]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),b=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),V={x:{x:v.x-b.x,y:v.y-b.y}.x,y:0,z:v.y-b.y},_=lbAnnotation.MathUtils.getLineLength(o,d),D=lbAnnotation.MathUtils.getLineLength(c,u),A=_-D,O=lbAnnotation.MathUtils.getLineLength(d,P),k=lbAnnotation.MathUtils.getLineLength(u,h),z=O-k,{newBoxParams:L}=a.getNewBoxBySideUpdate(V,z,A,i);return L},backViewPoint2PointCloud=(e,t,i)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-a.x,z:i.center.z-a.y}})},backViewPolygon2PointCloud=(e,t,i,a)=>{const[o,d,P]=e.pointList,[c,u,h]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),b=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),V={x:{x:v.x-b.x,y:v.y-b.y}.x,y:0,z:v.y-b.y},_=lbAnnotation.MathUtils.getLineLength(o,d),D=lbAnnotation.MathUtils.getLineLength(c,u),A=_-D,O=lbAnnotation.MathUtils.getLineLength(d,P),k=lbAnnotation.MathUtils.getLineLength(u,h),z=O-k;let{newBoxParams:L}=a.getNewBoxByBackUpdate(V,z,A,i);return L},syncSideViewByPoint=(e,t,i,a,o)=>{var d;if(!i)return;const{toolInstance:P,pointCloudInstance:c}=i;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(u);const{point2d:h,zoom:v}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeSideView=(e,t,i,a)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=i;d.loadPCDFileByBox(a,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxSidePolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,i,a,o)=>{var d;if(!i)return;const{toolInstance:P,pointCloudInstance:c}=i;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(u);const{point2d:h,zoom:v}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeBackView=(e,t,i,a)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=i;d.loadPCDFileByBox(a,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxBackPolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,i,a)=>{if(!i||!a)return;a.generateSphere(e),a.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:o,pointCloudInstance:d}=i,{point2d:P}=d.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},synchronizeTopView=(e,t,i,a)=>{var o,d;if(!i||!a)return;a.generateBox(e,t.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),h=[...P.polygonList],v=h.find(b=>b.id===t.id);v?(v.pointList=u,v.valid=(o=e.valid)!=null?o:!0):h.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=e.valid)!=null?d:!0}),P.setResultAndSelectedID(h,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:i,backViewInstance:a,mainViewInstance:o,addPointCloudBox:d,addPointCloudSphere:P,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:h,pointCloudSphereList:v,hideAttributes:b,setHighlight2DDataList:T,cuboidBoxIn2DView:V,imageSizes:_}=e,{addHistory:D,initHistory:A,pushHistoryUnderUpdatePolygon:O}=useHistory.useHistory(),{selectedPolygon:k}=usePolygon.usePolygon(),{getPointCloudSphereByID:z,updatePointCloudSphere:L,selectedSphere:q}=useSphere.useSphere(),{currentData:j,config:m}=ctx.useSelector(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),R=ctx.useDispatch(),W=n=>{if(!V){const{mappingImgList:s=[]}=j,p=s.map(r=>index.getRectPointCloudBox({pointCloudBox:n,mappingData:r,imageSizes:_}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:S,updateSelectedBox:tt,updateSelectedBoxes:Z,getPointCloudByID:ot}=useSingleBox.useSingleBox({generateRects:W}),{t:et}=reactI18next.useTranslation(),X=S==null?void 0:S.info;if(!t||!i||!a)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:G}=t,nt=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},it=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},st=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const C={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const g=topViewPoint2PointCloud(n,s,G,void 0,C);c(n.id);const f=P(g);H(PointCloudView.Top,n,g,p,f,m),D({newSphereParams:g})},rt=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:C})=>{var g,f;const x={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};r===!0&&Object.assign(x,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:v})});const B=t==null?void 0:t.toolInstance,w=__spreadValues({},n);let{boxParams:y,newPointList:U}=topViewPolygon2PointCloud(w,s,G,void 0,x,C);if(y=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[y],stepConfig:m,action:"viewUpdateBox"}))[0],(m==null?void 0:m.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<m.lowerLimitPointsNumInBox){antd.message.info(et("LowerLimitPointsNumInBox",{num:m.lowerLimitPointsNumInBox})),B.deletePolygon(y.id);return}C&&(U==null?void 0:U.length)&&(w.pointList=U);const I=b.includes(w.attribute);W(y);const N=d(y),Q=(f=e==null?void 0:e.polygonList)!=null?f:[];t==null||t.updatePolygonList(N!=null?N:[],Q),I?c([]):(c(y.id),B.selection.setSelectedIDs(w.id),E({omitView:PointCloudView.Top,polygon:w,boxParams:y,zoom:l,newPointCloudBoxList:N}),C&&synchronizeTopView(y,w,t,o)),D({newBoxParams:y})},lt=n=>{const{boxID:s,imageName:p,width:r,height:l,x:C,y:g}=n,f=h.find(x=>x.id===s);if(f==null?void 0:f.rects){const{rects:x=[]}=f,B=x.find(w=>w.imageName===p);if(B){let w=x;const y=__spreadProps(__spreadValues({},B),{width:r,height:l,x:C,y:g});w=x.map(I=>I===B?y:I);const U=__spreadProps(__spreadValues({},f),{rects:w}),M=h.map(I=>I===f?U:I);return t==null||t.updatePolygonList(M!=null?M:[]),M}}},at=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const C=t==null?void 0:t.toolInstance;if(!(u.length===0||!C)){if(n||(S==null?void 0:S.info)){const g=n!=null?n:S==null?void 0:S.info;(l=C==null?void 0:C.selection)==null||l.setSelectedIDs(u[0]);const f=C.selectedPolygon;if(u.length===1&&g){E({omitView:PointCloudView.Top,polygon:f,boxParams:g,newPointCloudBoxList:s});return}}if((p||q)&&u.length===1){const g=p!=null?p:q;C.setSelectedID(u[0]);const f=C.selectedPoint;g&&H(PointCloudView.Top,f,g,void 0,r,m)}}},Y=(n,s,p)=>{if(X){let r,l;switch(p){case PointCloudView.Back:r=backViewPolygon2PointCloud;break;case PointCloudView.Side:r=sideViewPolygon2PointCloud;break;default:r=sideViewPolygon2PointCloud;break}l=r(n,s,X,i.pointCloudInstance);const g=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[l],stepConfig:m,action:"viewUpdateBox"}))[0],f=l.valid!==g.valid;if(l=g,o){const{count:B}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=__spreadProps(__spreadValues({},l),{count:B})}const x=tt(l);return l=x.find(B=>B.id===l.id),E({omitView:f?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},J=(n,s,p)=>{if(q){let r,l;switch(p){case PointCloudView.Back:r=backViewPoint2PointCloud;break;case PointCloudView.Side:r=sideViewPoint2PointCloud;break;default:r=sideViewPoint2PointCloud;break}l=r(n,s,q);const C=L(l);return H(p,n,l,void 0,C,m),C}},dt=(n,s)=>{J(n,s,PointCloudView.Side)},ct=(n,s)=>{J(n,s,PointCloudView.Back)},ut=(n,s)=>{Y(n,s,PointCloudView.Side)},pt=(n,s)=>{Y(n,s,PointCloudView.Back)},Pt=(n,s)=>{const p=z(n.id),r=topViewPoint2PointCloud(n,s,G,p),l=L(r);H(PointCloudView.Top,n,r,void 0,l,m)},Ct=(n,s)=>{if(k){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>lbUtils.PointCloudUtils.transferCanvas2World(l,s)),O(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=ot(r.id),{boxParams:C}=topViewPolygon2PointCloud(r,s,t.pointCloudInstance,l);return C});if(p=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:m,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=Z(p);E({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=Z(p);r&&e.syncAllViewPointCloudColor(r)}},gt=n=>{var s,p,r,l,C;if(S){const g=Number(n.widthDefault),f=Number(n.depthDefault),x=Number(n.heightDefault),B=S==null?void 0:S.info.trackID,y=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(F=>(F==null?void 0:F.trackID)===B),U={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(C=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:C.height},M=y.pointList.map(F=>lbUtils.PointCloudUtils.transferCanvas2World(F,U)),I=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(M,x,g),N=I[0],Q=I[2],K=lbAnnotation.MathUtils.getLineCenterPoint([N,Q]),ht=S.info.center.z-S.info.depth/2,$=__spreadProps(__spreadValues({},S.info),{center:{x:K.x,y:K.y,z:ht+f/2},width:g,height:x,depth:f,valid:!0}),ft=Z([$]);E({omitView:PointCloudView["3D"],polygon:y,boxParams:$,newPointCloudBoxList:ft})}},H=(n,s,p,r,l,C)=>__async(void 0,null,function*(){const g=j==null?void 0:j.url,f={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,i,g,C)},[PointCloudView.Back]:()=>{a&&syncBackViewByPoint(p,s,a,g,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,t,o)}};Object.keys(f).forEach(x=>{x!==n&&f[x]()}),r&&(o==null||o.updateCameraZoom(r)),it(p)}),E=n=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:C}=n,g=j==null?void 0:j.url;C&&(yield e.syncAllViewPointCloudColor(C));const f={[PointCloudView.Side]:()=>{synchronizeSideView(r,p,i,g)},[PointCloudView.Back]:()=>{a&&synchronizeBackView(r,p,a,g)},[PointCloudView.Top]:()=>{synchronizeTopView(r,p,t,o)}};Object.keys(f).forEach(x=>{x!==s&&f[x]()}),l&&(o==null||o.updateCameraZoom(l)),nt(r)});return{topViewAddSphere:st,topViewAddBox:rt,topViewSelectedChanged:at,topViewUpdatePoint:Pt,sideViewUpdatePoint:dt,backViewUpdatePoint:ct,topViewUpdateBox:Ct,sideViewUpdateBox:ut,backViewUpdateBox:pt,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=j){var p,r,l,C,g,f;if(!(s==null?void 0:s.url)||!o)return;T([]),actionCreators.SetPointCloudLoading(R,!0),actionCreators.SetLoadPCDFileLoading(R,!0),yield o.loadPCDFile(s.url,(p=m==null?void 0:m.radius)!=null?p:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],B=[],w=[],y=[];o.updateTopCamera();const U=(l=(r=index.jsonParser(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(U),(C=e.sideViewInstance)==null||C.clearAllData(),(g=e.backViewInstance)==null||g.clearAllData(),t.updateData(s.url,s.result,{radius:(f=m==null?void 0:m.radius)!=null?f:DEFAULT_RADIUS}),s.result&&(x=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),w=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),y=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),A({pointCloudBoxList:x,polygonList:w,lineList:B,pointCloudSphereList:y}),actionCreators.SetPointCloudLoading(R,!1),actionCreators.SetLoadPCDFileLoading(R,!1)}),updateViewsByDefaultSize:gt,generateRects:W,update2DViewRect:lt}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__spreadValues=(e,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(e,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(e,i,t[i]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,i)=>new Promise((a,o)=>{var d=u=>{try{c(i.next(u))}catch(h){o(h)}},P=u=>{try{c(i.throw(u))}catch(h){o(h)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(d,P);c((i=i.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,i,a,o)=>{const{x:d,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,u={center:{x:d,y:P,z:c},id:e.id},h=a?__spreadValues(__spreadValues({},a),u):__spreadProps(__spreadValues({},u),{attribute:"",valid:!0});return o&&Object.assign(h,o),h},topViewPolygon2PointCloud=(e,t,i,a,o,d)=>{let P=e.pointList.map(L=>lbUtils.PointCloudUtils.transferCanvas2World(L,t)),c=0,u=1,h={};if(i){const L=i.getSensesPointZAxisInPolygon(P,void 0,d);d&&L.fittedCoordinates.length>0&&(P=L.fittedCoordinates),c=(L.maxZ+L.minZ)/2,u=L.maxZ-L.minZ,h={count:L.zCount}}const[v,b,T]=P,V=lbAnnotation.MathUtils.getLineCenterPoint([v,T]),_=lbAnnotation.MathUtils.getLineLength(v,b),D=lbAnnotation.MathUtils.getLineLength(b,T),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);a&&(c=a.center.z,u=a.depth);const k={center:{x:V.x,y:V.y,z:c},width:d?D+INTELLIGENT_FIT_MARGIN:D,height:d?_+INTELLIGENT_FIT_MARGIN:_,depth:u,rotation:A,id:e.id},O=__spreadValues(a?__spreadValues(__spreadValues({},a),k):__spreadProps(__spreadValues({},k),{attribute:"",valid:!0}),h);o&&Object.assign(O,o);const z=P.map(L=>lbUtils.PointCloudUtils.transferWorld2Canvas(L,t));return{boxParams:O,newPointList:z}},sideViewPoint2PointCloud=(e,t,i)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-a.x,y:i.center.y,z:i.center.z-a.y}})},sideViewPolygon2PointCloud=(e,t,i,a)=>{const[o,d,P]=e.pointList,[c,u,h]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),b=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),V={x:{x:v.x-b.x,y:v.y-b.y}.x,y:0,z:v.y-b.y},_=lbAnnotation.MathUtils.getLineLength(o,d),D=lbAnnotation.MathUtils.getLineLength(c,u),A=_-D,k=lbAnnotation.MathUtils.getLineLength(d,P),O=lbAnnotation.MathUtils.getLineLength(u,h),z=k-O,{newBoxParams:L}=a.getNewBoxBySideUpdate(V,z,A,i);return L},backViewPoint2PointCloud=(e,t,i)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-a.x,z:i.center.z-a.y}})},backViewPolygon2PointCloud=(e,t,i,a)=>{const[o,d,P]=e.pointList,[c,u,h]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),b=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),V={x:{x:v.x-b.x,y:v.y-b.y}.x,y:0,z:v.y-b.y},_=lbAnnotation.MathUtils.getLineLength(o,d),D=lbAnnotation.MathUtils.getLineLength(c,u),A=_-D,k=lbAnnotation.MathUtils.getLineLength(d,P),O=lbAnnotation.MathUtils.getLineLength(u,h),z=k-O;let{newBoxParams:L}=a.getNewBoxByBackUpdate(V,z,A,i);return L},syncSideViewByPoint=(e,t,i,a,o)=>{var d;if(!i)return;const{toolInstance:P,pointCloudInstance:c}=i;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(u);const{point2d:h,zoom:v}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeSideView=(e,t,i,a)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=i;d.loadPCDFileByBox(a,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxSidePolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,i,a,o)=>{var d;if(!i)return;const{toolInstance:P,pointCloudInstance:c}=i;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(u);const{point2d:h,zoom:v}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeBackView=(e,t,i,a)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=i;d.loadPCDFileByBox(a,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxBackPolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,i,a)=>{if(!i||!a)return;a.generateSphere(e),a.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:o,pointCloudInstance:d}=i,{point2d:P}=d.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},synchronizeTopView=(e,t,i,a)=>{var o,d;if(!i||!a)return;a.generateBox(e,t.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),h=[...P.polygonList],v=h.find(b=>b.id===t.id);v?(v.pointList=u,v.valid=(o=e.valid)!=null?o:!0):h.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=e.valid)!=null?d:!0}),P.setResultAndSelectedID(h,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:i,backViewInstance:a,mainViewInstance:o,addPointCloudBox:d,addPointCloudSphere:P,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:h,pointCloudSphereList:v,hideAttributes:b,setHighlight2DDataList:T,cuboidBoxIn2DView:V,imageSizes:_}=e,{addHistory:D,initHistory:A,pushHistoryUnderUpdatePolygon:k}=useHistory.useHistory(),{selectedPolygon:O}=usePolygon.usePolygon(),{getPointCloudSphereByID:z,updatePointCloudSphere:L,selectedSphere:q}=useSphere.useSphere(),{currentData:j,config:m}=ctx.useSelector(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),R=ctx.useDispatch(),tt=ahooks.useLatest(V),W=n=>{if(!tt.current){const{mappingImgList:s=[]}=j,p=s.map(r=>index.getRectPointCloudBox({pointCloudBox:n,mappingData:r,imageSizes:_}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:I,updateSelectedBox:ot,updateSelectedBoxes:Z,getPointCloudByID:et}=useSingleBox.useSingleBox({generateRects:W}),{t:nt}=reactI18next.useTranslation(),X=I==null?void 0:I.info;if(!t||!i||!a)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:G}=t,it=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},st=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},rt=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const C={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const g=topViewPoint2PointCloud(n,s,G,void 0,C);c(n.id);const f=P(g);H(PointCloudView.Top,n,g,p,f,m),D({newSphereParams:g})},lt=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:C})=>{var g,f;const x={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};r===!0&&Object.assign(x,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:v})});const B=t==null?void 0:t.toolInstance,w=__spreadValues({},n);let{boxParams:y,newPointList:U}=topViewPolygon2PointCloud(w,s,G,void 0,x,C);if(y=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[y],stepConfig:m,action:"viewUpdateBox"}))[0],(m==null?void 0:m.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<m.lowerLimitPointsNumInBox){antd.message.info(nt("LowerLimitPointsNumInBox",{num:m.lowerLimitPointsNumInBox})),B.deletePolygon(y.id);return}C&&(U==null?void 0:U.length)&&(w.pointList=U);const S=b.includes(w.attribute);W(y);const N=d(y),Q=(f=e==null?void 0:e.polygonList)!=null?f:[];t==null||t.updatePolygonList(N!=null?N:[],Q),S?c([]):(c(y.id),B.selection.setSelectedIDs(w.id),E({omitView:PointCloudView.Top,polygon:w,boxParams:y,zoom:l,newPointCloudBoxList:N}),C&&synchronizeTopView(y,w,t,o)),D({newBoxParams:y})},at=n=>{const{boxID:s,imageName:p,width:r,height:l,x:C,y:g}=n,f=h.find(x=>x.id===s);if(f==null?void 0:f.rects){const{rects:x=[]}=f,B=x.find(w=>w.imageName===p);if(B){let w=x;const y=__spreadProps(__spreadValues({},B),{width:r,height:l,x:C,y:g});w=x.map(S=>S===B?y:S);const U=__spreadProps(__spreadValues({},f),{rects:w}),M=h.map(S=>S===f?U:S);return t==null||t.updatePolygonList(M!=null?M:[]),M}}},dt=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const C=t==null?void 0:t.toolInstance;if(!(u.length===0||!C)){if(n||(I==null?void 0:I.info)){const g=n!=null?n:I==null?void 0:I.info;(l=C==null?void 0:C.selection)==null||l.setSelectedIDs(u[0]);const f=C.selectedPolygon;if(u.length===1&&g){E({omitView:PointCloudView.Top,polygon:f,boxParams:g,newPointCloudBoxList:s});return}}if((p||q)&&u.length===1){const g=p!=null?p:q;C.setSelectedID(u[0]);const f=C.selectedPoint;g&&H(PointCloudView.Top,f,g,void 0,r,m)}}},Y=(n,s,p)=>{if(X){let r,l;switch(p){case PointCloudView.Back:r=backViewPolygon2PointCloud;break;case PointCloudView.Side:r=sideViewPolygon2PointCloud;break;default:r=sideViewPolygon2PointCloud;break}l=r(n,s,X,i.pointCloudInstance);const g=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[l],stepConfig:m,action:"viewUpdateBox"}))[0],f=l.valid!==g.valid;if(l=g,o){const{count:B}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=__spreadProps(__spreadValues({},l),{count:B})}const x=ot(l);return l=x.find(B=>B.id===l.id),E({omitView:f?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},J=(n,s,p)=>{if(q){let r,l;switch(p){case PointCloudView.Back:r=backViewPoint2PointCloud;break;case PointCloudView.Side:r=sideViewPoint2PointCloud;break;default:r=sideViewPoint2PointCloud;break}l=r(n,s,q);const C=L(l);return H(p,n,l,void 0,C,m),C}},ct=(n,s)=>{J(n,s,PointCloudView.Side)},ut=(n,s)=>{J(n,s,PointCloudView.Back)},pt=(n,s)=>{Y(n,s,PointCloudView.Side)},Pt=(n,s)=>{Y(n,s,PointCloudView.Back)},Ct=(n,s)=>{const p=z(n.id),r=topViewPoint2PointCloud(n,s,G,p),l=L(r);H(PointCloudView.Top,n,r,void 0,l,m)},gt=(n,s)=>{if(O){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>lbUtils.PointCloudUtils.transferCanvas2World(l,s)),k(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=et(r.id),{boxParams:C}=topViewPolygon2PointCloud(r,s,t.pointCloudInstance,l);return C});if(p=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:m,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=Z(p);E({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=Z(p);r&&e.syncAllViewPointCloudColor(r)}},ht=n=>{var s,p,r,l,C;if(I){const g=Number(n.widthDefault),f=Number(n.depthDefault),x=Number(n.heightDefault),B=I==null?void 0:I.info.trackID,y=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(F=>(F==null?void 0:F.trackID)===B),U={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(C=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:C.height},M=y.pointList.map(F=>lbUtils.PointCloudUtils.transferCanvas2World(F,U)),S=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(M,x,g),N=S[0],Q=S[2],K=lbAnnotation.MathUtils.getLineCenterPoint([N,Q]),ft=I.info.center.z-I.info.depth/2,$=__spreadProps(__spreadValues({},I.info),{center:{x:K.x,y:K.y,z:ft+f/2},width:g,height:x,depth:f,valid:!0}),xt=Z([$]);E({omitView:PointCloudView["3D"],polygon:y,boxParams:$,newPointCloudBoxList:xt})}},H=(n,s,p,r,l,C)=>__async(void 0,null,function*(){const g=j==null?void 0:j.url,f={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,i,g,C)},[PointCloudView.Back]:()=>{a&&syncBackViewByPoint(p,s,a,g,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,t,o)}};Object.keys(f).forEach(x=>{x!==n&&f[x]()}),r&&(o==null||o.updateCameraZoom(r)),st(p)}),E=n=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:C}=n,g=j==null?void 0:j.url;C&&(yield e.syncAllViewPointCloudColor(C));const f={[PointCloudView.Side]:()=>{synchronizeSideView(r,p,i,g)},[PointCloudView.Back]:()=>{a&&synchronizeBackView(r,p,a,g)},[PointCloudView.Top]:()=>{synchronizeTopView(r,p,t,o)}};Object.keys(f).forEach(x=>{x!==s&&f[x]()}),l&&(o==null||o.updateCameraZoom(l)),it(r)});return{topViewAddSphere:rt,topViewAddBox:lt,topViewSelectedChanged:dt,topViewUpdatePoint:Ct,sideViewUpdatePoint:ct,backViewUpdatePoint:ut,topViewUpdateBox:gt,sideViewUpdateBox:pt,backViewUpdateBox:Pt,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=j){var p,r,l,C,g,f;if(!(s==null?void 0:s.url)||!o)return;T([]),actionCreators.SetPointCloudLoading(R,!0),actionCreators.SetLoadPCDFileLoading(R,!0),yield o.loadPCDFile(s.url,(p=m==null?void 0:m.radius)!=null?p:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],B=[],w=[],y=[];o.updateTopCamera();const U=(l=(r=index.jsonParser(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(U),(C=e.sideViewInstance)==null||C.clearAllData(),(g=e.backViewInstance)==null||g.clearAllData(),t.updateData(s.url,s.result,{radius:(f=m==null?void 0:m.radius)!=null?f:DEFAULT_RADIUS}),s.result&&(x=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),w=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),y=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),A({pointCloudBoxList:x,polygonList:w,lineList:B,pointCloudSphereList:y}),actionCreators.SetPointCloudLoading(R,!1),actionCreators.SetLoadPCDFileLoading(R,!1)}),updateViewsByDefaultSize:ht,generateRects:W,update2DViewRect:at}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
@@ -1 +1 @@
1
- import o,{useState as W,useEffect as U,useMemo as te}from"react";import{AudioPlayer as Ee}from"../audioPlayer/index.js";import{getClassName as _e}from"../../utils/dom.js";import Ce from"../predictTracking/previewResult/index.js";import{Layout as oe}from"antd/es";import{Spin as je}from"antd";import{prefix as Re}from"../../constant/index.js";import{cKeyCode as Te,CommonToolUtils as K,uuid as Pe,TagUtils as Le,cTool as he}from"@labelbee/lb-annotation";import N from"./index.module.scss.js";import we from"./tagResultShow/index.js";import{AudioClipProvider as Ae,useAudioClipStore as Oe}from"./audioContext/index.js";import Ie from"./textInput/index.js";import{connect as Ne}from"react-redux";import{a2MapStateToProps as ke}from"../../store/annotation/map.js";import{LabelBeeContext as $e}from"../../store/ctx.js";import{jsonParser as De}from"../../utils/index.js";import{useCustomToolInstance as Me}from"../../hooks/annotation.js";import{sidebarCls as Q}from"../../views/MainView/sidebar/index.js";import Ve from"./audioSide/labelSidebar/index.js";import Ke from"./audioSide/clipSidebar/index.js";import Be from"../../assets/annotation/audio/tag.svg.js";import Fe from"../../assets/annotation/audio/tagA.svg.js";import We from"../../assets/annotation/audio/clip.svg.js";import Ue from"../../assets/annotation/audio/clipA.svg.js";var Xe=Object.defineProperty,qe=Object.defineProperties,ze=Object.getOwnPropertyDescriptors,ne=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,ie=(e,t,s)=>t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,y=(e,t)=>{for(var s in t||(t={}))Ge.call(t,s)&&ie(e,s,t[s]);if(ne)for(var s of ne(t))He.call(t,s)&&ie(e,s,t[s]);return e},k=(e,t)=>qe(e,ze(t));const{EAudioToolName:Je}=he,le=Te.default,{Sider:Qe,Content:Ye}=oe,se=`${Re}-layout`,Ze=({setSideTab:e,sideTab:t})=>{const s=[{tab:"tag",commonSvg:Be,selectedSvg:Fe},{tab:"clip",commonSvg:We,selectedSvg:Ue}];return o.createElement("div",{className:N.toggleAudioOption},s.map((m,S)=>{const{tab:c,selectedSvg:x,commonSvg:C}=m;return o.createElement("div",{key:S,className:N.option},o.createElement("img",{className:N.icon,src:t===c?x:C,onClick:()=>{t!==c&&e(c)}}))}))},et=({result:e,inputDisabled:t,updateText:s,configList:m,autofocus:S,preContext:c,isCheck:x,clipAttributeConfigurable:C,clipTextConfigurable:$,textConfigurable:p,updateRegion:E,clipAttributeList:d})=>o.createElement("div",{className:N.textareaContainer},o.createElement("div",{className:N.textareaContent},o.createElement(Ie,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:s,configList:m,autofocus:!t&&S,preContext:c,regions:e==null?void 0:e.regions,clipAttributeConfigurable:C,clipTextConfigurable:$,textConfigurable:p,updateRegion:E,clipAttributeList:d}))),tt=e=>{var t,s;const{sider:m,config:S,result:c,updateTagResult:x,updateRegion:C,isEdit:$,tagConfigurable:p,clipConfigurable:E}=e;let d=(S==null?void 0:S.inputList)||[],_=(t=c==null?void 0:c.tag)!=null?t:{},r=(s=c==null?void 0:c.regions)!=null?s:[];const[X,h]=W([]),[j,g]=W("tag");U(()=>{if(!p&&E){g("clip");return}g("tag")},[p,E]),U(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}));const D=i=>{if(p&&E)switch(i.keyCode){case le.L:g("tag");break;case le.X:g("clip");break}if(j==="tag"){if(!K.hotkeyFilter(i))return;K.isMoveKey(i==null?void 0:i.keyCode)&&i.preventDefault();let l=i.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const u=X.slice();d.length===1?(R(0,l),h([0,l]),setTimeout(()=>{h([])},500)):u.length===1?(R(u[0],l),h([u[0],l]),setTimeout(()=>{h([])},500)):h([l])}}},R=(i,l)=>{if(i<d.length&&d[i].subSelected&&l<d[i].subSelected.length){const u=d[i].value,v=d[i].isMulti;let T=d[i].subSelected[l].value,q=0;const O=_;for(const I in _)if(I===d[i].value){if(q++,v===!0){const P=O[I].split(";").filter(z=>z!==""),B=P.indexOf(T);B===-1?P.push(T):P.splice(B,1),T=P.join(";")}T===""?delete O[I]:O[I]=T}q===0&&Object.assign(_,{[u]:T}),x(_)}},w=i=>{delete _[i],x(_)},A=p&&E&&o.createElement(Ze,{setSideTab:g,sideTab:j}),M=j==="tag"&&o.createElement(Ve,{labelInfoSet:p?d:[],labelSelectedList:X,setLabel:R,tagResult:_,clearResult:w,isEdit:$,withPanelTab:!1}),V=j==="clip"&&o.createElement(Ke,{regions:r,updateRegion:C,useAudioClipStore:Oe});return m?typeof m=="function"?o.createElement("div",{className:`${Q}`},m({toggleAudioOption:A,labelSidebar:M,clipSidebar:V})):m:o.createElement("div",{className:`${Q}`},o.createElement("div",{className:`${Q}__content`},A,M,V))},ot=e=>{var t,s,m,S,c,x,C,$,p;const E=(s=(t=e.style)==null?void 0:t.sider)==null?void 0:s.width,{step:d,stepList:_,audioContext:r,sider:X,drawLayerSlot:h,imgList:j,imgIndex:g,currentData:D,config:R,stepInfo:w}=e,A=K.getCurrentStepToolAndConfig(d,_),M=De(D.result),{toolInstanceRef:V}=Me({basicInfo:M}),[i,l]=W(!0),[u,v]=W(null),[T,q]=W(!1);U(()=>{l(!0),q(!0)},[g]),U(()=>{i===!1&&me()},[i]),U(()=>{V.current.exportData=()=>[[u],{}],V.current.setResult=Se,V.current.clearResult=xe},[u]);const O=te(()=>{const n=M[`step_${w==null?void 0:w.step}`];return(n==null?void 0:n.result)||[]},[R,M,w]),{tagConfigurable:I,textConfigurable:P=!0,clipConfigurable:B=!1,clipAttributeConfigurable:z=!1,clipAttributeList:Y=[],clipTextConfigurable:G=!1,inputList:re=[],configList:ae=[]}=te(()=>{if(A)return K.jsonParser(A==null?void 0:A.config)},[A]),ue={clipConfigurable:B,clipAttributeConfigurable:z,clipAttributeList:Y,clipTextConfigurable:G},H=r?r==null?void 0:r.valid:!0,ce=(S=(m=K.jsonParser(D.result))==null?void 0:m.duration)!=null?S:0,de=H?ce:0,fe=!H||i||![P,G].includes(!0);let Z={};if(g!==-1&&(j==null?void 0:j.length)){const n=(c=j[g])==null?void 0:c.preResult,a=(r==null?void 0:r.isEdit)?(x=r==null?void 0:r.stepConfig)==null?void 0:x.loadPreStep:w==null?void 0:w.loadPreStep;if(n&&a){const f=K.jsonParser(n),b=($=(C=f==null?void 0:f.config)==null?void 0:C.context)!=null?$:{};Object.keys(b).forEach(L=>{L&&b[L]&&(Z[L]={visible:!0,content:b[L],type:L})})}}const me=()=>{(O==null?void 0:O.length)>0?v(O[0]):v({id:Pe(),sourceID:"",value:ee(),tag:pe(),regions:[]})},ee=(n=!0)=>{const a={};let f=R.configList||[];return f.length>0&&f.forEach(b=>{a[b.key]=n&&b.default||""}),a},pe=()=>Le.getDefaultResultByConfig(R.inputList||[]),ge=({duration:n,hasError:a})=>{l(!1)},ve=n=>{v(a=>k(y({},a),{regions:((a==null?void 0:a.regions)||[]).filter(f=>f.id!==n)}))},J=n=>{v(a=>{var f;const b=(f=a==null?void 0:a.regions)!=null?f:[],{id:L}=n;return b.find(F=>F.id===L)?k(y({},a),{regions:b.map(F=>L===F.id?y(y({},F),n):F)}):k(y({},a),{regions:[...b,n]})})},be=(n,a)=>{v(f=>k(y({},f),{value:k(y({},f.value),{[a]:n})}))},ye=n=>{v(a=>k(y({},a),{tag:n}))},Se=n=>{v(n)},xe=()=>{v(n=>k(y({},n),{value:ee(),tag:{},regions:[]}))};return o.createElement(Ae,null,o.createElement(je,{spinning:i,wrapperClassName:"audio-tool-spinner"},o.createElement(oe,{className:_e("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,o.createElement(Ye,{className:`${se}__content`},o.createElement("div",{className:N.containerWrapper},o.createElement("div",{className:N.audioWrapper},I&&o.createElement(we,{result:u==null?void 0:u.tag,labelInfoSet:re,hasPromptLayer:!!(r==null?void 0:r.promptLayer)}),r==null?void 0:r.promptLayer,o.createElement(Ee,y({context:{isEdit:r==null?void 0:r.isEdit,count:de,toolName:Je.AudioTextTool,imgIndex:g},drawLayerSlot:h,fileData:D,onLoaded:ge,invalid:!H,updateRegion:J,removeRegion:ve,regions:u==null?void 0:u.regions,activeToolPanel:r==null?void 0:r.activeToolPanel,footer:e.footer},ue))),(P||G)&&o.createElement(et,{preContext:Z,result:u,inputDisabled:fe,updateText:be,updateRegion:J,configList:ae,autofocus:T,textConfigurable:P,clipTextConfigurable:G,clipAttributeList:Y,clipAttributeConfigurable:z}))),o.createElement(Qe,{className:`${se}__side`,width:E!=null?E:240,style:(p=e.style)==null?void 0:p.sider},o.createElement(tt,{sider:X,config:R,result:u,updateTagResult:ye,updateRegion:J,isEdit:r==null?void 0:r.isEdit,tagConfigurable:I,clipConfigurable:B})),o.createElement(Ce,null))))};var nt=Ne(ke,null,null,{context:$e})(ot);export{nt as default};
1
+ import o,{useState as V,useEffect as X,useMemo as ne}from"react";import{AudioPlayer as Ce}from"../audioPlayer/index.js";import{getClassName as je}from"../../utils/dom.js";import Re from"../predictTracking/previewResult/index.js";import{Layout as ie}from"antd/es";import{Spin as Te}from"antd";import{prefix as Pe}from"../../constant/index.js";import{cKeyCode as Le,CommonToolUtils as K,uuid as he,TagUtils as we,cTool as Ae}from"@labelbee/lb-annotation";import O from"./index.module.scss.js";import Oe from"./tagResultShow/index.js";import{AudioClipProvider as Ie,useAudioClipStore as Ne}from"./audioContext/index.js";import ke from"./textInput/index.js";import{connect as De}from"react-redux";import{a2MapStateToProps as $e}from"../../store/annotation/map.js";import{LabelBeeContext as Me}from"../../store/ctx.js";import{jsonParser as Ve}from"../../utils/index.js";import{useCustomToolInstance as Ke}from"../../hooks/annotation.js";import{sidebarCls as Q}from"../../views/MainView/sidebar/index.js";import Be from"./audioSide/labelSidebar/index.js";import Fe from"./audioSide/clipSidebar/index.js";import We from"../../assets/annotation/audio/tag.svg.js";import Ue from"../../assets/annotation/audio/tagA.svg.js";import Xe from"../../assets/annotation/audio/clip.svg.js";import qe from"../../assets/annotation/audio/clipA.svg.js";var ze=Object.defineProperty,Ge=Object.defineProperties,He=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,se=(e,t,s)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,y=(e,t)=>{for(var s in t||(t={}))Je.call(t,s)&&se(e,s,t[s]);if(le)for(var s of le(t))Qe.call(t,s)&&se(e,s,t[s]);return e},I=(e,t)=>Ge(e,He(t));const{EAudioToolName:Ye}=Ae,re=Le.default,{Sider:Ze,Content:et}=ie,ae=`${Pe}-layout`,tt=({setSideTab:e,sideTab:t})=>{const s=[{tab:"tag",commonSvg:We,selectedSvg:Ue},{tab:"clip",commonSvg:Xe,selectedSvg:qe}];return o.createElement("div",{className:O.toggleAudioOption},s.map((m,S)=>{const{tab:c,selectedSvg:x,commonSvg:C}=m;return o.createElement("div",{key:S,className:O.option},o.createElement("img",{className:O.icon,src:t===c?x:C,onClick:()=>{t!==c&&e(c)}}))}))},ot=({result:e,inputDisabled:t,updateText:s,configList:m,autofocus:S,preContext:c,isCheck:x,clipAttributeConfigurable:C,clipTextConfigurable:N,textConfigurable:p,updateRegion:E,clipAttributeList:d})=>o.createElement("div",{className:O.textareaContainer},o.createElement("div",{className:O.textareaContent},o.createElement(ke,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:s,configList:m,autofocus:!t&&S,preContext:c,regions:e==null?void 0:e.regions,clipAttributeConfigurable:C,clipTextConfigurable:N,textConfigurable:p,updateRegion:E,clipAttributeList:d}))),nt=e=>{var t,s;const{sider:m,config:S,result:c,updateTagResult:x,updateRegion:C,isEdit:N,tagConfigurable:p,clipConfigurable:E}=e;let d=(S==null?void 0:S.inputList)||[],_=(t=c==null?void 0:c.tag)!=null?t:{},r=(s=c==null?void 0:c.regions)!=null?s:[];const[q,h]=V([]),[j,g]=V("tag");X(()=>{if(!p&&E){g("clip");return}g("tag")},[p,E]),X(()=>(window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}));const k=i=>{if(p&&E)switch(i.keyCode){case re.L:g("tag");break;case re.X:g("clip");break}if(j==="tag"){if(!K.hotkeyFilter(i))return;K.isMoveKey(i==null?void 0:i.keyCode)&&i.preventDefault();let l=i.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const u=q.slice();d.length===1?(R(0,l),h([0,l]),setTimeout(()=>{h([])},500)):u.length===1?(R(u[0],l),h([u[0],l]),setTimeout(()=>{h([])},500)):h([l])}}},R=(i,l)=>{if(i<d.length&&d[i].subSelected&&l<d[i].subSelected.length){const u=d[i].value,v=d[i].isMulti;let T=d[i].subSelected[l].value,z=0;const B=_;for(const M in _)if(M===d[i].value){if(z++,v===!0){const P=B[M].split(";").filter(W=>W!==""),F=P.indexOf(T);F===-1?P.push(T):P.splice(F,1),T=P.join(";")}T===""?delete B[M]:B[M]=T}z===0&&Object.assign(_,{[u]:T}),x(_)}},w=i=>{delete _[i],x(_)},A=p&&E&&o.createElement(tt,{setSideTab:g,sideTab:j}),D=j==="tag"&&o.createElement(Be,{labelInfoSet:p?d:[],labelSelectedList:q,setLabel:R,tagResult:_,clearResult:w,isEdit:N,withPanelTab:!1}),$=j==="clip"&&o.createElement(Fe,{regions:r,updateRegion:C,useAudioClipStore:Ne});return m?typeof m=="function"?o.createElement("div",{className:`${Q}`},m({toggleAudioOption:A,labelSidebar:D,clipSidebar:$})):m:o.createElement("div",{className:`${Q}`},o.createElement("div",{className:`${Q}__content`},A,D,$))},it=e=>{var t,s,m,S,c,x,C,N,p;const E=(s=(t=e.style)==null?void 0:t.sider)==null?void 0:s.width,{step:d,stepList:_,audioContext:r,sider:q,drawLayerSlot:h,imgList:j,imgIndex:g,currentData:k,config:R,stepInfo:w}=e,A=K.getCurrentStepToolAndConfig(d,_),D=Ve(k.result),{toolInstanceRef:$}=Ke({basicInfo:D}),[i,l]=V(!0),[u,v]=V(null),[T,z]=V(!1),[B,M]=V(0);X(()=>{l(!0),z(!0)},[g]),X(()=>{i===!1&&ge()},[i]),X(()=>{$.current.exportData=()=>[[u],{duration:B,valid:H}],$.current.setResult=Ee,$.current.clearResult=_e},[u]);const P=ne(()=>{const n=D[`step_${w==null?void 0:w.step}`];return(n==null?void 0:n.result)||[]},[R,D,w]),{tagConfigurable:F,textConfigurable:W=!0,clipConfigurable:Y=!1,clipAttributeConfigurable:Z=!1,clipAttributeList:ee=[],clipTextConfigurable:G=!1,inputList:ue=[],configList:ce=[]}=ne(()=>{if(A)return K.jsonParser(A==null?void 0:A.config)},[A]),de={clipConfigurable:Y,clipAttributeConfigurable:Z,clipAttributeList:ee,clipTextConfigurable:G},H=r?r==null?void 0:r.valid:!0,fe=(S=(m=K.jsonParser(k.result))==null?void 0:m.duration)!=null?S:0,me=H?fe:0,pe=!H||i||![W,G].includes(!0);let te={};if(g!==-1&&(j==null?void 0:j.length)){const n=(c=j[g])==null?void 0:c.preResult,a=(r==null?void 0:r.isEdit)?(x=r==null?void 0:r.stepConfig)==null?void 0:x.loadPreStep:w==null?void 0:w.loadPreStep;if(n&&a){const f=K.jsonParser(n),b=(N=(C=f==null?void 0:f.config)==null?void 0:C.context)!=null?N:{};Object.keys(b).forEach(L=>{L&&b[L]&&(te[L]={visible:!0,content:b[L],type:L})})}}const ge=()=>{(P==null?void 0:P.length)>0?v(P[0]):v({id:he(),sourceID:"",value:oe(),tag:ve(),regions:[]})},oe=(n=!0)=>{const a={};let f=R.configList||[];return f.length>0&&f.forEach(b=>{a[b.key]=n&&b.default||""}),a},ve=()=>we.getDefaultResultByConfig(R.inputList||[]),be=({duration:n,hasError:a})=>{l(!1),M(n)},ye=n=>{v(a=>I(y({},a),{regions:((a==null?void 0:a.regions)||[]).filter(f=>f.id!==n)}))},J=n=>{v(a=>{var f;const b=(f=a==null?void 0:a.regions)!=null?f:[],{id:L}=n;return b.find(U=>U.id===L)?I(y({},a),{regions:b.map(U=>L===U.id?y(y({},U),n):U)}):I(y({},a),{regions:[...b,n]})})},Se=(n,a)=>{v(f=>I(y({},f),{value:I(y({},f.value),{[a]:n})}))},xe=n=>{v(a=>I(y({},a),{tag:n}))},Ee=n=>{v(n)},_e=()=>{v(n=>I(y({},n),{value:oe(),tag:{},regions:[]}))};return o.createElement(Ie,null,o.createElement(Te,{spinning:i,wrapperClassName:"audio-tool-spinner"},o.createElement(ie,{className:je("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,o.createElement(et,{className:`${ae}__content`},o.createElement("div",{className:O.containerWrapper},o.createElement("div",{className:O.audioWrapper},F&&o.createElement(Oe,{result:u==null?void 0:u.tag,labelInfoSet:ue,hasPromptLayer:!!(r==null?void 0:r.promptLayer)}),r==null?void 0:r.promptLayer,o.createElement(Ce,y({context:{isEdit:r==null?void 0:r.isEdit,count:me,toolName:Ye.AudioTextTool,imgIndex:g},drawLayerSlot:h,fileData:k,onLoaded:be,invalid:!H,updateRegion:J,removeRegion:ye,regions:u==null?void 0:u.regions,activeToolPanel:r==null?void 0:r.activeToolPanel,footer:e.footer},de))),(W||G)&&o.createElement(ot,{preContext:te,result:u,inputDisabled:pe,updateText:Se,updateRegion:J,configList:ce,autofocus:T,textConfigurable:W,clipTextConfigurable:G,clipAttributeList:ee,clipAttributeConfigurable:Z}))),o.createElement(Ze,{className:`${ae}__side`,width:E!=null?E:240,style:(p=e.style)==null?void 0:p.sider},o.createElement(nt,{sider:q,config:R,result:u,updateTagResult:xe,updateRegion:J,isEdit:r==null?void 0:r.isEdit,tagConfigurable:F,clipConfigurable:Y})),o.createElement(Re,null))))};var lt=De($e,null,null,{context:Me})(it);export{lt as default};
@@ -1 +1 @@
1
- import{useLatest as z}from"ahooks";import{Spin as B}from"antd/es";import f,{useContext as M,useRef as N,useState as U,useEffect as u}from"react";import{connect as F}from"react-redux";import{usePointCloudViews as T}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as $}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as q}from"../../store/annotation/map.js";import{LabelBeeContext as A}from"../../store/ctx.js";import{PointCloud2DRectOperation as G,ImgUtils as H}from"@labelbee/lb-annotation";var J=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,O=(n,e,t)=>e in n?J(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,m=(n,e)=>{for(var t in e||(e={}))W.call(e,t)&&O(n,t,e[t]);if(D)for(var t of D(e))X.call(e,t)&&O(n,t,e[t]);return n},b=(n,e)=>K(n,Q(e));const Y=n=>{var e;const{mappingData:t,size:s,config:C,checkMode:R,afterImgOnLoad:I}=n,l=(e=t==null?void 0:t.url)!=null?e:"",{pointCloudBoxList:v,setPointCloudResult:h,selectedID:c}=M($),{update2DViewRect:x}=T(),d=f.useRef(null),a=N(null),_=z(x),[y,V]=U(!0),P=r=>{var o;const i=(o=_.current)==null?void 0:o.call(_,r);h(i)},j=()=>{var r;let o=[];v.forEach(i=>{const{rects:p=[],id:g,attribute:S,trackID:E}=i,w=p.find(k=>k.imageName===(t==null?void 0:t.path)),L=g+"_"+(t==null?void 0:t.path);w&&(o=[...o,b(m({},w),{boxID:g,id:L,attribute:S,order:E})])}),(r=a.current)==null||r.setResult(o)};return u(()=>{if(d.current){const r=new G({container:d.current,size:s,config:b(m({},C),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:R});return a.current=r,a.current.init(),a.current.on("updateDragResult",P),()=>{var o,i;(o=a.current)==null||o.unbind("updateDragResult",P),(i=a.current)==null||i.destroy()}}},[]),u(()=>{a.current&&l&&H.load(l).then(r=>{a.current.setImgNode(r),I(r),V(!1)})},[l]),u(()=>{var r;(r=a.current)==null||r.setSize(s)},[s]),u(()=>{var r,o;if(j(),c){const i=(r=a.current)==null?void 0:r.rectList.find(p=>p.boxID===c);i&&((o=a.current)==null||o.setSelectedID(i.id))}},[v,c,l]),f.createElement(B,{spinning:y},f.createElement("div",{ref:d,style:m({position:"relative"},s)}))};var Z=F(q,null,null,{context:A})(Y);export{Z as default};
1
+ import{useLatest as B}from"ahooks";import{Spin as M}from"antd/es";import d,{useContext as N,useRef as w,useState as U,useEffect as u}from"react";import{connect as F}from"react-redux";import{usePointCloudViews as T}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as $}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as q}from"../../store/annotation/map.js";import{LabelBeeContext as A}from"../../store/ctx.js";import{PointCloud2DRectOperation as G,ImgUtils as H}from"@labelbee/lb-annotation";var J=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,O=(o,e,t)=>e in o?J(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,f=(o,e)=>{for(var t in e||(e={}))W.call(e,t)&&O(o,t,e[t]);if(C)for(var t of C(e))X.call(e,t)&&O(o,t,e[t]);return o},R=(o,e)=>K(o,Q(e));const Y=o=>{var e;const{mappingData:t,size:l,config:b,checkMode:D,afterImgOnLoad:h}=o,s=(e=t==null?void 0:t.url)!=null?e:"",{pointCloudBoxList:c,setPointCloudResult:x}=N($),{update2DViewRect:y}=T(),p=d.useRef(null),n=w(null),m=B(y),v=w(null),[I,V]=U(!0),_=r=>{var a;const i=(a=m.current)==null?void 0:a.call(m,r);v.current=i,x(i)},j=()=>{var r;let a=[];c.forEach(i=>{const{rects:S=[],id:P,attribute:E,trackID:L}=i,g=S.find(z=>z.imageName===(t==null?void 0:t.path)),k=P+"_"+(t==null?void 0:t.path);g&&(a=[...a,R(f({},g),{boxID:P,id:k,attribute:E,order:L})])}),(r=n.current)==null||r.setResult(a)};return u(()=>{if(p.current){const r=new G({container:p.current,size:l,config:R(f({},b),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:D});return n.current=r,n.current.init(),n.current.on("updateDragResult",_),()=>{var a,i;(a=n.current)==null||a.unbind("updateDragResult",_),(i=n.current)==null||i.destroy()}}},[]),u(()=>{n.current&&s&&H.load(s).then(r=>{n.current.setImgNode(r),h(r),V(!1)})},[s]),u(()=>{var r;(r=n.current)==null||r.setSize(l)},[l]),u(()=>{c!==v.current&&j()},[c,s]),d.createElement(M,{spinning:I},d.createElement("div",{ref:p,style:f({position:"relative"},l)}))};var Z=F(q,null,null,{context:A})(Y);export{Z as default};
@@ -1 +1 @@
1
- import{EPointCloudName as nt,MathUtils as w,getCuboidFromPointCloudBox as Mt}from"@labelbee/lb-annotation";import{EPerspectiveView as Q,PointCloudUtils as V,DEFAULT_SPHERE_PARAMS as Gt}from"@labelbee/lb-utils";import{useContext as Qt}from"react";import{PointCloudContext as Xt}from"../PointCloudContext.js";import{useSingleBox as Yt}from"./useSingleBox.js";import{useSphere as qt}from"./useSphere.js";import{useSelector as Jt,useDispatch as Kt}from"../../../store/ctx.js";import $t from"../../../utils/StepUtils.js";import{jsonParser as ft,getRectPointCloudBox as to}from"../../../utils/index.js";import{PreDataProcess as it,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{message as oo}from"antd";import{useTranslation as eo}from"react-i18next";import{useHistory as no}from"./useHistory.js";import{usePolygon as io}from"./usePolygon.js";var so=Object.defineProperty,ro=Object.defineProperties,lo=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,ao=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?so(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,y=(e,t)=>{for(var i in t||(t={}))ao.call(t,i)&&xt(e,i,t[i]);if(mt)for(var i of mt(t))co.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ro(e,lo(t)),st=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(P){o(P)}},g=u=>{try{c(i.throw(u))}catch(P){o(P)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const J=5,K=90,ht=.01,v={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},rt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Gt,u={center:{x:a,y:g,z:c},id:e.id},P=d?y(y({},d),u):O(y({},u),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},lt=(e,t,i,d,o,a)=>{let g=e.pointList.map(B=>V.transferCanvas2World(B,t)),c=0,u=1,P={};if(i){const B=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,u=B.maxZ-B.minZ,P={count:B.zCount}}const[h,D,F]=g,R=w.getLineCenterPoint([h,F]),z=w.getLineLength(h,D),A=w.getLineLength(D,F),N=w.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:R.x,y:R.y,z:c},width:a?A+ht:A,height:a?z+ht:z,depth:u,rotation:N,id:e.id},j=y(d?y(y({},d),T):O(y({},T),{attribute:"",valid:!0}),P);o&&Object.assign(j,o);const E=g.map(B=>V.transferWorld2Canvas(B,t));return{boxParams:j,newPointList:E}},yt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(y({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},Lt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),D=w.getLineCenterPoint([c,P]),R={x:{x:h.x-D.x,y:h.y-D.y}.x,y:0,z:h.y-D.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j,{newBoxParams:B}=d.getNewBoxBySideUpdate(R,E,N,i);return B},uo=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(y({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},po=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),D=w.getLineCenterPoint([c,P]),R={x:{x:h.x-D.x,y:h.y-D.y}.x,y:0,z:h.y-D.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j;let{newBoxParams:B}=d.getNewBoxByBackUpdate(R,E,N,i);return B},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Left);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(y(y({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},wt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Back);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(y(y({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,Q.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(y(y({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},dt=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),P=[...g.polygonList],h=P.find(D=>D.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):P.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(P,t.id)},go=()=>{const e=Qt(Xt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:D,setHighlight2DDataList:F,cuboidBoxIn2DView:R,imageSizes:z}=e,{addHistory:A,initHistory:N,pushHistoryUnderUpdatePolygon:T}=no(),{selectedPolygon:j}=io(),{getPointCloudSphereByID:E,updatePointCloudSphere:B,selectedSphere:X}=qt(),{currentData:W,config:b}=Jt(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:ft($t.getCurrentStepInfo(p,s).config)}}),H=Kt(),$=n=>{if(!R){const{mappingImgList:s=[]}=W,p=s.map(r=>to({pointCloudBox:n,mappingData:r,imageSizes:z}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:St,updateSelectedBoxes:tt,getPointCloudByID:Dt}=Yt({generateRects:$}),{t:_t}=eo(),at=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Vt=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},Ot=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},kt=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=rt(n,s,ot,void 0,f);c(n.id);const m=g(C);Y(v.Top,n,C,p,m,b),A({newSphereParams:C})},At=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var C,m;const x={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(x,{trackID:V.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const I=t==null?void 0:t.toolInstance,S=y({},n);let{boxParams:L,newPointList:U}=lt(S,s,ot,void 0,x,f);if(L=H(it({tool:nt.PointCloud,dataList:[L],stepConfig:b,action:"viewUpdateBox"}))[0],(b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof L.count=="number"&&L.count<b.lowerLimitPointsNumInBox){oo.info(_t("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),I.deletePolygon(L.id);return}f&&(U==null?void 0:U.length)&&(S.pointList=U);const k=D.includes(S.attribute);$(L);const G=a(L),et=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(L.id),I.selection.setSelectedIDs(S.id),M({omitView:v.Top,polygon:S,boxParams:L,zoom:l,newPointCloudBoxList:G}),f&&dt(L,S,t,o)),A({newBoxParams:L})},Ut=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:C}=n,m=P.find(x=>x.id===s);if(m==null?void 0:m.rects){const{rects:x=[]}=m,I=x.find(S=>S.imageName===p);if(I){let S=x;const L=O(y({},I),{width:r,height:l,x:f,y:C});S=x.map(k=>k===I?L:k);const U=O(y({},m),{rects:S}),Z=P.map(k=>k===m?U:k);return t==null||t.updatePolygonList(Z!=null?Z:[]),Z}}},Rt=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const C=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const m=f.selectedPolygon;if(u.length===1&&C){M({omitView:v.Top,polygon:m,boxParams:C,newPointCloudBoxList:s});return}}if((p||X)&&u.length===1){const C=p!=null?p:X;f.setSelectedID(u[0]);const m=f.selectedPoint;C&&Y(v.Top,m,C,void 0,r,b)}}},ct=(n,s,p)=>{if(at){let r,l;switch(p){case v.Back:r=po;break;case v.Side:r=Lt;break;default:r=Lt;break}l=r(n,s,at,i.pointCloudInstance);const C=H(it({tool:nt.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;if(l=C,o){const{count:I}=o.getSensesPointZAxisInPolygon(Mt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(y({},l),{count:I})}const x=St(l);return l=x.find(I=>I.id===l.id),M({omitView:m?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},ut=(n,s,p)=>{if(X){let r,l;switch(p){case v.Back:r=uo;break;case v.Side:r=yt;break;default:r=yt;break}l=r(n,s,X);const f=B(l);return Y(p,n,l,void 0,f,b),f}},zt=(n,s)=>{ut(n,s,v.Side)},Tt=(n,s)=>{ut(n,s,v.Back)},jt=(n,s)=>{ct(n,s,v.Side)},Nt=(n,s)=>{ct(n,s,v.Back)},Et=(n,s)=>{const p=E(n.id),r=rt(n,s,ot,p),l=B(r);Y(v.Top,n,r,void 0,l,b)},Ht=(n,s)=>{if(j){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),T(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=Dt(r.id),{boxParams:f}=lt(r,s,t.pointCloudInstance,l);return f});if(p=H(it({tool:nt.PointCloud,dataList:p,stepConfig:b,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=tt(p);M({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=tt(p);r&&e.syncAllViewPointCloudColor(r)}},Ft=n=>{var s,p,r,l,f;if(_){const C=Number(n.widthDefault),m=Number(n.depthDefault),x=Number(n.heightDefault),I=_==null?void 0:_.info.trackID,L=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(q=>(q==null?void 0:q.trackID)===I),U={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},Z=L.pointList.map(q=>V.transferCanvas2World(q,U)),k=w.getModifiedRectangleCoordinates(Z,x,C),G=k[0],et=k[2],pt=w.getLineCenterPoint([G,et]),Wt=_.info.center.z-_.info.depth/2,gt=O(y({},_.info),{center:{x:pt.x,y:pt.y,z:Wt+m/2},width:C,height:x,depth:m,valid:!0}),Zt=tt([gt]);M({omitView:v["3D"],polygon:L,boxParams:gt,newPointCloudBoxList:Zt})}},Y=(n,s,p,r,l,f)=>st(void 0,null,function*(){const C=W==null?void 0:W.url,m={[v.Side]:()=>{vt(p,s,i,C,f)},[v.Back]:()=>{d&&wt(p,s,d,C,f)},[v.Top]:()=>{It(p,s,t,o)}};Object.keys(m).forEach(x=>{x!==n&&m[x]()}),r&&(o==null||o.updateCameraZoom(r)),Ot(p)}),M=n=>st(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,C=W==null?void 0:W.url;f&&(yield e.syncAllViewPointCloudColor(f));const m={[v.Side]:()=>{Bt(r,p,i,C)},[v.Back]:()=>{d&&bt(r,p,d,C)},[v.Top]:()=>{dt(r,p,t,o)}};Object.keys(m).forEach(x=>{x!==s&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Vt(r)});return{topViewAddSphere:kt,topViewAddBox:At,topViewSelectedChanged:Rt,topViewUpdatePoint:Et,sideViewUpdatePoint:zt,backViewUpdatePoint:Tt,topViewUpdateBox:Ht,sideViewUpdateBox:jt,backViewUpdateBox:Nt,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>st(void 0,[...n],function*(s=W){var p,r,l,f,C,m;if(!(s==null?void 0:s.url)||!o)return;F([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(s.url,(p=b==null?void 0:b.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],I=[],S=[],L=[];o.updateTopCamera();const U=(l=(r=ft(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(U),(f=e.sideViewInstance)==null||f.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),t.updateData(s.url,s.result,{radius:(m=b==null?void 0:b.radius)!=null?m:K}),s.result&&(x=V.getBoxParamsFromResultList(s.result),S=V.getPolygonListFromResultList(s.result),I=V.getLineListFromResultList(s.result),L=V.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(L),yield e.syncAllViewPointCloudColor(x,[])),N({pointCloudBoxList:x,polygonList:S,lineList:I,pointCloudSphereList:L}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Ft,generateRects:$,update2DViewRect:Ut}};export{wt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,bt as synchronizeBackView,Bt as synchronizeSideView,dt as synchronizeTopView,rt as topViewPoint2PointCloud,lt as topViewPolygon2PointCloud,go as usePointCloudViews};
1
+ import{EPointCloudName as nt,MathUtils as w,getCuboidFromPointCloudBox as Gt}from"@labelbee/lb-annotation";import{EPerspectiveView as Q,PointCloudUtils as V,DEFAULT_SPHERE_PARAMS as Qt}from"@labelbee/lb-utils";import{useContext as Xt}from"react";import{PointCloudContext as Yt}from"../PointCloudContext.js";import{useSingleBox as qt}from"./useSingleBox.js";import{useSphere as Jt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as ft,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as it,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{message as eo}from"antd";import{useTranslation as no}from"react-i18next";import{useHistory as io}from"./useHistory.js";import{usePolygon as so}from"./usePolygon.js";import{useLatest as ro}from"ahooks";var lo=Object.defineProperty,ao=Object.defineProperties,co=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))uo.call(t,i)&&xt(e,i,t[i]);if(mt)for(var i of mt(t))po.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ao(e,co(t)),st=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(P){o(P)}},g=u=>{try{c(i.throw(u))}catch(P){o(P)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const J=5,K=90,ht=.01,v={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},rt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Qt,u={center:{x:a,y:g,z:c},id:e.id},P=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},lt=(e,t,i,d,o,a)=>{let g=e.pointList.map(B=>V.transferCanvas2World(B,t)),c=0,u=1,P={};if(i){const B=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,u=B.maxZ-B.minZ,P={count:B.zCount}}const[h,S,F]=g,R=w.getLineCenterPoint([h,F]),z=w.getLineLength(h,S),A=w.getLineLength(S,F),N=w.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:R.x,y:R.y,z:c},width:a?A+ht:A,height:a?z+ht:z,depth:u,rotation:N,id:e.id},j=L(d?L(L({},d),T):O(L({},T),{attribute:"",valid:!0}),P);o&&Object.assign(j,o);const E=g.map(B=>V.transferWorld2Canvas(B,t));return{boxParams:j,newPointList:E}},Lt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},yt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j,{newBoxParams:B}=d.getNewBoxBySideUpdate(R,E,N,i);return B},go=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},fo=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j;let{newBoxParams:B}=d.getNewBoxByBackUpdate(R,E,N,i);return B},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Left);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},wt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Back);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,Q.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},dt=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),P=[...g.polygonList],h=P.find(S=>S.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):P.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(P,t.id)},Co=()=>{const e=Xt(Yt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:S,setHighlight2DDataList:F,cuboidBoxIn2DView:R,imageSizes:z}=e,{addHistory:A,initHistory:N,pushHistoryUnderUpdatePolygon:T}=io(),{selectedPolygon:j}=so(),{getPointCloudSphereByID:E,updatePointCloudSphere:B,selectedSphere:X}=Jt(),{currentData:W,config:b}=Kt(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:ft(to.getCurrentStepInfo(p,s).config)}}),H=$t(),Dt=ro(R),$=n=>{if(!Dt.current){const{mappingImgList:s=[]}=W,p=s.map(r=>oo({pointCloudBox:n,mappingData:r,imageSizes:z}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:St,updateSelectedBoxes:tt,getPointCloudByID:_t}=qt({generateRects:$}),{t:Vt}=no(),at=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Ot=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},kt=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},At=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=rt(n,s,ot,void 0,f);c(n.id);const m=g(C);Y(v.Top,n,C,p,m,b),A({newSphereParams:C})},Ut=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var C,m;const x={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(x,{trackID:V.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const I=t==null?void 0:t.toolInstance,D=L({},n);let{boxParams:y,newPointList:U}=lt(D,s,ot,void 0,x,f);if(y=H(it({tool:nt.PointCloud,dataList:[y],stepConfig:b,action:"viewUpdateBox"}))[0],(b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<b.lowerLimitPointsNumInBox){eo.info(Vt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),I.deletePolygon(y.id);return}f&&(U==null?void 0:U.length)&&(D.pointList=U);const k=S.includes(D.attribute);$(y);const G=a(y),et=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(y.id),I.selection.setSelectedIDs(D.id),M({omitView:v.Top,polygon:D,boxParams:y,zoom:l,newPointCloudBoxList:G}),f&&dt(y,D,t,o)),A({newBoxParams:y})},Rt=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:C}=n,m=P.find(x=>x.id===s);if(m==null?void 0:m.rects){const{rects:x=[]}=m,I=x.find(D=>D.imageName===p);if(I){let D=x;const y=O(L({},I),{width:r,height:l,x:f,y:C});D=x.map(k=>k===I?y:k);const U=O(L({},m),{rects:D}),Z=P.map(k=>k===m?U:k);return t==null||t.updatePolygonList(Z!=null?Z:[]),Z}}},zt=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const C=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const m=f.selectedPolygon;if(u.length===1&&C){M({omitView:v.Top,polygon:m,boxParams:C,newPointCloudBoxList:s});return}}if((p||X)&&u.length===1){const C=p!=null?p:X;f.setSelectedID(u[0]);const m=f.selectedPoint;C&&Y(v.Top,m,C,void 0,r,b)}}},ct=(n,s,p)=>{if(at){let r,l;switch(p){case v.Back:r=fo;break;case v.Side:r=yt;break;default:r=yt;break}l=r(n,s,at,i.pointCloudInstance);const C=H(it({tool:nt.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;if(l=C,o){const{count:I}=o.getSensesPointZAxisInPolygon(Gt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:I})}const x=St(l);return l=x.find(I=>I.id===l.id),M({omitView:m?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},ut=(n,s,p)=>{if(X){let r,l;switch(p){case v.Back:r=go;break;case v.Side:r=Lt;break;default:r=Lt;break}l=r(n,s,X);const f=B(l);return Y(p,n,l,void 0,f,b),f}},Tt=(n,s)=>{ut(n,s,v.Side)},jt=(n,s)=>{ut(n,s,v.Back)},Nt=(n,s)=>{ct(n,s,v.Side)},Et=(n,s)=>{ct(n,s,v.Back)},Ht=(n,s)=>{const p=E(n.id),r=rt(n,s,ot,p),l=B(r);Y(v.Top,n,r,void 0,l,b)},Ft=(n,s)=>{if(j){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),T(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=_t(r.id),{boxParams:f}=lt(r,s,t.pointCloudInstance,l);return f});if(p=H(it({tool:nt.PointCloud,dataList:p,stepConfig:b,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=tt(p);M({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=tt(p);r&&e.syncAllViewPointCloudColor(r)}},Wt=n=>{var s,p,r,l,f;if(_){const C=Number(n.widthDefault),m=Number(n.depthDefault),x=Number(n.heightDefault),I=_==null?void 0:_.info.trackID,y=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(q=>(q==null?void 0:q.trackID)===I),U={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},Z=y.pointList.map(q=>V.transferCanvas2World(q,U)),k=w.getModifiedRectangleCoordinates(Z,x,C),G=k[0],et=k[2],pt=w.getLineCenterPoint([G,et]),Zt=_.info.center.z-_.info.depth/2,gt=O(L({},_.info),{center:{x:pt.x,y:pt.y,z:Zt+m/2},width:C,height:x,depth:m,valid:!0}),Mt=tt([gt]);M({omitView:v["3D"],polygon:y,boxParams:gt,newPointCloudBoxList:Mt})}},Y=(n,s,p,r,l,f)=>st(void 0,null,function*(){const C=W==null?void 0:W.url,m={[v.Side]:()=>{vt(p,s,i,C,f)},[v.Back]:()=>{d&&wt(p,s,d,C,f)},[v.Top]:()=>{It(p,s,t,o)}};Object.keys(m).forEach(x=>{x!==n&&m[x]()}),r&&(o==null||o.updateCameraZoom(r)),kt(p)}),M=n=>st(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,C=W==null?void 0:W.url;f&&(yield e.syncAllViewPointCloudColor(f));const m={[v.Side]:()=>{Bt(r,p,i,C)},[v.Back]:()=>{d&&bt(r,p,d,C)},[v.Top]:()=>{dt(r,p,t,o)}};Object.keys(m).forEach(x=>{x!==s&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Ot(r)});return{topViewAddSphere:At,topViewAddBox:Ut,topViewSelectedChanged:zt,topViewUpdatePoint:Ht,sideViewUpdatePoint:Tt,backViewUpdatePoint:jt,topViewUpdateBox:Ft,sideViewUpdateBox:Nt,backViewUpdateBox:Et,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>st(void 0,[...n],function*(s=W){var p,r,l,f,C,m;if(!(s==null?void 0:s.url)||!o)return;F([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(s.url,(p=b==null?void 0:b.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],I=[],D=[],y=[];o.updateTopCamera();const U=(l=(r=ft(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(U),(f=e.sideViewInstance)==null||f.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),t.updateData(s.url,s.result,{radius:(m=b==null?void 0:b.radius)!=null?m:K}),s.result&&(x=V.getBoxParamsFromResultList(s.result),D=V.getPolygonListFromResultList(s.result),I=V.getLineListFromResultList(s.result),y=V.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),N({pointCloudBoxList:x,polygonList:D,lineList:I,pointCloudSphereList:y}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Wt,generateRects:$,update2DViewRect:Rt}};export{wt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,bt as synchronizeBackView,Bt as synchronizeSideView,dt as synchronizeTopView,rt as topViewPoint2PointCloud,lt as topViewPolygon2PointCloud,Co as usePointCloudViews};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.16.0-alpha.9",
3
+ "version": "1.16.1",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",
@@ -43,9 +43,9 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "^4.6.2",
46
- "@labelbee/lb-annotation": "1.19.0-alpha.4",
47
- "@labelbee/lb-utils": "1.12.0-alpha.2",
48
- "@labelbee/wavesurfer": "1.0.0-alpha.3",
46
+ "@labelbee/lb-annotation": "1.19.0",
47
+ "@labelbee/lb-utils": "1.12.0",
48
+ "@labelbee/wavesurfer": "1.0.0",
49
49
  "@types/react-dom": "^18.2.7",
50
50
  "ahooks": "^3.4.0",
51
51
  "classnames": "^2.3.0",