Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-accessible-treeview

Package Overview
Dependencies
Maintainers
4
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-accessible-treeview - npm Package Compare versions

Comparing version 2.3.2 to 2.3.3

2

dist/react-accessible-treeview.cjs.js

@@ -1,1 +0,1 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("classnames")),a=e(require("prop-types")),n=require("react"),r=e(n);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==a)return;var n,r,l=[],d=!0,s=!1;try{for(a=a.call(e);!(d=(n=a.next()).done)&&(l.push(n.value),!t||l.length!==t);d=!0);}catch(e){s=!0,r=e}finally{try{d||null==a.return||a.return()}finally{if(s)throw r}}return l}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||i(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a<t;a++)n[a]=e[a];return n}function o(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=i(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,d=!0,s=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return d=e.done,e},e:function(e){s=!0,l=e},f:function(){try{d||null==a.return||a.return()}finally{if(s)throw l}}}}function u(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}var f=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return function(e){var a,n=o(t);try{for(n.s();!(a=n.n()).done;){var r=a.value;if(r&&r(e),e.defaultPrevented)break}}catch(e){n.e(e)}finally{n.f()}}},h=function(e,t){var a,n=new Set,r=o(e);try{for(r.s();!(a=r.n()).done;){var l=a.value;t.has(l)||n.add(l)}}catch(e){r.e(e)}finally{r.f()}return n},p=function(e,t){return new Set([].concat(s(h(e,t)),s(h(t,e))))},v=function(e){var t=n.useRef();return n.useEffect((function(){t.current=e}),[e]),t.current},I=function(e,t){return null!=e[t].children&&e[t].children.length>0},b=function(e,t){return e[t].parent},S=function(e,t,a){var n=[];return function e(t,r){var l=t[r];if(null!=l.children){var d,s=o(l.children.filter((function(e){return!a.has(e)})));try{for(s.s();!(d=s.n()).done;){var i=d.value;n.push(i),e(t,i)}}catch(e){s.e(e)}finally{s.f()}}}(e,t),n},y=function(e,t,a){var n=b(e,t);if(null!=n){var r=e[n],l=r.children.indexOf(t)+a;if(r.children[l])return r.children[l]}return null},m=function(e,t,a){var n=e[t];for(e[0].id===t&&(n=e[e[t].children[e[t].children.length-1]]);a.has(n.id)&&I(e,n.id);)n=e[n.children[n.children.length-1]];return n.id},g=function(e,t,a){if(t===e[0].children[0])return null;var n=y(e,t,-1);return null==n?b(e,t):m(e,n,a)},w=function(e,t,a){var n=e[t].id;if(I(e,n)&&a.has(n))return e[n].children[0];for(;;){var r=y(e,n,1);if(null!=r)return r;if(null==(n=b(e,n)))return null}},E=function(e){var t=e.data,a=e.expandedIds,n=e.from,r=e.to,l=[],d=Object.keys(t).length,s=0,i=n;if(l.push(n),n<r)for(;s<d&&(null!=(i=w(t,i,a))&&l.push(i),null!=i&&i!==r);)s+=1;else if(n>r)for(;s<d&&(null!=(i=g(t,i,a))&&l.push(i),null!=i&&i!==r);)s+=1;return l},O=function(e){var t=e.isSelected,a=e.isDisabled,n=e.multiSelect;return a||n?t:!!t||void 0},x=function(e){var t=e.isSelected,a=e.isDisabled,n=e.isHalfSelected,r=e.multiSelect;return a?t:n?"mixed":r?t:!!t||void 0},W=function(e,t,a){return t.concat.apply(t,s(t.filter((function(t){return I(e,t)})).map((function(t){return S(e,t,a)}))))},A=function(e,t,a){null!=t?window.navigator.userAgent.match(/Trident/)?setTimeout((function(){return!t.contains(document.activeElement)&&a()}),0):!t.contains(e.nativeEvent.relatedTarget)&&a():console.warn("ref not set on <ul>")},j={root:"tree",node:"tree-node",branch:"tree-node__branch",branchWrapper:"tree-branch-wrapper",leafListItem:"tree-leaf-list-item",leaf:"tree-node__leaf",nodeGroup:"tree-node-group"},C="COLLAPSE",D="COLLAPSE_MANY",k="EXPAND",L="EXPAND_MANY",N="HALF_SELECT",U="SELECT",R="DESELECT",T="TOGGLE",F="TOGGLE_SELECT",B="SELECT_MANY",_="EXCLUSIVE_CHANGE_SELECT_MANY",z="FOCUS",K="BLUR",H="DISABLE",P="ENABLE",G=function(e,t){switch(t.type){case C:var a=new Set(e.expandedIds);return a.delete(t.id),Object.assign(Object.assign({},e),{expandedIds:a,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case D:var n,r=new Set(e.expandedIds),l=o(t.ids);try{for(l.s();!(n=l.n()).done;){var d=n.value;r.delete(d)}}catch(e){l.e(e)}finally{l.f()}return Object.assign(Object.assign({},e),{expandedIds:r,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case k:var i=new Set(e.expandedIds);return i.add(t.id),Object.assign(Object.assign({},e),{expandedIds:i,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case L:var c=new Set([].concat(s(e.expandedIds),s(t.ids)));return Object.assign(Object.assign({},e),{expandedIds:c,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case T:var u=new Set(e.expandedIds);return e.expandedIds.has(t.id)?u.delete(t.id):u.add(t.id),Object.assign(Object.assign({},e),{expandedIds:u,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case N:if(e.disabledIds.has(t.id))return e;var f=new Set(e.halfSelectedIds),p=new Set(e.selectedIds);return f.add(t.id),p.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:p,halfSelectedIds:f,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case U:if(!t.controlled&&e.disabledIds.has(t.id))return e;var v;t.multiSelect?(v=new Set(e.selectedIds)).add(t.id):(v=new Set).add(t.id);var I=new Set(e.halfSelectedIds);return I.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:v,halfSelectedIds:I,tabbableId:t.keepFocus?e.tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case R:if(!t.controlled&&e.disabledIds.has(t.id))return e;var b;t.multiSelect?(b=new Set(e.selectedIds)).delete(t.id):b=new Set;var S=new Set(e.halfSelectedIds);return S.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:b,halfSelectedIds:S,tabbableId:t.keepFocus?e.tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case F:if(e.disabledIds.has(t.id))return e;var y,m=e.selectedIds.has(t.id);t.multiSelect?(y=new Set(e.selectedIds),m?y.delete(t.id):y.add(t.id)):(y=new Set,m||y.add(t.id));var g=new Set(e.halfSelectedIds);return g.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:y,halfSelectedIds:g,tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case B:var w,E=t.ids.filter((function(t){return!e.disabledIds.has(t)}));if(t.multiSelect){w=t.select?new Set([].concat(s(e.selectedIds),s(E))):h(e.selectedIds,new Set(E));var O=h(e.halfSelectedIds,w);return Object.assign(Object.assign({},e),{selectedIds:w,halfSelectedIds:O,lastAction:t.type,lastInteractedWith:t.lastInteractedWith})}return e;case _:var x,W=t.ids.filter((function(t){return!e.disabledIds.has(t)}));if(t.multiSelect){x=t.select?new Set(W):h(e.selectedIds,new Set(W));var A=h(e.halfSelectedIds,x);return Object.assign(Object.assign({},e),{selectedIds:x,halfSelectedIds:A,lastAction:t.type,lastInteractedWith:t.lastInteractedWith})}return e;case z:return Object.assign(Object.assign({},e),{tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case K:return Object.assign(Object.assign({},e),{isFocused:!1});case H:var j=new Set(e.disabledIds);return j.add(t.id),Object.assign(Object.assign({},e),{disabledIds:j});case P:var G=new Set(e.disabledIds);return G.delete(t.id),Object.assign(Object.assign({},e),{disabledIds:G});default:throw new Error("Invalid action passed to the reducer")}},M=function(e){var t=e.data,a=e.controlledIds,r=e.controlledExpandedIds,l=e.defaultExpandedIds,i=e.defaultSelectedIds,c=e.defaultDisabledIds,u=e.nodeRefs,f=e.onSelect,y=e.onExpand,m=e.onLoadData,g=e.togglableSelect,w=e.multiSelect,E=e.propagateSelect,O=e.propagateSelectUpwards,x=d(n.useReducer(G,{selectedIds:new Set(a||i),tabbableId:t[0].children[0],isFocused:!1,expandedIds:new Set(r||l),halfSelectedIds:new Set,lastUserSelect:t[0].children[0],lastInteractedWith:null,disabledIds:new Set(c)}),2),A=x[0],j=x[1],F=A.selectedIds,_=A.expandedIds,K=A.disabledIds,H=A.tabbableId,P=A.halfSelectedIds,M=A.lastAction,q=A.lastInteractedWith,X=v(F)||new Set,Y=p(F,X);n.useEffect((function(){if(null!=f&&f!==V){var e,a=o(Y);try{for(a.s();!(e=a.n()).done;){var n=e.value,r=I(t,n)||!!t[H].isBranch;f({element:t[n],isBranch:r,isExpanded:!!r&&_.has(n),isSelected:F.has(n),isDisabled:K.has(n),isHalfSelected:!!r&&P.has(n),treeState:A})}}catch(e){a.e(e)}finally{a.f()}}}),[t,F,_,K,P,Y,f,A]);var $=v(_)||new Set;n.useEffect((function(){var e=p(_,$);if(null!=y&&y!==V){var a,n=o(e);try{for(n.s();!(a=n.n()).done;){var r=a.value;y({element:t[r],isExpanded:_.has(r),isSelected:F.has(r),isDisabled:K.has(r),isHalfSelected:P.has(r),treeState:A})}}catch(e){n.e(e)}finally{n.f()}}}),[t,F,_,K,P,$,y,A]);var J,Q,Z=(J=t,Q=n.useRef(),n.useEffect((function(){Q.current=J})),Q.current||new Set);return n.useEffect((function(){var e=p(_,$);if(m){var a,n=o(e);try{for(n.s();!(a=n.n()).done;){var r=a.value;m({element:t[r],isExpanded:_.has(r),isSelected:F.has(r),isDisabled:K.has(r),isHalfSelected:P.has(r),treeState:A})}}catch(e){n.e(e)}finally{n.f()}if(Z!==t&&g&&E){var l,d=o(_);try{for(d.s();!(l=d.n()).done;){var s=l.value;F.has(s)&&j({type:B,ids:W(t,[s],K),select:!0,multiSelect:w,lastInteractedWith:s})}}catch(e){d.e(e)}finally{d.f()}}}}),[t,F,_,K,P,$,m,A]),n.useEffect((function(){var e=new Set(a),n=h(e,X),r=h(X,e);if(r.size){var l,d=o(r);try{for(d.s();!(l=d.n()).done;){var s=l.value;j({type:R,id:s,multiSelect:w,controlled:!0,lastInteractedWith:s})}}catch(e){d.e(e)}finally{d.f()}}if(n.size){var i,c=o(n);try{for(c.s();!(i=c.n()).done;){var u=i.value;j({type:U,id:u,multiSelect:w,controlled:!0,lastInteractedWith:u}),E&&!K.has(u)&&j({type:B,ids:W(t,[u],K),select:!0,multiSelect:w,lastInteractedWith:u})}}catch(e){c.e(e)}finally{c.f()}}}),[a]),n.useEffect((function(){var e=new Set(r),a=h(e,$),n=h($,e);if(n.size){var l,d=o(n);try{for(d.s();!(l=d.n()).done;){var i=l.value;if(I(t,i)||t[i].isBranch){var c=[i].concat(s(S(t,i,new Set)));j({type:D,ids:c,lastInteractedWith:i})}}}catch(e){d.e(e)}finally{d.f()}}if(a.size){var u,f=o(a);try{for(f.s();!(u=f.n()).done;){var p=u.value;if(I(t,p)||t[p].isBranch){var v=b(t,p);j(v?{type:L,ids:[p,v],lastInteractedWith:p}:{type:k,id:p,lastInteractedWith:p})}}}catch(e){f.e(e)}finally{f.f()}}}),[r]),n.useEffect((function(){if(O&&w){var e=new Set(Y);q&&M!==z&&M!==C&&M!==k&&M!==T&&e.add(q);var a,n=function(e,t,a,n){var r,l={every:new Set,some:new Set,none:new Set},d=o(t);try{for(d.s();!(r=d.n()).done;)for(var s=r.value;;){var i=b(e,s);if(0===i||null==i||null!=i&&n.has(i))break;var c=e[i].children.filter((function(e){return!n.has(e)}));if(0===c.length)break;c.some((function(e){return a.has(e)||l.some.has(e)}))?c.every((function(e){return a.has(e)}))?l.every.add(i):l.some.add(i):l.none.add(i),s=i}}catch(e){d.e(e)}finally{d.f()}return l}(t,e,F,K),r=n.every,l=n.some,d=n.none,s=o(r);try{for(s.s();!(a=s.n()).done;){var i=a.value;F.has(i)||j({type:U,id:i,multiSelect:w,keepFocus:!0,NotUserAction:!0,lastInteractedWith:q})}}catch(e){s.e(e)}finally{s.f()}var c,u=o(l);try{for(u.s();!(c=u.n()).done;){var f=c.value;P.has(f)||j({type:N,id:f,lastInteractedWith:q})}}catch(e){u.e(e)}finally{u.f()}var h,p=o(d);try{for(p.s();!(h=p.n()).done;){var v=h.value;(F.has(v)||P.has(v))&&j({type:R,id:v,multiSelect:w,keepFocus:!0,NotUserAction:!0,lastInteractedWith:q})}}catch(e){p.e(e)}finally{p.f()}}}),[t,w,O,F,_,K,P,M,X,Y,q]),n.useEffect((function(){null!=q&&(null!=H&&null!=(null==u?void 0:u.current)&&function(e){null!=e&&e.focus&&e.focus()}(u.current[H]))}),[H,u,q]),[A,j]},q={select:"SELECT",focus:"FOCUS",exclusiveSelect:"EXCLUSIVE_SELECT"},X=Object.freeze(Object.values(q)),Y=Object.freeze(Object.values({check:"check",select:"select"})),V=function(){},$=r.forwardRef((function(e,a){var l=e.data,s=e.selectedIds,i=e.nodeRenderer,c=e.onSelect,o=void 0===c?V:c,f=e.onExpand,h=void 0===f?V:f,p=e.onLoadData,v=e.className,I=void 0===v?"":v,b=e.multiSelect,S=void 0!==b&&b,y=e.propagateSelect,m=void 0!==y&&y,g=e.propagateSelectUpwards,w=void 0!==g&&g,E=e.propagateCollapse,O=void 0!==E&&E,x=e.expandOnKeyboardSelect,W=void 0!==x&&x,C=e.togglableSelect,D=void 0!==C&&C,k=e.defaultExpandedIds,L=void 0===k?[]:k,N=e.defaultSelectedIds,U=void 0===N?[]:N,R=e.defaultDisabledIds,T=void 0===R?[]:R,F=e.clickAction,B=void 0===F?q.select:F,_=e.nodeAction,z=void 0===_?"select":_,H=e.expandedIds,P=e.onBlur,G=u(e,["data","selectedIds","nodeRenderer","onSelect","onExpand","onLoadData","className","multiSelect","propagateSelect","propagateSelectUpwards","propagateCollapse","expandOnKeyboardSelect","togglableSelect","defaultExpandedIds","defaultSelectedIds","defaultDisabledIds","clickAction","nodeAction","expandedIds","onBlur"]),X=n.useRef({}),Y=d(M({data:l,controlledIds:s,controlledExpandedIds:H,defaultExpandedIds:L,defaultSelectedIds:U,defaultDisabledIds:T,nodeRefs:X,onSelect:o,onExpand:h,onLoadData:p,togglableSelect:D,multiSelect:S,propagateSelect:m,propagateSelectUpwards:w}),2),$=Y[0],Q=Y[1];m=m&&S;var Z=n.useRef(null);return null!=a&&(Z=a),r.createElement("ul",Object.assign({className:t(j.root,I),role:"tree","aria-multiselectable":"select"===z?S:void 0,ref:Z,onBlur:function(e){A(e,Z.current,(function(){P&&P({treeState:$,dispatch:Q}),Q({type:K})}))},onKeyDown:ee({data:l,tabbableId:$.tabbableId,expandedIds:$.expandedIds,selectedIds:$.selectedIds,disabledIds:$.disabledIds,halfSelectedIds:$.halfSelectedIds,dispatch:Q,propagateCollapse:O,propagateSelect:m,multiSelect:S,expandOnKeyboardSelect:W,togglableSelect:D})},G),l[0].children.map((function(e,t){return r.createElement(J,Object.assign({key:e,data:l,element:l[e],setsize:l[0].children.length,posinset:t+1,level:1},$,{state:$,dispatch:Q,nodeRefs:X,baseClassNames:j,nodeRenderer:i,propagateCollapse:O,propagateSelect:m,propagateSelectUpwards:w,multiSelect:S,togglableSelect:D,clickAction:B,nodeAction:z}))})))})),J=function(e){var a=e.element,n=e.dispatch,d=e.data,i=e.selectedIds,c=e.tabbableId,o=e.isFocused,u=e.expandedIds,h=e.disabledIds,p=e.halfSelectedIds,v=e.lastUserSelect,b=e.nodeRefs,y=e.baseClassNames,m=e.nodeRenderer,g=e.nodeAction,w=e.setsize,A=e.posinset,j=e.level,C=e.propagateCollapse,k=e.propagateSelect,L=e.multiSelect,N=e.togglableSelect,R=e.clickAction,K=e.state,H=function(e){if(!(e.ctrlKey||e.altKey||e.shiftKey))if(u.has(a.id)&&C){var t=[a.id].concat(s(S(d,a.id,new Set)));n({type:D,ids:t,lastInteractedWith:a.id})}else n({type:T,id:a.id,lastInteractedWith:a.id})},P=function(){return n({type:z,id:a.id,lastInteractedWith:a.id})},G=function(e){if(e.shiftKey){var t=E({data:d,expandedIds:u,from:v,to:a.id}).filter((function(e){return!h.has(e)}));t=k?W(d,t,h):t,n({type:_,select:!0,multiSelect:L,ids:t,lastInteractedWith:a.id})}else e.ctrlKey||q.select?(n({type:N?F:U,id:a.id,multiSelect:L,lastInteractedWith:a.id}),k&&!h.has(a.id)&&n({type:B,ids:W(d,[a.id],h),select:!N||!i.has(a.id),multiSelect:L,lastInteractedWith:a.id})):R===q.exclusiveSelect?n({type:N?F:U,id:a.id,multiSelect:!1,lastInteractedWith:a.id}):R===q.focus&&n({type:z,id:a.id,lastInteractedWith:a.id})},M=function(e){var n;return t(e,(l(n={},"".concat(e,"--expanded"),u.has(a.id)),l(n,"".concat(e,"--selected"),i.has(a.id)),l(n,"".concat(e,"--focused"),c===a.id&&o),n))},X="select"===g?{"aria-selected":O({isSelected:i.has(a.id),isDisabled:h.has(a.id),multiSelect:L})}:{"aria-checked":x({isSelected:i.has(a.id),isDisabled:h.has(a.id),isHalfSelected:p.has(a.id),multiSelect:L})};return I(d,a.id)||a.isBranch?r.createElement("li",Object.assign({role:"treeitem","aria-expanded":u.has(a.id),"aria-setsize":w,"aria-posinset":A,"aria-level":j,"aria-disabled":h.has(a.id),tabIndex:c===a.id?0:-1,ref:function(e){null!=(null==b?void 0:b.current)&&null!=e&&(b.current[a.id]=e)},className:y.branchWrapper},X),r.createElement(r.Fragment,null,m({element:a,isBranch:!0,isSelected:i.has(a.id),isHalfSelected:p.has(a.id),isExpanded:u.has(a.id),isDisabled:h.has(a.id),dispatch:n,getNodeProps:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=e.onClick;return{onClick:null==a?f(G,H,P):f(a,P),className:t(M(y.node),y.branch)}},setsize:w,posinset:A,level:j,handleSelect:G,handleExpand:H,treeState:K}),r.createElement(Z,Object.assign({getClasses:M},Q(e))))):r.createElement("li",{role:"none",className:M(y.leafListItem)},m({element:a,isBranch:!1,isSelected:i.has(a.id),isHalfSelected:!1,isExpanded:!1,isDisabled:h.has(a.id),dispatch:n,getNodeProps:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.onClick;return Object.assign({role:"treeitem",tabIndex:c===a.id?0:-1,onClick:f(null==n?G:n,P),ref:function(e){null!=(null==b?void 0:b.current)&&(b.current[a.id]=e)},className:t(M(y.node),y.leaf),"aria-setsize":w,"aria-posinset":A,"aria-level":j,disabled:h.has(a.id),"aria-disabled":h.has(a.id)},X)},setsize:w,posinset:A,level:j,handleSelect:G,handleExpand:V,treeState:K}))},Q=function(e){e.setsize,e.posinset;return u(e,["setsize","posinset"])},Z=function(e){var t=e.data,a=e.element,n=e.expandedIds,l=e.getClasses,d=e.baseClassNames,s=e.level,i=u(e,["data","element","expandedIds","getClasses","baseClassNames","level"]);return r.createElement("ul",{role:"group",className:l(d.nodeGroup)},n.has(a.id)&&a.children.length>0&&a.children.map((function(e,l){return r.createElement(J,Object.assign({data:t,expandedIds:n,baseClassNames:d,key:e,element:t[e],setsize:a.children.length,posinset:l+1,level:s+1},i))})))},ee=function(e){var t=e.data,a=e.expandedIds,n=e.selectedIds,r=e.disabledIds,l=e.tabbableId,d=e.dispatch,i=e.propagateCollapse,c=e.propagateSelect,o=e.multiSelect,u=e.expandOnKeyboardSelect,f=e.togglableSelect;return function(e){var h=t[l],p=h.id;if(e.ctrlKey){if("a"===e.key){e.preventDefault();var v=t.filter((function(e){return 0!==e.id})),y=Object.values(v).map((function(e){return e.id})).filter((function(e){return!r.has(e)}));d({type:B,multiSelect:o,select:Array.from(n).filter((function(e){return!r.has(e)})).length!==y.length,ids:y,lastInteractedWith:h.id})}else if(e.shiftKey&&("Home"===e.key||"End"===e.key)){var O="Home"===e.key?t[0].children[0]:m(t,p,a),x=E({data:t,expandedIds:a,from:p,to:O}).filter((function(e){return!r.has(e)}));d({type:B,multiSelect:o,select:!0,ids:c?W(t,x,r):x}),d({type:z,id:O,lastInteractedWith:O})}}else{if(e.shiftKey)switch(e.key){case"ArrowUp":e.preventDefault();var A=g(t,p,a);return void(null==A||r.has(A)||(d({type:B,ids:c?W(t,[A],r):[A],select:!0,multiSelect:o,lastInteractedWith:A}),d({type:z,id:A,lastInteractedWith:A})));case"ArrowDown":e.preventDefault();var j=w(t,p,a);return void(null==j||r.has(j)||(d({type:B,ids:c?W(t,[j],r):[j],multiSelect:o,select:!0,lastInteractedWith:j}),d({type:z,id:j,lastInteractedWith:j})))}switch(e.key){case"ArrowDown":e.preventDefault();var N=w(t,p,a);return void(null!=N&&d({type:z,id:N,lastInteractedWith:N}));case"ArrowUp":e.preventDefault();var R=g(t,p,a);return void(null!=R&&d({type:z,id:R,lastInteractedWith:R}));case"ArrowLeft":if(e.preventDefault(),(I(t,p)||h.isBranch)&&a.has(l))if(i){var _=[p].concat(s(S(t,p,new Set)));d({type:D,ids:_,lastInteractedWith:h.id})}else d({type:C,id:p,lastInteractedWith:p});else if(!t[0].children.includes(p)){var K=b(t,p);if(null==K)throw new Error("parentId of root element is null");d({type:z,id:K,lastInteractedWith:K})}return;case"ArrowRight":return e.preventDefault(),void((I(t,p)||h.isBranch)&&(a.has(l)?d({type:z,id:h.children[0],lastInteractedWith:h.children[0]}):d({type:k,id:p,lastInteractedWith:p})));case"Home":e.preventDefault(),d({type:z,id:t[0].children[0],lastInteractedWith:t[0].children[0]});break;case"End":e.preventDefault();var H=m(t,t[0].id,a);return void d({type:z,id:H,lastInteractedWith:H});case"*":e.preventDefault();var P=b(t,p);if(null==P)throw new Error("parentId of element is null");var G=t[P].children.filter((function(e){return I(t,e)||t[e].isBranch}));return void d({type:L,ids:G,lastInteractedWith:p});case"Enter":case" ":case"Spacebar":return e.preventDefault(),d({type:f?F:U,id:p,multiSelect:o,lastInteractedWith:p}),c&&!r.has(h.id)&&d({type:B,ids:W(t,[p],r),select:!f||!n.has(p),multiSelect:o,lastInteractedWith:p}),void(u&&d({type:T,id:p,lastInteractedWith:p}));default:if(1===e.key.length)for(var M=w(t,p,a);M!==p;)if(null!=M){if(t[M].name[0].toLowerCase()===e.key.toLowerCase())return void d({type:z,id:M,lastInteractedWith:p});M=w(t,M,a)}else M=t[0].children[0];return}}}};$.propTypes={data:a.array.isRequired,onSelect:a.func,onExpand:a.func,className:a.string,nodeRenderer:a.func.isRequired,defaultExpandedIds:a.array,defaultSelectedIds:a.array,expandedIds:a.array,selectedIds:a.array,defaultDisabledIds:a.array,propagateCollapse:a.bool,propagateSelect:a.bool,propagateSelectUpwards:a.bool,multiSelect:a.bool,expandOnKeyboardSelect:a.bool,togglableSelect:a.bool,nodeAction:a.oneOf(Y),clickAction:a.oneOf(X),onBlur:a.func,onLoadData:a.func},exports.CLICK_ACTIONS=X,exports.default=$,exports.flattenTree=function(e){var t=0,a=[];return function e(n,r){var l={id:t,name:n.name,children:[],parent:r};if(a[t]=l,t+=1,null!=n.children&&0!==n.children.length){var d,s=o(n.children);try{for(s.s();!(d=s.n()).done;){e(d.value,l.id)}}catch(e){s.e(e)}finally{s.f()}l.children=a.filter((function(e){return e.parent===l.id})).map((function(e){return e.id}))}}(e,null),a};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("classnames")),a=e(require("prop-types")),n=require("react"),r=e(n);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==a)return;var n,r,l=[],d=!0,i=!1;try{for(a=a.call(e);!(d=(n=a.next()).done)&&(l.push(n.value),!t||l.length!==t);d=!0);}catch(e){i=!0,r=e}finally{try{d||null==a.return||a.return()}finally{if(i)throw r}}return l}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return c(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a<t;a++)n[a]=e[a];return n}function o(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=s(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,d=!0,i=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return d=e.done,e},e:function(e){i=!0,l=e},f:function(){try{d||null==a.return||a.return()}finally{if(i)throw l}}}}function u(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}var f=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return function(e){var a,n=o(t);try{for(n.s();!(a=n.n()).done;){var r=a.value;if(r&&r(e),e.defaultPrevented)break}}catch(e){n.e(e)}finally{n.f()}}},h=function(e,t){var a,n=new Set,r=o(e);try{for(r.s();!(a=r.n()).done;){var l=a.value;t.has(l)||n.add(l)}}catch(e){r.e(e)}finally{r.f()}return n},p=function(e,t){return new Set([].concat(i(h(e,t)),i(h(t,e))))},v=function(e){var t=n.useRef();return n.useEffect((function(){t.current=e}),[e]),t.current},I=function(e,t){return null!=e[t].children&&e[t].children.length>0},b=function(e,t){return e[t].parent},S=function(e,t,a){for(var n=t,r=[];;){var l=b(e,n);if(0===l||null==l||null!=l&&a.has(l))break;r.push(l),n=l}return r},y=function(e,t,a){var n=[];return function e(t,r){var l=t[r];if(null!=l.children){var d,i=o(l.children.filter((function(e){return!a.has(e)})));try{for(i.s();!(d=i.n()).done;){var s=d.value;n.push(s),e(t,s)}}catch(e){i.e(e)}finally{i.f()}}}(e,t),n},m=function(e,t,a){var n=b(e,t);if(null!=n){var r=e[n],l=r.children.indexOf(t)+a;if(r.children[l])return r.children[l]}return null},g=function(e,t,a){var n=e[t];for(e[0].id===t&&(n=e[e[t].children[e[t].children.length-1]]);a.has(n.id)&&I(e,n.id);)n=e[n.children[n.children.length-1]];return n.id},w=function(e,t,a){if(t===e[0].children[0])return null;var n=m(e,t,-1);return null==n?b(e,t):g(e,n,a)},E=function(e,t,a){var n=e[t].id;if(I(e,n)&&a.has(n))return e[n].children[0];for(;;){var r=m(e,n,1);if(null!=r)return r;if(null==(n=b(e,n)))return null}},O=function(e){var t=e.data,a=e.expandedIds,n=e.from,r=e.to,l=[],d=Object.keys(t).length,i=0,s=n;if(l.push(n),n<r)for(;i<d&&(null!=(s=E(t,s,a))&&l.push(s),null!=s&&s!==r);)i+=1;else if(n>r)for(;i<d&&(null!=(s=w(t,s,a))&&l.push(s),null!=s&&s!==r);)i+=1;return l},x=function(e){var t=e.isSelected,a=e.isDisabled,n=e.multiSelect;return a||n?t:!!t||void 0},W=function(e){var t=e.isSelected,a=e.isDisabled,n=e.isHalfSelected,r=e.multiSelect;return a?t:n?"mixed":r?t:!!t||void 0},A=function(e,t,a){return t.concat.apply(t,i(t.filter((function(t){return I(e,t)})).map((function(t){return y(e,t,a)}))))},j=function(e,t,a){null!=t?window.navigator.userAgent.match(/Trident/)?setTimeout((function(){return!t.contains(document.activeElement)&&a()}),0):!t.contains(e.nativeEvent.relatedTarget)&&a():console.warn("ref not set on <ul>")},C=function(e,t,a){return I(e,t)&&a.has(t)&&y(e,t,new Set).some((function(e){return a.has(e)}))},D={root:"tree",node:"tree-node",branch:"tree-node__branch",branchWrapper:"tree-branch-wrapper",leafListItem:"tree-leaf-list-item",leaf:"tree-node__leaf",nodeGroup:"tree-node-group"},k="COLLAPSE",L="COLLAPSE_MANY",N="EXPAND",U="EXPAND_MANY",R="HALF_SELECT",T="SELECT",F="DESELECT",B="TOGGLE",_="TOGGLE_SELECT",z="SELECT_MANY",K="EXCLUSIVE_CHANGE_SELECT_MANY",H="FOCUS",P="BLUR",G="DISABLE",M="ENABLE",q=function(e,t){switch(t.type){case k:var a=new Set(e.expandedIds);return a.delete(t.id),Object.assign(Object.assign({},e),{expandedIds:a,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case L:var n,r=new Set(e.expandedIds),l=o(t.ids);try{for(l.s();!(n=l.n()).done;){var d=n.value;r.delete(d)}}catch(e){l.e(e)}finally{l.f()}return Object.assign(Object.assign({},e),{expandedIds:r,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case N:var s=new Set(e.expandedIds);return s.add(t.id),Object.assign(Object.assign({},e),{expandedIds:s,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case U:var c=new Set([].concat(i(e.expandedIds),i(t.ids)));return Object.assign(Object.assign({},e),{expandedIds:c,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case B:var u=new Set(e.expandedIds);return e.expandedIds.has(t.id)?u.delete(t.id):u.add(t.id),Object.assign(Object.assign({},e),{expandedIds:u,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case R:if(e.disabledIds.has(t.id))return e;var f=new Set(e.halfSelectedIds),p=new Set(e.selectedIds);return f.add(t.id),p.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:p,halfSelectedIds:f,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case T:if(!t.controlled&&e.disabledIds.has(t.id))return e;var v;t.multiSelect?(v=new Set(e.selectedIds)).add(t.id):(v=new Set).add(t.id);var I=new Set(e.halfSelectedIds);return I.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:v,halfSelectedIds:I,tabbableId:t.keepFocus?e.tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case F:if(!t.controlled&&e.disabledIds.has(t.id))return e;var b,S=new Set(e.selectedIds);return S.delete(t.id),t.multiSelect?(b=new Set(e.halfSelectedIds)).delete(t.id):b=new Set,Object.assign(Object.assign({},e),{selectedIds:S,halfSelectedIds:b,tabbableId:t.keepFocus?e.tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case _:if(e.disabledIds.has(t.id))return e;var y,m=e.selectedIds.has(t.id);t.multiSelect?(y=new Set(e.selectedIds),m?y.delete(t.id):y.add(t.id)):(y=new Set,m||y.add(t.id));var g=new Set(e.halfSelectedIds);return g.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:y,halfSelectedIds:g,tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case z:var w,E=t.ids.filter((function(t){return!e.disabledIds.has(t)}));if(t.multiSelect){w=t.select?new Set([].concat(i(e.selectedIds),i(E))):h(e.selectedIds,new Set(E));var O=h(e.halfSelectedIds,w);return Object.assign(Object.assign({},e),{selectedIds:w,halfSelectedIds:O,lastAction:t.type,lastInteractedWith:t.lastInteractedWith})}return e;case K:var x,W=t.ids.filter((function(t){return!e.disabledIds.has(t)}));if(t.multiSelect){x=t.select?new Set(W):h(e.selectedIds,new Set(W));var A=h(e.halfSelectedIds,x);return Object.assign(Object.assign({},e),{selectedIds:x,halfSelectedIds:A,lastAction:t.type,lastInteractedWith:t.lastInteractedWith})}return e;case H:return Object.assign(Object.assign({},e),{tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case P:return Object.assign(Object.assign({},e),{isFocused:!1});case G:var j=new Set(e.disabledIds);return j.add(t.id),Object.assign(Object.assign({},e),{disabledIds:j});case M:var C=new Set(e.disabledIds);return C.delete(t.id),Object.assign(Object.assign({},e),{disabledIds:C});default:throw new Error("Invalid action passed to the reducer")}},X=function(e){var t=e.data,a=e.controlledIds,r=e.controlledExpandedIds,l=e.defaultExpandedIds,s=e.defaultSelectedIds,c=e.defaultDisabledIds,u=e.nodeRefs,f=e.onSelect,m=e.onExpand,g=e.onLoadData,w=e.togglableSelect,E=e.multiSelect,O=e.propagateSelect,x=e.propagateSelectUpwards,W=d(n.useReducer(q,{selectedIds:new Set(a||s),tabbableId:t[0].children[0],isFocused:!1,expandedIds:new Set(r||l),halfSelectedIds:new Set,lastUserSelect:t[0].children[0],lastInteractedWith:null,disabledIds:new Set(c)}),2),j=W[0],C=W[1],D=j.selectedIds,_=j.expandedIds,K=j.disabledIds,P=j.tabbableId,G=j.halfSelectedIds,M=j.lastAction,X=j.lastInteractedWith,Y=v(D)||new Set,V=p(D,Y);n.useEffect((function(){if(null!=f&&f!==J){var e,a=o(V);try{for(a.s();!(e=a.n()).done;){var n=e.value,r=I(t,n)||!!t[P].isBranch;f({element:t[n],isBranch:r,isExpanded:!!r&&_.has(n),isSelected:D.has(n),isDisabled:K.has(n),isHalfSelected:!!r&&G.has(n),treeState:j})}}catch(e){a.e(e)}finally{a.f()}}}),[t,D,_,K,G,V,f,j]);var $=v(_)||new Set;n.useEffect((function(){var e=p(_,$);if(null!=m&&m!==J){var a,n=o(e);try{for(n.s();!(a=n.n()).done;){var r=a.value;m({element:t[r],isExpanded:_.has(r),isSelected:D.has(r),isDisabled:K.has(r),isHalfSelected:G.has(r),treeState:j})}}catch(e){n.e(e)}finally{n.f()}}}),[t,D,_,K,G,$,m,j]);var Q,Z,ee=(Q=t,Z=n.useRef(),n.useEffect((function(){Z.current=Q})),Z.current||new Set);return n.useEffect((function(){var e=p(_,$);if(g){var a,n=o(e);try{for(n.s();!(a=n.n()).done;){var r=a.value;g({element:t[r],isExpanded:_.has(r),isSelected:D.has(r),isDisabled:K.has(r),isHalfSelected:G.has(r),treeState:j})}}catch(e){n.e(e)}finally{n.f()}if(ee!==t&&w&&O){var l,d=o(_);try{for(d.s();!(l=d.n()).done;){var i=l.value;D.has(i)&&C({type:z,ids:A(t,[i],K),select:!0,multiSelect:E,lastInteractedWith:i})}}catch(e){d.e(e)}finally{d.f()}}}}),[t,D,_,K,G,$,g,j]),n.useEffect((function(){var e=new Set(a),n=h(e,Y),r=h(Y,e);if(r.size){var l,d=o(r);try{for(d.s();!(l=d.n()).done;){var i=l.value;C({type:F,id:i,multiSelect:E,controlled:!0,lastInteractedWith:i})}}catch(e){d.e(e)}finally{d.f()}}if(n.size){var s,c=o(n);try{for(c.s();!(s=c.n()).done;){var u=s.value;C({type:T,id:u,multiSelect:E,controlled:!0,lastInteractedWith:u}),O&&!K.has(u)&&C({type:z,ids:A(t,[u],K),select:!0,multiSelect:E,lastInteractedWith:u})}}catch(e){c.e(e)}finally{c.f()}}}),[a]),n.useEffect((function(){var e=new Set(r),a=h(e,$),n=h($,e);if(n.size){var l,d=o(n);try{for(d.s();!(l=d.n()).done;){var s=l.value;if(I(t,s)||t[s].isBranch){var c=[s].concat(i(y(t,s,new Set)));C({type:L,ids:c,lastInteractedWith:s})}}}catch(e){d.e(e)}finally{d.f()}}if(a.size){var u,f=o(a);try{for(f.s();!(u=f.n()).done;){var p=u.value;if(I(t,p)||t[p].isBranch){var v=b(t,p);C(v?{type:U,ids:[p,v],lastInteractedWith:p}:{type:N,id:p,lastInteractedWith:p})}}}catch(e){f.e(e)}finally{f.f()}}}),[r]),n.useEffect((function(){if(x){var e=new Set(V);X&&M!==H&&M!==k&&M!==N&&M!==B&&e.add(X);var a,n=function(e,t,a,n,r,l){var d,i={every:new Set,some:new Set,none:new Set},s=o(t);try{for(s.s();!(d=s.n()).done;)for(var c=d.value;;){var u=b(e,c);if(0===u||null==u||null!=u&&n.has(u))break;var f=e[u].children.filter((function(e){return!n.has(e)}));if(0===f.length)break;if(f.some((function(e){return a.has(e)||i.some.has(e)||r.has(e)})))f.every((function(e){return a.has(e)}))?i.every.add(u):i.some.add(u);else{var h=S(e,c,n).find((function(e){return a.has(e)}));if(!l&&h){y(e,h,n).forEach((function(e){r.has(e)&&i.none.add(e)}));break}i.none.add(u)}c=u}}catch(e){s.e(e)}finally{s.f()}return i}(t,e,D,K,G,E),r=n.every,l=n.some,d=n.none,i=o(r);try{for(i.s();!(a=i.n()).done;){var s=a.value;D.has(s)||C({type:T,id:s,multiSelect:E,keepFocus:!0,NotUserAction:!0,lastInteractedWith:X})}}catch(e){i.e(e)}finally{i.f()}var c,u=o(l);try{for(u.s();!(c=u.n()).done;){var f=c.value;G.has(f)||C({type:R,id:f,lastInteractedWith:X})}}catch(e){u.e(e)}finally{u.f()}var h,p=o(d);try{for(p.s();!(h=p.n()).done;){var v=h.value;(D.has(v)||G.has(v))&&C({type:F,id:v,multiSelect:E,keepFocus:!0,NotUserAction:!0,lastInteractedWith:X})}}catch(e){p.e(e)}finally{p.f()}}}),[t,E,x,D,_,K,G,M,Y,V,X]),n.useEffect((function(){null!=X&&(null!=P&&null!=(null==u?void 0:u.current)&&function(e){null!=e&&e.focus&&e.focus()}(u.current[P]))}),[P,u,X]),[j,C]},Y={select:"SELECT",focus:"FOCUS",exclusiveSelect:"EXCLUSIVE_SELECT"},V=Object.freeze(Object.values(Y)),$=Object.freeze(Object.values({check:"check",select:"select"})),J=function(){},Q=r.forwardRef((function(e,a){var l=e.data,i=e.selectedIds,s=e.nodeRenderer,c=e.onSelect,o=void 0===c?J:c,f=e.onExpand,h=void 0===f?J:f,p=e.onLoadData,v=e.className,I=void 0===v?"":v,b=e.multiSelect,S=void 0!==b&&b,y=e.propagateSelect,m=void 0!==y&&y,g=e.propagateSelectUpwards,w=void 0!==g&&g,E=e.propagateCollapse,O=void 0!==E&&E,x=e.expandOnKeyboardSelect,W=void 0!==x&&x,A=e.togglableSelect,C=void 0!==A&&A,k=e.defaultExpandedIds,L=void 0===k?[]:k,N=e.defaultSelectedIds,U=void 0===N?[]:N,R=e.defaultDisabledIds,T=void 0===R?[]:R,F=e.clickAction,B=void 0===F?Y.select:F,_=e.nodeAction,z=void 0===_?"select":_,K=e.expandedIds,H=e.onBlur,G=u(e,["data","selectedIds","nodeRenderer","onSelect","onExpand","onLoadData","className","multiSelect","propagateSelect","propagateSelectUpwards","propagateCollapse","expandOnKeyboardSelect","togglableSelect","defaultExpandedIds","defaultSelectedIds","defaultDisabledIds","clickAction","nodeAction","expandedIds","onBlur"]),M=n.useRef({}),q=d(X({data:l,controlledIds:i,controlledExpandedIds:K,defaultExpandedIds:L,defaultSelectedIds:U,defaultDisabledIds:T,nodeRefs:M,onSelect:o,onExpand:h,onLoadData:p,togglableSelect:C,multiSelect:S,propagateSelect:m,propagateSelectUpwards:w}),2),V=q[0],$=q[1];m=m&&S;var Q=n.useRef(null);return null!=a&&(Q=a),r.createElement("ul",Object.assign({className:t(D.root,I),role:"tree","aria-multiselectable":"select"===z?S:void 0,ref:Q,onBlur:function(e){j(e,Q.current,(function(){H&&H({treeState:V,dispatch:$}),$({type:P})}))},onKeyDown:ae({data:l,tabbableId:V.tabbableId,expandedIds:V.expandedIds,selectedIds:V.selectedIds,disabledIds:V.disabledIds,halfSelectedIds:V.halfSelectedIds,dispatch:$,propagateCollapse:O,propagateSelect:m,multiSelect:S,expandOnKeyboardSelect:W,togglableSelect:C})},G),l[0].children.map((function(e,t){return r.createElement(Z,Object.assign({key:e,data:l,element:l[e],setsize:l[0].children.length,posinset:t+1,level:1},V,{state:V,dispatch:$,nodeRefs:M,baseClassNames:D,nodeRenderer:s,propagateCollapse:O,propagateSelect:m,propagateSelectUpwards:w,multiSelect:S,togglableSelect:C,clickAction:B,nodeAction:z}))})))})),Z=function(e){var a=e.element,n=e.dispatch,d=e.data,s=e.selectedIds,c=e.tabbableId,o=e.isFocused,u=e.expandedIds,h=e.disabledIds,p=e.halfSelectedIds,v=e.lastUserSelect,b=e.nodeRefs,S=e.baseClassNames,m=e.nodeRenderer,g=e.nodeAction,w=e.setsize,E=e.posinset,j=e.level,D=e.propagateCollapse,k=e.propagateSelect,N=e.multiSelect,U=e.togglableSelect,F=e.clickAction,P=e.state,G=function(e){if(!(e.ctrlKey||e.altKey||e.shiftKey))if(u.has(a.id)&&D){var t=[a.id].concat(i(y(d,a.id,new Set)));n({type:L,ids:t,lastInteractedWith:a.id})}else n({type:B,id:a.id,lastInteractedWith:a.id})},M=function(){return n({type:H,id:a.id,lastInteractedWith:a.id})},q=function(e){if(e.shiftKey){var t=O({data:d,expandedIds:u,from:v,to:a.id}).filter((function(e){return!h.has(e)}));t=k?A(d,t,h):t,n({type:K,select:!0,multiSelect:N,ids:t,lastInteractedWith:a.id})}else if(e.ctrlKey||Y.select){var r=C(d,a.id,s);n({type:U?r?R:_:T,id:a.id,multiSelect:N,lastInteractedWith:a.id}),k&&!h.has(a.id)&&n({type:z,ids:A(d,[a.id],h),select:!U||!s.has(a.id),multiSelect:N,lastInteractedWith:a.id})}else F===Y.exclusiveSelect?n({type:U?_:T,id:a.id,multiSelect:!1,lastInteractedWith:a.id}):F===Y.focus&&n({type:H,id:a.id,lastInteractedWith:a.id})},X=function(e){var n;return t(e,(l(n={},"".concat(e,"--expanded"),u.has(a.id)),l(n,"".concat(e,"--selected"),s.has(a.id)),l(n,"".concat(e,"--focused"),c===a.id&&o),n))},V="select"===g?{"aria-selected":x({isSelected:s.has(a.id),isDisabled:h.has(a.id),multiSelect:N})}:{"aria-checked":W({isSelected:s.has(a.id),isDisabled:h.has(a.id),isHalfSelected:p.has(a.id),multiSelect:N})};return I(d,a.id)||a.isBranch?r.createElement("li",Object.assign({role:"treeitem","aria-expanded":u.has(a.id),"aria-setsize":w,"aria-posinset":E,"aria-level":j,"aria-disabled":h.has(a.id),tabIndex:c===a.id?0:-1,ref:function(e){null!=(null==b?void 0:b.current)&&null!=e&&(b.current[a.id]=e)},className:S.branchWrapper},V),r.createElement(r.Fragment,null,m({element:a,isBranch:!0,isSelected:s.has(a.id),isHalfSelected:p.has(a.id),isExpanded:u.has(a.id),isDisabled:h.has(a.id),dispatch:n,getNodeProps:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=e.onClick;return{onClick:null==a?f(q,G,M):f(a,M),className:t(X(S.node),S.branch)}},setsize:w,posinset:E,level:j,handleSelect:q,handleExpand:G,treeState:P}),r.createElement(te,Object.assign({getClasses:X},ee(e))))):r.createElement("li",{role:"none",className:X(S.leafListItem)},m({element:a,isBranch:!1,isSelected:s.has(a.id),isHalfSelected:!1,isExpanded:!1,isDisabled:h.has(a.id),dispatch:n,getNodeProps:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.onClick;return Object.assign({role:"treeitem",tabIndex:c===a.id?0:-1,onClick:f(null==n?q:n,M),ref:function(e){null!=(null==b?void 0:b.current)&&(b.current[a.id]=e)},className:t(X(S.node),S.leaf),"aria-setsize":w,"aria-posinset":E,"aria-level":j,disabled:h.has(a.id),"aria-disabled":h.has(a.id)},V)},setsize:w,posinset:E,level:j,handleSelect:q,handleExpand:J,treeState:P}))},ee=function(e){e.setsize,e.posinset;return u(e,["setsize","posinset"])},te=function(e){var t=e.data,a=e.element,n=e.expandedIds,l=e.getClasses,d=e.baseClassNames,i=e.level,s=u(e,["data","element","expandedIds","getClasses","baseClassNames","level"]);return r.createElement("ul",{role:"group",className:l(d.nodeGroup)},n.has(a.id)&&a.children.length>0&&a.children.map((function(e,l){return r.createElement(Z,Object.assign({data:t,expandedIds:n,baseClassNames:d,key:e,element:t[e],setsize:a.children.length,posinset:l+1,level:i+1},s))})))},ae=function(e){var t=e.data,a=e.expandedIds,n=e.selectedIds,r=e.disabledIds,l=e.tabbableId,d=e.dispatch,s=e.propagateCollapse,c=e.propagateSelect,o=e.multiSelect,u=e.expandOnKeyboardSelect,f=e.togglableSelect;return function(e){var h=t[l],p=h.id;if(e.ctrlKey){if("a"===e.key){e.preventDefault();var v=t.filter((function(e){return 0!==e.id})),S=Object.values(v).map((function(e){return e.id})).filter((function(e){return!r.has(e)}));d({type:z,multiSelect:o,select:Array.from(n).filter((function(e){return!r.has(e)})).length!==S.length,ids:S,lastInteractedWith:h.id})}else if(e.shiftKey&&("Home"===e.key||"End"===e.key)){var m="Home"===e.key?t[0].children[0]:g(t,p,a),x=O({data:t,expandedIds:a,from:p,to:m}).filter((function(e){return!r.has(e)}));d({type:z,multiSelect:o,select:!0,ids:c?A(t,x,r):x}),d({type:H,id:m,lastInteractedWith:m})}}else{if(e.shiftKey)switch(e.key){case"ArrowUp":e.preventDefault();var W=w(t,p,a);return void(null==W||r.has(W)||(d({type:z,ids:c?A(t,[W],r):[W],select:!0,multiSelect:o,lastInteractedWith:W}),d({type:H,id:W,lastInteractedWith:W})));case"ArrowDown":e.preventDefault();var j=E(t,p,a);return void(null==j||r.has(j)||(d({type:z,ids:c?A(t,[j],r):[j],multiSelect:o,select:!0,lastInteractedWith:j}),d({type:H,id:j,lastInteractedWith:j})))}switch(e.key){case"ArrowDown":e.preventDefault();var D=E(t,p,a);return void(null!=D&&d({type:H,id:D,lastInteractedWith:D}));case"ArrowUp":e.preventDefault();var F=w(t,p,a);return void(null!=F&&d({type:H,id:F,lastInteractedWith:F}));case"ArrowLeft":if(e.preventDefault(),(I(t,p)||h.isBranch)&&a.has(l))if(s){var K=[p].concat(i(y(t,p,new Set)));d({type:L,ids:K,lastInteractedWith:h.id})}else d({type:k,id:p,lastInteractedWith:p});else if(!t[0].children.includes(p)){var P=b(t,p);if(null==P)throw new Error("parentId of root element is null");d({type:H,id:P,lastInteractedWith:P})}return;case"ArrowRight":return e.preventDefault(),void((I(t,p)||h.isBranch)&&(a.has(l)?d({type:H,id:h.children[0],lastInteractedWith:h.children[0]}):d({type:N,id:p,lastInteractedWith:p})));case"Home":e.preventDefault(),d({type:H,id:t[0].children[0],lastInteractedWith:t[0].children[0]});break;case"End":e.preventDefault();var G=g(t,t[0].id,a);return void d({type:H,id:G,lastInteractedWith:G});case"*":e.preventDefault();var M=b(t,p);if(null==M)throw new Error("parentId of element is null");var q=t[M].children.filter((function(e){return I(t,e)||t[e].isBranch}));return void d({type:U,ids:q,lastInteractedWith:p});case"Enter":case" ":case"Spacebar":e.preventDefault();var X=C(t,h.id,n);return d({type:f?X?R:_:T,id:p,multiSelect:o,lastInteractedWith:p}),c&&!r.has(h.id)&&d({type:z,ids:A(t,[p],r),select:!f||!n.has(p),multiSelect:o,lastInteractedWith:p}),void(u&&d({type:B,id:p,lastInteractedWith:p}));default:if(1===e.key.length)for(var Y=E(t,p,a);Y!==p;)if(null!=Y){if(t[Y].name[0].toLowerCase()===e.key.toLowerCase())return void d({type:H,id:Y,lastInteractedWith:p});Y=E(t,Y,a)}else Y=t[0].children[0];return}}}};Q.propTypes={data:a.array.isRequired,onSelect:a.func,onExpand:a.func,className:a.string,nodeRenderer:a.func.isRequired,defaultExpandedIds:a.array,defaultSelectedIds:a.array,expandedIds:a.array,selectedIds:a.array,defaultDisabledIds:a.array,propagateCollapse:a.bool,propagateSelect:a.bool,propagateSelectUpwards:a.bool,multiSelect:a.bool,expandOnKeyboardSelect:a.bool,togglableSelect:a.bool,nodeAction:a.oneOf($),clickAction:a.oneOf(V),onBlur:a.func,onLoadData:a.func},exports.CLICK_ACTIONS=V,exports.default=Q,exports.flattenTree=function(e){var t=0,a=[];return function e(n,r){var l={id:t,name:n.name,children:[],parent:r};if(a[t]=l,t+=1,null!=n.children&&0!==n.children.length){var d,i=o(n.children);try{for(i.s();!(d=i.n()).done;){e(d.value,l.id)}}catch(e){i.e(e)}finally{i.f()}l.children=a.filter((function(e){return e.parent===l.id})).map((function(e){return e.id}))}}(e,null),a};

@@ -1,1 +0,1 @@

import e from"classnames";import t from"prop-types";import a,{useRef as n,useEffect as r,useReducer as l}from"react";function d(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==a)return;var n,r,l=[],d=!0,i=!1;try{for(a=a.call(e);!(d=(n=a.next()).done)&&(l.push(n.value),!t||l.length!==t);d=!0);}catch(e){i=!0,r=e}finally{try{d||null==a.return||a.return()}finally{if(i)throw r}}return l}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return o(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a<t;a++)n[a]=e[a];return n}function u(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=c(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,d=!0,i=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return d=e.done,e},e:function(e){i=!0,l=e},f:function(){try{d||null==a.return||a.return()}finally{if(i)throw l}}}}function f(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}var h=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return function(e){var a,n=u(t);try{for(n.s();!(a=n.n()).done;){var r=a.value;if(r&&r(e),e.defaultPrevented)break}}catch(e){n.e(e)}finally{n.f()}}},p=function(e,t){var a,n=new Set,r=u(e);try{for(r.s();!(a=r.n()).done;){var l=a.value;t.has(l)||n.add(l)}}catch(e){r.e(e)}finally{r.f()}return n},v=function(e,t){return new Set([].concat(s(p(e,t)),s(p(t,e))))},I=function(e){var t=n();return r((function(){t.current=e}),[e]),t.current},b=function(e,t){return null!=e[t].children&&e[t].children.length>0},S=function(e,t){return e[t].parent},y=function(e,t,a){var n=[];return function e(t,r){var l=t[r];if(null!=l.children){var d,i=u(l.children.filter((function(e){return!a.has(e)})));try{for(i.s();!(d=i.n()).done;){var s=d.value;n.push(s),e(t,s)}}catch(e){i.e(e)}finally{i.f()}}}(e,t),n},m=function(e,t,a){var n=S(e,t);if(null!=n){var r=e[n],l=r.children.indexOf(t)+a;if(r.children[l])return r.children[l]}return null},g=function(e,t,a){var n=e[t];for(e[0].id===t&&(n=e[e[t].children[e[t].children.length-1]]);a.has(n.id)&&b(e,n.id);)n=e[n.children[n.children.length-1]];return n.id},w=function(e,t,a){if(t===e[0].children[0])return null;var n=m(e,t,-1);return null==n?S(e,t):g(e,n,a)},E=function(e,t,a){var n=e[t].id;if(b(e,n)&&a.has(n))return e[n].children[0];for(;;){var r=m(e,n,1);if(null!=r)return r;if(null==(n=S(e,n)))return null}},O=function(e){var t=e.data,a=e.expandedIds,n=e.from,r=e.to,l=[],d=Object.keys(t).length,i=0,s=n;if(l.push(n),n<r)for(;i<d&&(null!=(s=E(t,s,a))&&l.push(s),null!=s&&s!==r);)i+=1;else if(n>r)for(;i<d&&(null!=(s=w(t,s,a))&&l.push(s),null!=s&&s!==r);)i+=1;return l},W=function(e){var t=0,a=[];return function e(n,r){var l={id:t,name:n.name,children:[],parent:r};if(a[t]=l,t+=1,null!=n.children&&0!==n.children.length){var d,i=u(n.children);try{for(i.s();!(d=i.n()).done;){e(d.value,l.id)}}catch(e){i.e(e)}finally{i.f()}l.children=a.filter((function(e){return e.parent===l.id})).map((function(e){return e.id}))}}(e,null),a},x=function(e){var t=e.isSelected,a=e.isDisabled,n=e.multiSelect;return a||n?t:!!t||void 0},A=function(e){var t=e.isSelected,a=e.isDisabled,n=e.isHalfSelected,r=e.multiSelect;return a?t:n?"mixed":r?t:!!t||void 0},j=function(e,t,a){return t.concat.apply(t,s(t.filter((function(t){return b(e,t)})).map((function(t){return y(e,t,a)}))))},C=function(e,t,a){null!=t?window.navigator.userAgent.match(/Trident/)?setTimeout((function(){return!t.contains(document.activeElement)&&a()}),0):!t.contains(e.nativeEvent.relatedTarget)&&a():console.warn("ref not set on <ul>")},D={root:"tree",node:"tree-node",branch:"tree-node__branch",branchWrapper:"tree-branch-wrapper",leafListItem:"tree-leaf-list-item",leaf:"tree-node__leaf",nodeGroup:"tree-node-group"},k="COLLAPSE",L="COLLAPSE_MANY",N="EXPAND",U="EXPAND_MANY",F="HALF_SELECT",B="SELECT",T="DESELECT",z="TOGGLE",K="TOGGLE_SELECT",R="SELECT_MANY",_="EXCLUSIVE_CHANGE_SELECT_MANY",H="FOCUS",P="BLUR",G="DISABLE",M="ENABLE",X=function(e,t){switch(t.type){case k:var a=new Set(e.expandedIds);return a.delete(t.id),Object.assign(Object.assign({},e),{expandedIds:a,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case L:var n,r=new Set(e.expandedIds),l=u(t.ids);try{for(l.s();!(n=l.n()).done;){var d=n.value;r.delete(d)}}catch(e){l.e(e)}finally{l.f()}return Object.assign(Object.assign({},e),{expandedIds:r,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case N:var i=new Set(e.expandedIds);return i.add(t.id),Object.assign(Object.assign({},e),{expandedIds:i,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case U:var c=new Set([].concat(s(e.expandedIds),s(t.ids)));return Object.assign(Object.assign({},e),{expandedIds:c,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case z:var o=new Set(e.expandedIds);return e.expandedIds.has(t.id)?o.delete(t.id):o.add(t.id),Object.assign(Object.assign({},e),{expandedIds:o,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case F:if(e.disabledIds.has(t.id))return e;var f=new Set(e.halfSelectedIds),h=new Set(e.selectedIds);return f.add(t.id),h.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:h,halfSelectedIds:f,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case B:if(!t.controlled&&e.disabledIds.has(t.id))return e;var v;t.multiSelect?(v=new Set(e.selectedIds)).add(t.id):(v=new Set).add(t.id);var I=new Set(e.halfSelectedIds);return I.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:v,halfSelectedIds:I,tabbableId:t.keepFocus?e.tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case T:if(!t.controlled&&e.disabledIds.has(t.id))return e;var b;t.multiSelect?(b=new Set(e.selectedIds)).delete(t.id):b=new Set;var S=new Set(e.halfSelectedIds);return S.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:b,halfSelectedIds:S,tabbableId:t.keepFocus?e.tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case K:if(e.disabledIds.has(t.id))return e;var y,m=e.selectedIds.has(t.id);t.multiSelect?(y=new Set(e.selectedIds),m?y.delete(t.id):y.add(t.id)):(y=new Set,m||y.add(t.id));var g=new Set(e.halfSelectedIds);return g.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:y,halfSelectedIds:g,tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case R:var w,E=t.ids.filter((function(t){return!e.disabledIds.has(t)}));if(t.multiSelect){w=t.select?new Set([].concat(s(e.selectedIds),s(E))):p(e.selectedIds,new Set(E));var O=p(e.halfSelectedIds,w);return Object.assign(Object.assign({},e),{selectedIds:w,halfSelectedIds:O,lastAction:t.type,lastInteractedWith:t.lastInteractedWith})}return e;case _:var W,x=t.ids.filter((function(t){return!e.disabledIds.has(t)}));if(t.multiSelect){W=t.select?new Set(x):p(e.selectedIds,new Set(x));var A=p(e.halfSelectedIds,W);return Object.assign(Object.assign({},e),{selectedIds:W,halfSelectedIds:A,lastAction:t.type,lastInteractedWith:t.lastInteractedWith})}return e;case H:return Object.assign(Object.assign({},e),{tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case P:return Object.assign(Object.assign({},e),{isFocused:!1});case G:var j=new Set(e.disabledIds);return j.add(t.id),Object.assign(Object.assign({},e),{disabledIds:j});case M:var C=new Set(e.disabledIds);return C.delete(t.id),Object.assign(Object.assign({},e),{disabledIds:C});default:throw new Error("Invalid action passed to the reducer")}},Y=function(e){var t=e.data,a=e.controlledIds,d=e.controlledExpandedIds,c=e.defaultExpandedIds,o=e.defaultSelectedIds,f=e.defaultDisabledIds,h=e.nodeRefs,m=e.onSelect,g=e.onExpand,w=e.onLoadData,E=e.togglableSelect,O=e.multiSelect,W=e.propagateSelect,x=e.propagateSelectUpwards,A=i(l(X,{selectedIds:new Set(a||o),tabbableId:t[0].children[0],isFocused:!1,expandedIds:new Set(d||c),halfSelectedIds:new Set,lastUserSelect:t[0].children[0],lastInteractedWith:null,disabledIds:new Set(f)}),2),C=A[0],D=A[1],K=C.selectedIds,_=C.expandedIds,P=C.disabledIds,G=C.tabbableId,M=C.halfSelectedIds,Y=C.lastAction,q=C.lastInteractedWith,V=I(K)||new Set,$=v(K,V);r((function(){if(null!=m&&m!==J){var e,a=u($);try{for(a.s();!(e=a.n()).done;){var n=e.value,r=b(t,n)||!!t[G].isBranch;m({element:t[n],isBranch:r,isExpanded:!!r&&_.has(n),isSelected:K.has(n),isDisabled:P.has(n),isHalfSelected:!!r&&M.has(n),treeState:C})}}catch(e){a.e(e)}finally{a.f()}}}),[t,K,_,P,M,$,m,C]);var Q=I(_)||new Set;r((function(){var e=v(_,Q);if(null!=g&&g!==J){var a,n=u(e);try{for(n.s();!(a=n.n()).done;){var r=a.value;g({element:t[r],isExpanded:_.has(r),isSelected:K.has(r),isDisabled:P.has(r),isHalfSelected:M.has(r),treeState:C})}}catch(e){n.e(e)}finally{n.f()}}}),[t,K,_,P,M,Q,g,C]);var Z,ee,te=(Z=t,ee=n(),r((function(){ee.current=Z})),ee.current||new Set);return r((function(){var e=v(_,Q);if(w){var a,n=u(e);try{for(n.s();!(a=n.n()).done;){var r=a.value;w({element:t[r],isExpanded:_.has(r),isSelected:K.has(r),isDisabled:P.has(r),isHalfSelected:M.has(r),treeState:C})}}catch(e){n.e(e)}finally{n.f()}if(te!==t&&E&&W){var l,d=u(_);try{for(d.s();!(l=d.n()).done;){var i=l.value;K.has(i)&&D({type:R,ids:j(t,[i],P),select:!0,multiSelect:O,lastInteractedWith:i})}}catch(e){d.e(e)}finally{d.f()}}}}),[t,K,_,P,M,Q,w,C]),r((function(){var e=new Set(a),n=p(e,V),r=p(V,e);if(r.size){var l,d=u(r);try{for(d.s();!(l=d.n()).done;){var i=l.value;D({type:T,id:i,multiSelect:O,controlled:!0,lastInteractedWith:i})}}catch(e){d.e(e)}finally{d.f()}}if(n.size){var s,c=u(n);try{for(c.s();!(s=c.n()).done;){var o=s.value;D({type:B,id:o,multiSelect:O,controlled:!0,lastInteractedWith:o}),W&&!P.has(o)&&D({type:R,ids:j(t,[o],P),select:!0,multiSelect:O,lastInteractedWith:o})}}catch(e){c.e(e)}finally{c.f()}}}),[a]),r((function(){var e=new Set(d),a=p(e,Q),n=p(Q,e);if(n.size){var r,l=u(n);try{for(l.s();!(r=l.n()).done;){var i=r.value;if(b(t,i)||t[i].isBranch){var c=[i].concat(s(y(t,i,new Set)));D({type:L,ids:c,lastInteractedWith:i})}}}catch(e){l.e(e)}finally{l.f()}}if(a.size){var o,f=u(a);try{for(f.s();!(o=f.n()).done;){var h=o.value;if(b(t,h)||t[h].isBranch){var v=S(t,h);D(v?{type:U,ids:[h,v],lastInteractedWith:h}:{type:N,id:h,lastInteractedWith:h})}}}catch(e){f.e(e)}finally{f.f()}}}),[d]),r((function(){if(x&&O){var e=new Set($);q&&Y!==H&&Y!==k&&Y!==N&&Y!==z&&e.add(q);var a,n=function(e,t,a,n){var r,l={every:new Set,some:new Set,none:new Set},d=u(t);try{for(d.s();!(r=d.n()).done;)for(var i=r.value;;){var s=S(e,i);if(0===s||null==s||null!=s&&n.has(s))break;var c=e[s].children.filter((function(e){return!n.has(e)}));if(0===c.length)break;c.some((function(e){return a.has(e)||l.some.has(e)}))?c.every((function(e){return a.has(e)}))?l.every.add(s):l.some.add(s):l.none.add(s),i=s}}catch(e){d.e(e)}finally{d.f()}return l}(t,e,K,P),r=n.every,l=n.some,d=n.none,i=u(r);try{for(i.s();!(a=i.n()).done;){var s=a.value;K.has(s)||D({type:B,id:s,multiSelect:O,keepFocus:!0,NotUserAction:!0,lastInteractedWith:q})}}catch(e){i.e(e)}finally{i.f()}var c,o=u(l);try{for(o.s();!(c=o.n()).done;){var f=c.value;M.has(f)||D({type:F,id:f,lastInteractedWith:q})}}catch(e){o.e(e)}finally{o.f()}var h,p=u(d);try{for(p.s();!(h=p.n()).done;){var v=h.value;(K.has(v)||M.has(v))&&D({type:T,id:v,multiSelect:O,keepFocus:!0,NotUserAction:!0,lastInteractedWith:q})}}catch(e){p.e(e)}finally{p.f()}}}),[t,O,x,K,_,P,M,Y,V,$,q]),r((function(){null!=q&&(null!=G&&null!=(null==h?void 0:h.current)&&function(e){null!=e&&e.focus&&e.focus()}(h.current[G]))}),[G,h,q]),[C,D]},q={select:"SELECT",focus:"FOCUS",exclusiveSelect:"EXCLUSIVE_SELECT"},V=Object.freeze(Object.values(q)),$=Object.freeze(Object.values({check:"check",select:"select"})),J=function(){},Q=a.forwardRef((function(t,r){var l=t.data,d=t.selectedIds,s=t.nodeRenderer,c=t.onSelect,o=void 0===c?J:c,u=t.onExpand,h=void 0===u?J:u,p=t.onLoadData,v=t.className,I=void 0===v?"":v,b=t.multiSelect,S=void 0!==b&&b,y=t.propagateSelect,m=void 0!==y&&y,g=t.propagateSelectUpwards,w=void 0!==g&&g,E=t.propagateCollapse,O=void 0!==E&&E,W=t.expandOnKeyboardSelect,x=void 0!==W&&W,A=t.togglableSelect,j=void 0!==A&&A,k=t.defaultExpandedIds,L=void 0===k?[]:k,N=t.defaultSelectedIds,U=void 0===N?[]:N,F=t.defaultDisabledIds,B=void 0===F?[]:F,T=t.clickAction,z=void 0===T?q.select:T,K=t.nodeAction,R=void 0===K?"select":K,_=t.expandedIds,H=t.onBlur,G=f(t,["data","selectedIds","nodeRenderer","onSelect","onExpand","onLoadData","className","multiSelect","propagateSelect","propagateSelectUpwards","propagateCollapse","expandOnKeyboardSelect","togglableSelect","defaultExpandedIds","defaultSelectedIds","defaultDisabledIds","clickAction","nodeAction","expandedIds","onBlur"]),M=n({}),X=i(Y({data:l,controlledIds:d,controlledExpandedIds:_,defaultExpandedIds:L,defaultSelectedIds:U,defaultDisabledIds:B,nodeRefs:M,onSelect:o,onExpand:h,onLoadData:p,togglableSelect:j,multiSelect:S,propagateSelect:m,propagateSelectUpwards:w}),2),V=X[0],$=X[1];m=m&&S;var Q=n(null);return null!=r&&(Q=r),a.createElement("ul",Object.assign({className:e(D.root,I),role:"tree","aria-multiselectable":"select"===R?S:void 0,ref:Q,onBlur:function(e){C(e,Q.current,(function(){H&&H({treeState:V,dispatch:$}),$({type:P})}))},onKeyDown:ae({data:l,tabbableId:V.tabbableId,expandedIds:V.expandedIds,selectedIds:V.selectedIds,disabledIds:V.disabledIds,halfSelectedIds:V.halfSelectedIds,dispatch:$,propagateCollapse:O,propagateSelect:m,multiSelect:S,expandOnKeyboardSelect:x,togglableSelect:j})},G),l[0].children.map((function(e,t){return a.createElement(Z,Object.assign({key:e,data:l,element:l[e],setsize:l[0].children.length,posinset:t+1,level:1},V,{state:V,dispatch:$,nodeRefs:M,baseClassNames:D,nodeRenderer:s,propagateCollapse:O,propagateSelect:m,propagateSelectUpwards:w,multiSelect:S,togglableSelect:j,clickAction:z,nodeAction:R}))})))})),Z=function(t){var n=t.element,r=t.dispatch,l=t.data,i=t.selectedIds,c=t.tabbableId,o=t.isFocused,u=t.expandedIds,f=t.disabledIds,p=t.halfSelectedIds,v=t.lastUserSelect,I=t.nodeRefs,S=t.baseClassNames,m=t.nodeRenderer,g=t.nodeAction,w=t.setsize,E=t.posinset,W=t.level,C=t.propagateCollapse,D=t.propagateSelect,k=t.multiSelect,N=t.togglableSelect,U=t.clickAction,F=t.state,T=function(e){if(!(e.ctrlKey||e.altKey||e.shiftKey))if(u.has(n.id)&&C){var t=[n.id].concat(s(y(l,n.id,new Set)));r({type:L,ids:t,lastInteractedWith:n.id})}else r({type:z,id:n.id,lastInteractedWith:n.id})},P=function(){return r({type:H,id:n.id,lastInteractedWith:n.id})},G=function(e){if(e.shiftKey){var t=O({data:l,expandedIds:u,from:v,to:n.id}).filter((function(e){return!f.has(e)}));t=D?j(l,t,f):t,r({type:_,select:!0,multiSelect:k,ids:t,lastInteractedWith:n.id})}else e.ctrlKey||q.select?(r({type:N?K:B,id:n.id,multiSelect:k,lastInteractedWith:n.id}),D&&!f.has(n.id)&&r({type:R,ids:j(l,[n.id],f),select:!N||!i.has(n.id),multiSelect:k,lastInteractedWith:n.id})):U===q.exclusiveSelect?r({type:N?K:B,id:n.id,multiSelect:!1,lastInteractedWith:n.id}):U===q.focus&&r({type:H,id:n.id,lastInteractedWith:n.id})},M=function(t){var a;return e(t,(d(a={},"".concat(t,"--expanded"),u.has(n.id)),d(a,"".concat(t,"--selected"),i.has(n.id)),d(a,"".concat(t,"--focused"),c===n.id&&o),a))},X="select"===g?{"aria-selected":x({isSelected:i.has(n.id),isDisabled:f.has(n.id),multiSelect:k})}:{"aria-checked":A({isSelected:i.has(n.id),isDisabled:f.has(n.id),isHalfSelected:p.has(n.id),multiSelect:k})};return b(l,n.id)||n.isBranch?a.createElement("li",Object.assign({role:"treeitem","aria-expanded":u.has(n.id),"aria-setsize":w,"aria-posinset":E,"aria-level":W,"aria-disabled":f.has(n.id),tabIndex:c===n.id?0:-1,ref:function(e){null!=(null==I?void 0:I.current)&&null!=e&&(I.current[n.id]=e)},className:S.branchWrapper},X),a.createElement(a.Fragment,null,m({element:n,isBranch:!0,isSelected:i.has(n.id),isHalfSelected:p.has(n.id),isExpanded:u.has(n.id),isDisabled:f.has(n.id),dispatch:r,getNodeProps:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=t.onClick;return{onClick:null==a?h(G,T,P):h(a,P),className:e(M(S.node),S.branch)}},setsize:w,posinset:E,level:W,handleSelect:G,handleExpand:T,treeState:F}),a.createElement(te,Object.assign({getClasses:M},ee(t))))):a.createElement("li",{role:"none",className:M(S.leafListItem)},m({element:n,isBranch:!1,isSelected:i.has(n.id),isHalfSelected:!1,isExpanded:!1,isDisabled:f.has(n.id),dispatch:r,getNodeProps:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=t.onClick;return Object.assign({role:"treeitem",tabIndex:c===n.id?0:-1,onClick:h(null==a?G:a,P),ref:function(e){null!=(null==I?void 0:I.current)&&(I.current[n.id]=e)},className:e(M(S.node),S.leaf),"aria-setsize":w,"aria-posinset":E,"aria-level":W,disabled:f.has(n.id),"aria-disabled":f.has(n.id)},X)},setsize:w,posinset:E,level:W,handleSelect:G,handleExpand:J,treeState:F}))},ee=function(e){e.setsize,e.posinset;return f(e,["setsize","posinset"])},te=function(e){var t=e.data,n=e.element,r=e.expandedIds,l=e.getClasses,d=e.baseClassNames,i=e.level,s=f(e,["data","element","expandedIds","getClasses","baseClassNames","level"]);return a.createElement("ul",{role:"group",className:l(d.nodeGroup)},r.has(n.id)&&n.children.length>0&&n.children.map((function(e,l){return a.createElement(Z,Object.assign({data:t,expandedIds:r,baseClassNames:d,key:e,element:t[e],setsize:n.children.length,posinset:l+1,level:i+1},s))})))},ae=function(e){var t=e.data,a=e.expandedIds,n=e.selectedIds,r=e.disabledIds,l=e.tabbableId,d=e.dispatch,i=e.propagateCollapse,c=e.propagateSelect,o=e.multiSelect,u=e.expandOnKeyboardSelect,f=e.togglableSelect;return function(e){var h=t[l],p=h.id;if(e.ctrlKey){if("a"===e.key){e.preventDefault();var v=t.filter((function(e){return 0!==e.id})),I=Object.values(v).map((function(e){return e.id})).filter((function(e){return!r.has(e)}));d({type:R,multiSelect:o,select:Array.from(n).filter((function(e){return!r.has(e)})).length!==I.length,ids:I,lastInteractedWith:h.id})}else if(e.shiftKey&&("Home"===e.key||"End"===e.key)){var m="Home"===e.key?t[0].children[0]:g(t,p,a),W=O({data:t,expandedIds:a,from:p,to:m}).filter((function(e){return!r.has(e)}));d({type:R,multiSelect:o,select:!0,ids:c?j(t,W,r):W}),d({type:H,id:m,lastInteractedWith:m})}}else{if(e.shiftKey)switch(e.key){case"ArrowUp":e.preventDefault();var x=w(t,p,a);return void(null==x||r.has(x)||(d({type:R,ids:c?j(t,[x],r):[x],select:!0,multiSelect:o,lastInteractedWith:x}),d({type:H,id:x,lastInteractedWith:x})));case"ArrowDown":e.preventDefault();var A=E(t,p,a);return void(null==A||r.has(A)||(d({type:R,ids:c?j(t,[A],r):[A],multiSelect:o,select:!0,lastInteractedWith:A}),d({type:H,id:A,lastInteractedWith:A})))}switch(e.key){case"ArrowDown":e.preventDefault();var C=E(t,p,a);return void(null!=C&&d({type:H,id:C,lastInteractedWith:C}));case"ArrowUp":e.preventDefault();var D=w(t,p,a);return void(null!=D&&d({type:H,id:D,lastInteractedWith:D}));case"ArrowLeft":if(e.preventDefault(),(b(t,p)||h.isBranch)&&a.has(l))if(i){var F=[p].concat(s(y(t,p,new Set)));d({type:L,ids:F,lastInteractedWith:h.id})}else d({type:k,id:p,lastInteractedWith:p});else if(!t[0].children.includes(p)){var T=S(t,p);if(null==T)throw new Error("parentId of root element is null");d({type:H,id:T,lastInteractedWith:T})}return;case"ArrowRight":return e.preventDefault(),void((b(t,p)||h.isBranch)&&(a.has(l)?d({type:H,id:h.children[0],lastInteractedWith:h.children[0]}):d({type:N,id:p,lastInteractedWith:p})));case"Home":e.preventDefault(),d({type:H,id:t[0].children[0],lastInteractedWith:t[0].children[0]});break;case"End":e.preventDefault();var _=g(t,t[0].id,a);return void d({type:H,id:_,lastInteractedWith:_});case"*":e.preventDefault();var P=S(t,p);if(null==P)throw new Error("parentId of element is null");var G=t[P].children.filter((function(e){return b(t,e)||t[e].isBranch}));return void d({type:U,ids:G,lastInteractedWith:p});case"Enter":case" ":case"Spacebar":return e.preventDefault(),d({type:f?K:B,id:p,multiSelect:o,lastInteractedWith:p}),c&&!r.has(h.id)&&d({type:R,ids:j(t,[p],r),select:!f||!n.has(p),multiSelect:o,lastInteractedWith:p}),void(u&&d({type:z,id:p,lastInteractedWith:p}));default:if(1===e.key.length)for(var M=E(t,p,a);M!==p;)if(null!=M){if(t[M].name[0].toLowerCase()===e.key.toLowerCase())return void d({type:H,id:M,lastInteractedWith:p});M=E(t,M,a)}else M=t[0].children[0];return}}}};Q.propTypes={data:t.array.isRequired,onSelect:t.func,onExpand:t.func,className:t.string,nodeRenderer:t.func.isRequired,defaultExpandedIds:t.array,defaultSelectedIds:t.array,expandedIds:t.array,selectedIds:t.array,defaultDisabledIds:t.array,propagateCollapse:t.bool,propagateSelect:t.bool,propagateSelectUpwards:t.bool,multiSelect:t.bool,expandOnKeyboardSelect:t.bool,togglableSelect:t.bool,nodeAction:t.oneOf($),clickAction:t.oneOf(V),onBlur:t.func,onLoadData:t.func};export default Q;export{V as CLICK_ACTIONS,W as flattenTree};
import e from"classnames";import t from"prop-types";import a,{useRef as n,useEffect as r,useReducer as l}from"react";function d(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==a)return;var n,r,l=[],d=!0,i=!1;try{for(a=a.call(e);!(d=(n=a.next()).done)&&(l.push(n.value),!t||l.length!==t);d=!0);}catch(e){i=!0,r=e}finally{try{d||null==a.return||a.return()}finally{if(i)throw r}}return l}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return o(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a<t;a++)n[a]=e[a];return n}function u(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=c(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,d=!0,i=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return d=e.done,e},e:function(e){i=!0,l=e},f:function(){try{d||null==a.return||a.return()}finally{if(i)throw l}}}}function f(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}var h=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return function(e){var a,n=u(t);try{for(n.s();!(a=n.n()).done;){var r=a.value;if(r&&r(e),e.defaultPrevented)break}}catch(e){n.e(e)}finally{n.f()}}},p=function(e,t){var a,n=new Set,r=u(e);try{for(r.s();!(a=r.n()).done;){var l=a.value;t.has(l)||n.add(l)}}catch(e){r.e(e)}finally{r.f()}return n},v=function(e,t){return new Set([].concat(s(p(e,t)),s(p(t,e))))},I=function(e){var t=n();return r((function(){t.current=e}),[e]),t.current},b=function(e,t){return null!=e[t].children&&e[t].children.length>0},S=function(e,t){return e[t].parent},y=function(e,t,a){for(var n=t,r=[];;){var l=S(e,n);if(0===l||null==l||null!=l&&a.has(l))break;r.push(l),n=l}return r},m=function(e,t,a){var n=[];return function e(t,r){var l=t[r];if(null!=l.children){var d,i=u(l.children.filter((function(e){return!a.has(e)})));try{for(i.s();!(d=i.n()).done;){var s=d.value;n.push(s),e(t,s)}}catch(e){i.e(e)}finally{i.f()}}}(e,t),n},g=function(e,t,a){var n=S(e,t);if(null!=n){var r=e[n],l=r.children.indexOf(t)+a;if(r.children[l])return r.children[l]}return null},w=function(e,t,a){var n=e[t];for(e[0].id===t&&(n=e[e[t].children[e[t].children.length-1]]);a.has(n.id)&&b(e,n.id);)n=e[n.children[n.children.length-1]];return n.id},E=function(e,t,a){if(t===e[0].children[0])return null;var n=g(e,t,-1);return null==n?S(e,t):w(e,n,a)},O=function(e,t,a){var n=e[t].id;if(b(e,n)&&a.has(n))return e[n].children[0];for(;;){var r=g(e,n,1);if(null!=r)return r;if(null==(n=S(e,n)))return null}},W=function(e){var t=e.data,a=e.expandedIds,n=e.from,r=e.to,l=[],d=Object.keys(t).length,i=0,s=n;if(l.push(n),n<r)for(;i<d&&(null!=(s=O(t,s,a))&&l.push(s),null!=s&&s!==r);)i+=1;else if(n>r)for(;i<d&&(null!=(s=E(t,s,a))&&l.push(s),null!=s&&s!==r);)i+=1;return l},x=function(e){var t=0,a=[];return function e(n,r){var l={id:t,name:n.name,children:[],parent:r};if(a[t]=l,t+=1,null!=n.children&&0!==n.children.length){var d,i=u(n.children);try{for(i.s();!(d=i.n()).done;){e(d.value,l.id)}}catch(e){i.e(e)}finally{i.f()}l.children=a.filter((function(e){return e.parent===l.id})).map((function(e){return e.id}))}}(e,null),a},A=function(e){var t=e.isSelected,a=e.isDisabled,n=e.multiSelect;return a||n?t:!!t||void 0},j=function(e){var t=e.isSelected,a=e.isDisabled,n=e.isHalfSelected,r=e.multiSelect;return a?t:n?"mixed":r?t:!!t||void 0},C=function(e,t,a){return t.concat.apply(t,s(t.filter((function(t){return b(e,t)})).map((function(t){return m(e,t,a)}))))},D=function(e,t,a){null!=t?window.navigator.userAgent.match(/Trident/)?setTimeout((function(){return!t.contains(document.activeElement)&&a()}),0):!t.contains(e.nativeEvent.relatedTarget)&&a():console.warn("ref not set on <ul>")},k=function(e,t,a){return b(e,t)&&a.has(t)&&m(e,t,new Set).some((function(e){return a.has(e)}))},L={root:"tree",node:"tree-node",branch:"tree-node__branch",branchWrapper:"tree-branch-wrapper",leafListItem:"tree-leaf-list-item",leaf:"tree-node__leaf",nodeGroup:"tree-node-group"},N="COLLAPSE",U="COLLAPSE_MANY",F="EXPAND",B="EXPAND_MANY",T="HALF_SELECT",z="SELECT",K="DESELECT",R="TOGGLE",_="TOGGLE_SELECT",H="SELECT_MANY",P="EXCLUSIVE_CHANGE_SELECT_MANY",G="FOCUS",M="BLUR",X="DISABLE",Y="ENABLE",q=function(e,t){switch(t.type){case N:var a=new Set(e.expandedIds);return a.delete(t.id),Object.assign(Object.assign({},e),{expandedIds:a,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case U:var n,r=new Set(e.expandedIds),l=u(t.ids);try{for(l.s();!(n=l.n()).done;){var d=n.value;r.delete(d)}}catch(e){l.e(e)}finally{l.f()}return Object.assign(Object.assign({},e),{expandedIds:r,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case F:var i=new Set(e.expandedIds);return i.add(t.id),Object.assign(Object.assign({},e),{expandedIds:i,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case B:var c=new Set([].concat(s(e.expandedIds),s(t.ids)));return Object.assign(Object.assign({},e),{expandedIds:c,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case R:var o=new Set(e.expandedIds);return e.expandedIds.has(t.id)?o.delete(t.id):o.add(t.id),Object.assign(Object.assign({},e),{expandedIds:o,tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case T:if(e.disabledIds.has(t.id))return e;var f=new Set(e.halfSelectedIds),h=new Set(e.selectedIds);return f.add(t.id),h.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:h,halfSelectedIds:f,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case z:if(!t.controlled&&e.disabledIds.has(t.id))return e;var v;t.multiSelect?(v=new Set(e.selectedIds)).add(t.id):(v=new Set).add(t.id);var I=new Set(e.halfSelectedIds);return I.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:v,halfSelectedIds:I,tabbableId:t.keepFocus?e.tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case K:if(!t.controlled&&e.disabledIds.has(t.id))return e;var b,S=new Set(e.selectedIds);return S.delete(t.id),t.multiSelect?(b=new Set(e.halfSelectedIds)).delete(t.id):b=new Set,Object.assign(Object.assign({},e),{selectedIds:S,halfSelectedIds:b,tabbableId:t.keepFocus?e.tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case _:if(e.disabledIds.has(t.id))return e;var y,m=e.selectedIds.has(t.id);t.multiSelect?(y=new Set(e.selectedIds),m?y.delete(t.id):y.add(t.id)):(y=new Set,m||y.add(t.id));var g=new Set(e.halfSelectedIds);return g.delete(t.id),Object.assign(Object.assign({},e),{selectedIds:y,halfSelectedIds:g,tabbableId:t.id,isFocused:!0,lastUserSelect:t.NotUserAction?e.lastUserSelect:t.id,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case H:var w,E=t.ids.filter((function(t){return!e.disabledIds.has(t)}));if(t.multiSelect){w=t.select?new Set([].concat(s(e.selectedIds),s(E))):p(e.selectedIds,new Set(E));var O=p(e.halfSelectedIds,w);return Object.assign(Object.assign({},e),{selectedIds:w,halfSelectedIds:O,lastAction:t.type,lastInteractedWith:t.lastInteractedWith})}return e;case P:var W,x=t.ids.filter((function(t){return!e.disabledIds.has(t)}));if(t.multiSelect){W=t.select?new Set(x):p(e.selectedIds,new Set(x));var A=p(e.halfSelectedIds,W);return Object.assign(Object.assign({},e),{selectedIds:W,halfSelectedIds:A,lastAction:t.type,lastInteractedWith:t.lastInteractedWith})}return e;case G:return Object.assign(Object.assign({},e),{tabbableId:t.id,isFocused:!0,lastAction:t.type,lastInteractedWith:t.lastInteractedWith});case M:return Object.assign(Object.assign({},e),{isFocused:!1});case X:var j=new Set(e.disabledIds);return j.add(t.id),Object.assign(Object.assign({},e),{disabledIds:j});case Y:var C=new Set(e.disabledIds);return C.delete(t.id),Object.assign(Object.assign({},e),{disabledIds:C});default:throw new Error("Invalid action passed to the reducer")}},V=function(e){var t=e.data,a=e.controlledIds,d=e.controlledExpandedIds,c=e.defaultExpandedIds,o=e.defaultSelectedIds,f=e.defaultDisabledIds,h=e.nodeRefs,g=e.onSelect,w=e.onExpand,E=e.onLoadData,O=e.togglableSelect,W=e.multiSelect,x=e.propagateSelect,A=e.propagateSelectUpwards,j=i(l(q,{selectedIds:new Set(a||o),tabbableId:t[0].children[0],isFocused:!1,expandedIds:new Set(d||c),halfSelectedIds:new Set,lastUserSelect:t[0].children[0],lastInteractedWith:null,disabledIds:new Set(f)}),2),D=j[0],k=j[1],L=D.selectedIds,_=D.expandedIds,P=D.disabledIds,M=D.tabbableId,X=D.halfSelectedIds,Y=D.lastAction,V=D.lastInteractedWith,$=I(L)||new Set,J=v(L,$);r((function(){if(null!=g&&g!==Z){var e,a=u(J);try{for(a.s();!(e=a.n()).done;){var n=e.value,r=b(t,n)||!!t[M].isBranch;g({element:t[n],isBranch:r,isExpanded:!!r&&_.has(n),isSelected:L.has(n),isDisabled:P.has(n),isHalfSelected:!!r&&X.has(n),treeState:D})}}catch(e){a.e(e)}finally{a.f()}}}),[t,L,_,P,X,J,g,D]);var Q=I(_)||new Set;r((function(){var e=v(_,Q);if(null!=w&&w!==Z){var a,n=u(e);try{for(n.s();!(a=n.n()).done;){var r=a.value;w({element:t[r],isExpanded:_.has(r),isSelected:L.has(r),isDisabled:P.has(r),isHalfSelected:X.has(r),treeState:D})}}catch(e){n.e(e)}finally{n.f()}}}),[t,L,_,P,X,Q,w,D]);var ee,te,ae=(ee=t,te=n(),r((function(){te.current=ee})),te.current||new Set);return r((function(){var e=v(_,Q);if(E){var a,n=u(e);try{for(n.s();!(a=n.n()).done;){var r=a.value;E({element:t[r],isExpanded:_.has(r),isSelected:L.has(r),isDisabled:P.has(r),isHalfSelected:X.has(r),treeState:D})}}catch(e){n.e(e)}finally{n.f()}if(ae!==t&&O&&x){var l,d=u(_);try{for(d.s();!(l=d.n()).done;){var i=l.value;L.has(i)&&k({type:H,ids:C(t,[i],P),select:!0,multiSelect:W,lastInteractedWith:i})}}catch(e){d.e(e)}finally{d.f()}}}}),[t,L,_,P,X,Q,E,D]),r((function(){var e=new Set(a),n=p(e,$),r=p($,e);if(r.size){var l,d=u(r);try{for(d.s();!(l=d.n()).done;){var i=l.value;k({type:K,id:i,multiSelect:W,controlled:!0,lastInteractedWith:i})}}catch(e){d.e(e)}finally{d.f()}}if(n.size){var s,c=u(n);try{for(c.s();!(s=c.n()).done;){var o=s.value;k({type:z,id:o,multiSelect:W,controlled:!0,lastInteractedWith:o}),x&&!P.has(o)&&k({type:H,ids:C(t,[o],P),select:!0,multiSelect:W,lastInteractedWith:o})}}catch(e){c.e(e)}finally{c.f()}}}),[a]),r((function(){var e=new Set(d),a=p(e,Q),n=p(Q,e);if(n.size){var r,l=u(n);try{for(l.s();!(r=l.n()).done;){var i=r.value;if(b(t,i)||t[i].isBranch){var c=[i].concat(s(m(t,i,new Set)));k({type:U,ids:c,lastInteractedWith:i})}}}catch(e){l.e(e)}finally{l.f()}}if(a.size){var o,f=u(a);try{for(f.s();!(o=f.n()).done;){var h=o.value;if(b(t,h)||t[h].isBranch){var v=S(t,h);k(v?{type:B,ids:[h,v],lastInteractedWith:h}:{type:F,id:h,lastInteractedWith:h})}}}catch(e){f.e(e)}finally{f.f()}}}),[d]),r((function(){if(A){var e=new Set(J);V&&Y!==G&&Y!==N&&Y!==F&&Y!==R&&e.add(V);var a,n=function(e,t,a,n,r,l){var d,i={every:new Set,some:new Set,none:new Set},s=u(t);try{for(s.s();!(d=s.n()).done;)for(var c=d.value;;){var o=S(e,c);if(0===o||null==o||null!=o&&n.has(o))break;var f=e[o].children.filter((function(e){return!n.has(e)}));if(0===f.length)break;if(f.some((function(e){return a.has(e)||i.some.has(e)||r.has(e)})))f.every((function(e){return a.has(e)}))?i.every.add(o):i.some.add(o);else{var h=y(e,c,n).find((function(e){return a.has(e)}));if(!l&&h){m(e,h,n).forEach((function(e){r.has(e)&&i.none.add(e)}));break}i.none.add(o)}c=o}}catch(e){s.e(e)}finally{s.f()}return i}(t,e,L,P,X,W),r=n.every,l=n.some,d=n.none,i=u(r);try{for(i.s();!(a=i.n()).done;){var s=a.value;L.has(s)||k({type:z,id:s,multiSelect:W,keepFocus:!0,NotUserAction:!0,lastInteractedWith:V})}}catch(e){i.e(e)}finally{i.f()}var c,o=u(l);try{for(o.s();!(c=o.n()).done;){var f=c.value;X.has(f)||k({type:T,id:f,lastInteractedWith:V})}}catch(e){o.e(e)}finally{o.f()}var h,p=u(d);try{for(p.s();!(h=p.n()).done;){var v=h.value;(L.has(v)||X.has(v))&&k({type:K,id:v,multiSelect:W,keepFocus:!0,NotUserAction:!0,lastInteractedWith:V})}}catch(e){p.e(e)}finally{p.f()}}}),[t,W,A,L,_,P,X,Y,$,J,V]),r((function(){null!=V&&(null!=M&&null!=(null==h?void 0:h.current)&&function(e){null!=e&&e.focus&&e.focus()}(h.current[M]))}),[M,h,V]),[D,k]},$={select:"SELECT",focus:"FOCUS",exclusiveSelect:"EXCLUSIVE_SELECT"},J=Object.freeze(Object.values($)),Q=Object.freeze(Object.values({check:"check",select:"select"})),Z=function(){},ee=a.forwardRef((function(t,r){var l=t.data,d=t.selectedIds,s=t.nodeRenderer,c=t.onSelect,o=void 0===c?Z:c,u=t.onExpand,h=void 0===u?Z:u,p=t.onLoadData,v=t.className,I=void 0===v?"":v,b=t.multiSelect,S=void 0!==b&&b,y=t.propagateSelect,m=void 0!==y&&y,g=t.propagateSelectUpwards,w=void 0!==g&&g,E=t.propagateCollapse,O=void 0!==E&&E,W=t.expandOnKeyboardSelect,x=void 0!==W&&W,A=t.togglableSelect,j=void 0!==A&&A,C=t.defaultExpandedIds,k=void 0===C?[]:C,N=t.defaultSelectedIds,U=void 0===N?[]:N,F=t.defaultDisabledIds,B=void 0===F?[]:F,T=t.clickAction,z=void 0===T?$.select:T,K=t.nodeAction,R=void 0===K?"select":K,_=t.expandedIds,H=t.onBlur,P=f(t,["data","selectedIds","nodeRenderer","onSelect","onExpand","onLoadData","className","multiSelect","propagateSelect","propagateSelectUpwards","propagateCollapse","expandOnKeyboardSelect","togglableSelect","defaultExpandedIds","defaultSelectedIds","defaultDisabledIds","clickAction","nodeAction","expandedIds","onBlur"]),G=n({}),X=i(V({data:l,controlledIds:d,controlledExpandedIds:_,defaultExpandedIds:k,defaultSelectedIds:U,defaultDisabledIds:B,nodeRefs:G,onSelect:o,onExpand:h,onLoadData:p,togglableSelect:j,multiSelect:S,propagateSelect:m,propagateSelectUpwards:w}),2),Y=X[0],q=X[1];m=m&&S;var J=n(null);return null!=r&&(J=r),a.createElement("ul",Object.assign({className:e(L.root,I),role:"tree","aria-multiselectable":"select"===R?S:void 0,ref:J,onBlur:function(e){D(e,J.current,(function(){H&&H({treeState:Y,dispatch:q}),q({type:M})}))},onKeyDown:re({data:l,tabbableId:Y.tabbableId,expandedIds:Y.expandedIds,selectedIds:Y.selectedIds,disabledIds:Y.disabledIds,halfSelectedIds:Y.halfSelectedIds,dispatch:q,propagateCollapse:O,propagateSelect:m,multiSelect:S,expandOnKeyboardSelect:x,togglableSelect:j})},P),l[0].children.map((function(e,t){return a.createElement(te,Object.assign({key:e,data:l,element:l[e],setsize:l[0].children.length,posinset:t+1,level:1},Y,{state:Y,dispatch:q,nodeRefs:G,baseClassNames:L,nodeRenderer:s,propagateCollapse:O,propagateSelect:m,propagateSelectUpwards:w,multiSelect:S,togglableSelect:j,clickAction:z,nodeAction:R}))})))})),te=function(t){var n=t.element,r=t.dispatch,l=t.data,i=t.selectedIds,c=t.tabbableId,o=t.isFocused,u=t.expandedIds,f=t.disabledIds,p=t.halfSelectedIds,v=t.lastUserSelect,I=t.nodeRefs,S=t.baseClassNames,y=t.nodeRenderer,g=t.nodeAction,w=t.setsize,E=t.posinset,O=t.level,x=t.propagateCollapse,D=t.propagateSelect,L=t.multiSelect,N=t.togglableSelect,F=t.clickAction,B=t.state,K=function(e){if(!(e.ctrlKey||e.altKey||e.shiftKey))if(u.has(n.id)&&x){var t=[n.id].concat(s(m(l,n.id,new Set)));r({type:U,ids:t,lastInteractedWith:n.id})}else r({type:R,id:n.id,lastInteractedWith:n.id})},M=function(){return r({type:G,id:n.id,lastInteractedWith:n.id})},X=function(e){if(e.shiftKey){var t=W({data:l,expandedIds:u,from:v,to:n.id}).filter((function(e){return!f.has(e)}));t=D?C(l,t,f):t,r({type:P,select:!0,multiSelect:L,ids:t,lastInteractedWith:n.id})}else if(e.ctrlKey||$.select){var a=k(l,n.id,i);r({type:N?a?T:_:z,id:n.id,multiSelect:L,lastInteractedWith:n.id}),D&&!f.has(n.id)&&r({type:H,ids:C(l,[n.id],f),select:!N||!i.has(n.id),multiSelect:L,lastInteractedWith:n.id})}else F===$.exclusiveSelect?r({type:N?_:z,id:n.id,multiSelect:!1,lastInteractedWith:n.id}):F===$.focus&&r({type:G,id:n.id,lastInteractedWith:n.id})},Y=function(t){var a;return e(t,(d(a={},"".concat(t,"--expanded"),u.has(n.id)),d(a,"".concat(t,"--selected"),i.has(n.id)),d(a,"".concat(t,"--focused"),c===n.id&&o),a))},q="select"===g?{"aria-selected":A({isSelected:i.has(n.id),isDisabled:f.has(n.id),multiSelect:L})}:{"aria-checked":j({isSelected:i.has(n.id),isDisabled:f.has(n.id),isHalfSelected:p.has(n.id),multiSelect:L})};return b(l,n.id)||n.isBranch?a.createElement("li",Object.assign({role:"treeitem","aria-expanded":u.has(n.id),"aria-setsize":w,"aria-posinset":E,"aria-level":O,"aria-disabled":f.has(n.id),tabIndex:c===n.id?0:-1,ref:function(e){null!=(null==I?void 0:I.current)&&null!=e&&(I.current[n.id]=e)},className:S.branchWrapper},q),a.createElement(a.Fragment,null,y({element:n,isBranch:!0,isSelected:i.has(n.id),isHalfSelected:p.has(n.id),isExpanded:u.has(n.id),isDisabled:f.has(n.id),dispatch:r,getNodeProps:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=t.onClick;return{onClick:null==a?h(X,K,M):h(a,M),className:e(Y(S.node),S.branch)}},setsize:w,posinset:E,level:O,handleSelect:X,handleExpand:K,treeState:B}),a.createElement(ne,Object.assign({getClasses:Y},ae(t))))):a.createElement("li",{role:"none",className:Y(S.leafListItem)},y({element:n,isBranch:!1,isSelected:i.has(n.id),isHalfSelected:!1,isExpanded:!1,isDisabled:f.has(n.id),dispatch:r,getNodeProps:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=t.onClick;return Object.assign({role:"treeitem",tabIndex:c===n.id?0:-1,onClick:h(null==a?X:a,M),ref:function(e){null!=(null==I?void 0:I.current)&&(I.current[n.id]=e)},className:e(Y(S.node),S.leaf),"aria-setsize":w,"aria-posinset":E,"aria-level":O,disabled:f.has(n.id),"aria-disabled":f.has(n.id)},q)},setsize:w,posinset:E,level:O,handleSelect:X,handleExpand:Z,treeState:B}))},ae=function(e){e.setsize,e.posinset;return f(e,["setsize","posinset"])},ne=function(e){var t=e.data,n=e.element,r=e.expandedIds,l=e.getClasses,d=e.baseClassNames,i=e.level,s=f(e,["data","element","expandedIds","getClasses","baseClassNames","level"]);return a.createElement("ul",{role:"group",className:l(d.nodeGroup)},r.has(n.id)&&n.children.length>0&&n.children.map((function(e,l){return a.createElement(te,Object.assign({data:t,expandedIds:r,baseClassNames:d,key:e,element:t[e],setsize:n.children.length,posinset:l+1,level:i+1},s))})))},re=function(e){var t=e.data,a=e.expandedIds,n=e.selectedIds,r=e.disabledIds,l=e.tabbableId,d=e.dispatch,i=e.propagateCollapse,c=e.propagateSelect,o=e.multiSelect,u=e.expandOnKeyboardSelect,f=e.togglableSelect;return function(e){var h=t[l],p=h.id;if(e.ctrlKey){if("a"===e.key){e.preventDefault();var v=t.filter((function(e){return 0!==e.id})),I=Object.values(v).map((function(e){return e.id})).filter((function(e){return!r.has(e)}));d({type:H,multiSelect:o,select:Array.from(n).filter((function(e){return!r.has(e)})).length!==I.length,ids:I,lastInteractedWith:h.id})}else if(e.shiftKey&&("Home"===e.key||"End"===e.key)){var y="Home"===e.key?t[0].children[0]:w(t,p,a),g=W({data:t,expandedIds:a,from:p,to:y}).filter((function(e){return!r.has(e)}));d({type:H,multiSelect:o,select:!0,ids:c?C(t,g,r):g}),d({type:G,id:y,lastInteractedWith:y})}}else{if(e.shiftKey)switch(e.key){case"ArrowUp":e.preventDefault();var x=E(t,p,a);return void(null==x||r.has(x)||(d({type:H,ids:c?C(t,[x],r):[x],select:!0,multiSelect:o,lastInteractedWith:x}),d({type:G,id:x,lastInteractedWith:x})));case"ArrowDown":e.preventDefault();var A=O(t,p,a);return void(null==A||r.has(A)||(d({type:H,ids:c?C(t,[A],r):[A],multiSelect:o,select:!0,lastInteractedWith:A}),d({type:G,id:A,lastInteractedWith:A})))}switch(e.key){case"ArrowDown":e.preventDefault();var j=O(t,p,a);return void(null!=j&&d({type:G,id:j,lastInteractedWith:j}));case"ArrowUp":e.preventDefault();var D=E(t,p,a);return void(null!=D&&d({type:G,id:D,lastInteractedWith:D}));case"ArrowLeft":if(e.preventDefault(),(b(t,p)||h.isBranch)&&a.has(l))if(i){var L=[p].concat(s(m(t,p,new Set)));d({type:U,ids:L,lastInteractedWith:h.id})}else d({type:N,id:p,lastInteractedWith:p});else if(!t[0].children.includes(p)){var K=S(t,p);if(null==K)throw new Error("parentId of root element is null");d({type:G,id:K,lastInteractedWith:K})}return;case"ArrowRight":return e.preventDefault(),void((b(t,p)||h.isBranch)&&(a.has(l)?d({type:G,id:h.children[0],lastInteractedWith:h.children[0]}):d({type:F,id:p,lastInteractedWith:p})));case"Home":e.preventDefault(),d({type:G,id:t[0].children[0],lastInteractedWith:t[0].children[0]});break;case"End":e.preventDefault();var P=w(t,t[0].id,a);return void d({type:G,id:P,lastInteractedWith:P});case"*":e.preventDefault();var M=S(t,p);if(null==M)throw new Error("parentId of element is null");var X=t[M].children.filter((function(e){return b(t,e)||t[e].isBranch}));return void d({type:B,ids:X,lastInteractedWith:p});case"Enter":case" ":case"Spacebar":e.preventDefault();var Y=k(t,h.id,n);return d({type:f?Y?T:_:z,id:p,multiSelect:o,lastInteractedWith:p}),c&&!r.has(h.id)&&d({type:H,ids:C(t,[p],r),select:!f||!n.has(p),multiSelect:o,lastInteractedWith:p}),void(u&&d({type:R,id:p,lastInteractedWith:p}));default:if(1===e.key.length)for(var q=O(t,p,a);q!==p;)if(null!=q){if(t[q].name[0].toLowerCase()===e.key.toLowerCase())return void d({type:G,id:q,lastInteractedWith:p});q=O(t,q,a)}else q=t[0].children[0];return}}}};ee.propTypes={data:t.array.isRequired,onSelect:t.func,onExpand:t.func,className:t.string,nodeRenderer:t.func.isRequired,defaultExpandedIds:t.array,defaultSelectedIds:t.array,expandedIds:t.array,selectedIds:t.array,defaultDisabledIds:t.array,propagateCollapse:t.bool,propagateSelect:t.bool,propagateSelectUpwards:t.bool,multiSelect:t.bool,expandOnKeyboardSelect:t.bool,togglableSelect:t.bool,nodeAction:t.oneOf(Q),clickAction:t.oneOf(J),onBlur:t.func,onLoadData:t.func};export default ee;export{J as CLICK_ACTIONS,x as flattenTree};

@@ -12,2 +12,3 @@ /// <reference types="react" />

export declare const getParent: (data: INode[], id: number) => number | null;
export declare const getAncestors: (data: INode[], childId: number, disabledIds: Set<number>) => number[];
export declare const getDescendants: (data: INode[], id: number, disabledIds: Set<number>) => number[];

@@ -18,3 +19,3 @@ export declare const getSibling: (data: INode[], id: number, diff: number) => number | null;

export declare const getNextAccessible: (data: INode[], id: number, expandedIds: Set<number>) => number | null;
export declare const propagateSelectChange: (data: INode[], ids: Set<number>, selectedIds: Set<number>, disabledIds: Set<number>) => {
export declare const propagateSelectChange: (data: INode[], ids: Set<number>, selectedIds: Set<number>, disabledIds: Set<number>, halfSelectedIds: Set<number>, multiSelect?: boolean) => {
every: Set<number>;

@@ -48,2 +49,3 @@ some: Set<number>;

export declare const onComponentBlur: (event: React.FocusEvent, treeNode: HTMLUListElement | null, callback: () => void) => void;
export declare const isBranchSelectedAndHasSelectedDescendants: (data: INode[], elementId: number, selectedIds: Set<number>) => boolean;
export {};
{
"name": "react-accessible-treeview",
"description": "A react component that implements the treeview pattern as described by the WAI-ARIA Authoring Practices.",
"version": "2.3.2",
"version": "2.3.3",
"author": "lissitz (https://github.com/lissitz)",

@@ -6,0 +6,0 @@ "main": "dist/react-accessible-treeview.cjs.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc