=0&&n.splice(r,1),n}function G(e,t){var n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n}function W(e){return e.split("-")}function A(e,t){return"".concat(e,"-").concat(t)}function K(e,t){var n=[];return function e(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((function(t){var r=t.key,o=t.children;n.push(r),e(o)}))}(t[e].children),n}function X(e){if(e.parent){var t=W(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1}function F(e,t,n,r,o,i,a,l,s,u){var c,d=e.clientX,f=e.clientY,h=e.target.getBoundingClientRect(),p=h.top,m=h.height,g=(("rtl"===u?-1:1)*(((null==o?void 0:o.x)||0)-d)-12)/r,v=l[n.props.eventKey];if(f-1.5?i({dragNode:O,dropNode:P,dropPosition:1})?C=1:j=!1:i({dragNode:O,dropNode:P,dropPosition:0})?C=0:i({dragNode:O,dropNode:P,dropPosition:1})?C=1:j=!1:i({dragNode:O,dropNode:P,dropPosition:1})?C=1:j=!1,{dropPosition:C,dropLevelOffset:k,dropTargetKey:v.key,dropTargetPos:v.pos,dragOverNodeKey:S,dropContainerKey:0===C?null:(null===(c=v.parent)||void 0===c?void 0:c.key)||null,dropAllowed:j}}function Y(e,t){if(e)return t.multiple?e.slice():e.length?[e[0]]:e}function H(e){if(!e)return null;var t;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else{if("object"!==(0,i.Z)(e))return(0,m.ZP)(!1,"`checkedKeys` is not an array or an object"),null;t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0}}return t}function z(e,t){var n=new Set;function r(e){if(!n.has(e)){var o=t[e];if(o){n.add(e);var i=o.parent;o.node.disabled||i&&r(i.key)}}}return(e||[]).forEach((function(e){r(e)})),(0,l.Z)(n)}var B=n(67449),U=n(7606),J=n(39702),Q=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],q=function(e,t){var n=e.className,o=e.style,i=e.motion,a=e.motionNodes,l=e.motionType,s=e.onMotionStart,u=e.onMotionEnd,c=e.active,d=e.treeNodeRequiredProps,f=(0,w.Z)(e,Q),p=h.useState(!0),m=(0,B.Z)(p,2),g=m[0],v=m[1],x=h.useContext(b).prefixCls,S=h.useRef(!1),C=function(){S.current||u(),S.current=!0};return(0,h.useEffect)((function(){a&&"hide"===l&&g&&v(!1)}),[a]),(0,h.useEffect)((function(){return a&&s(),function(){a&&C()}}),[]),a?h.createElement(J.default,(0,r.Z)({ref:t,visible:g},i,{motionAppear:"show"===l,onAppearEnd:C,onLeaveEnd:C}),(function(e,t){var n=e.className,o=e.style;return h.createElement("div",{ref:t,className:y()("".concat(x,"-treenode-motion"),n),style:o},a.map((function(e){var t=(0,r.Z)({},e.data),n=e.title,o=e.key,i=e.isStart,a=e.isEnd;delete t.children;var l=_(o,d);return h.createElement(V,(0,r.Z)({},t,l,{title:n,active:c,data:e.data,key:o,isStart:i,isEnd:a}))})))})):h.createElement(V,(0,r.Z)({domRef:t,className:n,style:o},f,{active:c}))};q.displayName="MotionTreeNode";var $=h.forwardRef(q);function ee(e,t,n){var r=e.findIndex((function(e){return e.key===n})),o=e[r+1],i=t.findIndex((function(e){return e.key===n}));if(o){var a=t.findIndex((function(e){return e.key===o.key}));return t.slice(i+1,a)}return t.slice(i+1)}var te=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],ne={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},re=function(){},oe="RC_TREE_MOTION_".concat(Math.random()),ie={key:oe},ae={key:oe,level:0,index:0,pos:"0",node:ie,nodes:[ie]},le={parent:null,children:[],pos:ae.pos,data:ie,title:null,key:oe,isStart:[],isEnd:[]};function se(e,t,n,r){return!1!==t&&n?e.slice(0,Math.ceil(n/r)+1):e}function ue(e){return R(e.key,e.pos)}var ce=function(e,t){var n=e.prefixCls,o=e.data,i=(e.selectable,e.checkable,e.expandedKeys),a=e.selectedKeys,l=e.checkedKeys,s=e.loadedKeys,u=e.loadingKeys,c=e.halfCheckedKeys,d=e.keyEntities,f=e.disabled,p=e.dragging,m=e.dragOverNodeKey,g=e.dropPosition,v=e.motion,y=e.height,b=e.itemHeight,x=e.virtual,S=e.focusable,C=e.activeItem,k=e.focused,E=e.tabIndex,O=e.onKeyDown,P=e.onFocus,j=e.onBlur,I=e.onActiveChange,M=e.onListChangeStart,T=e.onListChangeEnd,L=(0,w.Z)(e,te),N=h.useRef(null),Z=h.useRef(null);h.useImperativeHandle(t,(function(){return{scrollTo:function(e){N.current.scrollTo(e)},getIndentWidth:function(){return Z.current.offsetWidth}}}));var V=h.useState(i),D=(0,B.Z)(V,2),G=D[0],W=D[1],A=h.useState(o),K=(0,B.Z)(A,2),X=K[0],F=K[1],Y=h.useState(o),H=(0,B.Z)(Y,2),z=H[0],J=H[1],Q=h.useState([]),q=(0,B.Z)(Q,2),ie=q[0],ae=q[1],ce=h.useState(null),de=(0,B.Z)(ce,2),fe=de[0],he=de[1];function pe(){F(o),J(o),ae([]),he(null),T()}h.useEffect((function(){W(i);var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.length,r=t.length;if(1!==Math.abs(n-r))return{add:!1,key:null};function o(e,t){var n=new Map;e.forEach((function(e){n.set(e,!0)}));var r=t.filter((function(e){return!n.has(e)}));return 1===r.length?r[0]:null}return n ").concat(t);return t}(C)),h.createElement("div",null,h.createElement("input",{style:ne,disabled:!1===S||f,tabIndex:!1!==S?E:null,onKeyDown:O,onFocus:P,onBlur:j,value:"",onChange:re,"aria-label":"for screen reader"})),h.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden"}},h.createElement("div",{className:"".concat(n,"-indent")},h.createElement("div",{ref:Z,className:"".concat(n,"-indent-unit")}))),h.createElement(U.Z,(0,r.Z)({},L,{data:me,itemKey:ue,height:y,fullHeight:!1,virtual:x,itemHeight:b,prefixCls:"".concat(n,"-list"),ref:N,onVisibleChange:function(e,t){var n=new Set(e);t.filter((function(e){return!n.has(e)})).some((function(e){return ue(e)===oe}))&&pe()}}),(function(e){var t=e.pos,n=(0,r.Z)({},e.data),o=e.title,i=e.key,a=e.isStart,l=e.isEnd,s=R(i,t);delete n.key,delete n.children;var u=_(s,ge);return h.createElement($,(0,r.Z)({},n,u,{title:o,active:!!C&&i===C.key,pos:t,data:e.data,isStart:a,isEnd:l,motion:v,motionNodes:i===oe?ie:null,motionType:fe,onMotionStart:M,onMotionEnd:pe,treeNodeRequiredProps:ge,onMouseMove:function(){I(null)}}))})))},de=h.forwardRef(ce);de.displayName="NodeList";var fe=de;function he(e,t){var n=new Set;return e.forEach((function(e){t.has(e)||n.add(e)})),n}function pe(e){var t=e||{},n=t.disabled,r=t.disableCheckbox,o=t.checkable;return!(!n&&!r)||!1===o}function me(e,t,n,r){var o,i=[];o=r||pe;var a,l=new Set(e.filter((function(e){var t=!!n[e];return t||i.push(e),t}))),s=new Map,u=0;return Object.keys(n).forEach((function(e){var t=n[e],r=t.level,o=s.get(r);o||(o=new Set,s.set(r,o)),o.add(t),u=Math.max(u,r)})),(0,m.ZP)(!i.length,"Tree missing follow keys: ".concat(i.slice(0,100).map((function(e){return"'".concat(e,"'")})).join(", "))),a=!0===t?function(e,t,n,r){for(var o=new Set(e),i=new Set,a=0;a<=n;a+=1)(t.get(a)||new Set).forEach((function(e){var t=e.key,n=e.node,i=e.children,a=void 0===i?[]:i;o.has(t)&&!r(n)&&a.filter((function(e){return!r(e.node)})).forEach((function(e){o.add(e.key)}))}));for(var l=new Set,s=n;s>=0;s-=1)(t.get(s)||new Set).forEach((function(e){var t=e.parent,n=e.node;if(!r(n)&&e.parent&&!l.has(e.parent.key))if(r(e.parent.node))l.add(t.key);else{var a=!0,s=!1;(t.children||[]).filter((function(e){return!r(e.node)})).forEach((function(e){var t=e.key,n=o.has(t);a&&!n&&(a=!1),s||!n&&!i.has(t)||(s=!0)})),a&&o.add(t.key),s&&i.add(t.key),l.add(t.key)}}));return{checkedKeys:Array.from(o),halfCheckedKeys:Array.from(he(i,o))}}(l,s,u,o):function(e,t,n,r,o){for(var i=new Set(e),a=new Set(t),l=0;l<=r;l+=1)(n.get(l)||new Set).forEach((function(e){var t=e.key,n=e.node,r=e.children,l=void 0===r?[]:r;i.has(t)||a.has(t)||o(n)||l.filter((function(e){return!o(e.node)})).forEach((function(e){i.delete(e.key)}))}));a=new Set;for(var s=new Set,u=r;u>=0;u-=1)(n.get(u)||new Set).forEach((function(e){var t=e.parent,n=e.node;if(!o(n)&&e.parent&&!s.has(e.parent.key))if(o(e.parent.node))s.add(t.key);else{var r=!0,l=!1;(t.children||[]).filter((function(e){return!o(e.node)})).forEach((function(e){var t=e.key,n=i.has(t);r&&!n&&(r=!1),l||!n&&!a.has(t)||(l=!0)})),r||i.delete(t.key),l&&a.add(t.key),s.add(t.key)}}));return{checkedKeys:Array.from(i),halfCheckedKeys:Array.from(he(a,i))}}(l,t.halfCheckedKeys,s,u,o),a}var ge=function(e){(0,d.Z)(n,e);var t=(0,f.Z)(n);function n(){var e;(0,s.Z)(this,n);for(var r=arguments.length,o=new Array(r),i=0;i2&&void 0!==arguments[2]&&arguments[2],i=e.state,l=i.dragChildrenKeys,s=i.dropPosition,u=i.dropTargetKey,c=i.dropTargetPos;if(i.dropAllowed){var d=e.props.onDrop;if(e.setState({dragOverNodeKey:null}),e.cleanDragState(),null!==u){var f=(0,a.Z)((0,a.Z)({},_(u,e.getTreeNodeRequiredProps())),{},{active:(null===(r=e.getActiveItem())||void 0===r?void 0:r.data.key)===u,data:e.state.keyEntities[u].node}),h=-1!==l.indexOf(u);(0,m.ZP)(!h,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var p=W(c),g={event:t,node:I(f),dragNode:e.dragNode?I(e.dragNode.props):null,dragNodesKeys:[e.dragNode.props.eventKey].concat(l),dropToGap:0!==s,dropPosition:s+Number(p[p.length-1])};o||null==d||d(g),e.dragNode=null}}},e.cleanDragState=function(){null!==e.state.draggingNodeKey&&e.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),e.dragStartMousePosition=null,e.currentMouseOverDroppableNodeKey=null},e.onNodeClick=function(t,n){var r=e.props.onClick;null==r||r(t,n)},e.onNodeDoubleClick=function(t,n){var r=e.props.onDoubleClick;null==r||r(t,n)},e.onNodeSelect=function(t,n){var r=e.state.selectedKeys,o=e.state,i=o.keyEntities,a=o.fieldNames,l=e.props,s=l.onSelect,u=l.multiple,c=n.selected,d=n[a.key],f=!c,h=(r=f?u?G(r,d):[d]:D(r,d)).map((function(e){var t=i[e];return t?t.node:null})).filter((function(e){return e}));e.setUncontrolledState({selectedKeys:r}),null==s||s(r,{event:"select",selected:f,node:n,selectedNodes:h,nativeEvent:t.nativeEvent})},e.onNodeCheck=function(t,n,r){var o,i=e.state,a=i.keyEntities,s=i.checkedKeys,u=i.halfCheckedKeys,c=e.props,d=c.checkStrictly,f=c.onCheck,h=n.key,p={event:"check",node:n,checked:r,nativeEvent:t.nativeEvent};if(d){var m=r?G(s,h):D(s,h);o={checked:m,halfChecked:D(u,h)},p.checkedNodes=m.map((function(e){return a[e]})).filter((function(e){return e})).map((function(e){return e.node})),e.setUncontrolledState({checkedKeys:m})}else{var g=me([].concat((0,l.Z)(s),[h]),!0,a),v=g.checkedKeys,y=g.halfCheckedKeys;if(!r){var b=new Set(v);b.delete(h);var w=me(Array.from(b),{checked:!1,halfCheckedKeys:y},a);v=w.checkedKeys,y=w.halfCheckedKeys}o=v,p.checkedNodes=[],p.checkedNodesPositions=[],p.halfCheckedKeys=y,v.forEach((function(e){var t=a[e];if(t){var n=t.node,r=t.pos;p.checkedNodes.push(n),p.checkedNodesPositions.push({node:n,pos:r})}})),e.setUncontrolledState({checkedKeys:v},!1,{halfCheckedKeys:y})}null==f||f(o,p)},e.onNodeLoad=function(t){var n=t.key,r=new Promise((function(r,o){e.setState((function(i){var a=i.loadedKeys,l=void 0===a?[]:a,s=i.loadingKeys,u=void 0===s?[]:s,c=e.props,d=c.loadData,f=c.onLoad;return d&&-1===l.indexOf(n)&&-1===u.indexOf(n)?(d(t).then((function(){var o=G(e.state.loadedKeys,n);null==f||f(o,{event:"load",node:t}),e.setUncontrolledState({loadedKeys:o}),e.setState((function(e){return{loadingKeys:D(e.loadingKeys,n)}})),r()})).catch((function(t){if(e.setState((function(e){return{loadingKeys:D(e.loadingKeys,n)}})),e.loadingRetryTimes[n]=(e.loadingRetryTimes[n]||0)+1,e.loadingRetryTimes[n]>=10){var i=e.state.loadedKeys;(0,m.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),e.setUncontrolledState({loadedKeys:G(i,n)}),r()}o(t)})),{loadingKeys:G(u,n)}):null}))}));return r.catch((function(){})),r},e.onNodeMouseEnter=function(t,n){var r=e.props.onMouseEnter;null==r||r({event:t,node:n})},e.onNodeMouseLeave=function(t,n){var r=e.props.onMouseLeave;null==r||r({event:t,node:n})},e.onNodeContextMenu=function(t,n){var r=e.props.onRightClick;r&&(t.preventDefault(),r({event:t,node:n}))},e.onFocus=function(){var t=e.props.onFocus;e.setState({focused:!0});for(var n=arguments.length,r=new Array(n),o=0;o1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e.destroyed){var o=!1,i=!0,l={};Object.keys(t).forEach((function(n){n in e.props?i=!1:(o=!0,l[n]=t[n])})),!o||n&&!i||e.setState((0,a.Z)((0,a.Z)({},l),r))}},e.scrollTo=function(t){e.listRef.current.scrollTo(t)},e}return(0,u.Z)(n,[{key:"componentDidMount",value:function(){this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var e=this.props.activeKey;void 0!==e&&e!==this.state.activeKey&&(this.setState({activeKey:e}),null!==e&&this.scrollTo({key:e}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var e,t,n=this.state,a=n.focused,l=n.flattenNodes,s=n.keyEntities,u=n.draggingNodeKey,c=n.activeKey,d=n.dropLevelOffset,f=n.dropContainerKey,p=n.dropTargetKey,m=n.dropPosition,v=n.dragOverNodeKey,w=n.indent,x=this.props,S=x.prefixCls,C=x.className,k=x.style,E=x.showLine,R=x.focusable,O=x.tabIndex,P=void 0===O?0:O,j=x.selectable,_=x.showIcon,I=x.icon,M=x.switcherIcon,T=x.draggable,L=x.checkable,N=x.checkStrictly,Z=x.disabled,V=x.motion,D=x.loadData,G=x.filterTreeNode,W=x.height,A=x.itemHeight,K=x.virtual,X=x.titleRender,F=x.dropIndicatorRender,Y=x.onContextMenu,H=x.onScroll,z=x.direction,B=(0,g.Z)(this.props,{aria:!0,data:!0});return T&&(t="object"===(0,i.Z)(T)?T:"function"==typeof T?{nodeDraggable:T}:{}),h.createElement(b.Provider,{value:{prefixCls:S,selectable:j,showIcon:_,icon:I,switcherIcon:M,draggable:t,draggingNodeKey:u,checkable:L,checkStrictly:N,disabled:Z,keyEntities:s,dropLevelOffset:d,dropContainerKey:f,dropTargetKey:p,dropPosition:m,dragOverNodeKey:v,indent:w,direction:z,dropIndicatorRender:F,loadData:D,filterTreeNode:G,titleRender:X,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},h.createElement("div",{role:"tree",className:y()(S,C,(e={},(0,o.Z)(e,"".concat(S,"-show-line"),E),(0,o.Z)(e,"".concat(S,"-focused"),a),(0,o.Z)(e,"".concat(S,"-active-focused"),null!==c),e))},h.createElement(fe,(0,r.Z)({ref:this.listRef,prefixCls:S,style:k,data:l,disabled:Z,selectable:j,checkable:!!L,motion:V,dragging:null!==u,height:W,itemHeight:A,virtual:K,focusable:R,focused:a,tabIndex:P,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:Y,onScroll:H},this.getTreeNodeRequiredProps(),B))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n,r=t.prevProps,i={prevProps:e};function l(t){return!r&&t in e||r&&r[t]!==e[t]}var s=t.fieldNames;if(l("fieldNames")&&(s=O(e.fieldNames),i.fieldNames=s),l("treeData")?n=e.treeData:l("children")&&((0,m.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),n=function e(t){return(0,k.Z)(t).map((function(t){if(!function(e){return e&&e.type&&e.type.isTreeNode}(t))return(0,m.ZP)(!t,"Tree/TreeNode can only accept TreeNode as children."),null;var n=t.key,r=t.props,o=r.children,i=(0,w.Z)(r,E),l=(0,a.Z)({key:n},i),s=e(o);return s.length&&(l.children=s),l})).filter((function(e){return e}))}(e.children)),n){i.treeData=n;var u=j(n,{fieldNames:s});i.keyEntities=(0,a.Z)((0,o.Z)({},oe,ae),u.keyEntities)}var c,d=i.keyEntities||t.keyEntities;if(l("expandedKeys")||r&&l("autoExpandParent"))i.expandedKeys=e.autoExpandParent||!r&&e.defaultExpandParent?z(e.expandedKeys,d):e.expandedKeys;else if(!r&&e.defaultExpandAll){var f=(0,a.Z)({},d);delete f[oe],i.expandedKeys=Object.keys(f).map((function(e){return f[e].key}))}else!r&&e.defaultExpandedKeys&&(i.expandedKeys=e.autoExpandParent||e.defaultExpandParent?z(e.defaultExpandedKeys,d):e.defaultExpandedKeys);if(i.expandedKeys||delete i.expandedKeys,n||i.expandedKeys){var h=P(n||t.treeData,i.expandedKeys||t.expandedKeys,s);i.flattenNodes=h}if((e.selectable&&(l("selectedKeys")?i.selectedKeys=Y(e.selectedKeys,e):!r&&e.defaultSelectedKeys&&(i.selectedKeys=Y(e.defaultSelectedKeys,e))),e.checkable)&&(l("checkedKeys")?c=H(e.checkedKeys)||{}:!r&&e.defaultCheckedKeys?c=H(e.defaultCheckedKeys)||{}:n&&(c=H(e.checkedKeys)||{checkedKeys:t.checkedKeys,halfCheckedKeys:t.halfCheckedKeys}),c)){var p=c,g=p.checkedKeys,v=void 0===g?[]:g,y=p.halfCheckedKeys,b=void 0===y?[]:y;if(!e.checkStrictly){var x=me(v,!0,d);v=x.checkedKeys,b=x.halfCheckedKeys}i.checkedKeys=v,i.halfCheckedKeys=b}return l("loadedKeys")&&(i.loadedKeys=e.loadedKeys),i}}]),n}(h.Component);ge.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:function(e){var t=e.dropPosition,n=e.dropLevelOffset,r=e.indent,o={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(t){case-1:o.top=0,o.left=-n*r;break;case 1:o.bottom=0,o.left=-n*r;break;case 0:o.bottom=0,o.left=r}return h.createElement("div",{style:o})},allowDrop:function(){return!0}},ge.TreeNode=V;var ve=ge},66991:function(e,t,n){"use strict";var r=n(29282),o=n(4149);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=o(n(89457)),a=r(n(67294)),l=o(n(94184)),s=function(e){for(var t=e.prefixCls,n=e.level,r=e.isStart,o=e.isEnd,s="".concat(t,"-indent-unit"),u=[],c=0;c=0&&n.splice(r,1);return n},t.calcDropPosition=function(e,t,n,r,o,i,a,l,s,u){var c,d=e.clientX,f=e.clientY,m=e.target.getBoundingClientRect(),g=m.top,v=m.height,y=(("rtl"===u?-1:1)*(((null==o?void 0:o.x)||0)-d)-12)/r,b=l[n.props.eventKey];if(f-1.5?i({dragNode:P,dropNode:j,dropPosition:1})?E=1:_=!1:i({dragNode:P,dropNode:j,dropPosition:0})?E=0:i({dragNode:P,dropNode:j,dropPosition:1})?E=1:_=!1:i({dragNode:P,dropNode:j,dropPosition:1})?E=1:_=!1;return{dropPosition:E,dropLevelOffset:R,dropTargetKey:b.key,dropTargetPos:b.pos,dragOverNodeKey:k,dropContainerKey:0===E?null:(null===(c=b.parent)||void 0===c?void 0:c.key)||null,dropAllowed:_}},t.calcSelectedKeys=function(e,t){if(!e)return;if(t.multiple)return e.slice();if(e.length)return[e[0]];return e},t.conductExpandParent=function(e,t){var n=new Set;function r(e){if(!n.has(e)){var o=t[e];if(o){n.add(e);var i=o.parent;o.node.disabled||i&&r(i.key)}}}return(e||[]).forEach((function(e){r(e)})),(0,o.default)(n)},t.convertDataToTree=function e(t,n){if(!t)return[];var r=(n||{}).processProps,o=void 0===r?m:r;return(Array.isArray(t)?t:[t]).map((function(t){var r=t.children,i=(0,l.default)(t,d),u=e(r,n);return s.default.createElement(c.default,(0,a.default)({key:i.key},o(i)),u)}))},t.getDragChildrenKeys=function(e,t){var n=[];return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.forEach((function(t){var r=t.key,o=t.children;n.push(r),e(o)}))}(t[e].children),n},t.getPosition=function(e,t){return"".concat(e,"-").concat(t)},t.isFirstChild=p,t.isLastChild=h,t.isTreeNode=function(e){return e&&e.type&&e.type.isTreeNode},t.parseCheckedKeys=function(e){if(!e)return null;var t;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else{if("object"!==(0,i.default)(e))return(0,u.default)(!1,"`checkedKeys` is not an array or an object"),null;t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0}}return t},t.posToArr=f;var o=r(n(21108)),i=r(n(15626)),a=r(n(93120)),l=r(n(12055)),s=r(n(67294)),u=r(n(45520)),c=r(n(48654)),d=["children"];function f(e){return e.split("-")}function h(e){if(e.parent){var t=f(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1}function p(e){var t=f(e.pos);return 0===Number(t[t.length-1])}var m=function(e){return e}},36034:function(e,t,n){"use strict";var r=n(4149);Object.defineProperty(t,"__esModule",{value:!0}),t.conductCheck=function(e,t,n,r){var l,s=[];l=r||a;var u,c=new Set(e.filter((function(e){var t=!!n[e];return t||s.push(e),t}))),d=new Map,f=0;Object.keys(n).forEach((function(e){var t=n[e],r=t.level,o=d.get(r);o||(o=new Set,d.set(r,o)),o.add(t),f=Math.max(f,r)})),(0,o.default)(!s.length,"Tree missing follow keys: ".concat(s.slice(0,100).map((function(e){return"'".concat(e,"'")})).join(", "))),u=!0===t?function(e,t,n,r){for(var o=new Set(e),a=new Set,l=0;l<=n;l+=1){(t.get(l)||new Set).forEach((function(e){var t=e.key,n=e.node,i=e.children,a=void 0===i?[]:i;o.has(t)&&!r(n)&&a.filter((function(e){return!r(e.node)})).forEach((function(e){o.add(e.key)}))}))}for(var s=new Set,u=n;u>=0;u-=1){(t.get(u)||new Set).forEach((function(e){var t=e.parent,n=e.node;if(!r(n)&&e.parent&&!s.has(e.parent.key))if(r(e.parent.node))s.add(t.key);else{var i=!0,l=!1;(t.children||[]).filter((function(e){return!r(e.node)})).forEach((function(e){var t=e.key,n=o.has(t);i&&!n&&(i=!1),l||!n&&!a.has(t)||(l=!0)})),i&&o.add(t.key),l&&a.add(t.key),s.add(t.key)}}))}return{checkedKeys:Array.from(o),halfCheckedKeys:Array.from(i(a,o))}}(c,d,f,l):function(e,t,n,r,o){for(var a=new Set(e),l=new Set(t),s=0;s<=r;s+=1){(n.get(s)||new Set).forEach((function(e){var t=e.key,n=e.node,r=e.children,i=void 0===r?[]:r;a.has(t)||l.has(t)||o(n)||i.filter((function(e){return!o(e.node)})).forEach((function(e){a.delete(e.key)}))}))}l=new Set;for(var u=new Set,c=r;c>=0;c-=1){(n.get(c)||new Set).forEach((function(e){var t=e.parent,n=e.node;if(!o(n)&&e.parent&&!u.has(e.parent.key))if(o(e.parent.node))u.add(t.key);else{var r=!0,i=!1;(t.children||[]).filter((function(e){return!o(e.node)})).forEach((function(e){var t=e.key,n=a.has(t);r&&!n&&(r=!1),i||!n&&!l.has(t)||(i=!0)})),r||a.delete(t.key),i&&l.add(t.key),u.add(t.key)}}))}return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(i(l,a))}}(c,t.halfCheckedKeys,d,f,l);return u},t.isCheckDisabled=a;var o=r(n(45520));function i(e,t){var n=new Set;return e.forEach((function(e){t.has(e)||n.add(e)})),n}function a(e){var t=e||{},n=t.disabled,r=t.disableCheckbox,o=t.checkable;return!(!n&&!r)||!1===o}},57906:function(e,t,n){"use strict";var r=n(4149);Object.defineProperty(t,"__esModule",{value:!0}),t.convertDataToEntities=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.initWrapper,r=t.processEntity,o=t.onProcessFinished,i=t.externalGetKey,a=t.childrenPropName,l=t.fieldNames,s=arguments.length>2?arguments[2]:void 0,u=i||s,c={},d={},f={posEntities:c,keyEntities:d};n&&(f=n(f)||f);m(e,(function(e){var t=e.node,n=e.index,o=e.pos,i=e.key,a=e.parentPos,l=e.level,s={node:t,nodes:e.nodes,index:n,key:i,pos:o,level:l},u=h(i,o);c[o]=s,d[u]=s,s.parent=c[a],s.parent&&(s.parent.children=s.parent.children||[],s.parent.children.push(s)),r&&r(s,f)}),{externalGetKey:u,childrenPropName:a,fieldNames:l}),o&&o(f);return f},t.convertNodePropsToEventData=function(e){var t=e.data,n=e.expanded,r=e.selected,o=e.checked,i=e.loaded,l=e.loading,s=e.halfChecked,u=e.dragOver,d=e.dragOverGapTop,f=e.dragOverGapBottom,h=e.pos,p=e.active,m=e.eventKey,g=(0,a.default)((0,a.default)({},t),{},{expanded:n,selected:r,checked:o,loaded:i,loading:l,halfChecked:s,dragOver:u,dragOverGapTop:d,dragOverGapBottom:f,pos:h,active:p,key:m});"props"in g||Object.defineProperty(g,"props",{get:function(){return(0,c.default)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),e}});return g},t.convertTreeToData=function(e){return function e(t){return(0,u.default)(t).map((function(t){if(!(0,d.isTreeNode)(t))return(0,c.default)(!t,"Tree/TreeNode can only accept TreeNode as children."),null;var n=t.key,r=t.props,o=r.children,i=(0,l.default)(r,f),s=(0,a.default)({key:n},i),u=e(o);return u.length&&(s.children=u),s})).filter((function(e){return e}))}(e)},t.fillFieldNames=p,t.flattenTreeData=function(e,t,n){var r=p(n),o=r._title,l=r.key,u=r.children,c=new Set(!0===t?[]:t),f=[];return function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return n.map((function(p,m){for(var g,v=(0,d.getPosition)(r?r.pos:"0",m),y=h(p[l],v),b=0;b1&&void 0!==arguments[1]?arguments[1]:"";(r||[]).forEach((function(r){var i=r[t.key],a=r[t.children];(0,c.default)(null!=i,"Tree node must have a certain key: [".concat(o).concat(i,"]"));var l=String(i);(0,c.default)(!n.has(l)||null==i,"Same 'key' exist in the Tree: ".concat(l)),n.set(l,!0),e(a,"".concat(o).concat(l," > "))}))}(e)};var o=r(n(15626)),i=r(n(21108)),a=r(n(71208)),l=r(n(12055)),s=r(n(18475)),u=r(n(45598)),c=r(n(45520)),d=n(45798),f=["children"];function h(e,t){return null!=e?e:t}function p(e){var t=e||{},n=t.title||"title";return{title:n,_title:t._title||[n],key:t.key||"key",children:t.children||"children"}}function m(e,t,n){var r,a=("object"===(0,o.default)(n)?n:{externalGetKey:n})||{},l=a.childrenPropName,s=a.externalGetKey,u=p(a.fieldNames),c=u.key,f=u.children,m=l||f;s?"string"==typeof s?r=function(e){return e[s]}:"function"==typeof s&&(r=function(e){return s(e)}):r=function(e,t){return h(e[c],t)},function n(o,a,l,s){var u=o?o[m]:e,c=o?(0,d.getPosition)(l.pos,a):"0",f=o?[].concat((0,i.default)(s),[o]):[];if(o){var h=r(o,c),p={node:o,index:a,pos:c,key:h,parentPos:l.node?l.pos:null,level:l.level+1,nodes:f};t(p)}u&&u.forEach((function(e,t){n(e,t,{node:o,pos:c,level:l?l.level+1:-1},f)}))}(null)}},62903:function(e,t){"use strict";t.Z={onDeleteAnnotation:function(){},onEntityCreate:function(){},onEntityDelete:function(){},onGroundTruth:function(){},onLabelStudioLoad:function(){},onSkipTask:function(){},onUnskipTask:function(){},onSubmitAnnotation:function(){},onSubmitDraft:function(e){},onTaskLoad:function(){},onUpdateAnnotation:function(){},onSelectAnnotation:function(e,t){},onAcceptAnnotation:function(e,t){},onRejectAnnotation:function(e,t){},onStorageInitialized:function(e){},onNextTask:function(e){},onPrevTask:function(e){}}},71808:function(e,t,n){"use strict";n.r(t);var r=n(62903),o=n(64588);t.default={getData:function(e){return e&&e.data?{...e,data:JSON.stringify(e.data)}:e},getState:function(e){return{annotations:null==e?void 0:e.annotations,completions:null==e?void 0:e.completions,predictions:null==e?void 0:e.predictions}},rootElement:function(e){let t;return t="string"==typeof e?document.getElementById(e):e,t.innerHTML="",t},configureApplication:function(e){var t,n;const i=e.submitAnnotation||e.onSubmitAnnotation,a=e.updateAnnotation||e.onUpdateAnnotation,l=e.deleteAnnotation||e.onDeleteAnnotation;return{settings:e.settings||{},messages:{...o.Z,...e.messages},onSubmitAnnotation:e.onSubmitAnnotation?i:r.Z.onSubmitAnnotation,onUpdateAnnotation:e.onUpdateAnnotation?a:r.Z.onUpdateAnnotation,onDeleteAnnotation:e.onDeleteAnnotation?l:r.Z.onDeleteAnnotation,onSkipTask:e.onSkipTask?e.onSkipTask:r.Z.onSkipTask,onUnskipTask:e.onUnskipTask?e.onUnskipTask:r.Z.onUnskipTask,onSubmitDraft:e.onSubmitDraft,onPresignUrlForProject:e.onPresignUrlForProject,onTaskLoad:e.onTaskLoad||r.Z.onTaskLoad,onLabelStudioLoad:e.onLabelStudioLoad||r.Z.onLabelStudioLoad,onEntityCreate:e.onEntityCreate||r.Z.onEntityCreate,onEntityDelete:e.onEntityDelete||r.Z.onEntityDelete,onGroundTruth:e.onGroundTruth||r.Z.onGroundTruth,onSelectAnnotation:e.onSelectAnnotation||r.Z.onSelectAnnotation,onAcceptAnnotation:e.onAcceptAnnotation||r.Z.onAcceptAnnotation,onRejectAnnotation:e.onRejectAnnotation||r.Z.onRejectAnnotation,onStorageInitialized:e.onStorageInitialized||r.Z.onStorageInitialized,onNextTask:e.onNextTask||r.Z.onNextTask,onPrevTask:e.onPrevTask||r.Z.onPrevTask,forceAutoAnnotation:null!==(t=e.forceAutoAnnotation)&&void 0!==t&&t,forceAutoAcceptSuggestions:null!==(n=e.forceAutoAcceptSuggestions)&&void 0!==n&&n}}}},35535:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});const r=(e,t=(e=>void 0!==e?": "+e:""))=>class extends Error{constructor(n){super(e(n)+t(n))}},o=r((()=>"illegal argument(s)")),i=e=>{throw new o(e)},a=r((()=>"illegal state")),l=Math.pow(2,32);class s{constructor(e,t=0,n=e.length<<3){this.buffer=e,this.start=t,this.limit=n,this.seek(t)}*[Symbol.iterator](){let e=this.start,t=e>>>3,n=7-(7&e);for(;e>>n&1,--n<0&&(t++,n=7),e++}get length(){return this.limit}get position(){return this.bitPos}seek(e){return(e=this.limit)&&i(`seek pos out of bounds: ${e}`),this.pos=e>>>3,this.bit=8-(7&e),this.bitPos=e,this}read(e=1){if(e>32)return this.read(e-32)*l+this.read(32);if(e>8){let t=0,n=-8&e,r=e-n;for(r>0&&(t=this._read(r));n>0;)t=(t<<8|this._read(8))>>>0,n-=8;return t}return this._read(e)}readFields(e){return e.map((e=>this.read(e)))}readWords(e,t=8){let n=[];for(;--e>=0;)n.push(this.read(t));return n}readStruct(e){return e.reduce(((e,[t,n])=>(e[t]=this.read(n),e)),{})}readBit(){this.checkLimit(1),this.bit--,this.bitPos++;let e=this.buffer[this.pos]>>>this.bit&1;return 0===this.bit&&(this.pos++,this.bit=8),e}_read(e){this.checkLimit(e);let t,n=this.bit-e;return n>=0?(this.bit=n,t=this.buffer[this.pos]>>>n&(1<>>this.bit),this.bitPos+=e,t}checkLimit(e){this.bitPos+e>this.limit&&(e=>{throw new a(e)})("can't read past EOF")}}const u=Math.pow(2,32);class c{constructor(e,t=0){this.buffer=void 0===e?new Uint8Array(16):"number"==typeof e?new Uint8Array(e):e,this.start=t,this.seek(t),this.buffer[this.pos]&=~((1<=this.buffer.length<<3)&&i(`seek pos out of bounds: ${e}`),this.pos=e>>>3,this.bit=8-(7&e),this.bitPos=e,this}bytes(){return this.buffer.slice(0,this.pos+(7&this.bit?1:0))}reader(e=0){return new s(this.buffer,e,this.position)}write(e,t=1){if(t>32){let n=Math.floor(e/u);this.write(n,t-32),this.write(e-n*u,32)}else if(t>8){let n=-8&t,r=t-n;for(r>0&&this._write(e>>>n,r),n-=8;n>=0;)this._write(e>>>n,8),n-=8}else this._write(e,t);return this}writeWords(e,t=8){let n,r=e[Symbol.iterator]();for(;n=r.next(),!n.done;)this.write(n.value,t)}writeBit(e){return this.bit--,this.buffer[this.pos]=this.buffer[this.pos]&~(1<=0?(a|=(1<>>-i&~a,this.ensureSize(),this.buffer[this.pos]=this.buffer[this.pos]&(1<{(n<1||n>32)&&i("word size (1-32 bits only)");const o=new c(Math.ceil(t*n/8)+4+2+1).write(t,32).write(n-1,5);r.forEach((e=>{(e<1||e>16)&&i("RLE repeat size (1-16 bits only)"),o.write(e-1,4)}));const[a,l,s,u]=r.map((e=>1<{const e=m{const e=d.length-1,t=e0?v():(d.push(h),d.length===u&&y()),h=t):(d.length&&y(),++m===u&&(m--,v(),p=g{const t=new s(e),n=t.read(32),r=t.read(5)+1,o=[0,0,0,0].map((()=>t.read(4)+1)),i=h(r,n);let a,l;for(let e=0;enew(e<9?Uint8Array:e<17?Uint16Array:Uint32Array)(t);var p=n(28670),m=n.n(p),g=n(44116),v=n(39489),y=n(23138);function b(e,t,n,r,o,i){const[a,l,s]=m()(o).rgb(),u=e.getImageData(0,0,n,r),c=new ArrayBuffer(n*r*4),d=new Uint32Array(c),f=new Uint8ClampedArray(c),h=function(){const e=new ArrayBuffer(2),t=new Uint8Array(e),n=new Uint16Array(e);return t[0]=170,t[1]=187,48042===n[0]?"little endian":43707===n[0]?"big endian":(console.error("Can not determine platform endianness, assuming little endian"),"little endian")}();let p,g,v;"little endian"===h?p=255<<24|s<<16|l<<8|a:"big endian"===h?p=a<<24|l<<16|s<<8|255:(console.error(`Unknown platform endianness (${h}), assuming little endian`),p=255<<24|s<<16|l<<8|a);const y=i;for(v=0;v<=r;v++)for(g=0;g<=n;g++){const e=v*n+g;t[e*y]&&(d[e]=p)}u.data.set(f),e.putImageData(u,0,0)}var w={Region2RLE:function(e){var t;if((0,y.pZ)(y.FH))return function(e){const{naturalWidth:t,naturalHeight:n}=e.currentImageEntity,r=document.createElement("canvas");r.width=t,r.height=n,r.style.setProperty("position","absolute"),r.style.setProperty("bottom","200%"),r.style.setProperty("right","200%"),r.style.setProperty("opacity","0");const o=r.getContext("2d");if(document.body.appendChild(r),e.rle&&e.rle.length>0){const r=o.createImageData(t,n);r.data.set(f(e.rle)),o.putImageData(r,0,0)}e.touches.length>0&&e.touches.forEach((e=>{const{relativePoints:r}=e.toJSON(),i=(e,r)=>[t*(e/100),n*(r/100)];o.save(),o.beginPath(),o.moveTo(...i(r[0],r[1]));for(let e=0;e{const o=document.createElement("img");o.onload=()=>{const e=document.createElement("canvas"),r=o.width,i=o.height;e.width=r,e.height=i;const a=e.getContext("2d");a.drawImage(o,0,0);const l=a.getImageData(0,0,r,i);b(a,l.data,r,i,t,4),o.src=e.toDataURL(),n(o)},o.src=e}))},brushSizeCircle:function(e){const t=document.createElement("canvas"),n=t.getContext("2d");return t.width=4*e+8,t.height=4*e+8,n.beginPath(),n.arc(e/2+4,e/2+4,e/2,0,2*Math.PI,!1),n.lineWidth=2,n.strokeStyle="white",n.stroke(),t.toDataURL()},labelToSVG:function(){const e={};return function({label:t,score:n}){let r=t;if(null!==n&&(r+=n),r in e)return e[r];let o=0;const i=[];if(null!=n){const e=v.getScaleGradient(n);i.push(``),i.push(`${n.toFixed(2)}`),o+=26}t&&(i.push(`${t}`),o=o+function(e){const t=document.createElement("svg"),n=document.createElement("text");n.style="font-size: 9.5px; font-weight: bold; color: red; fill: red; font-family: Monaco",n.innerHTML=e,t.appendChild(n),document.body.appendChild(t);const r=n.getBoundingClientRect().width;return t.remove(),r}(t)+2);const a=function(e){const t={level1:"'",level2:'"'},n=(e=(e=(e=(e=function(e){return e.indexOf("http://www.w3.org/2000/svg")<0&&(e=e.replace(/<")).replace(/\s{2,}/g," ")).replace(/[\r\n%#()<>?[\\\]^`{|}]/g,encodeURIComponent);return`${t.level1}data:image/svg+xml,${n}${t.level1}`}(``);return e[r]=a,a}}(),trim:e=>{var t,n;let r,o=e.width,i=e.height;const a=e.getContext("2d"),l={top:null,left:null,right:null,bottom:null};try{r=document.createElement("canvas").getContext("2d");const t=a.getImageData(0,0,e.width,e.height),n=t.data.length;let s,u,c;for(s=0;s+e))}function c(e,t){const n=u(e);let r=.3;return"number"==typeof parseInt(t)&&(r=t),`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${r})`}function d(e,t){if("string"==typeof e){return c(a[e.toLowerCase()],t)}return e}function f(e,t){const n=y(e);return n[3]=Number(t)===t?t:n[3],w(n)}function h(e){let t=0;for(let n=0;n>8*e&255).toString(16)).substr(-2)}return n}function p(e,t){return e.replace(/[\d\.]+\)$/g,`${t})`)}function m(e){return i[Math.ceil(30*e)]}const g=(e,t,n,r,o=[255,255,255,1])=>{const i=[];return i[3]=1-(1-r)*(1-o[3]),i[0]=Math.round(e*r/i[3]+o[0]*o[3]*(1-r)/i[3]),i[1]=Math.round(t*r/i[3]+o[1]*o[3]*(1-r)/i[3]),i[2]=Math.round(n*r/i[3]+o[2]*o[3]*(1-r)/i[3]),i},v=e=>{const[t,n,r]=g(...e.match(/([0-9.]{1,3})/g).map(Number));return(299*t+587*n+114*r)/1e3>=128?"rgb(0,0,0)":"rgb(255,255,255)"};function y(e){if(e){if("#"===e.charAt(0)){const t=u(e);return t.push(1),t}let t;if(t=l.exec(e))return t.slice(1,5).map((e=>+e));if(t=s.exec(e)){const e=t.slice(1,4);return e.push(1),e.map((e=>+e))}if("string"==typeof e){const t=u(a[e.toLowerCase()]);return t.push(1),t}}return[0,0,0,1]}function b(e){const t=e.slice(0,3).map((e=>(256|e).toString(16).slice(1)));return t.unshift("#"),t.join("")}function w(e){return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]})`}function x(e,t="white"){e=o()(e),t=o()(t);const n=e.alpha(),r=t.alpha()*(1-n),i=n+r,a=t.rgb()||[];return o()([...e.rgb().map(((e,t)=>(n*e+r*a[t])/i)),i])}},21416:function(e,t,n){"use strict";n.r(t),n.d(t,{applyHighlightStylesToDoc:function(){return R},createClass:function(){return u},findByXpath:function(){return P},findIdxContainer:function(){return C},findNodeAt:function(){return _},getNodesInRange:function(){return m},getTextNodesInRange:function(){return g},highlightRange:function(){return b},htmlEscape:function(){return j},isValidTreeNode:function(){return p},labelWithCSS:function(){return s},mainOffsets:function(){return S},matchesSelector:function(){return O},moveStylesBetweenHeadTags:function(){return E},normalizeBoundaries:function(){return y},removeSpans:function(){return k},sanitizeHtml:function(){return I},splitBoundaries:function(){return w},toGlobalOffset:function(){return x},toggleLabelsAndScores:function(){return l}});var r=n(11409),o=n.n(r),i=n(13430),a=n(35535);function l(e){const t=t=>{const n=t.getElementsByClassName("htx-highlight");Array.from(n).forEach((t=>{t.classList.contains("htx-manual-label")||(e?t.classList.remove("htx-no-label"):t.classList.add("htx-no-label"))}))};t(document),document.querySelectorAll("iframe.lsf-htx-richtext").forEach((e=>t(e.contentWindow.document)))}const s=function(){const e={};return function(t,{labels:n,score:r}){const o=n?n.join(","):"",l=i.hashCode(o+r);let s="htx-label-"+l;if(s=s.toLowerCase(),s in e)return e[s];t.setAttribute("data-labels",o);return u(`.${s}:after`,`content:${`url(${a.Z.labelToSVG({label:o,score:r})})`}`),e[l]=!0,s}}();function u(e,t){const n=document.createElement("style");n.type="text/css",document.getElementsByTagName("head")[0].appendChild(n),(n.sheet||{}).insertRule?n.sheet.insertRule(e+"{"+t+"}",0):(n.styleSheet||n.sheet).addRule(e,t)}function c(e){return e.nodeType===Node.TEXT_NODE}function d(e){for(;e.hasChildNodes();)e=e.firstChild;return e}function f(e){for(;e.hasChildNodes();)e=e.lastChild;return e}function h(e){if(e.firstChild)return e.firstChild;for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function p(e,t){for(;e;){if(t&&e===t)return!0;if(e.nodeType===Node.ELEMENT_NODE&&"true"===e.dataset.skipNode)return!1;e=e.parentNode}return!0}function m(e){const t=e.startContainer,n=e.endContainer,r=e.commonAncestorContainer,o=[];let i;for(i=t.parentNode;i&&(p(i,r)&&o.push(i),i!==r);i=i.parentNode);for(o.reverse(),i=t;i&&(p(i,r)&&o.push(i),i!==n);i=h(i));return o}function g(e){return m(e).filter((e=>c(e)))}function v(e,t){const n=e.cloneNode(!1);return n.deleteData(0,t),e.deleteData(t,e.length-t),o()(n,e)}function y(e){let t,n,r,{startContainer:o,startOffset:i,endContainer:a,endOffset:l}=e;function s(e){return!!c(e)&&(!(e===o&&i>0)&&(e!==a||0!==l))}for(o.childNodes.length&&i>0&&(o=f(o.childNodes[i-1]),i=o.length||o.childNodes.length),le===r?null:function(e){if(e.firstChild)return e.firstChild;for(;!e.nextSibling;)if(!(e=e.parentNode))return null;return e.nextSibling}(e),r=f(a);t&&!s(t);)t=n(t);const u=t;for(t=a,n=e=>e===r?null:function(e){if(e.lastChild)return e.lastChild;for(;!e.previousSibling;)if(!(e=e.parentNode))return null;return e.previousSibling}(e),r=d(o);t&&!s(t);)t=n(t);const h=t;e.setStart(u,0),e.setEnd(h,h.length)}function b(e,t,n){null==t&&(t="htx-annotation");const r=/^\s*$/,o=g(e._range);let i=0;e._range.startOffset===o[i].length&&i++;let a=o.length;a>1&&o[o.length-1].length!==e._range.endOffset&&(a-=1);const l=[];for(let e=i,s=a;e0&&o0&&r{let r=0;const o=e=>{if(e===t)return r;"#text"===e.nodeName&&(r+=e.length),"BR"===e.nodeName&&(r+=1);for(let t=0;t<=e.childNodes.length;t++){const n=e.childNodes[t];if(n){const e=o(n);if(void 0!==e)return e}}};return n+o(e)},S=e=>{const t=window.getSelection().getRangeAt(0).cloneRange();let n=t.startOffset,r=t.endOffset,o=!1,i=!1;const a=e=>{if("#text"===e.nodeName&&(e===t.startContainer||o||(n+=e.length),e===t.startContainer&&(o=!0),e===t.endContainer||i||(r+=e.length),e===t.endContainer&&(i=!0)),"BR"===e.nodeName&&(o||(n+=1),i||(r+=1)),e.childNodes.length>0)for(let t=0;t<=e.childNodes.length;t++){const n=e.childNodes[t];if(n){const e=a(n);if(e)return e}}};return a(e),{start:n,end:r}},C=(e,t)=>{let n=t;const r=e=>{if(e)if("#text"===e.nodeName){if(n-e.length<=0)return e;n-=e.length}else if("BR"===e.nodeName)n-=1;else if(e.childNodes.length>0)for(let t=0;t<=e.childNodes.length;t++){const n=e.childNodes[t];if(n){const e=r(n);if(e)return e}}};return{node:r(e),len:n}};function k(e){const t=[];e&&e.forEach((e=>{for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);t.push(e.parentNode),e.parentNode.removeChild(e)})),t.forEach((e=>e.normalize()))}function E(e,t){const n={},r=document.createDocumentFragment();for(let t=0;te.matches(t)||null!==e.closest(t),P=(e,t=document)=>(t!==document&&"."!==e[0]&&(e=`.${e}`),document.evaluate(e,t,null,XPathResult.ANY_TYPE,null).iterateNext()),j=e=>{const t=""+e,n=/["'&<>]/.exec(t);if(!n)return t;let r,o="",i=0,a=0;for(i=n.index;i=t){if(!n.firstChild)return[n,t-r];n=n.firstChild}else r+=n.textContent.length,n=n.nextSibling}function I(e,t={}){if(!e)return"";const n=/