@labelbee/lb-components 1.23.0-alpha.137 → 1.23.0-alpha.139

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.
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react");const useFilterAnnotations=(t=[],r,n)=>React.useMemo(()=>n&&(r==null?void 0:r.length)?t.filter(u=>r.includes(u.annotation.id)):t,[t,r,n]);module.exports=useFilterAnnotations;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index=require("../measureCanvas/index.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,o)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,__spreadValues=(e,r)=>{for(var o in r||(r={}))__hasOwnProp.call(r,o)&&__defNormalProp(e,o,r[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(r))__propIsEnum.call(r,o)&&__defNormalProp(e,o,r[o]);return e},__async=(e,r,o)=>new Promise((g,d)=>{var c=u=>{try{f(o.next(u))}catch(v){d(v)}},s=u=>{try{f(o.throw(u))}catch(v){d(v)}},f=u=>u.done?g(u.value):Promise.resolve(u.value).then(c,s);f((o=o.apply(e,r)).next())});const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const r=__spreadValues({},e);return r.width||(r.width=DEFAULT_SIZE.width),r.height||(r.height=DEFAULT_SIZE.height),r},AnnotationView=(e,r)=>{var o,g;const{src:d,fallbackSrc:c,annotations:s=[],style:f={stroke:"blue",thickness:3},zoomChange:u,backgroundStyle:v={},onChange:C,showLoading:x=!1,globalStyle:L,afterImgOnLoad:k,measureVisible:y,onRightClick:m,pointCloudBoxList:E=[],hiddenText:P=!1,renderToolName:A}=e,_=sizeInitialized(e.size),[j,R]=React.useState(!1),w=React.useRef(null),t=React.useRef(),z=useRefCache(k),h=React.useRef([]),b=React.useRef(!0);React.useContext(PointCloudContext.PointCloudContext),React.useImperativeHandle(r,()=>{const n=t.current;return n?{zoomIn:()=>n.zoomChanged(!0),zoomOut:()=>n.zoomChanged(!1),initImgPos:()=>n.initImgPos(),toolInstance:n}:{}},[t.current]),React.useEffect(()=>(w.current&&(t.current=new lbAnnotation.ViewOperation({container:w.current,size:_,style:f,annotations:s,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode,renderToolName:A}),t.current.init(),m&&t.current.on("onRightClick",m)),()=>{var n,i;m&&((n=t.current)==null||n.unbind("onRightClick",m)),(i=t.current)==null||i.destroy()}),[y]);const I=React.useCallback(n=>__async(void 0,null,function*(){var i,a;try{const l=yield lbAnnotation.ImgUtils.load(n);return(i=t.current)==null||i.setImgNode(l),(a=z.current)==null||a.call(z,l),null}catch(l){return console.error("Error loading image:",l),l}}),[]),O=React.useCallback(n=>__async(void 0,null,function*(){var i,a;if(R(!0),(i=t.current)==null||i.setLoading(!0),(yield I(n))&&c){const p=yield I(c);p&&console.error("Error loading fallback image:",p)}(a=t.current)==null||a.setLoading(!1),R(!1)}),[I,c]);React.useEffect(()=>{t.current&&O(d)},[d,y,c,O]),React.useEffect(()=>{(t==null?void 0:t.current)&&t.current.setPointCloudBoxList(E)},[E]),React.useEffect(()=>{var n;(t==null?void 0:t.current)&&((n=t.current)==null||n.setHiddenText(P))},[P]),React.useEffect(()=>{if(b.current===!1){h.current.push(s);return}const n=()=>{b.current=!0,h.current=[]},i=()=>{var a;const l=h.current.length;if(l>0){const p=h.current[l-1];h.current=[],(a=t.current)==null||a.updateData(p).then(i).catch(n)}else b.current=!0};t.current&&(b.current=!1,t.current.updateData(s).then(i).catch(n))},[s]),React.useEffect(()=>{const n=t.current;(n==null?void 0:n.setSize)&&(n.setSize(_),n.initPosition())},[(o=e.size)==null?void 0:o.width,(g=e.size)==null?void 0:g.height]),React.useEffect(()=>{var n,i;return t.current&&((n=t.current)==null||n.on("onChange",(...a)=>{C==null||C.apply(null,a)}),(i=t.current)==null||i.on("renderZoom",a=>{u&&u(a)})),()=>{var a,l;(a=t.current)==null||a.unbindAll("onChange"),(l=t.current)==null||l.unbindAll("renderZoom")}},[u,C]);const q=React__default.default.createElement("div",{ref:w,style:__spreadValues(__spreadValues({position:"relative"},_),v)}),{imgNode:S,zoom:V,currentPos:D}=t.current||{};return React__default.default.createElement(es.Spin,{spinning:x||j,delay:300,style:L},y&&S?React__default.default.createElement(index,{size:_,imgNode:S,zoom:V,currentPos:D}):q)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$1;
1
+ "use strict";var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),es=require("antd/es"),useRefCache=require("../../hooks/useRefCache.js"),index$1=require("../measureCanvas/index.js"),PointCloudContext=require("../pointCloudView/PointCloudContext.js"),useFilterAnnotations=require("./hooks/useFilterAnnotations.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,o)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,__spreadValues=(e,r)=>{for(var o in r||(r={}))__hasOwnProp.call(r,o)&&__defNormalProp(e,o,r[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(r))__propIsEnum.call(r,o)&&__defNormalProp(e,o,r[o]);return e},__async=(e,r,o)=>new Promise((h,s)=>{var c=u=>{try{d(o.next(u))}catch(f){s(f)}},p=u=>{try{d(o.throw(u))}catch(f){s(f)}},d=u=>u.done?h(u.value):Promise.resolve(u.value).then(c,p);d((o=o.apply(e,r)).next())});const DEFAULT_SIZE={width:455,height:100},sizeInitialized=e=>{if(!e)return DEFAULT_SIZE;if(e.width&&e.height)return e;const r=__spreadValues({},e);return r.width||(r.width=DEFAULT_SIZE.width),r.height||(r.height=DEFAULT_SIZE.height),r},AnnotationView=(e,r)=>{var o,h;const{src:s,fallbackSrc:c,annotations:p=[],style:d={stroke:"blue",thickness:3},zoomChange:u,backgroundStyle:f={},onChange:y,showLoading:A=!1,globalStyle:k,afterImgOnLoad:L,measureVisible:w,onRightClick:g,pointCloudBoxList:P=[],hiddenText:R=!1,renderToolName:j}=e,m=sizeInitialized(e.size),[q,x]=React.useState(!1),I=React.useRef(null),t=React.useRef(),S=useRefCache(L),v=React.useRef([]),_=React.useRef(!0),{selectedIDs:V}=React.useContext(PointCloudContext.PointCloudContext),{selectBoxVisibleSwitch:D}=index(),b=useFilterAnnotations(p,V,D);React.useImperativeHandle(r,()=>{const n=t.current;return n?{zoomIn:()=>n.zoomChanged(!0),zoomOut:()=>n.zoomChanged(!1),initImgPos:()=>n.initImgPos(),toolInstance:n}:{}},[t.current]),React.useEffect(()=>(I.current&&(t.current=new lbAnnotation.ViewOperation({container:I.current,size:m,style:d,annotations:b,config:"{}",zoomInfo:e.zoomInfo,staticMode:e.staticMode,renderToolName:j}),t.current.init(),g&&t.current.on("onRightClick",g)),()=>{var n,a;g&&((n=t.current)==null||n.unbind("onRightClick",g)),(a=t.current)==null||a.destroy()}),[w]);const E=React.useCallback(n=>__async(void 0,null,function*(){var a,i;try{const l=yield lbAnnotation.ImgUtils.load(n);return(a=t.current)==null||a.setImgNode(l),(i=S.current)==null||i.call(S,l),null}catch(l){return console.error("Error loading image:",l),l}}),[]),z=React.useCallback(n=>__async(void 0,null,function*(){var a,i;if(x(!0),(a=t.current)==null||a.setLoading(!0),(yield E(n))&&c){const C=yield E(c);C&&console.error("Error loading fallback image:",C)}(i=t.current)==null||i.setLoading(!1),x(!1)}),[E,c]);React.useEffect(()=>{t.current&&z(s)},[s,w,c,z]),React.useEffect(()=>{(t==null?void 0:t.current)&&t.current.setPointCloudBoxList(P)},[P]),React.useEffect(()=>{var n;(t==null?void 0:t.current)&&((n=t.current)==null||n.setHiddenText(R))},[R]),React.useEffect(()=>{if(_.current===!1){v.current.push(b);return}const n=()=>{_.current=!0,v.current=[]},a=()=>{var i;const l=v.current.length;if(l>0){const C=v.current[l-1];v.current=[],(i=t.current)==null||i.updateData(C).then(a).catch(n)}else _.current=!0};t.current&&(_.current=!1,t.current.updateData(b).then(a).catch(n))},[b]),React.useEffect(()=>{const n=t.current;(n==null?void 0:n.setSize)&&(n.setSize(m),n.initPosition())},[(o=e.size)==null?void 0:o.width,(h=e.size)==null?void 0:h.height]),React.useEffect(()=>{var n,a;return t.current&&((n=t.current)==null||n.on("onChange",(...i)=>{y==null||y.apply(null,i)}),(a=t.current)==null||a.on("renderZoom",i=>{u&&u(i)})),()=>{var i,l;(i=t.current)==null||i.unbindAll("onChange"),(l=t.current)==null||l.unbindAll("renderZoom")}},[u,y]);const N=React__default.default.createElement("div",{ref:I,style:__spreadValues(__spreadValues({position:"relative"},m),f)}),{imgNode:O,zoom:T,currentPos:B}=t.current||{};return React__default.default.createElement(es.Spin,{spinning:A||q,delay:300,style:k},w&&O?React__default.default.createElement(index$1,{size:m,imgNode:O,zoom:T,currentPos:B}):N)};var AnnotationView$1=React__default.default.forwardRef(AnnotationView);module.exports=AnnotationView$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"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),_=require("lodash"),useToolStyle=require("../../hooks/useToolStyle.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,l,s)=>l in i?__defProp(i,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[l]=s,__spreadValues=(i,l)=>{for(var s in l||(l={}))__hasOwnProp.call(l,s)&&__defNormalProp(i,s,l[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(l))__propIsEnum.call(l,s)&&__defNormalProp(i,s,l[s]);return i},__spreadProps=(i,l)=>__defProps(i,__getOwnPropDescs(l)),__async=(i,l,s)=>new Promise((d,p)=>{var I=f=>{try{D(s.next(f))}catch(R){p(R)}},P=f=>{try{D(s.throw(f))}catch(R){p(R)}},D=f=>f.done?d(f.value):Promise.resolve(f.value).then(I,P);D((s=s.apply(i,l)).next())});const PointCloud2DRectOperationView=i=>{var l,s;const{mappingData:d,size:p,config:I,checkMode:P,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:f}=i,{selectBoxVisibleSwitch:R}=index(),S=(l=d==null?void 0:d.url)!=null?l:"",b=(s=d==null?void 0:d.fallbackUrl)!=null?s:"",{pointCloudBoxList:L,setPointCloudResult:E,defaultAttribute:O,rectList:V,addRectIn2DView:X,updateRectIn2DView:Y,removeRectIn2DView:Z,updateRectListByReducer:ee,selectedIDs:v,setSelectedIDs:q,selectedID:C}=React.useContext(PointCloudContext.PointCloudContext),{value:j}=useToolStyle.useToolStyleContext(),te=ahooks.useLatest(v),{update2DViewRect:re,remove2DViewRect:ne}=usePointCloudViews.usePointCloudViews(),k=React__default.default.useRef(null),n=React.useRef(null),A=ahooks.useMemoizedFn(re),x=ahooks.useMemoizedFn(ne),y=React.useRef(null),[oe,F]=React.useState(!0),[T,H]=React.useState(""),[ue,U]=React.useState(!1),[ie,B]=React.useState(!0),g=React.useMemo(()=>V==null?void 0:V.filter(e=>e.imageName===(d==null?void 0:d.path)),[d==null?void 0:d.path,V]),J=React.useRef(g),w=ahooks.useLatest(d==null?void 0:d.path),N=React.useCallback(e=>__async(void 0,null,function*(){try{const o=te.current.slice(0),r=yield Promise.resolve(e());if(!r||r.length===0)return r;if(o.length){const t=new Set(o),u=r.filter(c=>t.has(c.id)).map(c=>c.id);q(u)}return r}catch(o){}}),[q]),$=e=>{const{boxID:o}=e;if(!f&&o){N(()=>{const r=A==null?void 0:A(e);return r?(y.current=r,E(r),r):null});return}Y(e,!0)},G=e=>{w.current&&X(__spreadProps(__spreadValues({},e),{imageName:w.current}))},K=e=>{if(e.length===0)return;if(!f){const r=e.find(t=>t.boxID);if(r){N(()=>{const t=x==null?void 0:x(r);return t?(y.current=t,E(t),h(),t):null});return}}const o=e.find(r=>r.extId);o&&N(()=>{const{imageName:r,extId:t}=o,u=x==null?void 0:x({boxID:t,imageName:r});return u?(y.current=u,E(u),u):null}),Z(e)},ce=ahooks.useMemoizedFn(()=>{let e=[];return L.forEach(o=>{const{rects:r=[],id:t,attribute:u,trackID:c}=o,a=r.find(M=>M.imageName===w.current),m=t+"_"+w.current;a&&(e=[...e,__spreadProps(__spreadValues({},a),{boxID:t,id:m,attribute:u,order:c})])}),e}),h=useUpdateRectList.useUpdateRectList(()=>{var e,o,r,t,u;const c=f?[]:ce(),a=(e=n.current)==null?void 0:e.selectedRectID,m=v.slice(0),M=R?util.selectSpecifiedRectsFromTopViewSelectedIds(m,c,g):[...c,...g];let W=[];!R&&(v==null?void 0:v.length)&&(W=c.filter(z=>a?v.includes(z.boxID)&&!a.includes(z.boxID):v.includes(z.boxID))),(o=n.current)==null||o.setHighLightRectList(W),(r=n.current)==null||r.setResult(M),T?((t=n.current)==null||t.setSelectedRectID(T),H("")):ue&&a&&((u=n.current)==null||u.setSelectedRectID(a),U(!1))}),Q=({targetId:e,id:o})=>{B(!1),q(e),H(o)};return React.useEffect(()=>{if(k.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:k.current,size:p,config:__spreadProps(__spreadValues({},I),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:P});return n.current=e,n.current.init(),n.current.on("updateDragResult",$),n.current.on("afterAddingDrawingRect",G),n.current.on("deleteSelectedRects",K),n.current.on("onRightClick",Q),()=>{var o,r,t,u,c;(o=n.current)==null||o.unbind("updateDragResult",$),(r=n.current)==null||r.unbind("afterAddingDrawingRect",G),(t=n.current)==null||t.unbind("deleteSelectedRects",K),(u=n.current)==null||u.unbind("onRightClick",Q),(c=n.current)==null||c.destroy()}}},[]),React.useEffect(()=>{const e=r=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(r)}catch(t){return console.error("Error loading image:",t),null}}),o=()=>__async(void 0,null,function*(){var r;F(!0);let t=yield e(S);!t&&b&&(t=yield e(b)),t&&((r=n.current)==null||r.setImgNode(t),D(t)),F(!1)});n.current&&(S||b)&&o()},[S,b]),React.useEffect(()=>{var e;(e=n.current)==null||e.setSize(p)},[p]),React.useEffect(()=>{L!==y.current&&h()},[L]),React.useEffect(()=>{var e,o;const r=g.find(t=>t.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,O),r&&ee(t=>{var u;const c=[];let a=null;return t.forEach(m=>{m.id!==n.current.selectedRectID?c.push(m):a=m}),r.extId===void 0&&(a=(u=n.current)==null?void 0:u.selectedRect),[...c,__spreadProps(__spreadValues({},a||{}),{attribute:O})]}),U(!0),h()},[O]),React.useEffect(()=>{const e=J.current;___default.default.isEqual(e,g)||(U(!0),h(),J.current=g)},[g]),React.useEffect(()=>{h()},[f]),React.useEffect(()=>{var e,o,r,t;const u=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},c=__spreadProps(__spreadValues({},u),{attributeList:(r=I.attributeList)!=null?r:[]});(t=n.current)==null||t.setConfig(JSON.stringify(c))},[I.attributeList]),React.useEffect(()=>{var e;(e=n.current)==null||e.setEnableAddRect(v.length===0),h()},[v]),React.useEffect(()=>{if(!C||!ie){B(!0);return}const{rectList:e,size:o,zoom:r}=n.current,t=e.find(a=>a.boxID===C||a.extId===C);if(!t){B(!0);return}const u={x:t.x+t.width/2,y:t.y+t.height/2},c=lbAnnotation.MathUtils.getCurrentPosFromRectCenter(o,u,r);n.current.setHoverRectID(t.id),n.current.setCurrentPos(c),n.current.renderBasicCanvas(),n.current.render()},[C]),React.useEffect(()=>{const{hiddenText:e}=j||{};if(e===void 0)return;const o=n.current;if(!o)return;const r=__spreadValues(__spreadValues({},o.style),j);o.setStyle(r)},[j]),React.useEffect(()=>{h()},[R]),React__default.default.createElement(es.Spin,{spinning:oe},React__default.default.createElement("div",{ref:k,style:__spreadValues({position:"relative"},p)}))};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"),util=require("./util.js"),useUpdateRectList=require("./useUpdateRectList.js"),_=require("lodash"),useToolStyle=require("../../hooks/useToolStyle.js"),index=require("../../store/toolConfig/index.js");function _interopDefaultLegacy(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,l,s)=>l in i?__defProp(i,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[l]=s,__spreadValues=(i,l)=>{for(var s in l||(l={}))__hasOwnProp.call(l,s)&&__defNormalProp(i,s,l[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(l))__propIsEnum.call(l,s)&&__defNormalProp(i,s,l[s]);return i},__spreadProps=(i,l)=>__defProps(i,__getOwnPropDescs(l)),__async=(i,l,s)=>new Promise((d,p)=>{var I=f=>{try{D(s.next(f))}catch(R){p(R)}},S=f=>{try{D(s.throw(f))}catch(R){p(R)}},D=f=>f.done?d(f.value):Promise.resolve(f.value).then(I,S);D((s=s.apply(i,l)).next())});const PointCloud2DRectOperationView=i=>{var l,s;const{mappingData:d,size:p,config:I,checkMode:S,afterImgOnLoad:D,shouldExcludePointCloudBoxListUpdate:f}=i,{selectBoxVisibleSwitch:R}=index(),L=(l=d==null?void 0:d.url)!=null?l:"",b=(s=d==null?void 0:d.fallbackUrl)!=null?s:"",{pointCloudBoxList:E,setPointCloudResult:O,defaultAttribute:V,rectList:q,addRectIn2DView:X,updateRectIn2DView:Y,removeRectIn2DView:Z,updateRectListByReducer:ee,selectedIDs:v,setSelectedIDs:j,selectedID:C}=React.useContext(PointCloudContext.PointCloudContext),{value:k}=useToolStyle.useToolStyleContext(),te=ahooks.useLatest(v),{update2DViewRect:re,remove2DViewRect:ne}=usePointCloudViews.usePointCloudViews(),U=React__default.default.useRef(null),n=React.useRef(null),A=ahooks.useMemoizedFn(re),x=ahooks.useMemoizedFn(ne),w=React.useRef(null),[oe,F]=React.useState(!0),[T,H]=React.useState(""),[ue,B]=React.useState(!1),[ie,y]=React.useState(!0),g=React.useMemo(()=>q==null?void 0:q.filter(e=>e.imageName===(d==null?void 0:d.path)),[d==null?void 0:d.path,q]),J=React.useRef(g),P=ahooks.useLatest(d==null?void 0:d.path),N=React.useCallback(e=>__async(void 0,null,function*(){try{const o=te.current.slice(0),r=yield Promise.resolve(e());if(!r||r.length===0)return r;if(o.length){const t=new Set(o),u=r.filter(c=>t.has(c.id)).map(c=>c.id);j(u)}return r}catch(o){}}),[j]),$=e=>{const{boxID:o}=e;if(y(!1),!f&&o){N(()=>{const r=A==null?void 0:A(e);return r?(w.current=r,O(r),r):null});return}Y(e,!0)},G=e=>{P.current&&X(__spreadProps(__spreadValues({},e),{imageName:P.current}))},K=e=>{if(e.length===0)return;if(!f){const r=e.find(t=>t.boxID);if(r){N(()=>{const t=x==null?void 0:x(r);return t?(w.current=t,O(t),h(),t):null});return}}const o=e.find(r=>r.extId);o&&N(()=>{const{imageName:r,extId:t}=o,u=x==null?void 0:x({boxID:t,imageName:r});return u?(w.current=u,O(u),u):null}),Z(e)},ce=ahooks.useMemoizedFn(()=>{let e=[];return E.forEach(o=>{const{rects:r=[],id:t,attribute:u,trackID:c}=o,a=r.find(M=>M.imageName===P.current),m=t+"_"+P.current;a&&(e=[...e,__spreadProps(__spreadValues({},a),{boxID:t,id:m,attribute:u,order:c})])}),e}),h=useUpdateRectList.useUpdateRectList(()=>{var e,o,r,t,u;const c=f?[]:ce(),a=(e=n.current)==null?void 0:e.selectedRectID,m=v.slice(0),M=R?util.selectSpecifiedRectsFromTopViewSelectedIds(m,c,g):[...c,...g];let W=[];!R&&(v==null?void 0:v.length)&&(W=c.filter(z=>a?v.includes(z.boxID)&&!a.includes(z.boxID):v.includes(z.boxID))),(o=n.current)==null||o.setHighLightRectList(W),(r=n.current)==null||r.setResult(M),T?((t=n.current)==null||t.setSelectedRectID(T),H("")):ue&&a&&((u=n.current)==null||u.setSelectedRectID(a),B(!1))}),Q=({targetId:e,id:o})=>{y(!1),j(e),H(o)};return React.useEffect(()=>{if(U.current){const e=new lbAnnotation.PointCloud2DRectOperation({container:U.current,size:p,config:__spreadProps(__spreadValues({},I),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:S});return n.current=e,n.current.init(),n.current.on("updateDragResult",$),n.current.on("afterAddingDrawingRect",G),n.current.on("deleteSelectedRects",K),n.current.on("onRightClick",Q),()=>{var o,r,t,u,c;(o=n.current)==null||o.unbind("updateDragResult",$),(r=n.current)==null||r.unbind("afterAddingDrawingRect",G),(t=n.current)==null||t.unbind("deleteSelectedRects",K),(u=n.current)==null||u.unbind("onRightClick",Q),(c=n.current)==null||c.destroy()}}},[]),React.useEffect(()=>{const e=r=>__async(void 0,null,function*(){try{return yield lbAnnotation.ImgUtils.load(r)}catch(t){return console.error("Error loading image:",t),null}}),o=()=>__async(void 0,null,function*(){var r;F(!0);let t=yield e(L);!t&&b&&(t=yield e(b)),t&&((r=n.current)==null||r.setImgNode(t),D(t)),F(!1)});n.current&&(L||b)&&o()},[L,b]),React.useEffect(()=>{var e;(e=n.current)==null||e.setSize(p)},[p]),React.useEffect(()=>{E!==w.current&&h()},[E]),React.useEffect(()=>{var e,o;const r=g.find(t=>t.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,V),r&&ee(t=>{var u;const c=[];let a=null;return t.forEach(m=>{m.id!==n.current.selectedRectID?c.push(m):a=m}),r.extId===void 0&&(a=(u=n.current)==null?void 0:u.selectedRect),[...c,__spreadProps(__spreadValues({},a||{}),{attribute:V})]}),B(!0),h()},[V]),React.useEffect(()=>{const e=J.current;___default.default.isEqual(e,g)||(B(!0),h(),J.current=g)},[g]),React.useEffect(()=>{h()},[f]),React.useEffect(()=>{var e,o,r,t;const u=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},c=__spreadProps(__spreadValues({},u),{attributeList:(r=I.attributeList)!=null?r:[]});(t=n.current)==null||t.setConfig(JSON.stringify(c))},[I.attributeList]),React.useEffect(()=>{var e;(e=n.current)==null||e.setEnableAddRect(v.length===0),h()},[v]),ahooks.useDebounceEffect(()=>{if(!C||!ie){y(!0);return}const{rectList:e,size:o,zoom:r}=n.current,t=e.find(a=>a.boxID===C||a.extId===C);if(!t){y(!0);return}const u={x:t.x+t.width/2,y:t.y+t.height/2},c=lbAnnotation.MathUtils.getCurrentPosFromRectCenter(o,u,r);n.current.setHoverRectID(t.id),n.current.setCurrentPos(c),n.current.renderBasicCanvas(),n.current.render()},[C],{wait:200}),React.useEffect(()=>{const{hiddenText:e}=k||{};if(e===void 0)return;const o=n.current;if(!o)return;const r=__spreadValues(__spreadValues({},o.style),k);o.setStyle(r)},[k]),React.useEffect(()=>{h()},[R]),React__default.default.createElement(es.Spin,{spinning:oe},React__default.default.createElement("div",{ref:U,style:__spreadValues({position:"relative"},p)}))};var PointCloud2DRectOperationView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DRectOperationView);module.exports=PointCloud2DRectOperationView$1;
@@ -0,0 +1,2 @@
1
+ declare const useFilterAnnotations: (originAnnotations: any[] | undefined, selectedIDs: string[] | undefined, selectBoxVisibleSwitch: boolean) => any[];
2
+ export default useFilterAnnotations;