pixel-react 1.18.9 → 1.18.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -24,7 +24,7 @@ object-assign
24
24
  *
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
- */function dg(){return lg||(lg=1,e=cg,"production"!==process.env.NODE_ENV&&function(){var t,n,r,i,o;if("undefined"==typeof window||"function"!=typeof MessageChannel){var a=null,l=null,s=function(){if(null!==a)try{var t=e.unstable_now();a(!0,t),a=null}catch(e){throw setTimeout(s,0),e}},c=Date.now();e.unstable_now=function(){return Date.now()-c},t=function(e){null!==a?setTimeout(t,0,e):(a=e,setTimeout(s,0))},n=function(e,t){l=setTimeout(e,t)},r=function(){clearTimeout(l)},i=function(){return!1},o=e.unstable_forceFrameRate=function(){}}else{var d=window.performance,u=window.Date,f=window.setTimeout,h=window.clearTimeout;if("undefined"!=typeof console){var C=window.requestAnimationFrame,p=window.cancelAnimationFrame;"function"!=typeof C&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof d&&"function"==typeof d.now)e.unstable_now=function(){return d.now()};else{var m=u.now();e.unstable_now=function(){return u.now()-m}}var g=!1,v=null,y=-1,w=5,b=0;i=function(){return e.unstable_now()>=b},o=function(){},e.unstable_forceFrameRate=function(e){e<0||e>125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):w=e>0?Math.floor(1e3/e):5};var E=new MessageChannel,M=E.port2;E.port1.onmessage=function(){if(null!==v){var t=e.unstable_now();b=t+w;try{v(!0,t)?M.postMessage(null):(g=!1,v=null)}catch(e){throw M.postMessage(null),e}}else g=!1},t=function(e){v=e,g||(g=!0,M.postMessage(null))},n=function(t,n){y=f((function(){t(e.unstable_now())}),n)},r=function(){h(y),y=-1}}function A(e,t){var n=e.length;e.push(t),function(e,t,n){for(var r=n;;){var i=r-1>>>1,o=e[i];if(!(void 0!==o&&k(o,t)>0))return;e[i]=t,e[r]=o,r=i}}(e,t,n)}function x(e){var t=e[0];return void 0===t?null:t}function L(e){var t=e[0];if(void 0!==t){var n=e.pop();return n!==t&&(e[0]=n,function(e,t,n){for(var r=n,i=e.length;r<i;){var o=2*(r+1)-1,a=e[o],l=o+1,s=e[l];if(void 0!==a&&k(a,t)<0)void 0!==s&&k(s,a)<0?(e[r]=s,e[l]=t,r=l):(e[r]=a,e[o]=t,r=o);else{if(!(void 0!==s&&k(s,t)<0))return;e[r]=s,e[l]=t,r=l}}}(e,n,0)),t}return null}function k(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var H=0,S=0,V="function"==typeof SharedArrayBuffer?new SharedArrayBuffer(4*Int32Array.BYTES_PER_ELEMENT):"function"==typeof ArrayBuffer?new ArrayBuffer(4*Int32Array.BYTES_PER_ELEMENT):null,_=null!==V?new Int32Array(V):[];_[0]=0,_[3]=0,_[1]=0;var O=0,N=null,z=null,T=0;function D(e){if(null!==z){var t=T;if((T+=e.length)+1>O){if((O*=2)>524288)return console.error("Scheduler Profiling: Event log exceeded maximum size. Don't forget to call `stopLoggingProfilingEvents()`."),void I();var n=new Int32Array(4*O);n.set(z),N=n.buffer,z=n}z.set(e,t)}}function I(){var e=N;return O=0,N=null,z=null,T=0,e}function Z(e,t){_[3]++,null!==z&&D([1,1e3*t,e.id,e.priorityLevel])}function j(e,t){_[0]=0,_[1]=0,_[3]--,null!==z&&D([2,1e3*t,e.id])}function R(e,t){H++,_[0]=e.priorityLevel,_[1]=e.id,_[2]=H,null!==z&&D([5,1e3*t,e.id,H])}function B(e,t){_[0]=0,_[1]=0,_[2]=0,null!==z&&D([6,1e3*t,e.id,H])}var P=[],F=[],U=1,q=null,W=3,Q=!1,G=!1,K=!1;function Y(e){for(var t=x(F);null!==t;){if(null===t.callback)L(F);else{if(!(t.startTime<=e))return;L(F),t.sortIndex=t.expirationTime,A(P,t),Z(t,e),t.isQueued=!0}t=x(F)}}function X(e){if(K=!1,Y(e),!G)if(null!==x(P))G=!0,t(J);else{var r=x(F);null!==r&&n(X,r.startTime-e)}}function J(t,o){var a;a=o,null!==z&&D([8,1e3*a,S]),G=!1,K&&(K=!1,r()),Q=!0;var l=W;try{try{return function(t,r){var o=r;for(Y(o),q=x(P);null!==q&&(!(q.expirationTime>o)||t&&!i());){var a=q.callback;if(null!==a){q.callback=null,W=q.priorityLevel;var l=q.expirationTime<=o;R(q,o);var s=a(l);o=e.unstable_now(),"function"==typeof s?(q.callback=s,B(q,o)):(j(q,o),q.isQueued=!1,q===x(P)&&L(P)),Y(o)}else L(P);q=x(P)}if(null!==q)return!0;var c=x(F);return null!==c&&n(X,c.startTime-o),!1}(t,o)}catch(t){if(null!==q){var s=e.unstable_now();!function(e,t){_[0]=0,_[1]=0,_[3]--,null!==z&&D([3,1e3*t,e.id])}(q,s),q.isQueued=!1}throw t}}finally{q=null,W=l,Q=!1,function(e){S++,null!==z&&D([7,1e3*e,S])}(e.unstable_now())}}function $(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var ee=o,te={startLoggingProfilingEvents:function(){O=131072,N=new ArrayBuffer(4*O),z=new Int32Array(N),T=0},stopLoggingProfilingEvents:I,sharedProfilingBuffer:V};e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=te,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.isQueued&&(function(e,t){_[3]--,null!==z&&D([4,1e3*t,e.id])}(t,e.unstable_now()),t.isQueued=!1),t.callback=null},e.unstable_continueExecution=function(){G||Q||(G=!0,t(J))},e.unstable_getCurrentPriorityLevel=function(){return W},e.unstable_getFirstCallbackNode=function(){return x(P)},e.unstable_next=function(e){var t;switch(W){case 1:case 2:case 3:t=3;break;default:t=W}var n=W;W=t;try{return e()}finally{W=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=ee,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=W;W=e;try{return t()}finally{W=n}},e.unstable_scheduleCallback=function(i,o,a){var l,s,c=e.unstable_now();if("object"==typeof a&&null!==a){var d=a.delay;l="number"==typeof d&&d>0?c+d:c,s="number"==typeof a.timeout?a.timeout:$(i)}else s=$(i),l=c;var u=l+s,f={id:U++,callback:o,priorityLevel:i,startTime:l,expirationTime:u,sortIndex:-1,isQueued:!1};return l>c?(f.sortIndex=l,A(F,f),null===x(P)&&f===x(F)&&(K?r():K=!0,n(X,l-c))):(f.sortIndex=u,A(P,f),Z(f,c),f.isQueued=!0,G||Q||(G=!0,t(J))),f},e.unstable_shouldYield=function(){var t=e.unstable_now();Y(t);var n=x(P);return n!==q&&null!==q&&null!==n&&null!==n.callback&&n.startTime<=t&&n.expirationTime<q.expirationTime||i()},e.unstable_wrapCallback=function(e){var t=W;return function(){var n=W;W=t;try{return e.apply(this,arguments)}finally{W=n}}}}()),cg;var e}var ug=(sg||(sg=1,"production"===process.env.NODE_ENV?og.exports=(ig||(ig=1,function(e){var t,n,r,i,o;if("undefined"==typeof window||"function"!=typeof MessageChannel){var a=null,l=null,s=function(){if(null!==a)try{var t=e.unstable_now();a(!0,t),a=null}catch(e){throw setTimeout(s,0),e}},c=Date.now();e.unstable_now=function(){return Date.now()-c},t=function(e){null!==a?setTimeout(t,0,e):(a=e,setTimeout(s,0))},n=function(e,t){l=setTimeout(e,t)},r=function(){clearTimeout(l)},i=function(){return!1},o=e.unstable_forceFrameRate=function(){}}else{var d=window.performance,u=window.Date,f=window.setTimeout,h=window.clearTimeout;if("undefined"!=typeof console){var C=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof C&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof d&&"function"==typeof d.now)e.unstable_now=function(){return d.now()};else{var p=u.now();e.unstable_now=function(){return u.now()-p}}var m=!1,g=null,v=-1,y=5,w=0;i=function(){return e.unstable_now()>=w},o=function(){},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):y=0<e?Math.floor(1e3/e):5};var b=new MessageChannel,E=b.port2;b.port1.onmessage=function(){if(null!==g){var t=e.unstable_now();w=t+y;try{g(!0,t)?E.postMessage(null):(m=!1,g=null)}catch(e){throw E.postMessage(null),e}}else m=!1},t=function(e){g=e,m||(m=!0,E.postMessage(null))},n=function(t,n){v=f((function(){t(e.unstable_now())}),n)},r=function(){h(v),v=-1}}function M(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,i=e[r];if(!(void 0!==i&&0<L(i,t)))break e;e[r]=t,e[n]=i,n=r}}function A(e){return void 0===(e=e[0])?null:e}function x(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length;r<i;){var o=2*(r+1)-1,a=e[o],l=o+1,s=e[l];if(void 0!==a&&0>L(a,n))void 0!==s&&0>L(s,a)?(e[r]=s,e[l]=n,r=l):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==s&&0>L(s,n)))break e;e[r]=s,e[l]=n,r=l}}}return t}return null}function L(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var k=[],H=[],S=1,V=null,_=3,O=!1,N=!1,z=!1;function T(e){for(var t=A(H);null!==t;){if(null===t.callback)x(H);else{if(!(t.startTime<=e))break;x(H),t.sortIndex=t.expirationTime,M(k,t)}t=A(H)}}function D(e){if(z=!1,T(e),!N)if(null!==A(k))N=!0,t(I);else{var r=A(H);null!==r&&n(D,r.startTime-e)}}function I(t,o){N=!1,z&&(z=!1,r()),O=!0;var a=_;try{for(T(o),V=A(k);null!==V&&(!(V.expirationTime>o)||t&&!i());){var l=V.callback;if(null!==l){V.callback=null,_=V.priorityLevel;var s=l(V.expirationTime<=o);o=e.unstable_now(),"function"==typeof s?V.callback=s:V===A(k)&&x(k),T(o)}else x(k);V=A(k)}if(null!==V)var c=!0;else{var d=A(H);null!==d&&n(D,d.startTime-o),c=!1}return c}finally{V=null,_=a,O=!1}}function Z(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var j=o;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){N||O||(N=!0,t(I))},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_getFirstCallbackNode=function(){return A(k)},e.unstable_next=function(e){switch(_){case 1:case 2:case 3:var t=3;break;default:t=_}var n=_;_=t;try{return e()}finally{_=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=j,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=_;_=e;try{return t()}finally{_=n}},e.unstable_scheduleCallback=function(i,o,a){var l=e.unstable_now();if("object"==typeof a&&null!==a){var s=a.delay;s="number"==typeof s&&0<s?l+s:l,a="number"==typeof a.timeout?a.timeout:Z(i)}else a=Z(i),s=l;return i={id:S++,callback:o,priorityLevel:i,startTime:s,expirationTime:a=s+a,sortIndex:-1},s>l?(i.sortIndex=s,M(H,i),null===A(k)&&i===A(H)&&(z?r():z=!0,n(D,s-l))):(i.sortIndex=a,M(k,i),N||O||(N=!0,t(I))),i},e.unstable_shouldYield=function(){var t=e.unstable_now();T(t);var n=A(k);return n!==V&&null!==V&&null!==n&&null!==n.callback&&n.startTime<=t&&n.expirationTime<V.expirationTime||i()},e.unstable_wrapCallback=function(e){var t=_;return function(){var n=_;_=t;try{return e.apply(this,arguments)}finally{_=n}}}}(ag)),ag):og.exports=dg()),og.exports);const fg=Symbol(),hg=Symbol(),Cg="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?l:u,pg=ug.unstable_runWithPriority?e=>{try{ug.unstable_runWithPriority(ug.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e();function mg(e,t){const n=d(e)[fg];if("object"==typeof process&&"production"!==process.env.NODE_ENV&&!n)throw new Error("useContextSelector requires special context");const{v:{current:r},n:{current:i},l:o}=n,a=t(r),[l,s]=v(((e,n)=>{if(!n)return[r,a];if("p"in n)throw n.p;if(n.n===i)return Object.is(e[1],a)?e:[r,a];try{if("v"in n){if(Object.is(e[0],n.v))return e;const r=t(n.v);return Object.is(e[1],r)?e:[n.v,r]}}catch(e){}return[...e]}),[r,a]);return Object.is(l[1],a)||s(),Cg((()=>(o.add(s),()=>{o.delete(s)})),[o]),l[1]}const gg=function(e){const t=s({[fg]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[hg]=t.Provider,t.Provider=(n=t.Provider,({value:e,children:t})=>{const r=a(e),i=a(0),[o,l]=c(null);o&&(o(e),l(null));const s=a();if(!s.current){const e=new Set,t=(t,n)=>{i.current+=1;const r={n:i.current};(null==n?void 0:n.suspense)&&(r.n*=-1,r.p=new Promise((e=>{l((()=>t=>{r.v=t,delete r.p,e(t)}))}))),e.forEach((e=>e(r))),t()};s.current={[fg]:{v:r,n:i,l:e,u:t}}}return Cg((()=>{r.current=e,i.current+=1,pg((()=>{s.current[fg].l.forEach((t=>{t({n:i.current,v:e})}))}))}),[e]),p(n,{value:s.current},t)}),delete t.Consumer,t}([ng,()=>{}]),vg=({children:t,useTableRef:n,totalWidth:r})=>{const i=a(null);return l((()=>{n&&i.current&&n(i)}),[n]),e("table",{className:"ff-spreadsheet-table",ref:i,style:{minWidth:`${60+r}px`,tableLayout:"fixed"},children:t})},yg=t=>e("tr",{...t}),wg=t=>e("tr",{className:"ff-spreadsheet-row-header",...t});function bg(){return mg(gg,(([,e])=>e))}function Eg(e){return mg(gg,(([t])=>e(t)))}const Mg=({selected:t,onSelect:n})=>{const i=r.useCallback((()=>{n()}),[n]);return e("th",{className:"ff-spreadsheet-corner-header",onClick:i,tabIndex:0,children:e("div",{className:O("corner-header",{"ff-spreadsheet-header--selected":t}),children:e(B,{variant:t?"dark":"light",color:t?"var(--hover-color)":"var(--text-color)",name:"excel_corner_menu"})})})},Ag=t=>function(n){const i=bg(),o=r.useCallback((()=>i({type:CC})),[i]),a=Eg((e=>e.selected instanceof Yp));return e(t,{...n,selected:a,onSelect:o})},xg=t=>function(n){const i=bg(),o=r.useCallback(((e,t)=>i(function(e,t){return{type:hC,payload:{column:e,extend:t}}}(e,t))),[i]),a=Eg((e=>e.selected.hasEntireColumn(n.column))),l=Eg((e=>e.selectedColumn??void 0)),s=Eg((e=>e.active?Np(e.active,e.model.data):void 0));return e(t,{...n,cell:s,selected:a,selectedColumn:l,onSelect:o,scrollToColumn:n.scrollToColumn})},Lg=xg((({column:t,label:i,selected:o,onSelect:a,setContextMenu:l,deleteColumn:s,addColumnLeft:c,addColumnRight:d,columnContextEnable:u,cell:f,selectedColumn:C,minimumColumnWidth:p,maxColLimit:m,disableDeleteOption:g,contextMenu:v,onAddColumn:y,onDeleteColumn:w,setVisibleRange:b,scrollToColumn:E})=>{const M=bg(),A=Eg((e=>e.model.data)),x=p,L=Eg((e=>e.columnDimensions[t]?.width||x)),k=Eg((e=>e.model.data)),{columnCount:H}=xm(k),S=e=>{b((t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return C&&E(C),n}))},V=h((()=>[{label:"Add Column Left",value:"Add Column Left",iconName:"plus_icon",action:()=>{S("increment"),c(x),y?.(C??t,!0)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Left"]??!1,disable:H>=m},{label:"Add Column Right",value:"Add Column Right",iconName:"plus_icon",action:()=>{S("increment"),d(x),y?.(C??t,!1)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Right"]??!1,disable:H>=m},...g?[]:[{label:"Delete Column",value:"Delete Column",iconName:"delete",action:()=>{S("decrement"),s(),w?.(C??t)},disableTooltip:"",visible:f?.contextDisable?.["Delete Column"]??!1,disable:!1}]]),[C,t,A]),_=r.useCallback(((e,n)=>{const r=n?t-1:t,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientX,l=L,s=e=>{const t=Math.max(x,l+(e.clientX-o));M(np(i,t))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),M(Sp())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),M(Hp())}),[t,L]),N=r.useCallback((e=>M(Mp(e))),[M]),z=r.useCallback((e=>{a(t,e.shiftKey)}),[a,t]),T=r.useCallback((e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"column",options:V})}),[t,C,u,V]);return r.useEffect((()=>{void 0!==C&&"column"===v?.contextType&&l((e=>({open:e.open,contextType:"column",options:V})))}),[t,C,u,V,"column"===v?.contextType]),n("th",{className:O("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{minWidth:`${L}px`},onClick:z,onContextMenu:T,tabIndex:0,children:[e(P,{fontWeight:"medium",children:i??kg(t)}),e("div",{className:"drag-column-selector drag-column-left",onMouseDown:e=>_(e,!1),onDoubleClick:()=>M(np(t,x)),onClick:()=>N({row:-1,column:t})}),e("div",{className:"drag-column-selector drag-column-right",onMouseDown:e=>_(e,!0),onDoubleClick:()=>M(np(t,x)),onClick:()=>N({row:-1,column:t})})]},t)}));function kg(e){let t="",n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}const Hg=({row:t,label:i,selected:o,onSelect:a,setContextMenu:l,addRowTop:s,addRowBottom:c,deleteRow:d,rowContextEnable:u,selectedRow:f,cell:h,maxRowLimit:C,disableDeleteOption:p,contextMenu:m,setVisibleRange:g,scrollToRow:v})=>{const y=bg(),w=Eg((e=>e.rowDimensions[t]?.height||32)),b=Eg((e=>e.model.data)),{rowCount:E}=xm(b),M=e=>{g((t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return f&&v(f),n}))},A=r.useMemo((()=>[{label:"Add Row Top",value:"Add Row Top",iconName:"plus_icon",action:()=>{M("increment"),s()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Top"]??!1,disable:E>=C},{label:"Add Row Bottom",value:"Add Row Bottom",iconName:"plus_icon",action:()=>{M("increment"),c()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Bottom"]??!1,disable:E>=C},...p?[]:[{label:"Delete Row",value:"Delete Row",iconName:"delete",action:()=>{M("decrement"),d()},disableTooltip:"",visible:h?.contextDisable?.["Delete Row"]??!1,disable:!1}]]),[f,t]),x=r.useCallback(((e,n)=>{const r=n?t:t-1,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientY,l=w,s=e=>{const t=Math.max(32,l+(e.clientY-o));y(tp(i,t))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),y(Sp())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),y(Sp())}),[w,t]),L=r.useCallback((e=>y(Mp(e))),[y]),k=r.useCallback((e=>{a(t,e.shiftKey)}),[t]),H=r.useCallback((e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"row",options:A})}),[t,u,A,f]);return r.useEffect((()=>{void 0!==f&&"row"===m?.contextType&&l((e=>({open:e.open,contextType:"row",options:A})))}),[t,u,A,f,"row"===m?.contextType]),n("th",{className:O("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{height:`${w}px`,minWidth:"60px"},onClick:k,onContextMenu:H,tabIndex:0,children:[e(P,{fontWeight:"medium",children:void 0!==i?i:t+1}),e("div",{className:"drag-row-selector drag-row-down",onMouseDown:e=>x(e,!0),onDoubleClick:()=>y(tp(t,32)),onClick:()=>L({row:t,column:-1})}),e("div",{className:"drag-row-selector drag-row-up",onMouseDown:e=>x(e,!1),onDoubleClick:()=>y(tp(t,32)),onClick:()=>L({row:t,column:-1})})]})},Sg=t=>function(n){const i=bg(),o=Eg((e=>e.selected.hasEntireRow(n.row))),a=Eg((e=>e.active?Np(e.active,e.model.data):void 0)),l=Eg((e=>e.selectedRow??void 0)),s=r.useCallback(((e,t)=>i(function(e,t){return{type:fC,payload:{row:e,extend:t}}}(e,t))),[i]);return e(t,{...n,selected:o,cell:a,selectedRow:l,onSelect:s,scrollToRow:n.scrollToRow})},Vg=({row:t,column:n,DataViewer:i,active:o,dragging:a,mode:l,data:s,evaluatedData:c,select:d,activate:u,setCellDimensions:f,setCellData:h})=>{const C=r.useRef(null),p=r.useMemo((()=>({row:t,column:n})),[t,n]),m=r.useCallback((e=>{e.preventDefault(),window.getSelection()?.removeAllRanges(),"view"===l&&(f(p,am(e.currentTarget)),e.shiftKey?d(p):u(p))}),[l,f,p,d,u]),g=r.useCallback((e=>{a&&(f(p,am(e.currentTarget)),d(p))}),[f,d,a,p]);return r.useEffect((()=>{const e=C.current;if(!e)return;const t=()=>{f(p,am(e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()}),[f,p]),s&&s.DataViewer&&(i=s.DataViewer),e("td",{ref:C,style:{...s?.style,..."dropDown"===s?.inputType?.type&&{fontSize:"12px"},textDecoration:"underline"===s?.style?.textDecoration?s?.style?.textDecoration:"none"},className:O("ff-spreadsheet-cell",s?.className,{"ff-spreadsheet-active-cell":o||a}),onMouseEnter:g,onMouseDown:m,tabIndex:0,children:e(i,{row:t,column:n,cell:s,active:o,evaluatedCell:c,setCellData:h,inputValue:()=>null})})},_g=t=>function(n){const{row:i,column:o}=n,a=bg(),l=r.useMemo((()=>({row:i,column:o})),[i,o]),s=r.useCallback((e=>a(Ap(l,e))),[a,l]),c=r.useCallback((e=>a(function(e){return{type:mC,payload:{point:e}}}(e))),[a]),d=r.useCallback((e=>a(Mp(e))),[a]),u=r.useCallback(((e,t)=>a(xp(e,t))),[a]),f=Eg((e=>om(e.active,l))),h=Eg((e=>f?e.mode:"view")),C=Eg((e=>Np(l,e.model.data))),p=Eg((e=>Np(l,e.model.evaluatedData))),m=Eg((e=>e.dragging)),g=Eg((e=>e.copied?.has(l)||!1));return e(t,{...n,active:f,copied:g,dragging:m,mode:h,evaluatedData:p,data:C,select:c,activate:d,setCellDimensions:u,setCellData:s})},Og=({cell:r,evaluatedCell:i,active:o})=>{const a=function(e,t){const n=t?.value??e?.value;if(n&&"object"==typeof n)return n.toString();return n}(r,i);return e("span","boolean"==typeof a?{className:"ff-spreadsheet-data-viewer ff-spreadsheet-data-viewer--boolean",children:Ng(a)}:{className:O("ff-spreadsheet-data-viewer",{"ff-spreadsheet-data-viewer--preserve-breaks":vm(a)}),children:o||"dropDown"!==r?.inputType?.type?o||"file"!==r?.inputType?.type?!o&&a:e(t,{children:Q(r?.value)?n("div",{className:"ff-spreadsheet-data-viewer--without-fileType",children:[e(B,{name:"attachment_icon"})," Attachment"]}):(n=>{if(Q(n))return e(t,{});return JSON.parse(n).map((t=>e("div",{className:"ff-spreadsheet-data-viewer--fileType",children:e(sn,{width:r?.style?.width??100,title:t?.name?.split("*")?.[0]??""})},t.name)))})(a)}):n("div",{className:"ff-spreadsheet-data-viewer--dropdownType",children:[a,e(B,{name:"arrow_down",height:8,className:"dropdownType-icon"})]})})};function Ng(e){return e?"TRUE":"FALSE"}const zg=i.forwardRef((({initialValue:t="",onChange:n,className:r="",style:o={}},s)=>{const c=a(null);i.useImperativeHandle(s,(()=>c.current)),l((()=>{c.current&&t!==c.current.innerText&&(c.current.innerText=t)}),[t]);const d=()=>{if(c.current){const e=c.current.innerText;n?.(e)}};return e("div",{style:o,children:e("div",{ref:c,className:`editable-cell ${r}`,contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:e=>{if("Enter"===e.key){if(e.altKey||e.shiftKey)return e.preventDefault(),document.execCommand("insertLineBreak"),void d();c.current?.blur()}"Delete"!==e.key&&"Backspace"!==e.key||e.stopPropagation()},onInput:d,onPaste:e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain"),n=window.getSelection();if(!n||!n.rangeCount)return;const r=n.getRangeAt(0);r.deleteContents();const i=document.createTextNode(t);r.insertNode(i),r.setStartAfter(i),r.collapse(!0),n.removeAllRanges(),n.addRange(r),d()},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{outline:"none",transition:"border 0.2s",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"inherit",fontSize:"inherit",lineHeight:"normal",minHeight:"24px",verticalAlign:"middle",caretColor:"black",height:"inherit",maxHeight:"inherit",display:"block",position:"relative",paddingBottom:"2px"}})})})),Tg=({onChange:t,cell:n})=>{const i=r.useRef(null),o=r.useCallback((e=>{const{contextDisable:r,...i}=n;t({...i,value:e,inputType:i.inputType??{type:"text"}})}),[t,n]);r.useEffect((()=>{i.current&&function(e){if(e)if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)e.selectionStart=e.selectionEnd=e.value.length;else if(e.isContentEditable){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)}}(i.current)}),[]);return e("div",{className:"ff-spreadsheet-data-editor",children:e(zg,{ref:i,initialValue:n?.value??"",onChange:o,className:"ff-spreadsheet-cell-textarea",style:{...n?.style,borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})})},Dg=t=>{const i=r.useRef(null),o=r.useRef(null),a=bg(),l=r.useCallback(((e,t)=>a(Ap(e,t))),[a]),s=r.useCallback((e=>a(Mp(e))),[a]),c=r.useCallback((()=>a({type:MC})),[a]),d=r.useCallback((e=>a({type:KC,payload:{autofill:e}})),[a]),u=r.useCallback((e=>a(function(e){return{type:VC,payload:{changes:e}}}(e))),[a]),f=r.useCallback((()=>{a({type:AC})}),[a]),h=Eg((e=>e.rowDimensions)),C=Eg((e=>e.active)),p=Eg((e=>e.mode)),m=Eg((e=>e.active?Np(e.active,e.model.data):void 0)),g=Eg((e=>e.selected)),v=Eg((e=>g&&Cm(e.rowDimensions,e.columnDimensions,e.model.data,e.selected))),y=Eg((e=>{let t=C?fm(C,e.rowDimensions,e.columnDimensions):void 0;return t={top:t?.top?t?.top:0,height:t?.height?t?.height:0,left:t?.left?t?.left:0,width:t?.width?t?.width:0},t})),w=r.useMemo((()=>!C||!y||C.row<t.visibleRowRange.start||C.row>=t.visibleRowRange.end||C.column<t.visibleColRange.start||C.column>=t.visibleColRange.end),[C,y,t.visibleRowRange,t.visibleColRange]),b=r.useRef(void 0),E=r.useRef(null),M=r.useRef(void 0),A=r.useCallback((e=>{C&&l(C,e)}),[l,C]),[x,L]=r.useState({value:"",name:""}),[k,H]=r.useState(!1),[S,V]=r.useState(),[_,N]=r.useState([]);r.useEffect((()=>{m&&C&&t.getActiveCell({value:m.value,active:C});const n=i.current;if(!w&&n){if(n.focus({preventScroll:!0}),"file"===m?.inputType?.type&&m?.value)try{const e=JSON.parse(m.value).map((e=>new File([new Blob],e.name.split("*")[0]??"default")));N(e)}catch(e){console.error("Error parsing cell value for files:",e),N([])}else N([]);if("dropDown"===m?.inputType?.type){L({value:m?.value,name:m?.value}),H((e=>!e));const t=m?.inputType?.options?.map((t=>({disable:t.disable,label:e("span",{style:{color:t.color},children:t.label}),value:t.value})));V(t)}}}),[i,w,C?.row,C?.column]),r.useEffect((()=>{"dropDown"===m?.inputType?.type&&m?.value!==x.value&&L({value:m?.value,name:m?.value})}),[m?.value,m?.inputType?.type,x.value]),r.useEffect((()=>{const e=E.current,t=M.current;if(E.current=C,M.current=m,!e||!t)return;const n=C?.row!==e.row||C?.column!==e.column;if(n||"edit"!==p){const e=b.current;t!==e?u([{prevCell:e||null,nextCell:t}]):n||m===t||u([{prevCell:t,nextCell:m||null}]),b.current=m}}));const z=m&&m.DataEditor||t.DataEditor,T=m&&m.readOnly,D=r.useCallback((e=>{if(!C)return;const t=e.currentTarget.closest(".ff-excel-spreadsheet");if(!t)return void e.preventDefault();e.stopPropagation();const n=document.body.style.userSelect,r=document.body.style.overflow;document.body.style.userSelect="none",document.body.style.overflow="hidden";let i=null;const o=()=>{i&&(cancelAnimationFrame(i),i=null)},a=e=>{const n=t.getBoundingClientRect();let r=0,a=0;e.clientY<n.top+50?a=-12:e.clientY>n.bottom-50&&(a=12),e.clientX<n.left+50?r=-12:e.clientX>n.right-50&&(r=12),0!==r||0!==a?(e=>{o();const n=()=>{const{x:r,y:o}=e;0!==r&&(t.scrollLeft+=r),0!==o&&(t.scrollTop+=o),i=requestAnimationFrame(n)};i=requestAnimationFrame(n)})({x:r,y:a}):o()},l=()=>{o(),document.body.style.userSelect=n,document.body.style.overflow=r,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),d(!0)}),[s,d,C]),I=r.useCallback((e=>{e.preventDefault(),t.setContextMenu({open:t.contextOption?.open??!1,contextType:t.contextOption?.contextType??null,options:t.contextOption?.options||[]})}),[t]),Z=v?.height!==y?.height||v?.width!==y?.width,j=r.useCallback((e=>{C&&Z&&(xp(C,am(e.currentTarget)),s(C))}),[C,Z]),R=t.isAtRight?t.maxWidth-(y?.left-t.scrollPos.left)+100:t.maxWidth,B=t.isAtBottom?t.maxHeight-(y?.top-t.scrollPos.top)+64:t.maxHeight,P=["file","dropDown"].includes(m?.inputType?.type||"");return n("div",{ref:i,className:O("ff-spreadsheet-active-cell",`ff-spreadsheet-active-cell--${p}`,{"ff-spreadsheet-active-cell--hidden":w,"ff-spreadsheet-active-cell--dragging":Z&&"text"!==m?.inputType?.type}),onMouseDown:j,style:{...y,backgroundColor:m?.style?.backgroundColor,...P?{display:"flex",alignItems:m?.style?.alignContent,justifyContent:m?.style?.textAlign}:{},..."edit"===p&&C?{minWidth:Math.min(y?.width,t.maxWidth),minHeight:Math.min(y?.height,t.maxHeight),height:"auto",maxWidth:`${R}px`,maxHeight:`${B}px`,overflow:"auto",..."dropDown"===m?.inputType?.type?{}:{padding:"2px 4px 0px 4px",width:"max-content"}}:{}},onContextMenu:I,onClick:"view"!==p||T?void 0:c,tabIndex:0,children:[e("div",{className:P?"":"active-cell-main",children:"dropDown"===m?.inputType?.type?e(or,{...m?.inputType?.inputProps,dropDownRef:o,showOptions:{open:!("edit"!==p||!C),toggle:k},selectedOption:x,optionsList:S||[],height:26,showLabel:!1,disabled:!t.editable,showBorder:!1,optionZIndex:5e3,onChange:e=>{L({value:e.value,name:e.label}),A({...m,value:e.value,style:m?.style,inputType:m?.inputType})}}):"file"===m?.inputType?.type?e(nC,{...m?.inputType?.inputProps,label:"",onFileListClick:e=>{const n=e.target.closest(".ff-attachment-files"),r=e.target.closest(".ff-icon-container, .ff-icon-click, .ff-icon-danger");if(n&&!r&&m?.value&&t.attachmentAction?.viewAttachment)try{const e=JSON.parse(m.value),r=n.parentElement?.querySelectorAll(".ff-attachment-files")||[],i=Array.from(r).indexOf(n);if(-1===i||!e[i])return void console.error("File index not found or invalid");const o=e[i];t.attachmentAction.viewAttachment(o.id,o.name?.split("*")[0]??"default")}catch(e){console.error("Error parsing cell value:",e)}else console.warn("Missing file element, icon click, cell value, or viewAttachment action")},selectedFiles:_,onFilesChange:async(e,n,r)=>{try{if("ADD"===r&&"file"===m?.inputType?.type){let n=[];try{m?.value&&(n=JSON.parse(m.value))}catch(e){console.error("Error parsing cell.value:",e)}let r=0;const i=e.filter(((e,t,i)=>{const o=e.name.split("*")[0],a=i.findIndex((e=>e.name.split("*")[0]===o))!==t,l=n.some((e=>e.name.split("*")[0]===o));return!a&&!l||(r++,!1)}));if(n.length+i.length>5)return void Da.info("Cannot upload more than 5 files.");if(t.attachmentAction?.addAttachment&&i.length>0)try{let e=0,r=0,o=0;const l=_?.length+i?.length,s=l>0?25*l:1,c=[...n],d=i?.map((async e=>{try{if(e.name.includes("*"))return{file:e,status:"existing",data:{name:e.name}};const n=await(t?.attachmentAction?.addAttachment(e));if(!n||"string"==typeof n&&0===n.trim().length)return{file:e,status:"failed",reason:"no response"};if("string"==typeof n)try{const t=JSON.parse(n);return 507===t.responseCode?{file:e,status:"memory_full",reason:"no memory"}:400===t.responseCode?{file:e,status:"failed",reason:"invalid file"}:t?.id&&t?.name?{file:e,status:"success",data:t}:(console.error(`Invalid response structure for ${e.name}:`,t),{file:e,status:"failed",reason:"invalid response"})}catch(t){return console.error(`Parse error for ${e.name}:`,t),{file:e,status:"failed",reason:"parse error"}}if("object"==typeof n&&null!==n){const t=n;return t?.id&&t?.name?{file:e,status:"success",data:t}:(console.error(`Invalid response structure for ${e.name}:`,n),{file:e,status:"failed",reason:"invalid response"})}return console.error(`Unknown response for ${e.name}:`,n),{file:e,status:"failed",reason:"unknown"}}catch(t){return console.error(`Upload failed for ${e.name}:`,t),{file:e,status:"failed",reason:"upload error"}}}));if((await Promise.allSettled(d)).forEach((t=>{if("fulfilled"===t.status&&t.value){const{status:n,data:i}=t.value;"success"===n&&i?.id&&i?.name?(c.push(i),e++):"existing"===n&&i?.name?c.push(i):"memory_full"===n?o++:r++}else r++})),e>0||c.length>n.length){const e=c.length>0?JSON.stringify(c):"";A({...m,value:e,style:m?.style,inputType:m?.inputType}),a(tp(C?.row||0,Math.max(s,h?.[C.row]?.height||s))),N(c.map((e=>new File([new Blob],e.name?.split("*")[0]??"default"))))}o>0&&Da.info("No memory available to add the file"),e>0&&Da.success(`${e} file${e>1?"s":""} uploaded successfully`),r>0&&Da.info(`${r} unsupported ${r>1?"files":"file"}. Please check the file formats.`)}catch(e){console.error("Upload operation failed:",e),Da.error("Operation failed")}}else if("DELETE"===r&&"file"===m?.inputType?.type)try{let e=[...m&&JSON.parse(m.value)],r=0;for(const i of n||[]){const n=e.findIndex((e=>e.name.split("*")[0]===i.name.split("*")[0])),o=e[n]?.id;if(-1!==n&&o&&t.attachmentAction?.deleteAttachment)try{const a=await t.attachmentAction.deleteAttachment(o);"SUCCESS"===a||"object"==typeof a&&null!==a&&("status"in a&&"SUCCESS"===a.status||"responseCode"in a&&200===a.responseCode)?(e.splice(n,1),r++):console.error(`Delete failed for ${i.name}: Invalid response`,a)}catch(e){console.error(`Delete error for ${i.name}:`,e),Da.error("Error deleting file")}else console.error(`Cannot delete ${i.name}: Invalid fileId or no match`,{index:n,fileId:o,hasDeleteAttachment:!!t.attachmentAction?.deleteAttachment}),Da.error("Failed to delete file: Invalid file data")}if(r>0){const t=e.length>0?JSON.stringify(e):"";A({...m,value:t,style:m?.style,inputType:m?.inputType}),N(e?.map((e=>new File([new Blob],e.name.split("*")[0])))),Da.success(`${r} file${r>1?"s":""} deleted successfully`)}else if(n?.length){const t=e?.filter((e=>e.id&&e.name));if(t.length<e.length){const e=t.length>0?JSON.stringify(t):"";A({...m,value:e,style:m?.style,inputType:m?.inputType}),N(t.map((e=>new File([new Blob],e.name.split("*")[0])))),Da.error("Failed to delete file(s). Invalid file data detected.")}else Da.error("Failed to delete file(s). No valid files removed.")}}catch(e){console.error("Delete operation failed:",e),Da.error("Delete operation failed")}}catch(e){console.error("handleFilesChange error:",e),Da.error("Operation failed")}},disabled:!t.editable,maxFiles:5,buttonLabel:"+ Attachments",buttonVariant:"tertiary",deleteButton:t.editable,selectedFileMessage:"Duplicate attachments not allowed within the same row",addAttachmentButton:t.editable,isInfoIconRequired:!1,truncateMaxLimit:(y?.width??0)-60}):"edit"===p&&C&&t.editable?e(z,{row:C.row,column:C.column,cell:m,onChange:A,exitEditMode:f}):e(zg,{initialValue:m?.value,onChange:()=>{},className:"ff-spreadsheet-cell-textarea",style:{...m?.style,textDecoration:"underline"===m?.style?.textDecoration?"underline":"none",backgroundColor:Z?"#1e161f00":m?.style?.backgroundColor,pointerEvents:"none",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})}),!["file"].includes(m?.inputType?.type??"")&&("edit"===p||C&&e("div",{onMouseDown:D,className:"select_dot"}))]},`${C?.row}-${C?.column}`)},Ig=({dimensions:t,dragging:n,hidden:r,variant:i})=>{const o=Eg((e=>e.active)),a=Eg((e=>e.autoFill)),l=Eg((e=>o?fm(o,e.rowDimensions,e.columnDimensions):void 0)),{width:s,height:c,top:d,left:u}=t||{};let f=l?.height??0,h=l?.width??0,C=s,p=c;return a.open&&s&&c&&l&&(s-h>c-f?(C=s,p=l.height):(p=c,C=l.width)),e("div",{className:O("ff-spreadsheet-floating-rect",{[`ff-spreadsheet-floating-rect--${i}`]:i,"ff-spreadsheet-floating-rect--dragging":n,"ff-spreadsheet-floating-rect--hidden":r}),style:{width:(C??0)+1,height:(p??0)+1,top:d,left:u}})},Zg=({scrollPos:t={top:0,left:0}})=>{const n=Eg((e=>e.selected)),i=Eg((e=>e.dragging)),o=Eg((e=>e.selected.size(e.model.data)<2)),a=Eg((e=>n&&Cm(e.rowDimensions,e.columnDimensions,e.model.data,e.selected))),l=r.useMemo((()=>{if(a)return{...a,top:a.top-1,left:a.left-1,height:a.height-1,width:a.width-1}}),[a,t]);return e(Ig,{variant:"selected",dimensions:l,dragging:i,hidden:o||!a})},jg=({scrollPos:t={top:0,left:0}})=>{const n=Eg((e=>e.copied)),i=null===n,o=Eg((e=>n&&hm(e.rowDimensions,e.columnDimensions,n))),a=r.useMemo((()=>{if(o)return{...o,top:o.top-1,left:o.left-1,height:o.height-1,width:o.width-1}}),[o,t]);return e(Ig,{variant:"copied",dimensions:a,hidden:i||!o,dragging:!1})},Rg=i.forwardRef((({getColorValue:t,disabled:n,initialColor:r},o)=>{const l=a(null);i.useImperativeHandle(o,(()=>l.current));const[s,d]=c(r);return e("div",{className:O("ff-excel-color-selector",{"color-selector-disabled":n}),style:{backgroundColor:s},onClick:()=>{l.current&&!n&&l.current.click()},children:e("input",{type:"color",disabled:n,className:O("ff-excel-color-selector-picker",{"color-selector-disabled":n}),ref:l,onChange:e=>{d(e.target.value),t(e.target.value.replace("#",""))}})})}));Rg.displayName="ColorBarSelector";const Bg=e=>{switch(e.toUpperCase()){case"LEFT":default:return"left";case"RIGHT":return"right";case"CENTER":return"center";case"JUSTIFY":return"justify";case"BOTTOM":return"end";case"TOP":return"start"}},Pg=e=>{switch(e){case"left":return"LEFT";case"right":return"RIGHT";case"center":return"CENTER";case"justify":return"JUSTIFY";case"end":default:return"BOTTOM";case"start":return"TOP"}},Fg=e=>Mm.reduce(((t,n)=>Math.abs(n-parseFloat(e))<Math.abs(t-parseFloat(e))?n:t));function Ug(e){const{border:t}=e;let n="",r="",i="",o="";return"THIN"!==t.top&&(n="MEDIUM"===t.top?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.right&&(r="MEDIUM"===t.right?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.bottom&&(i="MEDIUM"===t.bottom?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.left&&(o="MEDIUM"===t.left?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),{fontSize:ym(Fg(String(e.size))),fontFamily:(a=e.name,Em.some((e=>e.label===a))?a:"Poppins"),color:`#${e.color}`,backgroundColor:`#${e.backgroundColor}`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":"normal",borderTop:n,borderRight:r,borderBottom:i,borderLeft:o,textAlign:Bg(e.alignment.horizontal),alignContent:Bg(e.alignment.vertical)};var a}const qg=e=>{if(!e||"none"===e)return"THIN";if(e.includes("solid")||e.includes("dashed")||e.includes("dotted")){if(e.includes("2px")||e.includes("medium"))return"MEDIUM";if(e.includes("3px")||e.includes("medium"))return"THICK"}return"THIN"},Wg=e=>({name:e.fontFamily||"Arial",size:wm(e.fontSize?.toString()||"12"),bold:"bold"===e.fontWeight,italic:"italic"===e.fontStyle,underline:"underline"===e.textDecoration,color:e.color?.replace("#","")||"000000",backgroundColor:e.backgroundColor?.replace("#","")||"FFFFFF",borderColor:"F2F2F2",border:{top:qg(e.borderTop?e.borderTop.toString():void 0),right:qg(e.borderRight?e.borderRight.toString():void 0),bottom:qg(e.borderBottom?e.borderBottom.toString():void 0),left:qg(e.borderLeft?e.borderLeft.toString():void 0)},alignment:{horizontal:Pg(e.textAlign),vertical:Pg(e.alignContent),wrapText:!1}}),Qg=({toolbar:t="show",editable:r,onBold:i,onItalic:o,setUnderlineType:s,setColor:d,setFontSize:u,setFontFamily:f,setTextAlign:h,setBackgroundColor:C,setBorderType:p,setFormatePainter:m})=>{const g=Eg((e=>e.selected instanceof Yp)),[v,y]=c("disable"===t||!r),w=Eg((e=>e.active?Np(e.active,e.model.data):null)),b=Eg((e=>e.model.data)),E=Eg((e=>e.formattedStyle.open)),M={...bm.style,color:"#1e161f",backgroundColor:"#ffffff",borderColor:"#1e161f"},[A,x]=c(w?.style||M),L=a(null);l((()=>{w?.style&&JSON.stringify(w.style)!==JSON.stringify(A)&&x(w?.style||M),g?y(!r):w&&"boolean"==typeof w.readOnly&&y(w.readOnly||"disable"===t||!r||"dropDown"===w?.inputType?.type)}),[w,r]);const k=Wg(A),[H,S]=c("border-none"),[V,_]=c({label:"",value:""}),[O,N]=c({label:"",value:""}),[z,T]=c({color:M.color,backgroundColor:M.backgroundColor,borderColor:M.borderColor}),D=[{value:"border-all-sides",label:"All Border",icon:"all_borders"},{value:"border-bottom",label:"Border Bottom",icon:"border_bottom"},{value:"border-left",label:"Border Left",icon:"border_left"},{value:"border-right",label:"Border Right",icon:"border_right"},{value:"border-top",label:"Border Top",icon:"border_top"},{value:"border-none",label:"No Border",icon:"no_border"}],I=Mm.map((e=>({label:e,value:e}))),Z=a(null),j=a(null);l((()=>{let e=setTimeout((()=>{d(b,z.color)}),0);return()=>{clearTimeout(e)}}),[z.color]),l((()=>{let e=setTimeout((()=>{C(b,z.backgroundColor)}),0);return()=>{clearTimeout(e)}}),[z.backgroundColor]);return l((()=>{const e=A.fontFamily,t=`${wm(A.fontSize)}`;_({label:e??"Times New Roman",value:e??"Times New Roman"}),N({label:t??"11",value:t??"11"})}),[A]),n("div",{className:"ff-excel-toolbar",children:[n("div",{className:"ff-excel-toolbar-font ",children:[e("div",{className:"ff-excel-toolbar-font-family",children:e(or,{disabled:v,height:24,tooltip:!0,showToolTip:!0,showLabel:!1,optionZIndex:2e3,onChange:e=>{_({label:e.label,value:e.label}),f(b,e.value)},required:!1,optionsList:Em,selectedOption:V})}),e("div",{className:"ff-excel-toolbar-font-size",children:e(or,{disabled:v,height:24,showLabel:!1,optionZIndex:2e3,required:!1,onChange:e=>{N({label:e.label,value:e.value}),u(b,e.value)},optionsList:I,selectedOption:O})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(G,{placement:"top",title:"Text Left",children:e(B,{disabled:v,variant:"left"===A.textAlign?"dark":"light",hoverEffect:"left"!==A.textAlign,onClick:()=>h(b,"left"),name:"text_align_left"})}),e(G,{placement:"top",title:"Text Center",children:e(B,{disabled:v,variant:"center"===A.textAlign?"dark":"light",hoverEffect:"center"!==A.textAlign,onClick:()=>h(b,"center"),name:"text_align_center"})}),e(G,{placement:"top",title:"Text Right",children:e(B,{disabled:v,variant:"right"===A.textAlign?"dark":"light",hoverEffect:"right"!==A.textAlign,onClick:()=>h(b,"right"),name:"text_align_right"})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-text",children:[e(G,{placement:"top",title:"Bold",children:e(B,{disabled:v,variant:k.bold?"dark":"light",hoverEffect:!k.bold,onClick:()=>i(b),name:"bold"})}),e(G,{placement:"top",title:"Italic",children:e(B,{disabled:v,variant:k.italic?"dark":"light",hoverEffect:!k.italic,onClick:()=>o(b),name:"italic"})}),e(G,{placement:"top",title:"Underline",children:e("div",{className:"ff-excel-toolbar-icon-underline",children:e(B,{disabled:v,variant:"underline"===A.textDecoration?"dark":"light",hoverEffect:"underline"!==A.textDecoration,onClick:()=>s(b),name:"underline"})})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(G,{placement:"top",title:"Format Painter",children:e(B,{disabled:v,variant:E?"dark":"light",hoverEffect:!E,onClick:()=>{m(b)},name:"formate_painter"})}),e(G,{placement:"top",title:"Text Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(B,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{d(b,z.color),Z.current?.click()},name:"text_color"}),e(Rg,{ref:Z,disabled:v,getColorValue:e=>{T((t=>({...t,color:e})))},initialColor:z.color})]})}),e(G,{placement:"top",title:"Background Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(B,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{C(b,z.backgroundColor),j.current?.click()},name:"fill_color"}),e(Rg,{ref:j,disabled:v,getColorValue:e=>{T((t=>({...t,backgroundColor:e})))},initialColor:z.backgroundColor})]})})]}),e("div",{className:"ff-excel-toolbar-divider"}),e("div",{className:"ff-excel-toolbar-menu",children:n("div",{className:"ff-excel-toolbar-menu-option",children:[e(G,{placement:"top",title:"Border Type",children:e(B,{hoverEffect:!0,disabled:v,onClick:()=>p(b,H,"var(--input-hover-border-color)"),name:(()=>{const e=D.find((e=>e.value===H));return e?e.icon:""})()})}),e("span",{ref:L,children:e(ur,{disabled:v,iconName:"arrow_down",targetRef:L,iconSize:12,zIndex:2e3,options:D,tooltipTitle:"Border Type",tooltipPlacement:"top",onOptionClick:e=>{let t=e.value;p(b,t,"var(--input-hover-border-color)"),S(t)}})})]})})]})},Gg=(e,t)=>{let n,r=null;const i=function(...i){const o=this;null===r||Date.now()-r>=t?(e.apply(o,i),r=Date.now()):(n&&clearTimeout(n),n=setTimeout((()=>{e.apply(o,i),r=Date.now()}),t-(Date.now()-r)))};return i.cancel=()=>{n&&clearTimeout(n),n=null,r=null},i},Kg=r.forwardRef((function(t,i){const{className:o,columnLabels:a=[],rowLabels:l=[],toolbar:s,editable:c,onKeyDown:d,Table:u=vg,Row:f=yg,sheetHeight:h,HeaderRow:C=wg,DataEditor:p=Tg,DataViewer:m=Og,onSelect:g=()=>{},onActivate:v=()=>{},onEvaluatedDataChange:y=()=>{},contextOption:w,attachmentAction:b,workRef:E,minimumColumnWidth:M,setContextMenu:A,maxRowLimit:x,maxColLimit:L,disableDeleteOption:k,contextMenu:H,getActiveCell:S,onAddColumn:V,onDeleteColumn:_}=t,N=M||100,z=r.useRef(!1),T=Eg((e=>e.model.data)),[D,I]=r.useState(!1),[Z,j]=r.useState(0),[R,B]=r.useState(0),[P,F]=r.useState({top:0,left:0}),[U,q]=r.useState(!1),[W,Q]=r.useState(!1),G=r.useMemo((()=>{const e=t.createFormulaParser||km,n=new Om(e,t.data);return I((e=>!e)),{...ng,model:n,selected:t.selected||ng.selected}}),[t.createFormulaParser,t.data,t.selected]),K=r.useReducer(rg,G),[Y,X]=K,J=r.useMemo((()=>function(e,t,n){const{columns:r,rows:i}=Rp(e);return{rows:t?Math.max(i,t.length):i,columns:n?Math.max(r,n.length):r}}(Y.model.data,l,a)),[Y.model.data,l,a]),[$,ee]=r.useState({start:0,end:Math.min(20,J.rows)}),[te,ne]=r.useState({start:0,end:Math.min(15,J.columns)}),re=r.useCallback((e=>{let t=0;for(let n=0;n<e;n++)t+=Y.rowDimensions[n]?.height||32;return t}),[Y.rowDimensions,32]),ie=r.useCallback((e=>{let t=0;for(let n=0;n<e;n++)t+=Y.columnDimensions[n]?.width||N;return t}),[Y.columnDimensions,N]);r.useEffect((()=>{X(function(e){return{type:YC,payload:{minimumColumnWidth:e}}}(M))}),[M]);const oe=re(J.rows),ae=ie(J.columns),le=re($.start),se=oe-re($.end),ce=ie(te.start),de=ae-ie(te.end),ue=Y.mode,fe=r.useRef(null),he=e=>r.useCallback(((...t)=>X(e(...t))),[e]),Ce=he(ep),pe=he(_p),me=he(Vp),ge=he(Op),ve=he(Lp),ye=he(kp),we=he(yp),be=he(Hp),Ee=he(Sp),Me=he(wp),Ae=he(bp),xe=he(Ep),Le=he(rp),ke=he(ip),He=he(ap),Se=he(cp),Ve=he(lp),_e=he(sp),Oe=he(op),Ne=he(dp),ze=he(up),Te=he(fp),De=he($C),Ie=he(hp),Ze=he(Cp),je=he(pp),Re=he(mp),Be=he(gp),Pe=he(vp);r.useImperativeHandle(i,(()=>({removeSelect:ge})));const Fe=r.useRef(Y.active);r.useEffect((()=>{if(Y.active!==Fe.current)if(Y.active)v(Y.active);else{const e=E.current;e&&gm(e)&&document.activeElement&&document.activeElement.blur()}Fe.current=Y.active}),[v,Y.active]);const Ue=r.useRef(Y.model.evaluatedData);r.useEffect((()=>{Y?.model?.evaluatedData!==Ue?.current&&y(Y?.model?.evaluatedData),Ue.current=Y.model.evaluatedData}),[Y?.model?.evaluatedData,y]);const qe=r.useRef(Y.selected);r.useEffect((()=>{Y.selected.equals(qe.current)||t.selected&&Y.selected.equals(t.selected)||g(Y.selected),qe.current=Y.selected}),[Y.selected,g,t.selected]);const We=r.useRef(t.selected);r.useEffect((()=>{t.selected&&We.current&&!t.selected.equals(We.current)&&xe(t.selected),We.current=t.selected}),[t.selected,xe]);let Qe=r.useRef(t.data);r.useEffect((()=>{Ce(c),t.data!==Qe.current&&Me(t.data),Qe.current=t.data}),[t.data,Me,c]);const Ge=r.useRef(t.createFormulaParser);r.useEffect((()=>{t.createFormulaParser!==Ge.current&&t.createFormulaParser&&Ae(t.createFormulaParser),Ge.current=t.createFormulaParser}),[t.createFormulaParser,Ae]);const Ke=r.useCallback((e=>{const{model:t,selected:n}=Y,{data:r}=t,i=n.toRange(r);if(i){!function(e,t){e.clipboardData?.setData(rm,t)}(e,pm(function(e,t,n){const r=[],i=t.column-e.column;for(let o=e.row;o<=t.row;o++){const a=o-e.row;r[a]=r[a]||Array(i);for(let i=e.column;i<=t.column;i++)r[a][i-e.column]=Np({row:o,column:i},n)}return r}(i.start,i.end,r)))}}),[Y]),Ye=r.useCallback((e=>{mm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),Ke(e),pe())}),[ue,Ke,pe]),Xe=r.useCallback((e=>{mm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),Ke(e),me())}),[ue,Ke,me]),Je=r.useCallback((e=>{if(mm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),e.clipboardData)){const t=function(e){return window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData?e.clipboardData.getData(rm):""}(e);ve(t)}}),[ue,ve]),$e=r.useCallback((e=>{e.persist();const t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();t&&"b"===n?(e.preventDefault(),Le(T)):t&&"i"===n?(e.preventDefault(),ke(T)):t&&"u"===n&&(e.preventDefault(),He(T)),d&&d(e),e.defaultPrevented||(function(e,t){return void 0!==Xm(e,t)}(Y,e)&&e.nativeEvent.preventDefault(),ye(e))}),[Y,d,ye]),et=r.useCallback((()=>{Y.formattedStyle.open&&Y.active&&De(Y.active)}),[Y]),tt=r.useCallback((()=>{Ee(),document.removeEventListener("mouseup",tt)}),[Ee]),nt=r.useCallback((e=>{Y.dragging||1!==e.buttons||"view"!==ue||(be(),document.addEventListener("mouseup",tt))}),[Y,be,tt,ue]),rt=r.useMemo((()=>_g(t.Cell||Vg)),[t.Cell,D,c]),it=r.useMemo((()=>Ag(t.CornerIndicator||Mg)),[t.CornerIndicator,D]),ot=r.useMemo((()=>Sg(t.RowIndicator||Hg)),[t.RowIndicator,D]),at=r.useMemo((()=>xg(t.ColumnIndicator||Lg)),[t.ColumnIndicator,D]);r.useEffect((()=>(document.addEventListener("cut",Ye),document.addEventListener("copy",Xe),document.addEventListener("paste",Je),()=>{document.removeEventListener("cut",Ye),document.removeEventListener("copy",Xe),document.removeEventListener("paste",Je)})),[Ye,Xe,Je]);const lt=e=>{const t=new ResizeObserver((e=>{const t=e[0];if(t&&fe.current){const e=t.target;if(e){const{clientWidth:t,clientHeight:n}=e;B(Math.min(fe.current.clientHeight,n)),j(Math.min(fe.current.clientWidth,t))}}})),n=e.current;n&&t.observe(n)},st=r.useCallback((e=>{const t=e.target,{scrollTop:n,clientHeight:r,scrollLeft:i,clientWidth:o}=t;F({top:n,left:i});let a=0;for(;a<J.rows&&re(a)<n;)a++;let l=a;for(;l<J.rows&&re(l)<n+r;)l++;a=Math.max(0,a-10),l=Math.min(J.rows,l+10),ee({start:a,end:l});const s=l===J.rows;q(s);let c=0;for(;c<J.columns&&ie(c)<i;)c++;let d=c;for(;d<J.columns&&ie(d)<i+o;)d++;c=Math.max(0,c-10),d=Math.min(J.columns,d+10),ne({start:c,end:d});const u=d===J.columns;Q(u),H.open&&A({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})}),[J.rows,J.columns,re,ie]),ct=r.useMemo((()=>Gg(st,16)),[st]),dt=e=>{z.current=!0,requestAnimationFrame((()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.rowDimensions?.[n]?.height||32;requestAnimationFrame((()=>{fe.current&&e>=J.rows-1&&fe?.current?.scrollTo({top:t+32,behavior:"smooth"})}))}))},ut=e=>{z.current=!0,requestAnimationFrame((()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.columnDimensions?.[n]?.width||N;requestAnimationFrame((()=>{fe.current&&e>=J.columns-1&&fe.current.scrollTo({left:t+60,behavior:"smooth"})}))}))};r.useEffect((()=>{z.current||(ee({start:0,end:Math.min(20,J.rows)}),ne({start:0,end:Math.min(15,J.columns)}))}),[J.rows,J.columns,z.current]);const ft=im($.end,$.start),ht=im(te.end,te.start),Ct=n("colgroup",{children:[e("col",{style:{width:"60px"}},"row-indicator")," ",e("col",{style:{width:`${ce}px`}},"left-spacer")," ",ht.map((t=>e("col",{style:{width:`${Y.columnDimensions[t]?.width||N}px`}},t))),e("col",{style:{width:`${de}px`}},"right-spacer")," "]}),pt=r.useMemo((()=>n(u,{useTableRef:lt,totalWidth:ae,children:[Ct,n("tbody",{children:[n(C,{children:[e(it,{}),e("div",{className:"spacer left"}),ht.map((n=>e(at,{column:n,minimumColumnWidth:M,setContextMenu:t.setContextMenu,label:n in a?a[n]:void 0,deleteColumn:Pe,addColumnLeft:je,addColumnRight:Re,columnContextEnable:t.columnContextEnable,maxColLimit:L,disableDeleteOption:k,contextMenu:H,onAddColumn:V,onDeleteColumn:_,setVisibleRange:ne,scrollToColumn:ut},n))),e("div",{className:"spacer right"})]}),e("tr",{style:{height:`${le}px`}}),ft.map((r=>n(f,{row:r,children:[e(ot,{label:r in l?l?.[r]:void 0,row:r,addRowTop:Ie,addRowBottom:Ze,deleteRow:Be,setContextMenu:t.setContextMenu,rowContextEnable:t.rowContextEnable,maxRowLimit:x,disableDeleteOption:k,contextMenu:H,setVisibleRange:ee,scrollToRow:dt},r),e("div",{className:"spacer left"}),ht.map((t=>e(rt,{row:r,column:t,DataViewer:m},t))),e("div",{className:"spacer right"})]},r))),e("tr",{style:{height:`${se}px`}})]})]})),[u,J.rows,J.columns,f,C,it,a,at,l,ot,rt,m,$,te,le,se,ce,de,Y.rowDimensions,Y.columnDimensions]),mt=r.useMemo((()=>e(Dg,{attachmentAction:b,contextOption:w,getActiveCell:S,setContextMenu:t.setContextMenu,DataEditor:p,visibleRowRange:$,visibleColRange:te,maxHeight:R-64,maxWidth:Z-M,totalHeight:oe,totalWidth:ae,isAtBottom:U,isAtRight:W,scrollPos:P,editable:c},Y.active?`${Y.active.row}-${Y.active.column}`:"no-active")),[p,$,te,Y.active,R,Z,oe,ae,U,W,c]),gt=r.useMemo((()=>n("div",{className:"ff-excel-spreadsheet-container",children:[e("div",{style:{width:`${Z}px`},className:O("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),e("div",{style:{height:`${R}px`},className:O("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),"hide"!==s&&e("div",{className:"ff-excel-toolbar-container",children:e(Qg,{editable:c,toolbar:s,onBold:Le,onItalic:ke,setUnderlineType:He,setColor:Ne,setBorderType:Oe,setFontSize:Ve,setFontFamily:_e,setTextAlign:Se,setBackgroundColor:ze,setFormatePainter:Te})}),n("div",{ref:fe,style:{height:h},className:O("ff-excel-spreadsheet",o),onKeyPress:we,onKeyDown:$e,onClick:et,onMouseMove:nt,onScroll:e=>ct(e),children:[pt,mt,e(Zg,{scrollPos:P}),e(jg,{scrollPos:P})]})]})),[o,we,$e,nt,pt,mt,Z]);return e(gg.Provider,{value:K,children:gt})})),Yg=({contextMenu:t,position:r,editable:i})=>{if(!t.open)return null;return i&&e("div",{onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},className:"ff-excel-menu",style:{left:r.x,top:r.y,position:"absolute",zIndex:9999999999},children:t.options.map((t=>{if(!t.visible){const i=t.disable;return e(G,{title:i?t.disableTooltip:"",children:n("div",{className:"ff-excel-menu-options "+(i?"disabled":""),onClick:()=>{i||t.action()},children:[t.iconName&&e(B,{name:t.iconName,height:16,width:16,color:(r=t.label,r.includes("Delete")?"var(--label-edit-error-text)":"var(--brand-color)"),disabled:i}),e(P,{as:"label",children:t.label})]})},t.label)}var r;return null}))})},Xg=({excelData:r,contextOption:o,toolbar:s="show",sheetBar:d="show",rowCount:u=26,colCount:f=26,sheetHeight:h="100%",editable:C=!0,contextHeightPositioning:p=0,contextWidthPositioning:m=0,onSave:g=()=>Promise.resolve(),onSaveInfoChange:v,attachmentAction:y={addAttachment:()=>Promise.resolve(""),deleteAttachment:()=>Promise.resolve(""),viewAttachment:()=>Promise.resolve()},onSaveDelay:w=3e3,scroller:b=!1,columnContextEnable:E=!0,rowContextEnable:M=!0,sheetBarContextEnable:A=!0,minimumColumnWidth:x=100,disableDeleteOption:L=!1,maxRowLimit:k=1/0,maxColLimit:H=1/0,maxSheetLimit:S=1/0,getActiveCell:V=()=>{}})=>{const _=a(null),[N,z]=c([]),[T,D]=c(""),[I,Z]=i.useState({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",disable:!1,visible:!1}]}),[j,R]=c({name:"defaultSheet",index:0}),[F,U]=c({defaultSheet:[[bm]]}),[q,W]=c([[bm]]),[K,Y]=c((g.length,{})),[X,J]=c({x:0,y:0}),$=a(""),ee=a(null),te=a(null),ne=a(null);l((()=>{const e=r;if(e){const t=e.map((e=>e.sheetName));z(t),Q(t.length)||($.current=t[0]||"",R({name:t[0]||"",index:0}));const n={},r={};e.forEach((e=>{const t=e.sheetName,i=e.data,o=Math.max(u,i.length),a=Math.max(f,Math.max(...i.map((e=>e.length))));let l=Array.from({length:o},(()=>Array(a).fill({value:"",style:bm.style,readOnly:!1,inputType:void 0})));i.forEach(((e,t)=>{e.forEach(((e,n)=>{var r;t<o&&n<a&&(l[t]||(l[t]=[]),l[t][n]={value:(r=e.value,null==r?null:r),style:Q(e?.style)?bm.style:Ug(e?.style),readOnly:!!e?.readOnly&&e?.readOnly,inputType:e?.inputType??void 0,contextDisable:e.contextDisable})}))}));const s=new Set([...e?.rows?.readOnly?e.rows.readOnly.map((e=>`r${e}`)):[],...e?.columns?.readOnly?e.columns.readOnly.map((e=>`c${e}`)):[],...e?.cells?.readOnly?e.cells.readOnly.map((([e,t])=>`${e},${t}`)):[]]);if(l.forEach(((t,n)=>{t.forEach(((t,r)=>{l[n]||(l[n]=[]);const i=s.has(`r${n+1}`)||s.has(`c${r+1}`)||s.has(`${n+1},${r+1}`),o=((t,n,r)=>r?.inputType?r.inputType:e?.rows?.inputType?.[t+1]||e?.columns?.inputType?.[n+1]||e?.cells?.inputType?.[`${t+1},${n+1}`]||{type:"text"})(n,r,t||bm);l[n][r]={...t,value:t?.value??"",readOnly:t?.readOnly?t.readOnly:i,inputType:o,contextDisable:t?.contextDisable}}))})),n[t]=l,g.length>1){const e=i[0]||[];r[t]=Array.from({length:a},((t,n)=>({newData:"",oldData:e[n]?.value||""})))}})),U(n),g.length>1&&Y(r);const i=Object.keys(n)[0];i&&void 0!==n[i]&&W(n[i])}}),[r]),l((()=>{v&&v(T),"File saved"===T&&setTimeout((()=>{D("")}),2e3)}),[T]),l((()=>{D("Saving..."),oe(le())}),[F,$.current]);const oe=i.useCallback(Aa((e=>{if(g.length>1){const t={...K};N.forEach(((n,r)=>{const i=(e[r].data[0]||[]).map((e=>e?.value||""));t[n]=(t[n]||[]).map(((e,t)=>({...e,newData:i[t]||""})))})),Y(t);const n=N.map((e=>({sheetName:e,headers:t[e]||[]})));g(e,n)}else g(e);D("File saved")}),w),[g,K,N]),ae=i.useCallback((e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),oe(le()))}),[g]);i.useEffect((()=>(document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)})),[ae]);const le=()=>N.map((e=>{const t=F[e]?.map((e=>{const t=e.reduce(((e,t,n)=>""!==String(t?.value??"").trim()?n:e),-1),n=e.map(((e,n)=>e&&e.style&&n<=t?{value:e.value,style:Wg(e.style),readOnly:e.readOnly,inputType:e.inputType,contextDisable:e.contextDisable}:null)).filter((e=>null!==e));return n.length>0?n:[]}))||[],n=t.filter(((e,n)=>{const r=t.slice(n+1).some((e=>e.length>0));return e.length>0||r}));return{sheetName:e,data:Q(n.length)?[[]]:n}})),[se,ce]=c(null),de=()=>N.length>=S,ue=()=>{if(de())return;const e=((e,t)=>{const n=t.map((e=>e.toLowerCase()));let r=`${e}1`,i=2;for(;n.includes(r.toLowerCase());)r=`${e}${i}`,i++;return r})("Sheet",N),t=Array.from({length:u},(()=>Array.from({length:f},(()=>bm))));z((t=>[...t,e])),R({index:N?.length,name:e}),U({...F,[e]:t}),W(t),g.length>1&&Y((t=>({...t,[e]:Array.from({length:f},(()=>({newData:"",oldData:""})))}))),$.current=e},fe=(e=[[bm]])=>{W(e)},he=(e,t,n)=>{const r=e.target;if(!r||r?.textContent?.trim()===n?.trim())return void ce(null);const i=(r.textContent||"").trim();if(!i)return Da.warning("Sheet name cannot be empty."),r.textContent=j.name,void ce(null);if(i.length>50)return Da.warning("The sheet name cannot be greater than 50 characters"),r.textContent=j.name,void ce(null);if(N.map((e=>e.toLowerCase())).includes(i.toLowerCase())&&n.trim()?.toLowerCase()!==i?.toLowerCase())return Da.warning("Sheet name already exists"),r.textContent=j.name,void ce(null);let o=N;fe(F?.[n]),o.splice(t,1,i);const a=function(e,t,n){if(!(t in e))throw new Error(`Key "${t}" not found in object`);const{[t]:r,...i}=e;return{...i,[n]:r??[]}}(F,n,i);$.current=i,R((e=>({...e,name:i}))),U(a),g.length>1&&Y((e=>{const t={...e},r=t[n];return delete t[n],t[i]=r??[],t})),ce(null)};const Ce=(e,t)=>{e!==j.name&&t!==j.index&&(R({index:t,name:e}),z((n=>{const r=[...n];return r[t]=e,r})),fe(F[e]),$.current=e)},pe=i.useCallback(((e,t=!1)=>{const n=e.target;(!n.closest(".ff-excel-tab-list")&&!n.closest(".ff-excel-sheet")||t)&&I.open&&(Z({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]}),t||(e.preventDefault(),e.stopPropagation()))}),[I.open]);i.useEffect((()=>(document.addEventListener("contextmenu",pe),document.addEventListener("click",(e=>pe(e,!0))),()=>{document.removeEventListener("contextmenu",pe),document.removeEventListener("click",(e=>pe(e,!0)))})),[pe]);const me=(e,t,n)=>{e.preventDefault();const r=[{label:"Add Sheet",value:"Add Sheet",iconName:"plus_icon",action:()=>ue(),disableTooltip:"Sheet limit reached",visible:!1,disable:de()},...L?[]:[{label:"Delete Sheet",value:"Delete Sheet",iconName:"delete",action:()=>((e,t)=>{if(N.length>1){let n=N.slice();n.splice(t,1);const r={...F};delete r[e];const i=Math.min(t,n.length-1);z(n),U(r),g.length>1&&Y((t=>{const n={...t};return delete n[e],n}));const o=n[i]?n[i]:"";R({index:i,name:o}),fe(r?.[o]),$.current=o}else Da.warning("Cannot delete the last sheet.")})(t,n),disableTooltip:"",visible:!1,disable:!1}]];Z((e=>({...e,open:!0,contextType:"sheet",options:r})))};l((()=>{ne.current?.removeSelect()}),[j.name]);return e(t,{children:N.length>0&&n("div",{ref:ee,className:"ff-excel",onContextMenu:e=>{e.preventDefault();const t=te.current?.parentElement?.getBoundingClientRect(),n=window.scrollX,r=window.scrollY;let i=e.clientX-(t?.left||0)+n,o=e.clientY-(t?.top||0)+r;const a=300,l=window.innerWidth,s=window.innerHeight,c=l-e.clientX,d=e.clientX,u=s-e.clientY,f=e.clientY;c<a&&d>=a?i=e.clientX-(t?.left||0)+n-150:i+=2,u<200&&f>=200?o=e.clientY-(t?.top||0)+r-20:o+=2,e.target.classList.contains("ff-excel-tab-list")?J({x:i,y:o-(L?32:65)}):(i+a>l&&(i=l-a-2),i<0&&(i=2),J({x:i+m,y:o+p}))},onClick:e=>{e.stopPropagation(),I.open&&Z({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},children:[e("div",{ref:te,className:"ff-excel-sheet",children:e(Kg,{ref:ne,editable:C,attachmentAction:y,toolbar:s,sheetHeight:h,setContextMenu:Z,contextOption:o,data:q,columnContextEnable:E,rowContextEnable:M,minimumColumnWidth:x,onEvaluatedDataChange:e=>{U((t=>({...t,[$.current]:e})))},workRef:ee,scroller:b,maxRowLimit:k,maxColLimit:H,disableDeleteOption:L,contextMenu:I,getActiveCell:V,onAddColumn:(e,t)=>{g.length>1&&Y((n=>{const r=j.name,i=[...n[r]||[]],o=t?e:e+1;return i.splice(o,0,{newData:"",oldData:""}),{...n,[r]:i}}))},onDeleteColumn:e=>{g.length>1&&Y((t=>{const n=j.name,r=[...t[n]||[]];return r.splice(e,1),{...t,[n]:r}}))}},j.name)}),"hide"!==d&&n("div",{className:"ff-excel-sheet-bar",children:["show"===d&&n("div",{className:"ff-excel-add-sheet-set",children:[e(G,{title:de()?"Sheet limit reached":"Add Sheet",placement:"top",children:e(B,{disabled:!C||de(),className:"ff-excel-add-sheet-icon",hoverEffect:!0,onClick:ue,name:"plus_icon",height:20,width:20})}),e(ur,{options:(t=>t.map(((t,r)=>({label:n("div",{style:{display:"flex",gap:"8px"},children:[j?.name===t?e(B,{height:16,width:16,name:"tick"}):e("div",{style:{height:"16px",width:"24px"}}),e(G,{title:ie(t,20,"count")?t:"",children:e(P,{children:re(t,20,"count")})})]}),name:r,value:t}))))(N),targetRef:_,onOptionClick:e=>{const{value:t,name:n=""}=e;Ce(t,parseInt(n))},dropdownPlacement:"top",iconName:"show_script",tooltipTitle:"All Sheets",tooltipPlacement:"top",dropdownHeight:215,selectedValue:j.name})]}),e("div",{className:"ff-excel-tab-container",children:N.map(((t,n)=>e(P,{lineHeight:"16px",children:e("div",{onContextMenu:e=>{Ce(t,n),A&&me(e,t,n)},className:O("ff-excel-tab-list",{active:t===j.name}),onClick:()=>{Ce(t,n)},suppressContentEditableWarning:se===n,onDoubleClick:e=>{"show"===d&&(ce(n),null===se&&setTimeout((()=>(e=>{const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)})(e.target)),0))},contentEditable:C&&se===n,onBlur:e=>{he(e,n,t)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),he(e,n,t))},children:t})},t)))})]}),I.open&&e(Yg,{contextMenu:I,position:X,editable:C}),e(Ta,{})]})})},Jg=({label:t="",isActive:n=!0,onClick:r=()=>{},isFilterChip:i=!1})=>{const o=i?"filter":"module";return e("div",{className:O("ff-module-chip",{"ff-filter-chip":i,[`ff-${o}-chip--active`]:n,[`ff-${o}-chip--hover`]:!n}),onClick:r,children:e(P,{lineHeight:"18px",className:"module-typography",children:t})})},$g=({x:e,y:t,radius:n,startAngle:r,endAngle:i})=>{const o=e+n*Math.cos(r),a=t+n*Math.sin(r),l=e+n*Math.cos(i),s=t+n*Math.sin(i),c=i-r>Math.PI?1:0;return i-r>=2*Math.PI?`\n M ${e+n} ${t}\n A ${n} ${n} 0 1 1 ${e-n} ${t} \n A ${n} ${n} 0 1 1 ${e+n} ${t}\n `:`M ${o} ${a} A ${n} ${n} 0 ${c} 1 ${l} ${s}`},ev=({radius:t=15,lineWidth:r=5,label:i,percentageValue:o,icon:l,fontSize:s=10,labelColor:d="",arcColor:u="var(--brand-color)",backgroundArcColor:f="var(--ff-select-scroll-thumb-color)",isSelectedArch:h=!1,onSelect:C})=>{const[p,m]=c({x:0,y:0}),[g,v]=c(!1),y=a(null);let w=-Math.PI/2;const b=2*(t+r),{backgroundArcPath:E,foregroundArcPath:M}=((e,t,n)=>{const r=t,i=r+Math.max(0,Math.min(e,100))/100*2*Math.PI;return{backgroundArcPath:$g({x:0,y:0,radius:n,startAngle:0,endAngle:2*Math.PI}),foregroundArcPath:$g({x:0,y:0,radius:n,startAngle:r,endAngle:i})}})(o,w,t),A=()=>{v(!0)},x=()=>{m({x:0,y:0}),v(!1)},L=e=>{if(y.current){const t=y.current.getBoundingClientRect();m({x:e.clientX-t.left,y:e.clientY-t.top})}};return n("div",{ref:y,className:"ff-icon-radial-chart-container",style:{"--fontSize":`${s}px`},onClick:C,children:[e("svg",{width:b,height:b,viewBox:`0 0 ${b} ${b}`,role:"img",children:n("g",{transform:`translate(${t+r}, ${t+r})`,children:[e("path",{d:E,fill:"none",stroke:f,strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),e("path",{d:M,fill:"none",stroke:u,strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),h&&e("path",{d:M,fill:"none",stroke:"var(--dotted-border-color)",strokeOpacity:"0.4",strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),l?e("foreignObject",{x:"-10",y:"-10",width:"20",height:"20",children:e(B,{className:"ff-radial-chart-icon-padding",name:l,height:20,width:20})}):e("text",{x:"0",y:"0",fill:d||u,textAnchor:"middle",dominantBaseline:"central",children:`${Math.round(o)}%`})]})}),g&&n("div",{className:"ff-icon-radial-chart-tooltip",style:{position:"absolute",left:`${p.x+15}px`,top:p.y-5+"px"},children:[e(P,{children:`${i} : `}),n(P,{children:[o,"%"]})]})]})},tv=({mediaSrc:t,fileId:r,onExpandClick:i,onDeleteClick:o,onDownloadClick:a,height:l="75px",width:s="79px",fileName:c,thumbnailMediaSrc:d,isDelete:u})=>e("div",{className:"ff-attach-media-container",style:{height:l,width:s},children:n("div",{className:"ff-media-wrapper",style:{height:l,width:s},children:[e("img",{src:d||t,alt:"Attached"}),n("div",{className:"ff-hover-icons",children:[n("div",{className:"ff-top-icons",children:[e("div",{className:"ff-icon-container",children:e(G,{title:"Download File",placement:"bottom",children:e(B,{name:"download_file_icon",height:10,width:10,onClick:a,color:"var(--icons-default-color)"})})}),u&&e("div",{className:"ff-icon-container",children:e(G,{title:"Delete",placement:"bottom",children:e(B,{name:"delete",height:10,width:10,color:"var(--ff-delete-button-attachment)",onClick:()=>{o&&o(r)}})})})]}),e("div",{className:"ff-expand-icon-container",children:e(G,{title:"Maximize",placement:"bottom",children:e(B,{name:"expand_icon",height:16,width:16,onClick:i})})})]}),e(P,{color:"var(--text-area-default-color)",fontWeight:"medium",className:"ff-media-text",children:c})]})}),nv=({icon:r,status:i,count:o,text:a,style:s={width:"196.4px"},resetToggle:d,onSelectedStatus:u=e=>{}})=>{const[f,h]=c(!1),C=["total defects","defect density","open defects","closed defects","quality score"],p=C.includes(i.toLowerCase()),m=C.includes(i.toLowerCase());l((()=>{h(!d)}),[d]);return n("div",{className:`ff-card-container ${i.toLowerCase()} ${f?"toggled":""}`,style:s,onClick:()=>(e=>{C.includes(e.toLowerCase())||(h(!0),u(e))})(i),children:[n("div",{className:"ff-status-bar",children:[e("div",{children:e(B,{name:r,height:20,width:20,hoverEffect:!1})}),!C.includes(i.toLowerCase())&&e(P,{fontWeight:"semi-bold",fontSize:"10px",textAlign:"center",lineHeight:"15px",className:"ff-status-text",as:"div",children:i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()})]}),e("div",{className:"ff-content "+(m?"red-background":""),children:n(t,p?{children:[e(P,{fontWeight:"semi-bold",fontSize:"10px",className:"ff-text",lineHeight:"15px",color:"var(--ff-chip-text-color)",children:a}),e(P,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"36px",children:"defect density"===i.toLowerCase()?n(t,{children:[o.toString().padStart(2,"0"),e(P,{fontSize:"15px",fontWeight:"semi-bold",children:"/ Modules"})]}):"quality score"===i.toLowerCase()?`${parseFloat(o.toString()).toFixed(2)}%`:o.toString().padStart(2,"0")})]}:{children:[e(P,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"24px",color:f?"var(--base-bg-color)":"",children:o.toString().padStart(2,"0")}),e(P,{className:"ff-text",lineHeight:"18px",color:f?"var(--base-bg-color)":"var(--ff-chip-text-color)",children:a})]})})]})},rv=({option:t})=>{const r=a(null),[i,o]=c(!1);l((()=>{const e=r.current;if(!e)return;const t=()=>{o(e.scrollWidth>e.clientWidth)},n=requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t)}}),[t]);const s={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},d=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;return n("div",{style:{width:"-webkit-fill-available"},className:"ff-variable-option ff-variable-data",children:[e(G,{title:i?d(t):"",style:{width:"calc(100% - 32px)"},children:e("span",{ref:r,className:"ff-truncated_text",children:d(t)})}),e(B,{name:(e=>{if(!e)return"";const t=e._id||e.id;return t?.startsWith("PARAMETER")?"step_group_parameter":"LOCAL"===e.type&&"STEPGROUP"===e?.parentVariableType?"step_group_variable":"_startforloop"===e.type?"for_loop_variable":"DATAPROVIDER"===e.type?"data_provider_variable":s[e.type||""]||""})(t),height:24,width:24,hoverEffect:!0})]})};function iv(e){return()=>e}function ov(e){e()}function av(e,t){return n=>e(t(n))}function lv(e,t){return()=>e(t)}function sv(e){return void 0!==e}function cv(){}function dv(e,t){return t(e),e}function uv(e,t){return t(e)}function fv(...e){return e}function hv(e,t){return e(1,t)}function Cv(e,t){e(0,t)}function pv(e){e(2)}function mv(e){return e(4)}function gv(e,t){return hv(e,function(e,t){return n=>e(t,n)}(t,0))}function vv(e,t){const n=e(1,(e=>{n(),t(e)}));return n}function yv(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout((()=>{r(t)}),e)}}function wv(e,t){return e===t}function bv(e=wv){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Ev(e){return t=>n=>{e(n)&&t(n)}}function Mv(e){return t=>av(t,e)}function Av(e){return t=>()=>{t(e)}}function xv(e,...t){const n=function(...e){return t=>e.reduceRight(uv,t)}(...t);return(t,r)=>{switch(t){case 2:return void pv(e);case 1:return hv(e,n(r))}}}function Lv(e,t){return n=>r=>{n(t=e(t,r))}}function kv(e){return t=>n=>{e>0?e--:t(n)}}function Hv(e){let t,n=null;return r=>i=>{n=i,!t&&(t=setTimeout((()=>{t=void 0,r(n)}),e))}}function Sv(...e){const t=new Array(e.length);let n=0,r=null;const i=Math.pow(2,e.length)-1;return e.forEach(((e,o)=>{const a=Math.pow(2,o);hv(e,(e=>{const l=n;n|=a,t[o]=e,l!==i&&n===i&&r&&(r(),r=null)}))})),e=>o=>{const a=()=>{e([o].concat(t))};n===i?a():r=a}}function Vv(e){let t=e;const n=Ov();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function _v(e,t){return dv(Vv(t),(t=>gv(e,t)))}function Ov(){const e=[];return(t,n)=>{switch(t){case 0:return void e.slice().forEach((e=>{e(n)}));case 2:return void e.splice(0,e.length);case 1:return e.push(n),()=>{const t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function Nv(e){return dv(Ov(),(t=>gv(e,t)))}function zv(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Tv(),singleton:n}}const Tv=()=>Symbol();function Dv(...e){const t=Ov(),n=new Array(e.length);let r=0;const i=Math.pow(2,e.length)-1;return e.forEach(((e,o)=>{const a=Math.pow(2,o);hv(e,(e=>{n[o]=e,r|=a,r===i&&Cv(t,n)}))})),function(e,o){switch(e){case 2:return void pv(t);case 1:return r===i&&o(n),hv(t,o)}}}function Iv(e,t=wv){return xv(e,bv(t))}function Zv(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(ov)}}(...e.map((e=>hv(e,n))))}}}var jv=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(jv||{});const Rv={0:"debug",3:"error",1:"log",2:"warn"},Bv=zv((()=>{const e=Vv(3);return{log:Vv(((t,n,r=1)=>{var i;r>=(null!=(i=(typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:mv(e))&&console[Rv[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)})),logLevel:e}}),[],{singleton:!0});function Pv(e,t,n){return Fv(e,t,n).callbackRef}function Fv(e,t,n){const r=i.useRef(null);let o=e=>{};const a=i.useMemo((()=>typeof ResizeObserver<"u"?new ResizeObserver((t=>{const r=()=>{const n=t[0].target;null!==n.offsetParent&&e(n)};n?r():requestAnimationFrame(r)})):null),[e,n]);return o=e=>{e&&t?(null==a||a.observe(e),r.current=e):(r.current&&(null==a||a.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function Uv(e,t,n,r,o,a,l,s,c){const d=i.useCallback((n=>{const i=function(e,t,n,r){const i=e.length;if(0===i)return null;const o=[];for(let a=0;a<i;a++){const i=e.item(a);if(void 0===i.dataset.index)continue;const l=parseInt(i.dataset.index),s=parseFloat(i.dataset.knownSize),c=t(i,n);if(0===c&&r("Zero-sized element, this should not happen",{child:i},jv.ERROR),c===s)continue;const d=o[o.length-1];0===o.length||d.size!==c||d.endIndex!==l-1?o.push({endIndex:l,size:c,startIndex:l}):o[o.length-1].endIndex++}return o}(n.children,t,s?"offsetWidth":"offsetHeight",o);let c=n.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const d="window"===c.lastElementChild.dataset.viewportType;let u;d&&(u=c.ownerDocument.defaultView);const f=l?s?l.scrollLeft:l.scrollTop:d?s?u.scrollX||u.document.documentElement.scrollLeft:u.scrollY||u.document.documentElement.scrollTop:s?c.scrollLeft:c.scrollTop,h=l?s?l.scrollWidth:l.scrollHeight:d?s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight:s?c.scrollWidth:c.scrollHeight,C=l?s?l.offsetWidth:l.offsetHeight:d?s?u.innerWidth:u.innerHeight:s?c.offsetWidth:c.offsetHeight;r({scrollHeight:h,scrollTop:Math.max(f,0),viewportHeight:C}),null==a||a(s?qv("column-gap",getComputedStyle(n).columnGap,o):qv("row-gap",getComputedStyle(n).rowGap,o)),null!==i&&e(i)}),[e,t,o,a,l,r,s]);return Fv(d,n,c)}function qv(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,jv.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}function Wv(e,t,n){const r=i.useRef(null),o=i.useCallback((n=>{if(null==n||!n.offsetParent)return;const i=n.getBoundingClientRect(),o=i.width;let a,s;if(t){const e=t.getBoundingClientRect(),n=i.top-e.top;s=e.height-Math.max(0,n),a=n+t.scrollTop}else{const e=l.current.ownerDocument.defaultView;s=e.innerHeight-Math.max(0,i.top),a=i.top+e.scrollY}r.current={offsetTop:a,visibleHeight:s,visibleWidth:o},e(r.current)}),[e,t]),{callbackRef:a,ref:l}=Fv(o,!0,n),s=i.useCallback((()=>{o(l.current)}),[o,l]);return i.useEffect((()=>{var e;if(t){t.addEventListener("scroll",s);const e=new ResizeObserver((()=>{requestAnimationFrame(s)}));return e.observe(t),()=>{t.removeEventListener("scroll",s),e.unobserve(t)}}{const t=null==(e=l.current)?void 0:e.ownerDocument.defaultView;return null==t||t.addEventListener("scroll",s),null==t||t.addEventListener("resize",s),()=>{null==t||t.removeEventListener("scroll",s),null==t||t.removeEventListener("resize",s)}}}),[s,t,l]),a}const Qv=zv((()=>{const e=Ov(),t=Ov(),n=Vv(0),r=Ov(),i=Vv(0),o=Ov(),a=Ov(),l=Vv(0),s=Vv(0),c=Vv(0),d=Vv(0),u=Ov(),f=Ov(),h=Vv(!1),C=Vv(!1),p=Vv(!1);return gv(xv(e,Mv((({scrollTop:e})=>e))),t),gv(xv(e,Mv((({scrollHeight:e})=>e))),a),gv(t,i),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:s,footerHeight:d,headerHeight:l,horizontalDirection:C,scrollBy:f,scrollContainerState:e,scrollHeight:a,scrollingInProgress:h,scrollTo:u,scrollTop:t,skipAnimationFrameInResizeObserver:p,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:o}}),[],{singleton:!0}),Gv={lvl:0};function Kv(e,t){const n=e.length;if(0===n)return[];let{index:r,value:i}=t(e[0]);const o=[];for(let a=1;a<n;a++){const{index:n,value:l}=t(e[a]);o.push({end:n-1,start:r,value:i}),r=n,i=l}return o.push({end:1/0,start:r,value:i}),o}function Yv(e){return e===Gv}function Xv(e,t){if(!Yv(e))return t===e.k?e.v:t<e.k?Xv(e.l,t):Xv(e.r,t)}function Jv(e,t,n="k"){if(Yv(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Jv(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Jv(e.l,t,n)}function $v(e,t,n){return Yv(e)?dy(t,n,1):t===e.k?ay(e,{k:t,v:n}):t<e.k?uy(ay(e,{l:$v(e.l,t,n)})):uy(ay(e,{r:$v(e.r,t,n)}))}function ey(){return Gv}function ty(e,t,n){if(Yv(e))return[];return function(e){return Kv(e,(({k:e,v:t})=>({index:e,value:t})))}(iy(e,Jv(e,t)[0],n))}function ny(e,t){if(Yv(e))return Gv;const{k:n,l:r,r:i}=e;if(t===n){if(Yv(r))return i;if(Yv(i))return r;{const[t,n]=cy(r);return oy(ay(e,{k:t,l:ly(r),v:n}))}}return oy(ay(e,t<n?{l:ny(r,t)}:{r:ny(i,t)}))}function ry(e){return Yv(e)?[]:[...ry(e.l),{k:e.k,v:e.v},...ry(e.r)]}function iy(e,t,n){if(Yv(e))return[];const{k:r,l:i,r:o,v:a}=e;let l=[];return r>t&&(l=l.concat(iy(i,t,n))),r>=t&&r<=n&&l.push({k:r,v:a}),r<=n&&(l=l.concat(iy(o,t,n))),l}function oy(e){const{l:t,lvl:n,r:r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(sy(t))return fy(ay(e,{lvl:n-1}));if(!Yv(t)&&!Yv(t.r))return ay(t.r,{l:ay(t,{r:t.r.l}),lvl:n,r:ay(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(sy(e))return hy(ay(e,{lvl:n-1}));if(Yv(r)||Yv(r.l))throw new Error("Unexpected empty nodes");{const t=r.l,i=sy(t)?r.lvl-1:r.lvl;return ay(t,{l:ay(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:hy(ay(r,{l:t.r,lvl:i}))})}}function ay(e,t){return dy(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function ly(e){return Yv(e.r)?e.l:oy(ay(e,{r:ly(e.r)}))}function sy(e){return Yv(e)||e.lvl>e.r.lvl}function cy(e){return Yv(e.r)?[e.k,e.v]:cy(e.r)}function dy(e,t,n,r=Gv,i=Gv){return{k:e,l:r,lvl:n,r:i,v:t}}function uy(e){return hy(fy(e))}function fy(e){const{l:t}=e;return Yv(t)||t.lvl!==e.lvl?e:ay(t,{r:ay(e,{l:t.r})})}function hy(e){const{lvl:t,r:n}=e;return Yv(n)||Yv(n.r)||n.lvl!==t||n.r.lvl!==t?e:ay(n,{l:ay(e,{r:n.l}),lvl:t+1})}function Cy(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function py(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const my=zv((()=>({recalcInProgress:Vv(!1)})),[],{singleton:!0});function gy(e,t,n){return e[vy(e,t,n)]}function vy(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const o=Math.floor((r+i)/2),a=n(e[o],t);if(0===a)return o;if(-1===a){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function yy(e,t){return Math.round(e.getBoundingClientRect()[t])}function wy(e){return!Yv(e.groupOffsetTree)}function by({index:e},t){return t===e?0:t<e?-1:1}function Ey({offset:e},t){return t===e?0:t<e?-1:1}function My(e,t,n){if(0===t.length)return 0;const{index:r,offset:i,size:o}=gy(t,e,by),a=e-r,l=o*a+(a-1)*n+i;return l>0?l+n:l}function Ay(e,t){if(!wy(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function xy(e,t,n){if(function(e){return typeof e.groupIndex<"u"}(e))return t.groupIndices[e.groupIndex]+1;{let r=Ay("LAST"===e.index?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}}function Ly(e,t,n,r=0){return r>0&&(t=Math.max(t,gy(e,r,by).offset)),Kv(function(e,t,n,r){const i=vy(e,t,r),o=vy(e,n,r,i);return e.slice(i,o+1)}(e,t,n,Ey),Vy)}function ky(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,jv.DEBUG);const o=e.sizeTree;let a=o,l=0;if(n.length>0&&Yv(o)&&2===t.length){const e=t[0].size,r=t[1].size;a=n.reduce(((t,n)=>$v($v(t,n,e),n+1,r)),a)}else[a,l]=function(e,t){let n=Yv(e)?0:1/0;for(const r of t){const{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),Yv(e)){e=$v(e,0,i);continue}const a=ty(e,o-1,t+1);if(a.some(_y(r)))continue;let l=!1,s=!1;for(const{end:n,start:r,value:o}of a)l?(t>=r||i===o)&&(e=ny(e,r)):(s=o!==i,l=!0),n>t&&t>=r&&o!==i&&(e=$v(e,t+1,o));s&&(e=$v(e,o,i))}return[e,n]}(a,t);if(a===o)return e;const{lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u}=Sy(e.offsetTree,l,a,i);return{groupIndices:n,groupOffsetTree:n.reduce(((e,t)=>$v(e,t,My(t,u,i))),ey()),lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:a}}function Hy(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function Sy(e,t,n,r){let i=e,o=0,a=0,l=0,s=0;if(0!==t){s=vy(i,t-1,by),l=i[s].offset;const e=Jv(n,t-1);o=e[0],a=e[1],i.length&&i[s].size===Jv(n,t)[1]&&(s-=1),i=i.slice(0,s+1)}else i=[];for(const{start:e,value:s}of ty(n,t,1/0)){const t=e-o,n=t*a+l+t*r;i.push({index:e,offset:n,size:s}),o=e,l=n,a=s}return{lastIndex:o,lastOffset:l,lastSize:a,offsetTree:i}}function Vy(e){return{index:e.index,value:e}}function _y(e){const{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}const Oy={offsetHeight:"height",offsetWidth:"width"},Ny=zv((([{log:e},{recalcInProgress:t}])=>{const n=Ov(),r=Ov(),i=_v(r,0),o=Ov(),a=Ov(),l=Vv(0),s=Vv([]),c=Vv(void 0),d=Vv(void 0),u=Vv(((e,t)=>yy(e,Oy[t]))),f=Vv(void 0),h=Vv(0),C={groupIndices:[],groupOffsetTree:ey(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ey()},p=_v(xv(n,Sv(s,e,h),Lv(ky,C),bv()),C),m=_v(xv(s,bv(),Lv(((e,t)=>({current:t,prev:e.current})),{current:[],prev:[]}),Mv((({prev:e})=>e))),[]);gv(xv(s,Ev((e=>e.length>0)),Sv(p,h),Mv((([e,t,n])=>{const r=e.reduce(((e,r,i)=>$v(e,r,My(r,t.offsetTree,n)||i)),ey());return{...t,groupIndices:e,groupOffsetTree:r}}))),p),gv(xv(r,Sv(p),Ev((([e,{lastIndex:t}])=>e<t)),Mv((([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}]))),n),gv(c,d);const g=_v(xv(c,Mv((e=>void 0===e))),!0);gv(xv(d,Ev((e=>void 0!==e&&Yv(mv(p).sizeTree))),Mv((e=>[{endIndex:0,size:e,startIndex:0}]))),n);const v=Nv(xv(n,Sv(p),Lv((({sizes:e},[t,n])=>({changed:n!==e,sizes:n})),{changed:!1,sizes:C}),Mv((e=>e.changed))));hv(xv(l,Lv(((e,t)=>({diff:e.prev-t,prev:t})),{diff:0,prev:0}),Mv((e=>e.diff))),(e=>{const{groupIndices:n}=mv(p);if(e>0)Cv(t,!0),Cv(o,e+Hy(e,n));else if(e<0){const t=mv(m);t.length>0&&(e-=Hy(-e,t)),Cv(a,e)}})),hv(xv(l,Sv(e)),(([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},jv.ERROR)}));const y=Nv(o);gv(xv(o,Sv(p),Mv((([e,t])=>{const n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){const n=Xv(t.sizeTree,0);let o=0,a=0;for(;o<e;){const e=t.groupIndices[a],l=t.groupIndices.length===a+1?1/0:t.groupIndices[a+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+l-1,size:i,startIndex:e+1}),a++,o+=l+1}const l=ry(t.sizeTree);return o!==e&&l.shift(),l.reduce(((t,{k:n,v:r})=>{let i=t.ranges;return 0!==t.prevSize&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}}),{prevIndex:e,prevSize:0,ranges:r}).ranges}return ry(t.sizeTree).reduce(((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]})),{prevIndex:0,prevSize:i,ranges:[]}).ranges}))),n);const w=Nv(xv(a,Sv(p,h),Mv((([e,{offsetTree:t},n])=>My(-e,t,n)))));return gv(xv(a,Sv(p,h),Mv((([e,t,n])=>{if(t.groupIndices.length>0){if(Yv(t.sizeTree))return t;let r=ey();const i=mv(m);let o=0,a=0,l=0;for(;o<-e;){l=i[a];const e=i[a+1]-l-1;a++,o+=e+1}if(r=ry(t.sizeTree).reduce(((t,{k:n,v:r})=>$v(t,Math.max(0,n+e),r)),r),o!==-e){r=$v(r,0,Xv(t.sizeTree,l));r=$v(r,1,Jv(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...Sy(t.offsetTree,0,r,n)}}{const r=ry(t.sizeTree).reduce(((t,{k:n,v:r})=>$v(t,Math.max(0,n+e),r)),ey());return{...t,sizeTree:r,...Sy(t.offsetTree,0,r,n)}}}))),p),{beforeUnshiftWith:y,data:f,defaultItemSize:d,firstItemIndex:l,fixedItemSize:c,gap:h,groupIndices:s,itemSize:u,listRefresh:v,shiftWith:a,shiftWithOffset:w,sizeRanges:n,sizes:p,statefulTotalCount:i,totalCount:r,trackItemSizes:g,unshiftWith:o}}),fv(Bv,my),{singleton:!0});function zy(e){return e.reduce(((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e)),{groupIndices:[],totalCount:0})}const Ty=zv((([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{const o=Ov(),a=Ov(),l=Nv(xv(o,Mv(zy)));return gv(xv(l,Mv((e=>e.totalCount))),n),gv(xv(l,Mv((e=>e.groupIndices))),e),gv(xv(Dv(i,t,r),Ev((([e,t])=>wy(t))),Mv((([e,t,n])=>Jv(t.groupOffsetTree,Math.max(e-n,0),"v")[0])),bv(),Mv((e=>[e]))),a),{groupCounts:o,topItemsIndexes:a}}),fv(Ny,Qv)),Dy=zv((([{log:e}])=>{const t=Vv(!1),n=Nv(xv(t,Ev((e=>e)),bv()));return hv(t,(t=>{t&&mv(e)("props updated",{},jv.DEBUG)})),{didMount:n,propsReady:t}}),fv(Bv),{singleton:!0}),Iy=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Zy(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Iy)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const jy=zv((([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:a,headerHeight:l,scrollingInProgress:s,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:u},{log:f}])=>{const h=Ov(),C=Ov(),p=Vv(0);let m=null,g=null,v=null;function y(){m&&(m(),m=null),v&&(v(),v=null),g&&(clearTimeout(g),g=null),Cv(s,!1)}return gv(xv(h,Sv(n,u,r,p,l,a,f),Sv(e,o,i),Mv((([[e,n,r,i,o,a,l,c],u,f,p])=>{const w=Zy(e),{align:b,behavior:E,offset:M}=w,A=i-1,x=xy(w,n,A);let L=My(x,n.offsetTree,u)+a;"end"===b?(L+=f+Jv(n.sizeTree,x)[1]-r+p,x===A&&(L+=l)):"center"===b?L+=(f+Jv(n.sizeTree,x)[1]-r+p)/2:L-=o,M&&(L+=M);const k=t=>{y(),t?(c("retrying to scroll to",{location:e},jv.DEBUG),Cv(h,e)):(Cv(C,!0),c("list did not change, scroll successful",{},jv.DEBUG))};if(y(),"smooth"===E){let e=!1;v=hv(t,(t=>{e=e||t})),m=vv(d,(()=>{k(e)}))}else m=vv(xv(t,function(e){return t=>{const n=setTimeout((()=>{t(!1)}),e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),k);return g=setTimeout((()=>{y()}),1200),Cv(s,!0),c("scrolling from index to",{behavior:E,index:x,top:L},jv.DEBUG),{behavior:E,top:L}}))),c),{scrollTargetReached:C,scrollToIndex:h,topListHeight:p}}),fv(Ny,Qv,Bv),{singleton:!0});function Ry(e,t){0==e?t():requestAnimationFrame((()=>{Ry(e-1,t)}))}function By(e,t){const n=t-1;return"number"==typeof e?e:"LAST"===e.index?n:e.index}const Py=zv((([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:a}])=>{const l=Vv(!0),s=Vv(0),c=Vv(!0);return gv(xv(a,Sv(s),Ev((([e,t])=>!!t)),Av(!1)),l),gv(xv(a,Sv(s),Ev((([e,t])=>!!t)),Av(!1)),c),hv(xv(Dv(t,a),Sv(l,n,e,c),Ev((([[,e],t,{sizeTree:n},r,i])=>e&&(!Yv(n)||sv(r))&&!t&&!i)),Sv(s)),(([,e])=>{vv(i,(()=>{Cv(c,!0)})),Ry(4,(()=>{vv(r,(()=>{Cv(l,!0)})),Cv(o,e)}))})),{initialItemFinalLocationReached:c,initialTopMostItemIndex:s,scrolledToInitialItem:l}}),fv(Ny,Qv,jy,Dy),{singleton:!0});function Fy(e,t){return Math.abs(e-t)<1.01}const Uy="up",qy="down",Wy={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Qy=zv((([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{const a=Vv(!1),l=Vv(!0),s=Ov(),c=Ov(),d=Vv(4),u=Vv(0),f=_v(xv(Zv(xv(Iv(i),kv(1),Av(!0)),xv(Iv(i),kv(1),Av(!1),yv(100))),bv()),!1),h=_v(xv(Zv(xv(n,Av(!0)),xv(n,Av(!1),yv(200))),bv()),!1);gv(xv(Dv(Iv(i),Iv(u)),Mv((([e,t])=>e<=t)),bv()),l),gv(xv(l,Hv(50)),c);const C=Nv(xv(Dv(r,Iv(o),Iv(t),Iv(e),Iv(d)),Lv(((e,[{scrollHeight:t,scrollTop:n},r,i,o,a])=>{const l={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-a){let t,r;return n>e.state.scrollTop?(t="SCROLLED_DOWN",r=e.state.scrollTop-n):(t="SIZE_DECREASED",r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:l}}let s;return s=l.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":r<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":n<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:s,state:l}}),Wy),bv(((e,t)=>e&&e.atBottom===t.atBottom)))),p=_v(xv(r,Lv(((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(Fy(e.scrollHeight,t))return{changed:!1,jump:0,scrollHeight:t,scrollTop:n};{const i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}}),{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ev((e=>e.changed)),Mv((e=>e.jump))),0);gv(xv(C,Mv((e=>e.atBottom))),a),gv(xv(a,Hv(50)),s);const m=Vv(qy);gv(xv(r,Mv((({scrollTop:e})=>e)),bv(),Lv(((e,t)=>mv(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Uy:qy,prevScrollTop:t}),{direction:qy,prevScrollTop:0}),Mv((e=>e.direction))),m),gv(xv(r,Hv(50),Av("none")),m);const g=Vv(0);return gv(xv(f,Ev((e=>!e)),Av(0)),g),gv(xv(i,Hv(100),Sv(f),Ev((([e,t])=>!!t)),Lv((([e,t],[n])=>[t,n]),[0,0]),Mv((([e,t])=>t-e))),g),{atBottomState:C,atBottomStateChange:s,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:a,isAtTop:l,isScrolling:f,lastJumpDueToItemResize:p,scrollDirection:m,scrollVelocity:g}}),fv(Qv)),Gy="top",Ky="bottom",Yy="none";function Xy(e,t,n){return"number"==typeof e?n===Uy&&t===Gy||n===qy&&t===Ky?e:0:n===Uy?t===Gy?e.main:e.reverse:t===Ky?e.main:e.reverse}function Jy(e,t){var n;return"number"==typeof e?e:null!=(n=e[t])?n:0}const $y=zv((([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const o=Ov(),a=Vv(0),l=Vv(0),s=Vv(0),c=_v(xv(Dv(Iv(r),Iv(i),Iv(n),Iv(o,py),Iv(s),Iv(a),Iv(t),Iv(e),Iv(l)),Mv((([e,t,n,[r,i],o,a,l,s,c])=>{const d=e-s,u=a+l,f=Math.max(n-d,0);let h=Yy;const C=Jy(c,Gy),p=Jy(c,Ky);return r-=s,i+=n+l,(r+=n+l)>e+u-C&&(h=Uy),(i-=s)<e-f+t+p&&(h=qy),h!==Yy?[Math.max(d-n-Xy(o,Gy,h)-C,0),d-f-l+t+Xy(o,Ky,h)+p]:null})),Ev((e=>null!=e)),bv(py)),[0,0]);return{increaseViewportBy:l,listBoundary:o,overscan:s,topListHeight:a,visibleRange:c}}),fv(Qv),{singleton:!0});const ew={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function tw(e,t,n,r,i,o){const{lastIndex:a,lastOffset:l,lastSize:s}=i;let c=0,d=0;if(e.length>0){c=e[0].offset;const t=e[e.length-1];d=t.offset+t.size}const u=n-a,f=c,h=l+u*s+(u-1)*r-d;return{bottom:d,firstItemIndex:o,items:rw(e,i,o),offsetBottom:h,offsetTop:c,top:f,topItems:rw(t,i,o),topListHeight:t.reduce(((e,t)=>t.size+e),0),totalCount:n}}function nw(e,t,n,r,i,o){let a=0;if(n.groupIndices.length>0)for(const t of n.groupIndices){if(t-a>=e)break;a++}const l=e+a,s=By(t,l);return tw(Array.from({length:l}).map(((e,t)=>({data:o[t+s],index:t+s,offset:0,size:0}))),[],l,i,n,r)}function rw(e,t,n){if(0===e.length)return[];if(!wy(t))return e.map((e=>({...e,index:e.index+n,originalIndex:e.index})));const r=e[0].index,i=e[e.length-1].index,o=[],a=ty(t.groupOffsetTree,r,i);let l,s=0;for(const r of e){let e;(!l||l.end<r.index)&&(l=a.shift(),s=t.groupIndices.indexOf(l.start)),e=r.index===l.start?{index:s,type:"group"}:{groupIndex:s,index:r.index-(s+1)+n},o.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return o}const iw=zv((([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:a,topListHeight:l,visibleRange:s},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:u},f,{didMount:h},{recalcInProgress:C}])=>{const p=Vv([]),m=Vv(0),g=Ov();gv(o.topItemsIndexes,p);const v=_v(xv(Dv(h,C,Iv(s,py),Iv(i),Iv(r),Iv(c),d,Iv(p),Iv(t),Iv(n),e),Ev((([e,t,,n,,,,,,,r])=>{const i=r&&r.length!==n;return e&&!t&&!i})),Mv((([,,[e,t],n,r,i,o,a,l,s,c])=>{const d=r,{offsetTree:u,sizeTree:f}=d,h=mv(m);if(0===n)return{...ew,totalCount:n};if(0===e&&0===t)return 0===h?{...ew,totalCount:n}:nw(h,i,r,l,s,c||[]);if(Yv(f))return h>0?null:tw(function(e,t,n){if(wy(t)){const r=Ay(e,t);return[{index:Jv(t.groupOffsetTree,r)[0],offset:0,size:0},{data:null==n?void 0:n[0],index:r,offset:0,size:0}]}return[{data:null==n?void 0:n[0],index:e,offset:0,size:0}]}(By(i,n),d,c),[],n,s,d,l);const C=[];if(a.length>0){const e=a[0],t=a[a.length-1];let n=0;for(const r of ty(f,e,t)){const i=r.value,o=Math.max(r.start,e),a=Math.min(r.end,t);for(let e=o;e<=a;e++)C.push({data:null==c?void 0:c[e],index:e,offset:n,size:i}),n+=i}}if(!o)return tw([],C,n,s,d,l);const p=a.length>0?a[a.length-1]+1:0,g=Ly(u,e,t,p);if(0===g.length)return null;const v=n-1,y=dv([],(n=>{for(const r of g){const i=r.value;let o=i.offset,a=r.start;const l=i.size;if(i.offset<e){a+=Math.floor((e-i.offset+s)/(l+s));const t=a-r.start;o+=t*l+t*s}a<p&&(o+=(p-a)*l,a=p);const d=Math.min(r.end,v);for(let e=a;e<=d&&!(o>=t);e++)n.push({data:null==c?void 0:c[e],index:e,offset:o,size:l}),o+=l+s}}));return tw(y,C,n,s,d,l)})),Ev((e=>null!==e)),bv()),ew);gv(xv(e,Ev(sv),Mv((e=>null==e?void 0:e.length))),i),gv(xv(v,Mv((e=>e.topListHeight))),u),gv(u,l),gv(xv(v,Mv((e=>[e.top,e.bottom]))),a),gv(xv(v,Mv((e=>e.items))),g);const y=Nv(xv(v,Ev((({items:e})=>e.length>0)),Sv(i,e),Ev((([{items:e},t])=>e[e.length-1].originalIndex===t-1)),Mv((([,e,t])=>[e-1,t])),bv(py),Mv((([e])=>e)))),w=Nv(xv(v,Hv(200),Ev((({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length)),Mv((({items:e})=>e[0].index)),bv())),b=Nv(xv(v,Ev((({items:e})=>e.length>0)),Mv((({items:e})=>{let t=0,n=e.length-1;for(;"group"===e[t].type&&t<n;)t++;for(;"group"===e[n].type&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}})),bv(Cy)));return{endReached:y,initialItemCount:m,itemsRendered:g,listState:v,rangeChanged:b,startReached:w,topItemsIndexes:p,...f}}),fv(Ny,Ty,$y,Py,jy,Qy,Dy,my),{singleton:!0}),ow=zv((([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const o=Ov(),a=_v(xv(Dv(n,e,r,t,i),Mv((([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom))),0);return gv(Iv(a),o),{totalListHeight:a,totalListHeightChanged:o}}),fv(Qv,iw),{singleton:!0}),aw=zv((([{viewportHeight:e},{totalListHeight:t}])=>{const n=Vv(!1);return{alignToBottom:n,paddingTopAddition:_v(xv(Dv(n,e,t),Ev((([e])=>e)),Mv((([,e,t])=>Math.max(0,e-t))),Hv(0),bv()),0)}}),fv(Qv,ow),{singleton:!0}),lw=zv((()=>({context:Vv(null)}))),sw=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:a})=>t<a?{...i,align:null!=n?n:"start",behavior:r}:e>o?{...i,align:null!=n?n:"end",behavior:r}:null,cw=zv((([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:a,scrollTop:l,viewportHeight:s},{scrollToIndex:c}])=>{const d=Ov();return gv(xv(d,Sv(t,s,n,o,i,r,l),Sv(e),Mv((([[e,t,n,r,i,o,l,s],c])=>{const{align:d,behavior:u,calculateViewLocation:f=sw,done:h,...C}=e,p=xy(e,t,r-1),m=My(p,t.offsetTree,c)+i+o,g=f({itemBottom:m+Jv(t.sizeTree,p)[1],itemTop:m,locationParams:{align:d,behavior:u,...C},viewportBottom:s+n-l,viewportTop:s+o});return g?h&&vv(xv(a,Ev((e=>!e)),kv(mv(a)?1:2)),h):h&&h(),g})),Ev((e=>null!==e))),c),{scrollIntoView:d}}),fv(Ny,Qv,jy,iw,Bv),{singleton:!0});function dw(e){return!!e&&("smooth"===e?"smooth":"auto")}const uw=zv((([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:o},{scrollToIndex:a},{scrolledToInitialItem:l},{didMount:s,propsReady:c},{log:d},{scrollingInProgress:u},{context:f},{scrollIntoView:h}])=>{const C=Vv(!1),p=Ov();let m=null;function g(e){Cv(a,{align:"end",behavior:e,index:"LAST"})}function v(e){const t=vv(i,(t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&!m&&(mv(d)("scrolling to bottom due to increased size",{},jv.DEBUG),g("auto"))}));setTimeout(t,100)}hv(xv(Dv(xv(Iv(t),kv(1)),s),Sv(Iv(C),o,l,u),Mv((([[e,t],n,r,i,o])=>{let a=t&&i,l="auto";return a&&(l=((e,t)=>"function"==typeof e?dw(e(t)):t&&dw(e))(n,r||o),a=a&&!!l),{followOutputBehavior:l,shouldFollow:a,totalCount:e}})),Ev((({shouldFollow:e})=>e))),(({followOutputBehavior:t,totalCount:r})=>{m&&(m(),m=null),mv(n)?requestAnimationFrame((()=>{mv(d)("following output to ",{totalCount:r},jv.DEBUG),g(t)})):m=vv(e,(()=>{mv(d)("following output to ",{totalCount:r},jv.DEBUG),g(t),m=null}))})),hv(xv(Dv(Iv(C),t,c),Ev((([e,,t])=>e&&t)),Lv((({value:e},[,t])=>({refreshed:e===t,value:t})),{refreshed:!1,value:0}),Ev((({refreshed:e})=>e)),Sv(C,t)),(([,e])=>{mv(l)&&v(!1!==e)})),hv(p,(()=>{v(!1!==mv(C))})),hv(Dv(Iv(C),i),(([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&g("auto")}));const y=Vv(null),w=Ov();return gv(Zv(xv(Iv(r),Mv((e=>{var t;return null!=(t=null==e?void 0:e.length)?t:0}))),xv(Iv(t))),w),hv(xv(Dv(xv(w,kv(1)),s),Sv(Iv(y),l,u,f),Mv((([[e,t],n,r,i,o])=>t&&r&&(null==n?void 0:n({context:o,totalCount:e,scrollingInProgress:i})))),Ev((e=>!!e)),Hv(0)),(t=>{m&&(m(),m=null),mv(n)?requestAnimationFrame((()=>{mv(d)("scrolling into view",{}),Cv(h,t)})):m=vv(e,(()=>{mv(d)("scrolling into view",{}),Cv(h,t),m=null}))})),{autoscrollToBottom:p,followOutput:C,scrollIntoViewOnChange:y}}),fv(Ny,Qy,jy,Py,Dy,Bv,Qv,lw,cw)),fw=zv((([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:a},{didMount:l}])=>(gv(xv(l,Sv(o),Ev((([,e])=>0!==e)),Sv(i,r,t,n,e),Mv((([[,e],t,n,r,i,o=[]])=>nw(e,t,n,r,i,o)))),a),{})),fv(Ny,Py,iw,Dy),{singleton:!0}),hw=zv((([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Vv(0);return hv(xv(e,Sv(r),Ev((([,e])=>0!==e)),Mv((([,e])=>({top:e})))),(e=>{vv(xv(n,kv(1),Ev((e=>e.items.length>1))),(()=>{requestAnimationFrame((()=>{Cv(t,e)}))}))})),{initialScrollTop:r}}),fv(Dy,Qv,iw),{singleton:!0}),Cw=zv((([{scrollVelocity:e}])=>{const t=Vv(!1),n=Ov(),r=Vv(!1);return gv(xv(e,Sv(r,t,n),Ev((([e,t])=>!!t)),Mv((([e,t,n,r])=>{const{enter:i,exit:o}=t;if(n){if(o(e,r))return!1}else if(i(e,r))return!0;return n})),bv()),t),hv(xv(Dv(t,e,n),Sv(r)),(([[e,t,n],r])=>{e&&r&&r.change&&r.change(t,n)})),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}}),fv(Qy),{singleton:!0}),pw=zv((([{scrollContainerState:e,scrollTo:t}])=>{const n=Ov(),r=Ov(),i=Ov(),o=Vv(!1),a=Vv(void 0);return gv(xv(Dv(n,r),Mv((([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n})))),e),gv(xv(t,Sv(r),Mv((([e,{offsetTop:t}])=>({...e,top:e.top+t})))),i),{customScrollParent:a,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}}),fv(Qv)),mw=zv((([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:a,windowScrollContainerState:l,windowViewportRect:s}])=>{const c=Ov(),d=Vv(void 0),u=Vv(null),f=Vv(null);return gv(l,u),gv(s,f),hv(xv(c,Sv(t,r,a,u,f,n)),(([e,t,n,r,i,o,a])=>{const l=function(e){return ry(e).map((({k:e,v:t},n,r)=>{const i=r[n+1];return{endIndex:i?i.k-1:1/0,size:t,startIndex:e}}))}(t.sizeTree);r&&null!==i&&null!==o&&(n=i.scrollTop-o.offsetTop),e({ranges:l,scrollTop:n-=a})})),gv(xv(d,Ev(sv),Mv(gw)),i),gv(xv(o,Sv(d),Ev((([,e])=>void 0!==e)),bv(),Mv((([,e])=>e.ranges))),e),{getState:c,restoreStateFrom:d}}),fv(Ny,Qv,Py,Dy,pw));function gw(e){return{align:"start",index:0,offset:e.scrollTop}}const vw=zv((([{topItemsIndexes:e}])=>{const t=Vv(0);return gv(xv(t,Ev((e=>e>=0)),Mv((e=>Array.from({length:e}).map(((e,t)=>t))))),e),{topItemCount:t}}),fv(iw));function yw(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const ww=yw((()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent))),bw=zv((([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:o,lastJumpDueToItemResize:a,scrollDirection:l},{listState:s},{beforeUnshiftWith:c,gap:d,shiftWithOffset:u,sizes:f},{log:h},{recalcInProgress:C}])=>{const p=Nv(xv(s,Sv(a),Lv((([,e,t,n],[{bottom:r,items:i,offsetBottom:o,totalCount:a},l])=>{const s=r+o;let c=0;return t===a&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||(c=s-n,0!==c&&(c+=l))),[c,i,a,s]}),[0,[],0,0]),Ev((([e])=>0!==e)),Sv(r,l,n,i,h,C),Ev((([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===Uy)),Mv((([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},jv.DEBUG),e)))));function m(n){n>0?(Cv(t,{behavior:"auto",top:-n}),Cv(e,0)):(Cv(e,0),Cv(t,{behavior:"auto",top:-n}))}return hv(xv(p,Sv(e,o)),(([t,n,r])=>{r&&ww()?Cv(e,n-t):m(-t)})),hv(xv(Dv(_v(o,!1),e,C),Ev((([e,t,n])=>!e&&!n&&0!==t)),Mv((([e,t])=>t)),Hv(1)),m),gv(xv(u,Mv((e=>({top:-e})))),t),hv(xv(c,Sv(f,d),Mv((([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function o(e){return e*(n+i)}if(0===t.length)return o(e);{let n=0;const i=Xv(r,0);let a=0,l=0;for(;a<e;){a++,n+=i;let r=t.length===l+1?1/0:t[l+1]-t[l]-1;a+r>e&&(n-=i,r=e-a+1),a+=r,n+=o(r),l++}return n}}))),(n=>{Cv(e,n),requestAnimationFrame((()=>{Cv(t,{top:n}),requestAnimationFrame((()=>{Cv(e,0),Cv(C,!1)}))}))})),{deviation:e}}),fv(Qv,Qy,iw,Ny,Bv,my)),Ew=zv((([e,t,n,r,i,o,a,l,s,c,d])=>({...e,...t,...n,...r,...i,...o,...a,...l,...s,...c,...d})),fv($y,fw,Dy,Cw,ow,hw,aw,pw,cw,Bv,lw)),Mw=zv((([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,gap:i,groupIndices:o,itemSize:a,sizeRanges:l,sizes:s,statefulTotalCount:c,totalCount:d,trackItemSizes:u},{initialItemFinalLocationReached:f,initialTopMostItemIndex:h,scrolledToInitialItem:C},p,m,g,{listState:v,topItemsIndexes:y,...w},{scrollToIndex:b},E,{topItemCount:M},{groupCounts:A},x])=>(gv(w.rangeChanged,x.scrollSeekRangeChanged),gv(xv(x.windowViewportRect,Mv((e=>e.visibleHeight))),p.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,gap:i,groupCounts:A,initialItemFinalLocationReached:f,initialTopMostItemIndex:h,scrolledToInitialItem:C,sizeRanges:l,topItemCount:M,topItemsIndexes:y,totalCount:d,...g,groupIndices:o,itemSize:a,listState:v,scrollToIndex:b,statefulTotalCount:c,trackItemSizes:u,...w,...x,...p,sizes:s,...m})),fv(Ny,Py,Qv,mw,uw,iw,jy,bw,vw,Ty,Ew));function Aw(e,t){const n={},r={};let i=0;const o=e.length;for(;i<o;)r[e[i]]=1,i+=1;for(const e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}const xw=typeof document<"u"?i.useLayoutEffect:i.useEffect;function Lw(t,n,r){const o=Object.keys(n.required||{}),a=Object.keys(n.optional||{}),l=Object.keys(n.methods||{}),s=Object.keys(n.events||{}),c=i.createContext({});function d(e,t){e.propsReady&&Cv(e.propsReady,!1);for(const r of o){Cv(e[n.required[r]],t[r])}for(const r of a)if(r in t){Cv(e[n.optional[r]],t[r])}e.propsReady&&Cv(e.propsReady,!0)}function u(e){return s.reduce(((t,r)=>(t[r]=function(e){let t,n;const r=()=>null==t?void 0:t();return function(i,o){switch(i){case 1:return o?n===o?void 0:(r(),n=o,t=hv(e,o),t):(r(),cv);case 2:return r(),void(n=null)}}}(e[n.events[r]]),t)),{})}const f=i.forwardRef(((f,h)=>{const{children:C,...p}=f,[m]=i.useState((()=>dv(function(e){const t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:o})=>{if(o&&t.has(i))return t.get(i);const a=e(r.map((e=>n(e))));return o&&t.set(i,a),a};return n(e)}(t),(e=>{d(e,p)})))),[g]=i.useState(lv(u,m));xw((()=>{for(const e of s)e in p&&hv(g[e],p[e]);return()=>{Object.values(g).map(pv)}}),[p,g,m]),xw((()=>{d(m,p)})),i.useImperativeHandle(h,iv(function(e){return l.reduce(((t,r)=>(t[r]=t=>{Cv(e[n.methods[r]],t)},t)),{})}(m)));const v=r;return e(c.Provider,{value:m,children:r?e(v,{...Aw([...o,...a,...s],p),children:C}):C})}));return{Component:f,useEmitter:(e,t)=>{const n=i.useContext(c)[e];xw((()=>hv(n,t)),[t,n])},useEmitterValue:i.version.startsWith("18")?e=>{const t=i.useContext(c)[e],n=i.useCallback((e=>hv(t,e)),[t]);return i.useSyncExternalStore(n,(()=>mv(t)),(()=>mv(t)))}:e=>{const t=i.useContext(c)[e],[n,r]=i.useState(lv(mv,t));return xw((()=>hv(t,(e=>{e!==n&&r(iv(e))}))),[t,n]),n},usePublisher:e=>{const t=i.useContext(c);return i.useCallback((n=>{Cv(t[e],n)}),[t,e])}}}const kw=i.createContext(void 0),Hw=i.createContext(void 0),Sw=typeof document<"u"?i.useLayoutEffect:i.useEffect;function Vw(e){return"self"in e}function _w(e,t,n,r=cv,o,a){const l=i.useRef(null),s=i.useRef(null),c=i.useRef(null),d=i.useCallback((n=>{let r,i,o;const l=n.target;if(function(e){return"body"in e}(l)||Vw(l)){const e=Vw(l)?l:l.defaultView;o=a?e.scrollX:e.scrollY,r=a?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a?e.innerWidth:e.innerHeight}else o=a?l.scrollLeft:l.scrollTop,r=a?l.scrollWidth:l.scrollHeight,i=a?l.offsetWidth:l.offsetHeight;const d=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync?d():M.flushSync(d),null!==s.current&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))}),[e,t,a]);return i.useEffect((()=>{const e=o||l.current;return r(o||l.current),d({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",d,{passive:!0}),()=>{r(null),e.removeEventListener("scroll",d)}}),[l,d,n,r,o]),{scrollByCallback:function(e){a&&(e={behavior:e.behavior,left:e.top}),l.current.scrollBy(e)},scrollerRef:l,scrollToCallback:function(n){const r=l.current;if(!r||(a?"offsetWidth"in r&&0===r.offsetWidth:"offsetHeight"in r&&0===r.offsetHeight))return;const i="smooth"===n.behavior;let o,d,u;Vw(r)?(d=Math.max(yy(r.document.documentElement,a?"width":"height"),a?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),o=a?r.innerWidth:r.innerHeight,u=a?window.scrollX:window.scrollY):(d=r[a?"scrollWidth":"scrollHeight"],o=yy(r,a?"width":"height"),u=r[a?"scrollLeft":"scrollTop"]);const f=d-o;if(n.top=Math.ceil(Math.max(Math.min(f,n.top),0)),Fy(o,d)||n.top===u)return e({scrollHeight:d,scrollTop:u,viewportHeight:o}),void(i&&t(!0));i?(s.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout((()=>{c.current=null,s.current=null,t(!0)}),1e3)):s.current=null,a&&(n={behavior:n.behavior,left:n.top}),r.scrollTo(n)}}}const Ow="-webkit-sticky",Nw="sticky",zw=yw((()=>{if(typeof document>"u")return Nw;const e=document.createElement("div");return e.style.position=Ow,e.style.position===Ow?Ow:Nw}));function Tw(e){return e}const Dw=zv((()=>{const e=Vv((e=>`Item ${e}`)),t=Vv((e=>`Group ${e}`)),n=Vv({}),r=Vv(Tw),i=Vv("div"),o=Vv(cv),a=(e,t=null)=>_v(xv(n,Mv((t=>t[e])),bv()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:a("EmptyPlaceholder"),FooterComponent:a("Footer"),GroupComponent:a("Group","div"),groupContent:t,HeaderComponent:a("Header"),HeaderFooterTag:i,ItemComponent:a("Item","div"),itemContent:e,ListComponent:a("List","div"),ScrollerComponent:a("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TopItemListComponent:a("TopItemList")}})),Iw=zv((([e,t])=>({...e,...t})),fv(Mw,Dw)),Zw=({height:t})=>e("div",{style:{height:t}}),jw={overflowAnchor:"none",position:zw(),zIndex:1},Rw={overflowAnchor:"none"},Bw={...Rw,display:"inline-block",height:"100%"},Pw=i.memo((function({showTopList:t=!1}){const n=ob("listState"),r=ab("sizeRanges"),o=ob("useWindowScroll"),a=ob("customScrollParent"),l=ab("windowScrollContainerState"),s=ab("scrollContainerState"),c=a||o?l:s,d=ob("itemContent"),u=ob("context"),f=ob("groupContent"),h=ob("trackItemSizes"),C=ob("itemSize"),m=ob("log"),g=ab("gap"),v=ob("horizontalDirection"),{callbackRef:y}=Uv(r,C,h,t?cv:c,m,g,a,v,ob("skipAnimationFrameInResizeObserver")),[w,b]=i.useState(0);ib("deviation",(e=>{w!==e&&b(e)}));const E=ob("EmptyPlaceholder"),M=ob("ScrollSeekPlaceholder")||Zw,A=ob("ListComponent"),x=ob("ItemComponent"),L=ob("GroupComponent"),k=ob("computeItemKey"),H=ob("isSeeking"),S=ob("groupIndices").length>0,V=ob("alignToBottom"),_=ob("initialItemFinalLocationReached"),O=t?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:0!==w?w:V?"auto":0,paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,whiteSpace:"nowrap"}:{marginTop:0!==w?w:V?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},..._?{}:{visibility:"hidden"}};return!t&&0===n.totalCount&&E?e(E,{...Qw(E,u)}):e(A,{...Qw(A,u),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:y,style:O,children:(t?n.topItems:n.items).map((e=>{const t=e.originalIndex,r=k(t+n.firstItemIndex,e.data,u);return H?p(M,{...Qw(M,u),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?p(L,{...Qw(L,u),"data-index":t,"data-item-index":e.index,"data-known-size":e.size,key:r,style:jw},f(e.index,u)):p(x,{...Qw(x,u),...Gw(x,e.data),"data-index":t,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:v?Bw:Rw},S?d(e.index,e.groupIndex,e.data,u):d(e.index,e.data,u))}))})})),Fw={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Uw={outline:"none",overflowX:"auto",position:"relative"},qw=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Ww={position:zw(),top:0,width:"100%",zIndex:1};function Qw(e,t){if("string"!=typeof e)return{context:t}}function Gw(e,t){return{item:"string"==typeof e?void 0:t}}const Kw=i.memo((function(){const t=ob("HeaderComponent"),n=ab("headerHeight"),r=ob("HeaderFooterTag"),o=Pv(i.useMemo((()=>e=>{n(yy(e,"height"))}),[n]),!0,ob("skipAnimationFrameInResizeObserver")),a=ob("context");return t?e(r,{ref:o,children:e(t,{...Qw(t,a)})}):null})),Yw=i.memo((function(){const t=ob("FooterComponent"),n=ab("footerHeight"),r=ob("HeaderFooterTag"),o=Pv(i.useMemo((()=>e=>{n(yy(e,"height"))}),[n]),!0,ob("skipAnimationFrameInResizeObserver")),a=ob("context");return t?e(r,{ref:o,children:e(t,{...Qw(t,a)})}):null}));function Xw({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo((function({children:i,style:o,...a}){const l=r("scrollContainerState"),s=n("ScrollerComponent"),c=r("smoothScrollTargetReached"),d=n("scrollerRef"),u=n("context"),f=n("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:C,scrollToCallback:p}=_w(l,c,s,d,void 0,f);return t("scrollTo",p),t("scrollBy",h),e(s,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:C,style:{...f?Uw:Fw,...o},tabIndex:0,...a,...Qw(s,u),children:i})}))}function Jw({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo((function({children:o,style:a,...l}){const s=r("windowScrollContainerState"),c=n("ScrollerComponent"),d=r("smoothScrollTargetReached"),u=n("totalListHeight"),f=n("deviation"),h=n("customScrollParent"),C=n("context"),p=i.useRef(null),m=n("scrollerRef"),{scrollByCallback:g,scrollerRef:v,scrollToCallback:y}=_w(s,d,c,m,h);return Sw((()=>{var e;return v.current=h||(null==(e=p.current)?void 0:e.ownerDocument.defaultView),()=>{v.current=null}}),[v,h]),t("windowScrollTo",y),t("scrollBy",g),e(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...0!==u?{height:u+f}:{}},...l,...Qw(c,C),children:o})}))}const $w=({children:t})=>{const n=i.useContext(kw),r=ab("viewportHeight"),o=ab("fixedItemHeight"),a=ob("alignToBottom"),l=ob("horizontalDirection"),s=Pv(i.useMemo((()=>av(r,(e=>yy(e,l?"width":"height")))),[r,l]),!0,ob("skipAnimationFrameInResizeObserver"));return i.useEffect((()=>{n&&(r(n.viewportHeight),o(n.itemHeight))}),[n,r,o]),e("div",{"data-viewport-type":"element",ref:s,style:qw(a),children:t})},eb=({children:t})=>{const n=i.useContext(kw),r=ab("windowViewportRect"),o=ab("fixedItemHeight"),a=ob("customScrollParent"),l=Wv(r,a,ob("skipAnimationFrameInResizeObserver")),s=ob("alignToBottom");return i.useEffect((()=>{n&&(o(n.itemHeight),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))}),[n,r,o]),e("div",{"data-viewport-type":"window",ref:l,style:qw(s),children:t})},tb=({children:t})=>{const n=ob("TopItemListComponent")||"div",r=ob("headerHeight"),i={...Ww,marginTop:`${r}px`},o=ob("context");return e(n,{style:i,...Qw(n,o),children:t})},nb=i.memo((function(t){const r=ob("useWindowScroll"),i=ob("topItemsIndexes").length>0,o=ob("customScrollParent"),a=ob("context"),l=o||r?sb:lb,s=o||r?eb:$w;return n(l,{...t,...Qw(l,a),children:[i&&e(tb,{children:e(Pw,{showTopList:!0})}),n(s,{children:[e(Kw,{}),e(Pw,{}),e(Yw,{})]})]})})),{Component:rb,useEmitter:ib,useEmitterValue:ob,usePublisher:ab}=Lw(Iw,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},nb),lb=Xw({useEmitter:ib,useEmitterValue:ob,usePublisher:ab}),sb=Jw({useEmitter:ib,useEmitterValue:ob,usePublisher:ab}),cb=rb,db=zv((()=>{const e=Vv((e=>n("td",{children:["Item $",e]}))),t=Vv(null),r=Vv((e=>n("td",{colSpan:1e3,children:["Group ",e]}))),i=Vv(null),o=Vv(null),a=Vv({}),l=Vv(Tw),s=Vv(cv),c=(e,t=null)=>_v(xv(a,Mv((t=>t[e])),bv()),t);return{components:a,computeItemKey:l,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:o,fixedHeaderContent:i,itemContent:e,groupContent:r,ScrollerComponent:c("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}}));fv(Mw,db),zw();const ub={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},fb={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:hb,floor:Cb,max:pb,min:mb,round:gb}=Math;function vb(e,t,n){return Array.from({length:t-e+1}).map(((t,r)=>({data:null===n?null:n[r+e],index:r+e})))}function yb(e,t){return e&&e.width===t.width&&e.height===t.height}function wb(e,t){return e&&e.column===t.column&&e.row===t.row}const bb=zv((([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:a,scrollContainerState:l,scrollTo:s,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:u},f,h,{didMount:C,propsReady:p},{customScrollParent:m,useWindowScroll:g,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:w},b])=>{const E=Vv(0),M=Vv(0),A=Vv(ub),x=Vv({height:0,width:0}),L=Vv({height:0,width:0}),k=Ov(),H=Ov(),S=Vv(0),V=Vv(null),_=Vv({column:0,row:0}),O=Ov(),N=Ov(),z=Vv(!1),T=Vv(0),D=Vv(!0),I=Vv(!1),Z=Vv(!1);hv(xv(C,Sv(T),Ev((([e,t])=>!!t))),(()=>{Cv(D,!1)})),hv(xv(Dv(C,D,L,x,T,I),Ev((([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i))),(([,,,,e])=>{Cv(I,!0),Ry(1,(()=>{Cv(k,e)})),vv(xv(c),(()=>{Cv(t,[0,0]),Cv(D,!0)}))})),gv(xv(N,Ev((e=>null!=e&&e.scrollTop>0)),Av(0)),M),hv(xv(C,Sv(N),Ev((([,e])=>null!=e))),(([,e])=>{e&&(Cv(x,e.viewport),Cv(L,e.item),Cv(_,e.gap),e.scrollTop>0&&(Cv(z,!0),vv(xv(c,kv(1)),(e=>{Cv(z,!1)})),Cv(s,{top:e.scrollTop})))})),gv(xv(x,Mv((({height:e})=>e))),u),gv(xv(Dv(Iv(x,yb),Iv(L,yb),Iv(_,((e,t)=>e&&e.column===t.column&&e.row===t.row)),Iv(c)),Mv((([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e})))),O),gv(xv(Dv(Iv(E),r,Iv(_,wb),Iv(L,yb),Iv(x,yb),Iv(V),Iv(M),Iv(z),Iv(D),Iv(T)),Ev((([,,,,,,,e])=>!e)),Mv((([e,[t,n],r,i,o,a,l,,s,c])=>{const{column:d,row:u}=r,{height:f,width:h}=i,{width:C}=o;if(0===l&&(0===e||0===C))return ub;if(0===h){const t=By(c,e);return function(e){return{...fb,items:e}}(vb(t,t+Math.max(l-1,0),a))}const p=Eb(C,h,d);let m,g;s?0===t&&0===n&&l>0?(m=0,g=l-1):(m=p*Cb((t+u)/(f+u)),g=p*hb((n+u)/(f+u))-1,g=mb(e-1,pb(g,p-1)),m=mb(g,pb(0,m))):(m=0,g=-1);const v=vb(m,g,a),{bottom:y,top:w}=Mb(o,r,i,v),b=hb(e/p);return{bottom:y,itemHeight:f,items:v,itemWidth:h,offsetBottom:b*f+(b-1)*u-y,offsetTop:w,top:w}}))),A),gv(xv(V,Ev((e=>null!==e)),Mv((e=>e.length))),E),gv(xv(Dv(x,L,A,_),Ev((([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height)),Mv((([e,t,{items:n},r])=>{const{bottom:i,top:o}=Mb(e,r,t,n);return[o,i]})),bv(py)),t);const j=Vv(!1);gv(xv(c,Sv(j),Mv((([e,t])=>t||0!==e))),j);const R=Nv(xv(Dv(A,E),Ev((([{items:e}])=>e.length>0)),Sv(j),Ev((([[e,t],n])=>{const r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&0===e.offsetBottom&&e.items.length===t)&&r})),Mv((([[,e]])=>e-1)),bv())),B=Nv(xv(Iv(A),Ev((({items:e})=>e.length>0&&0===e[0].index)),Av(0),bv())),P=Nv(xv(Iv(A),Sv(z),Ev((([{items:e},t])=>e.length>0&&!t)),Mv((([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index}))),bv(Cy),Hv(0)));gv(P,h.scrollSeekRangeChanged),gv(xv(k,Sv(x,L,E,_),Mv((([e,t,n,r,i])=>{const o=Zy(e),{align:a,behavior:l,offset:s}=o;let c=o.index;"LAST"===c&&(c=r-1),c=pb(0,c,mb(r-1,c));let d=Ab(t,i,n,c);return"end"===a?d=gb(d-t.height+n.height):"center"===a&&(d=gb(d-t.height/2+n.height/2)),s&&(d+=s),{behavior:l,top:d}}))),s);const F=_v(xv(A,Mv((e=>e.offsetBottom+e.bottom))),0);return gv(xv(w,Mv((e=>({height:e.visibleHeight,width:e.visibleWidth})))),x),{customScrollParent:m,data:V,deviation:S,footerHeight:i,gap:_,headerHeight:o,increaseViewportBy:e,initialItemCount:M,itemDimensions:L,overscan:n,restoreStateFrom:N,scrollBy:a,scrollContainerState:l,scrollHeight:H,scrollTo:s,scrollToIndex:k,scrollTop:c,smoothScrollTargetReached:d,totalCount:E,useWindowScroll:g,viewportDimensions:x,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:w,...h,gridState:A,horizontalDirection:Z,initialTopMostItemIndex:T,totalListHeight:F,...f,endReached:R,propsReady:p,rangeChanged:P,startReached:B,stateChanged:O,stateRestoreInProgress:z,...b}}),fv($y,Qv,Qy,Cw,Dy,pw,Bv));function Eb(e,t,n){return pb(1,Cb((e+n)/(Cb(t)+n)))}function Mb(e,t,n,r){const{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};const o=Ab(e,t,n,r[0].index);return{bottom:Ab(e,t,n,r[r.length-1].index)+i,top:o}}function Ab(e,t,n,r){const i=Eb(e.width,n.width,t.column),o=Cb(r/i),a=o*n.height+pb(0,o-1)*t.row;return a>0?a+t.row:a}const xb=zv((()=>{const e=Vv((e=>`Item ${e}`)),t=Vv({}),n=Vv(null),r=Vv("virtuoso-grid-item"),i=Vv("virtuoso-grid-list"),o=Vv(Tw),a=Vv("div"),l=Vv(cv),s=(e,n=null)=>_v(xv(t,Mv((t=>t[e])),bv()),n),c=Vv(!1),d=Vv(!1);return gv(Iv(d),c),{components:t,computeItemKey:o,context:n,FooterComponent:s("Footer"),HeaderComponent:s("Header"),headerFooterTag:a,itemClassName:r,ItemComponent:s("Item","div"),itemContent:e,listClassName:i,ListComponent:s("List","div"),readyStateChanged:c,reportReadyState:d,ScrollerComponent:s("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}})),Lb=zv((([e,t])=>({...e,...t})),fv(bb,xb)),kb=i.memo((function(){const t=zb("gridState"),n=zb("listClassName"),r=zb("itemClassName"),o=zb("itemContent"),a=zb("computeItemKey"),l=zb("isSeeking"),s=Tb("scrollHeight"),c=zb("ItemComponent"),d=zb("ListComponent"),u=zb("ScrollSeekPlaceholder"),f=zb("context"),h=Tb("itemDimensions"),C=Tb("gap"),m=zb("log"),g=zb("stateRestoreInProgress"),v=Tb("reportReadyState"),y=Pv(i.useMemo((()=>e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const n=e.firstChild;if(n){const{height:e,width:t}=n.getBoundingClientRect();h({height:e,width:t})}C({column:Zb("column-gap",getComputedStyle(e).columnGap,m),row:Zb("row-gap",getComputedStyle(e).rowGap,m)})}),[s,h,C,m]),!0,!1);return Sw((()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)}),[t]),g?null:e(d,{className:n,ref:y,...Qw(d,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map((n=>{const i=a(n.index,n.data,f);return l?e(u,{...Qw(u,f),height:t.itemHeight,index:n.index,width:t.itemWidth},i):p(c,{...Qw(c,f),className:r,"data-index":n.index,key:i},o(n.index,n.data,f))}))})})),Hb=i.memo((function(){const t=zb("HeaderComponent"),n=Tb("headerHeight"),r=zb("headerFooterTag"),o=Pv(i.useMemo((()=>e=>{n(yy(e,"height"))}),[n]),!0,!1),a=zb("context");return t?e(r,{ref:o,children:e(t,{...Qw(t,a)})}):null})),Sb=i.memo((function(){const t=zb("FooterComponent"),n=Tb("footerHeight"),r=zb("headerFooterTag"),o=Pv(i.useMemo((()=>e=>{n(yy(e,"height"))}),[n]),!0,!1),a=zb("context");return t?e(r,{ref:o,children:e(t,{...Qw(t,a)})}):null})),Vb=({children:t})=>{const n=i.useContext(Hw),r=Tb("itemDimensions"),o=Tb("viewportDimensions"),a=Pv(i.useMemo((()=>e=>{o(e.getBoundingClientRect())}),[o]),!0,!1);return i.useEffect((()=>{n&&(o({height:n.viewportHeight,width:n.viewportWidth}),r({height:n.itemHeight,width:n.itemWidth}))}),[n,o,r]),e("div",{ref:a,style:qw(!1),children:t})},_b=({children:t})=>{const n=i.useContext(Hw),r=Tb("windowViewportRect"),o=Tb("itemDimensions"),a=zb("customScrollParent"),l=Wv(r,a,!1);return i.useEffect((()=>{n&&(o({height:n.itemHeight,width:n.itemWidth}),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:n.viewportWidth}))}),[n,r,o]),e("div",{ref:l,style:qw(!1),children:t})},Ob=i.memo((function({...t}){const r=zb("useWindowScroll"),i=zb("customScrollParent"),o=i||r?Ib:Db,a=i||r?_b:Vb,l=zb("context");return e(o,{...t,...Qw(o,l),children:n(a,{children:[e(Hb,{}),e(kb,{}),e(Sb,{})]})})})),{useEmitter:Nb,useEmitterValue:zb,usePublisher:Tb}=Lw(Lb,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Ob),Db=Xw({useEmitter:Nb,useEmitterValue:zb,usePublisher:Tb}),Ib=Jw({useEmitter:Nb,useEmitterValue:zb,usePublisher:Tb});function Zb(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,jv.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}const jb=({optionsList:r=[],onSelectVariable:i,dropdownPosition:o,position:a="relative",width:l,height:s="160px",zIndex:c=9999})=>{const d={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},u=e=>{if(!e)return"";const t=e._id||e.id;return t?.startsWith("PARAMETER")?"step_group_parameter":"STEPGROUP"!==e?.parentVariableType||"LOCAL"!==e.type&&"STEPGROUP"!==e?.type?"_startforloop"===e.type?"for_loop_variable":"DATAPROVIDER"===e.type?"data_provider_variable":d[e.type||""]||"":"step_group_variable"},f=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;function h(e){if(e.endsWith("px")){const t=parseInt(e.slice(0,-2),10);return isNaN(t)?212:t-66}return 212}return e("div",{className:O("ff-variable-dropdown",a),style:o?{top:o.top+30,left:o.left-30,width:l,height:s,zIndex:c}:{width:l,height:s,zIndex:c},children:Q(r)?e("div",{className:"ff-variable-option ff-variable-option-no-data",children:e(P,{as:"span",fontSize:12,children:"No Option"})}):e(cb,{totalCount:r.length,itemContent:o=>{const a=r[o];return a?e("div",{className:"ff-variable-data",onMouseDown:()=>i(a),children:l.endsWith("px")?n(t,{children:[e(G,{title:ie(f(a),h(l),"pixel")?f(a):"",style:{width:`${h(l)}px`},children:e(P,{as:"span",fontSize:12,className:"ff-truncated_text",children:f(a)})}),e(B,{name:u(a),height:24,width:24,hoverEffect:!0})]}):e(rv,{option:a})},`${a.id}-${o}`):null},style:{height:s,fontSize:"12px"},overscan:10,fixedItemHeight:32})})},Rb=({data:r=[],width:i,height:o,lineChartWidth:a,yAxisLabel:s,xAxisLabel:d,yAxisValueColor:u,xAxisColor:f,yAxisColor:h,yAxisLabelColor:C,textSize:p,fontWeight:m,numberSize:g,chartName:v,shouldCenterSinglePoint:y,xAxisLabelGap:w=16,isLeftOverflow:b=!1})=>{const E=40,M=i-80,A=o-80,[x,L]=c(!1),[k,H]=c({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});l((()=>{const e=()=>{L(!1),H((e=>({...e,tooltip:{...e.tooltip,visible:!1}})))};return window.addEventListener("scroll",e,!0),()=>window.removeEventListener("scroll",e,!0)}),[]);if(!(r&&r.length>0&&r?.some((e=>Array.isArray(e?.data)&&e?.data?.length>0)))){const t=[];for(let e=6;e>=0;e--){const n=new Date;n.setDate(n.getDate()-e);const r=n?.toLocaleDateString("en-US",{day:"numeric",month:"short"});t.push(r)}const r=1024,a=6,l=7;return n("div",{className:"ff-line-chart-text",style:{width:i+20+w,gap:w},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(P,{className:"ff-line-chart-yAxisLabel",fontSize:p,fontWeight:"semi-bold",children:s})}),e("div",{className:"ff-line-chart-svg",children:e("svg",{height:o,width:i,className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:A,x2:M,y2:A,stroke:f,strokeWidth:1}),e("text",{x:M/2.1,y:A+E/1.2,textAnchor:"middle",fill:C,className:"ff-line-chart-x-axis-label",style:{fontSize:p,fontWeight:m},children:d}),t.map(((t,n)=>e("text",{x:n*(M/(l-1)),y:A+15,textAnchor:0===n?"start":n===l-1?"end":"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:t},t))),Array.from({length:a}).map(((t,n)=>{const i=n*r/(a-1),o=i/1024;return e("text",{x:-10,y:A-i*A/r,textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:o?.toFixed(1)},`y-${n}`)}))]})})})]})}function S(e){if(!isNaN(e))return parseFloat(e);const t=ot,n=e.match(t);if(!n)throw new Error("Invalid input format. Use '<value> <unit>' format (e.g., '10.9580078125 KB') or just a number.");const r=parseFloat(n[1]);switch(n[2]?n[2].toUpperCase():null){case"GB":return parseFloat((1024*r).toFixed(2));case"MB":return parseFloat(r.toFixed(2));case"KB":return parseFloat((r/1024).toFixed(2));default:throw new Error("Invalid unit. Supported units are GB, MB, and KB.")}}const V=r?.[0]?.data?.[0]?.hasOwnProperty("date")&&r?.[0]?.data?.[0]?.hasOwnProperty("totalMemory"),_="date",O=V?"totalMemory":"value",N=e=>{const t=r?.[0]?.data?.length;if(1===t)return y?M/2:M;const n=r[0].data.findIndex((t=>t[_]===e));return-1===n?0:n/(t-1)*M},z=Math.max(...r?.flatMap((e=>e?.data?.map((e=>S(e[O]))))),5),T=e=>{if("memory"===v){const t=Math.max(...r?.flatMap((e=>e?.data?.map((e=>S(e[O]))))));return A-e*A/(t>1024?t:1024)}return A-e*A/(0===z?1024:z)},D=e=>{if(1===e?.length){const t=e?.[0],n=N(t[_]),r=T(S(t[O]));return`M 0 ${T(0)} L ${n} ${r}`}return e?.reduce(((t,n,r)=>{const i=N(n[_]),o=T(S(n[O]));if(0===r)return`M ${i} ${o}`;const a=e[r-1],l=a?N(a[_]):0;return`${t} C ${l+(i-l)/2} ${a?T(S(a[O])):0}, ${i-(i-l)/2} ${o}, ${i} ${o}`}),"")},I=r[0].data;return n("div",{className:"ff-line-chart-text",style:{width:i+20+w,gap:w},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(P,{className:"ff-line-chart-yAxisLabel",fontSize:p,fontWeight:"semi-bold",children:s})}),n("div",{className:"ff-line-chart-svg",children:[e("svg",{height:o,width:i,onMouseMove:e=>{const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-E;if(e.clientY-t.top-E>A)return L(!1),void H({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});let i={hoverValues:{},dotPositions:{}},o=null;r.forEach(((e,t)=>{const r=e.data.reduce(((e,t)=>{const r=Math.abs(n-N(t[_]));return r<e.distance?{point:t,distance:r}:e}),{point:null,distance:1/0}).point;r&&(o=r[_],i.hoverValues[t]=((e,t=2)=>{let n="";if("string"==typeof e){const t=e.match(nt),r=e.match(rt);t&&(e=parseFloat(t[0])),r&&(n=r[0])}const r=Math.pow(10,t);return`${Math.ceil(e*r)/r} ${n}`.trim()})(r[O]),i.dotPositions[t]={x:N(r[_]),y:T(S(r[O]))})})),L(!0),H({cursorX:n,hoverValues:i.hoverValues,dotPositions:i.dotPositions,currentXValue:o,tooltip:o?{visible:!0,left:e.clientX+10,top:e.clientY-20}:{visible:!1,left:0,top:0}})},onMouseLeave:()=>H({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null}),className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:0,x2:0,y2:A,strokeWidth:2}),e("line",{x1:0,y1:A,x2:M,y2:A,stroke:f,strokeWidth:1}),e("text",{x:M/2.1,y:A+E/1.2,textAnchor:"middle",fill:C,className:"ff-line-chart-x-axis-label",style:{fontSize:p,fontWeight:m},children:d}),r.map(((r,i)=>{return!1!==r.show?n("g",{children:[e("path",{d:D(r.data),fill:"none",stroke:r.color,strokeWidth:a,opacity:(o=r.data,o.every((e=>0===S(e[O])))?.5:1)}),k.dotPositions[i]&&n(t,{children:[e("line",{x1:k.dotPositions[i].x,y1:0,x2:k.dotPositions[i].x,y2:A,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"}),e("circle",{cx:k.dotPositions[i].x,cy:k.dotPositions[i].y,r:5,fill:"white",stroke:r.color,strokeWidth:a,style:{transition:"cx 0.1s, cy 0.1s"}}),e("line",{x1:0,y1:k.dotPositions[i].y,x2:M,y2:k.dotPositions[i].y,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"})]})]},i):null;var o})),(()=>{if(1===I.length){const t=I?.[0];return e("text",{x:y?M/2:M,y:A+15,textAnchor:y?"middle":"end",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=t[_]?String(t[_]):""},String(t[_]))}if(I.length<7)return I.map((t=>e("text",{x:N(t[_]),y:A+15,textAnchor:"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=t[_]?String(t[_]):""},String(t[_]))));{const t=(i-80-7*9.2)/6;return Array.from({length:7}).map(((n,r)=>{const i=Math.floor(r*(I?.length-1)/6),o=I[i];return e("text",{x:r*t,y:A+15,fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=o?.[_]?String(o?.[_]):""},String(o?.[_]))}))}})(),(()=>{if("memory"===v){const t=Math.max(z,1024);return Array.from({length:6}).map(((n,r)=>{const i=r*t/5,o=i/1024;return e("text",{x:-10,y:T(i),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:o.toFixed(1)},`y-${r}`)}))}return Array.from({length:6}).map(((t,n)=>{const r=n*z/5;return e("text",{x:-10,y:T(r),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:r.toFixed(0)},`y-${n}`)}))})()]})}),x&&k.tooltip.visible&&n("div",{className:"ff-line-chart-tooltip",style:{left:b&&k.tooltip.left/2>i/1.75?k.tooltip.left-180:k.tooltip.left,top:k.tooltip.top},children:[e("div",{className:"ff-line-chart-date",children:k.currentXValue}),Object.entries(k.hoverValues).map((([t,i])=>!1!==r[Number(t)]?.show&&n("div",{className:"ff-line-chart-inner-tooltip",children:["default"!==r[Number(t)]?.name&&e("div",{className:"ff-line-chart-status-dot",style:{backgroundColor:r[Number(t)]?.color}}),r[Number(t)]?.name,": ",i]},t)))]})]})]})},Bb=({onClose:t,top:r="100px",left:i="0px",className:o,description:a="Download and Install the fireflink client to run the script",onClick:s=()=>{},optionZIndex:c=10000001})=>{l((()=>{const e=e=>{"Escape"===e.key&&t?.()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[t]);return n("div",{className:`ff-download-client-wrapper ${o}`,style:{top:r,left:i,zIndex:c},children:[n("div",{className:"ff-download-client-header-wrapper",children:[e("div",{className:"ff-download-client-hollow-triangle"}),e(P,{fontWeight:"semi-bold",lineHeight:"32px",className:"ff-download-client-header-text",children:"Download client"}),e(B,{name:"close",color:"var(--brand-color)",className:"ff-download-client-close-icon",height:12,width:12})]}),n("div",{className:"ff-download-client-content-text",children:[e(P,{as:"div",color:"var(--download-client-content-text-color)",fontWeight:"semi-bold",textAlign:"center",lineHeight:"26px",children:a}),e(P,{as:"div",className:"ff-download-client-description-text",textAlign:"center",fontWeight:"medium",lineHeight:"26px",children:"Choose OS to Download"}),e("div",{className:"ff-download-client-os-wrapper",children:["windows","mac_icon","linux"].map((t=>e("div",{className:"ff-os-version-wrapper",onClick:()=>{s("mac_icon"===t?"mac":t)},children:e(B,{name:t,height:36,width:36})},t)))})]})]})},Pb=({legendName:t,height:r,width:i,children:o})=>e("div",{className:"ff_fieldSet_container",children:n("fieldset",{className:"ff_fieldSet",style:{height:r,width:i},children:[e("legend",{className:"ff_legend_container",children:e(P,{color:"var(--license_header_text_color)",fontSize:8,lineHeight:"12px",children:t})}),e("div",{className:"ff_children_container",children:o})]})}),Fb=({onSelectVariable:t,dropdownPosition:n,filteredOptions:r=[],position:i="relative",width:o="100%",zIndex:a,truncateTextValue:l=34})=>e("div",{className:O(`ff-variable-dropdown-container ${i}`),style:n?{top:n.top+30,left:n.left-30,width:o,zIndex:a}:{width:o,zIndex:a},children:Q(r)?e("div",{className:"ff-variable-option no-data",children:e(P,{as:"div",children:"No Option",fontSize:14})}):r?.map((n=>e("div",{className:"ff-variable-option",onMouseDown:()=>t(n),children:e(G,{title:ie(n?.name,l,"pixel")?n?.name:"",children:e(P,{children:re(n?.name,l,"pixel")})})},n?.id)))}),Ub=o((({label:t="",hashInputValue:r="",setHashInputValue:i,variableList:o=[],placeholder:s="Enter text",onChange:d,onPaste:u,onCreateVariableClick:f,handleClearInput:h,value:C="",dropdownWidth:p="100%",dropdownHeight:m="160px",isHash:g=!1,isOnlyHash:v=!1,dataFiles:y=[],showAddVariableIcon:w=!0,helperText:E="",error:M,autoComplete:A="off",required:x=!1,zIndex:L=9999,truncateTextValue:k=34,formProps:H={},getSelectedVariable:S=()=>{},symbol:V="$",type:_="text",clearIcon:N=!0,inputTitle:z="",onBlur:T,helperTextWidth:D,iconProps:I={isShowIcon:!1,iconName:"",iconToolTipTitle:"",isIconDisable:!1,iconColor:"",onIconClick:()=>{}},...Z},j)=>{const[R,F]=c(!1),[U,q]=c(!1),[W,K]=c(!1),[Y,X]=c(null),[J,$]=c(0),[ee,te]=c(!1),[ne,re]=c([]),ie=a(null),oe=a(null),[ae,le]=c("auto"),se=I?.isShowIcon;l((()=>{const e=oe.current?.querySelector(".ff-input-container");if(!e)return;const t=new ResizeObserver((e=>{for(let t of e){const e=`${t.contentRect.width}px`;le(e)}}));return t.observe(e),()=>{t.disconnect()}}),[]),b(j,(()=>ie.current)),l((()=>{null!==Y&&ie.current&&(ie.current.setSelectionRange(Y,Y),ie.current.focus())}),[Y]),l((()=>{g&&F(C.startsWith("#"));const e=y?.find((e=>e.name===C)),t=o?.find((e=>e?.name===C));if(C.startsWith("#")&&g){const e=C.slice(1).toLowerCase(),t=y.filter((t=>t.name.toLowerCase().includes(e)));re(t),F(!0)}const n=null!==e&&C.startsWith("#"),r=null!==t&&C.startsWith("$"),i=C.length>(t?.name.length||0),a=C.length>0&&!r||C.startsWith("#");v?te(!1):r||n||C.includes("$")||C.includes("#")?(te(!1),a&&te(!0)):i&&!C.includes("$")&&te(!0)}),[C]);const ce=()=>{ie.current&&$(ie.current.selectionStart||0)},de=ce,ue=ce;l((()=>{ie.current&&$(ie.current.selectionStart||0)}),[C]);const fe=e=>{if(ie.current){const{selectionStart:t,selectionEnd:n}=ie.current,r=`${e.name}`;let o;if(o=g&&"#"===C[0]?e.name+C.slice(n||1):e.name,d){d({target:{value:o}},e),S(e.name)}ie.current.value=o,i?.(e),X((t||0)+r.length),F(!1),q(!0)}};const he=function(e,t,n){let r=!1,i="";const o="}"===C[t-1];if(t<0||t>e.length)return{showDropdown:r,searchString:i};const a=e.lastIndexOf(V,t-1),l=e.indexOf(V,t);if(-1!==a&&(v&&"$"===e[a]?r=!1:t===a+1?(r=!0,i=""):(i=e.slice(a+1,-1===l?void 0:l),t>a+1&&(i=e.slice(a+1,t)),r=!0),U&&o&&(r=!1),(/[{}]/.test(i)||0===t)&&(r=!1,i=""),i)){n.some((e=>e.name.toLowerCase().includes(i.toLowerCase())))||(n=[])}return{showDropdown:r,searchString:i}}(C,J,o),Ce=()=>o?.filter((e=>e?.name?.toLowerCase()?.includes(he?.searchString?.toLowerCase())));return n("div",{className:"ff-add-variable-container",children:[n("div",{className:"ff-add-variable-input",ref:oe,children:[e(G,{title:z,style:{width:"100%"},children:e(nn,{...Z,name:"add_variable",ref:ie,type:_,className:O("ff-variable-input-container",{"ff-variable-input-container--show-icon":se}),value:C,onChange:d,onPaste:()=>{te(!0)},variant:"primary",label:t,placeholder:s,onClick:de,onKeyUp:ue,onFocus:()=>K(!0),onBlur:e=>{(e=>{e.relatedTarget&&e.relatedTarget.closest(".dropdown-container")||K(!1)})(e),T?.(e)},autoComplete:A,helperText:E,error:M,required:x,helperTextWidth:D,...H})}),!Q(C)&&ee&&w&&e("div",{className:"ff-create-variable-container",onClick:f,children:e(P,{fontWeight:"regular",fontSize:"10px",color:"var(--brand-color)",cursor:"pointer",children:"Create Variable"})}),!Q(C)&&!v&&e("div",{className:O("ff-cancel-icon-container",{"ff-cancel-icon-container--show-icon":se}),children:N&&e(G,{title:"Cancel",style:{zIndex:99999},children:e(B,{onClick:h,name:"close",height:16,width:16,hoverEffect:!0})})}),se&&e("div",{className:"ff-info-icon-container",children:e(G,{title:se&&!I?.isIconDisable?I?.iconToolTipTitle:"",children:e(B,{name:I?.iconName||"",hoverEffect:!1,height:16,width:16,color:I?.iconColor||"var(--text-area-default-color)",onClick:e=>{I?.onIconClick&&I?.onIconClick(e)},disabled:I?.isIconDisable,cursorType:"pointer"})})})]}),he?.showDropdown&&W&&e(jb,{position:"absolute",zIndex:L,truncateTextValue:k,width:ae,height:Q(Ce())?"auto":m,optionsList:Ce(),onSelectVariable:fe}),R&&g&&W&&e(Fb,{position:"relative",zIndex:L,truncateTextValue:k,width:ae,filteredOptions:ne,onSelectVariable:fe})]})})),qb=({isOpen:t,variableTypesList:r=[],onClose:i,onNameChange:o,onValueChange:a,variableName:s,variableValue:d,onVariableTypeChange:u,selectedVariableType:f,hideValue:h=!1,onHideChange:C,handleSubmit:p,mode:m="create",disabled:g,dataFiles:v=[],truncateTextValue:y=34,isEnterKeySubmit:w=!1})=>{const[b,E]=c(!1),[M,A]=c(""),[x,L]=c(),[k,H]=c(!1),[S,V]=c(!1),[_,O]=c({name:"",value:"",isChecked:!1});l((()=>{t&&"edit"===m&&O({name:s,value:d,isChecked:h})}),[]);const N=e=>e&&0!==e.length?" "===e[0]||" "===e[e.length-1]?"Space is not allowed at starting and at the end":be.test(e)?e.length<3?"Name should contain at least 3 characters":e.length>25?"Name can contain at most 25 characters":"":"Name should be alphanumeric":"Variable Name is required";function z(e){const t=!!e,n=be.test(e),r=Vt.test(e),i=e.length>=3&&e.length<=25;return t&&n&&r&&i}l((()=>{const e=N(s);E(!!e),A(e)}),[s]),l((()=>{if("edit"!==m)return;const{name:e,value:t,isChecked:n}=_;V(s!==e||d!==t||h!==n)}),[m,s,d,h,_]);const T=()=>{!k&&z(s)&&(H(!0),p())};l((()=>{if(!w)return;const e=e=>{if("Enter"===e.key){e.preventDefault();!z(s)||k||"edit"===m&&!S||T()}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}}),[w,s,d,h,k,m,S,f]);return e(Y,{zIndex:1350,onClose:i,isOpen:t,title:"create"===m?"Create Variable":"Edit Variable",width:"284px",height:"280px",top:"30%",right:8,isFooterRequired:!0,overlay:!0,footerContent:e((()=>n("div",{className:"ff-create-slider-footer",children:[e(F,{onClick:i,label:"Cancel",variant:"tertiary"}),e(F,{variant:"primary",label:"create"===m?"Create":"Update",type:"submit",onClick:T,disabled:!z(s)||k||"edit"===m&&!S})]})),{}),children:n("div",{className:"ff-create-variable-slider",children:[e("div",{className:"ff-create-variable-slider-input",children:e(nn,{label:"Variable Name",required:!0,type:"text",name:"variableName",value:s||"",onChange:e=>{H(!1),o(e.target.value)},error:b,helperText:M,onBlur:e=>{const t=e.target.value,n=N(t);E(!!n),A(n)}})}),e(or,{label:"Variable Type",required:!0,onChange:e=>{u(e),H(!1)},selectedOption:f,optionsList:r,optionZIndex:99999,valueAccessor:"label",disabled:"edit"===m}),e(Ub,{label:"Variable Value",placeholder:"Enter Variable value or select path using #",isHash:!0,isOnlyHash:!0,zIndex:99999,truncateTextValue:y,dataFiles:v,dropdownWidth:"100%",setHashInputValue:L,hashInputValue:x||{},value:d||"",type:h?"password":"text",onChange:(e,t)=>{const n=e.target.value;a(n,t)},showAddVariableIcon:!1}),n("div",{className:"ff-hide-value-content",children:[e(ee,{onChange:e=>C(e.target.checked),name:"hideValue",label:"Hide Value",checked:h,disabled:g}),e(G,{title:"Once the value is hidden, it cannot be undone",children:e(B,{name:"info",width:12,height:12})})]})]})})},Wb=({highlightText:t="",tableMeta:r=[],tableData:i=[],accordionType:o="row",noDataContent:a,height:l="100%",withFixedHeader:s=!1,headerType:d,TableAccordionStateIconWidth:u=4,TableAccordionStateIconHeight:f=8})=>{const[h,C]=c(-1),p=(e,t)=>{let n=e[t.accessor];return t.cell?t.cell({value:n,row:e,column:t.accessor}):t.accessor||n&&"object"!=typeof n?n:"--"},m=t=>{const n=t.map(((t,n)=>e("table",{className:"ff-accordion-table",cellSpacing:0,children:e("tbody",{className:"ff-table-body",children:e("tr",{className:"ff-table-row",children:r.map(((n,r)=>e("td",{className:"ff-table-cell",style:{width:n.width},children:"column"===o&&0===r?"":e(P,{children:p(t,n)})},n.accessor+r)))},t.id||n)})},`accordion-table-${n}`)));return n};return n("div",{style:{height:l},className:O("ff-accordion-table-container",{"ff-accordion-fixed-header-table":s}),children:[e("table",{cellSpacing:0,className:O("ff-accordion-table",{"ff-accordion-fixed-header":s}),children:e("thead",{children:e("tr",{className:"ff-table-row",children:r.map((t=>e("th",{style:{width:t.width},className:O("ff-table-header",d&&`ff-accordion-table--${d}-bg`),children:e("div",{children:e(P,{fontWeight:"semi-bold",fontSize:12,children:t.header})})},`header-${t.header}`)))})})}),"row"===o&&i.map(((n,r)=>e(J,{highlightText:t,headerTitle:n.title,color:"var(--text-color)",accordionContent:m(n.data),disable:n.disable,disableInfoMessage:n.disableInfoMessage,accordionStateIconName:"arrows_down_icon",AccordionStateIconWidth:u,AccordionStateIconHeight:f},`accordion-row-${r}`))),"column"===o&&i.map(((i,o)=>n("div",{className:"column-table-accordion",children:[e("div",{className:"ff-display-flex",children:e(G,{title:i.disable?i?.disableInfoMessage:"string"==typeof i.title&&ie(i.title,r[0]?.width,"pixel")?i.title:"",placement:"bottom-start",children:n("div",{className:`accordion-header ${i.disable&&"accordion-header--disabled"}`,children:[e("div",{className:"header-title",children:e("span",{children:e(P,{children:e(X,{text:re(i.title,r[0]?.width,"pixel"),highlight:t})})})}),e("div",{className:"accordion-arrow",onClick:()=>{!i.disable&&(e=>{C(e===h?-1:e)})(o)},children:e(B,{name:h===o?"arrows_down_icon":"arrows_right_icon",color:"var(--table-with-accordion-icon-color)",width:u,height:f,hoverEffect:!1})})]})})}),h===o&&e("div",{children:m(i.data)})]},`column-accordion-${o}`))),i.length<=0&&e("div",{className:"no-data-content",style:{height:`calc(${l} - 50px)`},children:a})]})},Qb=({progressPercentage:t,totalMemory:r,usedMemory:i,color:o="var(--brand-color)",trackColor:a="#f0f0f0",height:l=10,label:s,labelFontSize:c=12,labelTextColor:d="var(--ff-card-status-text-color)",showPercentage:u=!1,percentageFontSize:f=10,percentageTextColor:h="var(--tooltip-text-color)",progressBarWidth:C="200px"})=>{const p=e=>{const t=e.trim().toLowerCase();if("0"===t)return 0;const n=t.match(/^(\d+(?:\.\d+)?)\s*(kb|mb|gb)$/);if(!n||!n[1])return 0;const r=parseFloat(n[1]),i=n[2];return"gb"===i?1024*r:"kb"===i?r/1024:r};let m=0,g=s;if(void 0!==r&&void 0!==i){const e=p(i),t=p(r);t>0?(m=e/t*100,g=s||i):(m=0,g="0MB")}else m=t||0;const v=Math.max(0,Math.min(m,100));return n("div",{className:"ff-progress-bar-container "+(g?"ff-has-label":""),style:{width:C},children:[e("div",{className:"ff-progress-bar-track",style:{backgroundColor:a,height:`${l}px`},children:e("div",{className:"ff-progress-bar",style:{width:`${v}%`,backgroundColor:o,height:`${l}px`},children:u&&e(P,{className:"ff-progress-bar-percentage",fontSize:f,color:h,children:`${Math.round(v)}%`})})}),g&&e("div",{className:"ff-progress-bar-label",children:e(P,{fontSize:c,color:d,children:e(G,{title:ie(g,10,"count")?g:"",children:re(g,10,"count")})})})]})},Gb=({variant:t="primary",size:n="small",onClick:r,label:i="Choose File",disabled:o=!1,type:l="button",className:s="",style:d={},iconName:f,isChooseFile:h=!1,buttonWidth:C="auto",buttonHeight:p="auto",selectedFile:m={},handleCloseIcon:g,isMandatory:v=!1})=>{const y=a(null),[w,b]=c(0);u((()=>{y.current&&b(y.current.getBoundingClientRect().width-10)}),[C]);const E=m?.name||i,M=w?re(E,w,"pixel"):E,A=!!w&&ie(E,w,"pixel");return e("div",{ref:y,style:{width:C},children:e(G,{title:A?E:"",children:e(F,{variant:t,label:M,type:l,onClick:r,buttonWidth:C,buttonHeight:p,isChooseFile:h,size:n,disabled:o,className:s,iconName:f,style:d,iconPosition:"right",selectedFile:m,handleCloseIcon:g,isMandatory:v})})})},Kb=({selected:t="text",handleClick:r,tabList:i})=>{const o=i?.includes("Automation"),a=i?.includes("Manual");return n("div",{className:"ff-script-switch-container",children:[e(G,{title:o?"Automation":"Add Automation",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Automation"===t?"active":""),onClick:()=>r(o?"Automation":"Add Automation"),children:e(B,{name:o?"automation_testcase":"add_testcase",color:"Automation"===t?"var(--primary-button-text-color)":"var(--description-text)"})})}),e(G,{title:a?"Manual":"Add Manual",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Manual"===t?"active":""),onClick:()=>r(a?"Manual":"Add Manual"),children:e(B,{name:a?"manual_testcase":"add_testcase",color:"Manual"===t?"var(--primary-button-text-color)":"var(--description-text)"})})})]})},Yb=({selected:t,handleClick:n,tabList:r})=>e("div",{className:"ff-switch-container",children:r.map((r=>e(G,{title:t===r.name?null:r.tooltip,zIndex:1e3,children:e("div",{className:"ff-switch-button "+(t===r.name?"active":""),onClick:()=>n(r.name),children:e(B,{name:r.icon,color:t===r.name?"var(--primary-button-text-color)":"var(--description-text)"})})},r.name)))}),Xb=({onModalClose:t,MediaSrc:r,fileName:o,onDeleteClick:a,mediaType:s,fileId:d,thumbnailMediaSrc:u,isDelete:f=!0,onExpandClick:h,onDownloadClick:C,isMediaIcon:p=!1,previewOnly:m=!1,iconName:g="video_preview",isDisabled:v=!1})=>{const[y,w]=c(!1),b=i.useRef(null),E=()=>{w(!0),h&&h(d)},M=()=>{t?.(),w(!1)},A=()=>{C&&C(d)};return l((()=>{m&&w(!0)}),[m]),n("div",{children:[!m&&(p?e(B,{name:g,hoverEffect:!0,onClick:E,disabled:v}):e(tv,{mediaSrc:r,mediaType:s,onDownloadClick:A,onDeleteClick:()=>a?.(r),onExpandClick:E,fileName:o,fileId:d,thumbnailMediaSrc:u,isDelete:f})),y&&e(_f,{isOpen:y,onClose:M,isFooterDisplayed:!1,isHeaderDisplayed:!1,customWidth:"1130px",customHeight:"570px",zIndex:1e4,children:n("div",{className:"media-wrapper",children:[n("div",{className:"ff-expand-icons",children:[e(G,{title:"Download File",children:e(B,{name:"download_file_icon",onClick:A,color:"var(--icons-default-color)",className:"header-icons"})}),e(G,{title:"Expand",children:e(B,{name:"expand",onClick:E,color:"var(--icons-default-color)",className:"header-icons"})}),e(G,{title:"close",children:e(B,{name:"close",onClick:M,color:"var(--icons-default-color)",className:"header-icons"})})]}),"image"===s&&e("img",{src:r,alt:"fileName",height:"auto"}),"video"===s&&e("video",{src:r,controls:!0,controlsList:"nodownload",className:"ff-video-preview",ref:b,onCanPlay:()=>{if(b.current){const e=b.current.play();void 0!==e&&e.catch((e=>{console.error("Autoplay failed:",e)}))}}})]})})]})},Jb=({children:t,orientation:r="",navBarIcons:o=[],mobileHeight:a=448,mobileWidth:l=220,UtilityBar:s,tooltip:c={},background:d,navBarPosition:u="bottom"})=>{const f="portrait"===r,h=f?a:l,C=f?l:a,p=s&&"top"===u,m=s&&"bottom"===u,g=s&&"left"===u;return n("div",{className:["ff-mobileskin-wrapper",f?"portrait":"landscape",g?"ff-side-nav-left":"",p?"navbar-top":"",m?"navbar-bottom":""].filter(Boolean).join(" "),children:[p&&e("div",{className:"ff-nav-bar top-nav-bar",children:o.map((({title:t,name:n,className:r,...i},a)=>{const l=c?.[n]??a;return e(G,{title:c?.[n]||"",placement:"top",children:e("div",{className:`ff-nav-bar-icon ${r||""} ${a===o.length-1?"last-icon":""} ${p?"navbar-top":""}`,children:e(B,{name:n,...i})})},l)}))}),e("div",{className:"ff-mobileskin-container",style:{height:h+16,width:C+16},children:e("div",{className:"ff-mobile-container",style:{width:C,height:h,background:d||"transparent"},children:e("div",{className:"ff-mobile-image-container",children:i.isValidElement(t)?t:e("img",{src:t,alt:"Mobile content",style:{width:f?"100%":2.1*l+"px",height:f?"100%":.5*a+"px"}})})})}),s&&m&&e("div",{className:"ff-nav-bar",children:o?.map(((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-nav-bar-icon ${t?.className||""} ${n===o.length-1?"last-icon":""}`,children:e(G,{title:r,children:e(B,{...i})})},n)}))}),s&&g&&e("div",{className:"ff-side-nav-bar",children:o?.map(((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-sidebar ${t?.className||""} ${n===o.length-1?"last-icon":""}`,children:e(G,{title:r,placement:"bottom",children:e(B,{...i})})},n)}))})]})},$b=o((({width:t=300,height:r=40,iconHeight:i=16,iconWidth:o=16,placeholder:l="Enter text",iconName:s="right_arrow_filled_icon",iconPosition:c="left",borderRadius:d=4,autoFocus:u=!1,value:f="",iconColor:h="var(--brand-color)",tooltipTitle:C="send",submitPrompt:p,onPromptChange:m,onBlur:g,onFocus:v,disableInput:y,isAdditionalIcon:w=!1,additionalIconName:b,additionIconToolTip:E,onAdditionalIconClick:M},A)=>{const x=a(null);se([{key:"Enter",action:()=>L()}],x);const L=e=>{f&&p?.(f.trim())};return n("div",{className:O("ff-prompt-container",{"icon-left":"left"===c,"icon-right":"left"!==c}),style:{width:`${t}px`,height:`${r}px`,borderRadius:d},ref:x,children:[e(G,{placement:"top",title:C,children:e(B,{name:s,className:"ff-prompt-icon",height:i,width:o,onClick:p,color:h,disabled:Q(f)})}),e("input",{ref:A,className:"ff-prompt-input",type:"text",placeholder:l,autoFocus:u,onChange:m,onFocus:v,onBlur:g,value:f,readOnly:y}),w&&b&&e(G,{placement:"top",title:E,children:e(B,{name:b,className:"ff-prompt-icon additional-icon",height:i,width:o,onClick:M})})]})})),eE=({content:t,isVisible:n,maxWidth:r=300,onClick:i,isClickable:o=!0,arrowPosition:a="left"})=>e("div",{onClick:i,style:{width:`${r}px`,"--triangle-position":r-4+"px"},className:O("ff-chat-msg-box",{visible:n,hidden:!n,pointer:o,default:!o,"chat-arrow-left":"left"===a,"chat-arrow-right":"left"!==a}),children:e("div",{className:O("content",`arrow-${a}`),children:e(P,{children:t})})}),tE=({iconName:r,iconPosition:{top:i,left:o,bottom:a,right:l},hoverIconPosition:{top:s,left:d,bottom:u,right:f},modalPosition:{top:h,left:C,bottom:p,right:m},modalWidth:g,modalHeight:v,headerContent:y="Header Content",footerContent:w="Footer Content",iconWidth:b,iconHeight:E,modalHeading:M="Ask Fia",children:x,onClearChat:L})=>{const[k,H]=c(!1),[S,V]=c(!1);return n(t,{children:[n("div",{style:{top:void 0!==i?`${i}px`:void 0,left:void 0!==o?`${o}px`:void 0,bottom:void 0!==a?`${a}px`:void 0,right:void 0!==l?`${l}px`:void 0},className:"ff-dynamic-icon-container",children:[e(B,{className:"ff-dynamic-icon",name:r,onClick:()=>{V((e=>!e)),setTimeout((()=>H((e=>!e))),10)},height:E,width:b}),e("div",{style:{top:void 0!==s?`${s}px`:void 0,left:void 0!==d?`${d}px`:void 0,bottom:void 0!==u?`${u}px`:void 0,right:void 0!==f?`${f}px`:void 0},className:"ff-chat-icon-hover",children:e(B,{name:"ask_fia_icon",height:32,width:82})})]}),S&&A(e("div",{className:O("ff-dynamic-modal",{open:k}),style:{top:void 0!==h?`${h}px`:void 0,left:void 0!==C?`${C}px`:void 0,bottom:void 0!==p?`${p}px`:void 0,right:void 0!==m?`${m}px`:void 0,position:"fixed",height:v,width:g},children:n("div",{className:"ff-dynamic-modal-content",children:[y&&e("div",{className:"ff-dynamic-modal-header",children:n("div",{className:"header-container",children:[n("div",{className:"header-left",children:[e(B,{height:16,width:16,name:"fia_icon"}),e(P,{fontWeight:"medium",children:M})]}),n("div",{className:"header-right",children:[e("span",{className:"action",children:e(G,{title:"Clear chat",placement:"bottom",children:e(B,{height:16,width:16,name:"delete",color:"var(--tooltip-text-color)",onClick:L})})}),e("span",{className:"action",children:e(G,{title:"Close",placement:"bottom",children:e(B,{height:16,width:16,name:"close",color:"var(--tooltip-text-color)",onClick:()=>(H(!1),void setTimeout((()=>V(!1)),300))})})})]})]})}),e("div",{className:"ff-dynamic-modal-body",children:x}),w&&e("div",{className:"ff-dynamic-modal-footer",children:w})]})}),document.body)]})},nE=o((({iconName:r,hoverTitle:i,iconPosition:{top:o,left:s,bottom:d,right:u},hoverIconPosition:{top:f,left:h,bottom:C,right:p},modalPosition:{top:m,left:g,bottom:v,right:y},modalWidth:w,modalHeight:E,headerContent:M="Header Content",footerContent:x="Footer Content",iconWidth:L,iconHeight:k,children:H,onVisibilityChange:S},V)=>{const[_,N]=c(!1),[z,T]=c(!1),D=a(null),I=()=>{D.current&&clearTimeout(D.current),N(!1),D.current=setTimeout((()=>{T(!1),S?.(!1)}),300)};return b(V,(()=>({closeModal:I}))),l((()=>()=>{D.current&&clearTimeout(D.current)}),[]),n(t,{children:[n("div",{style:{top:void 0!==o?`${o}px`:void 0,left:void 0!==s?`${s}px`:void 0,bottom:void 0!==d?`${d}px`:void 0,right:void 0!==u?`${u}px`:void 0},className:"ff-ai-dynamic-icon-container",children:[e(B,{className:"ff-ai-dynamic-icon",name:r,onClick:()=>{D.current&&clearTimeout(D.current),T((e=>!e)),S?.(!z),D.current=setTimeout((()=>N((e=>!e))),10)},height:k,width:L}),e("div",{style:{top:void 0!==f?`${f}px`:void 0,left:void 0!==h?`${h}px`:void 0,bottom:void 0!==C?`${C}px`:void 0,right:void 0!==p?`${p}px`:void 0},className:"ff-ai-chat-icon-hover",children:e("div",{className:"ai-hover-leaf",children:e(P,{fontWeight:"bold",fontSize:14,color:"var(--chatbot-leaf-text)",children:i})})})]}),z&&A(e("div",{className:O("ff-ai-dynamic-modal",{open:_}),style:{top:void 0!==m?`${m}px`:void 0,left:void 0!==g?`${g}px`:void 0,bottom:void 0!==v?`${v}px`:void 0,right:void 0!==y?`${y}px`:void 0,position:"fixed",height:E,width:w},children:n("div",{className:"ff-ai-dynamic-modal-content",children:[M&&e("div",{className:"ff-ai-dynamic-modal-header",children:M}),e("div",{className:"ff-ai-dynamic-modal-body",children:H}),x&&e("div",{className:"ff-ai-dynamic-modal-footer",children:x})]})}),document.body)]})})),rE=({variant:t,title:r,tabTitle:i,comment:o,profileShortName:a})=>n("div",{className:"ff-history-card",children:[e("div",{className:O("header",`header--${t}`),children:e(P,{fontWeight:"semi-bold",children:i})}),n("div",{className:"body",children:[e("div",{className:"title",children:n("div",{className:"profile",children:[e(P,{className:O("avatar",`avatar--${t}`),children:a}),e(P,{children:r})]})}),n("div",{className:"comment-container",children:[e(P,{fontWeight:"semi-bold",className:"heading",children:"Comments:"}),e(P,{color:"var(--details-page-value-color)",className:"comment",children:o})]})]})]}),iE=({onChange:t,disabled:r,checked:i=!1,id:o="toggle",path:a})=>n("div",{className:"ff--ai-switch-container",children:[e("input",{className:"ff--ai-switch-checkbox",id:`ff-toggle-${o}`,type:"checkbox",disabled:!!r,onChange:e=>{t&&t(e)},checked:i}),e("label",{className:O("ff--ai-switch-label",{"ff--ai-switch-label--disabled":r}),htmlFor:`ff-toggle-${o}`,children:e("span",{className:"ff--ai-switch-content",children:n("span",{className:"ff--ai-switch-content",children:[e(P,{className:O("ff--ai-switch-typography",{left:i,right:!i}),as:"div",fontWeight:"bold",fontSize:18,color:i?"var(--base-bg-color)":"var(--ff-ai-toggle-text-color)",children:"AI"}),e("img",{className:"ff--ai-switch-image",src:a,alt:"AI image"})]})})})]}),oE=o((({name:t,height:n=30,width:r=30,path:i="",onClick:o,color:s="var(--brand-color)",hoverEffect:c=!1,className:d="",disabled:u=!1,variant:f="light",isSelected:h=!1,x:C,y:p,tabIndex:m=-1,...g},v)=>{if(!R[t])return null;const y=a(null);l((()=>{y.current&&(void 0!==C&&y.current.setAttribute("x",String(C)),void 0!==p&&y.current.setAttribute("y",String(p)))}),[C,p]);const w={ref:v,onClick:u?void 0:o,style:{height:`${n}px`,width:`${r}px`,cursor:u?"not-allowed":"pointer",opacity:u?.3:1},tabIndex:m,...g};return e("span",{...w,children:e("img",{height:n,width:r,src:i,alt:""})})})),aE=({id:r=0,serialNumber:i,activeId:o,setActiveId:s,children:d,onIconClick:u,numberChildren:f,onContainerClick:h,onNextClick:C,onPreviousClick:p,disabled:m,isEditAccess:g,versionsLength:v,count:y,hiddenActions:w=[]})=>{const[b,E]=c(!1),[M,A]=c(!1),x=a(null),L=Array.isArray(w)?w:w?[w]:[],k=(e,t)=>{e.stopPropagation(),t()};l((()=>{x.current&&(()=>{if(x.current){const e=getComputedStyle(x.current),t=1.2*parseFloat(e.fontSize)*6;x.current.scrollHeight>t&&A(!0)}})()}),[]);const H=e=>{e.stopPropagation(),E(!b)};return n("div",{className:`ff-prompt-container-Block ${o===r?"active":"inactive"} `,onClick:()=>{s(r),h()},children:[e(P,{fontSize:8,className:"ff-prompt-number-bg-color",as:"span",children:`Test cases ${i}`}),n(t,{children:[n("div",{className:"ff-prompt-content "+(b?"expanded":""),ref:x,children:[d,b&&n(t,{children:[e("span",{role:"button","aria-label":"toggleExpand",onClick:H,className:"read-less-btn",children:e(P,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read Less"})})," "]})]}),M&&!b&&e("div",{role:"button","aria-label":"toggleExpand",onClick:H,className:"read-more-btn",children:e(P,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read More"})})]}),n("div",{className:"ff-prompt-icons",children:[e("div",{className:"ff-prompt-icons-leftside",children:[{action:"delete",title:"Delete",color:"var(--ff-delete-button-attachment)"},{action:"edit",title:"Edit",color:"var(--label-edit-text-label-color)"},{action:"regenerate",title:"Regenerate",color:"var(--label-edit-text-label-color)"}].filter((e=>!L.includes(e.action))).map(((t,n)=>{const r=g&&"delete"===t?.action||"regenerate"===t?.action&&(v??0)>=3||m;return e(G,{title:t.title,placement:"bottom",children:e(B,{disabled:r,name:t.action,color:t.color,hoverEffect:!0,onClick:e=>((e,t)=>{e.stopPropagation(),u(t)})(e,t.action)})},`${t?.title}-${n}`)}))}),n("div",{className:"ff-prompt-icons-rightside",children:[e(B,{disabled:1===y,className:"ff-prompt-icons-style",name:"arrow_left_accordian",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>k(e,p),cursorType:"pointer"}),f,e(B,{disabled:y===v,className:"ff-prompt-icons-style",name:"arrow_right_icon",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>k(e,C),cursorType:"pointer"})]})]})]})},lE=o((({type:t="text",variant:r="primary",name:i="",label:o,disabled:a=!1,disableLinkIcon:l=!1,required:s=!1,placeholder:c="Attach Link",value:d,error:u,helperText:f,noBorder:h,className:C="",onChange:p,onBlur:m,onFocus:g,autoComplete:v="off",autoFocus:y=!1,minValue:w=-1/0,maxValue:b=1/0,transparentBackground:E=!1,size:M="small",isLabelRequired:A=!0,onClick:x,onKeyUp:L,isViewMode:k=!1,...H},S)=>{const V=!Q(d);return n("fieldset",{className:O("ff-link-input-fieldset",{"ff-link-input-fieldset--disabled":a}),children:[n("div",{className:O("ff-link-input-container",{"ff-link-input-container--float":V,"ff-link-input-container--disabled":!!a}),children:[A&&n("label",{className:O(`ff-link-input-label-container ff-link-input-label-container--${M}`,{"ff-link-input-label-container--danger":!!u}),htmlFor:i,children:[s&&e("span",{className:"required-asterisk",children:"*"}),e("span",{className:O(`ff-link-input-label ff-link-input-label--${r}`,{"ff-link-input-label--no-hover":!!d,"ff-link-input-label--disabled":!!a,"ff-link-input-label--danger":!!u}),children:o})]}),e("input",{ref:S,name:i,value:d,type:t,spellCheck:!1,id:i,className:O(`ff-link-input ff-link-input-${r} default-input ff-link-input--${M}`,{"ff-link-input--transparentBackground":!!E,"ff-link-input--no-hover":!!d,"ff-link-input--disabled":!!a,"ff-link-input--danger":!!u,"ff-link-input--no-border":!!h,"ff-link-input--placeholder":!A},`${C}`),placeholder:c,disabled:k||a,onChange:p,onFocus:g,onBlur:m,autoComplete:v,autoFocus:y,min:w,max:b,onClick:x,onKeyUp:L,...H}),e("div",{className:"input-link-icon",children:l||u||!V?e(B,{name:"link",disabled:!0}):e(G,{title:"Click here to navigate",children:e("span",{children:e(B,{name:"link",disabled:!1,onClick:()=>{d&&!u&&window.open(d,"_blank")}})})})})]}),f&&u&&e("span",{className:O("ff-link-input-message",{"ff-link-input-message--danger":!!u}),children:f})]})})),sE=({labelsList:r=[],height:i=""})=>{const o=e("div",{className:"ff-chip-tooltip",children:r.filter(((e,t)=>t>0)).map(((t,n)=>e(P,{as:"div",className:"ff-chip-tooltip-label",children:t},`label-${n}-${t}`)))});return e(t,{children:!Q(r)&&n("div",{className:"ff-chip-with-count-container",children:[e(G,{title:r[0],children:e(P,{as:"div",children:re(r[0]||"",10),className:"ff-chip-label",fontWeight:"medium",style:i?{height:i}:void 0})}),r.length>1&&e(G,{title:e(P,{as:"div",children:o}),children:e(P,{as:"div",children:"+"+(r.length-1),className:"ff-chip-count",fontWeight:"medium"})})]})})};class cE extends E{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?this.props.fallback:this.props.children}}const dE=({iconName:t="",onButtonClick:r,buttonLabel:i="Label",buttonText:o="To Add Group",disableButton:a=!1,stepCount:l=1,iconWidth:s=120,iconHeight:c=120,addContentLabel:d="step"})=>n("div",{className:"add-content-button "+(a?"disabled":""),children:[!Q(t)&&e("div",{className:"icon-container",children:e(B,{name:t,width:s,height:c})}),n("div",{className:"typography-label-button",children:[n(P,{fontSize:"12px",fontWeight:"regular",lineHeight:"18px",children:[d+l," :"]}),e(P,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:"Click"}),e(Vf,{label:i,onClick:r,iconName:"plus_user_icon",isDisable:a}),e(P,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:o})]})]}),uE=({variant:t="default",tabsData:r,activeTabId:i,onTabClick:o,noBorder:a=!1,noPadding:l=!1,titleSize:s="12px"})=>{const[d,u]=c(0);return n("div",{className:"ff-tabs-slider-container",children:[n("div",{className:O(`ff-tab-row--${t} ff-tab-row-section`,{"ff-tab-row--no-border":a,"ff-tab-row--no-padding":l,"ff-tab-row--position":r.length>4}),children:[r.length>4&&e(B,{className:"ff-tab-icon ff-tab-icon--previous",name:""+(d?"arrow_left_accordian":""),onClick:()=>{d>0&&u((e=>e-1))},hoverEffect:!0}),e("div",{className:"ff-tab-row-carousel",children:e("div",{className:"carousel_inner",style:{transform:`translateX(-${100*d}%)`},children:r.map((r=>n("button",{onClick:()=>!r.disabled&&o(r.id),disabled:r.disabled,className:O(`ff-tab-button--${t}`,{disabled:r.disabled,active:i===r.id}),style:{flex:"0 0 25%"},children:[n("div",{className:"label-count-section",children:[e(G,{title:r.label.length>9?r.label:"",children:e(P,{children:r.label.length>9?r.label.slice(0,9)+"...":r.label,fontSize:s,lineHeight:"18px",fontWeight:i===r.id?"semi-bold":"regular",color:i===r.id?"var(--tabs-label-active-color)":"var(--tabs-label-default-color)",className:O("ff-tab-label",{"ff-tab-label--active":i===r.id})})}),"default"===t&&r.count&&e("span",{className:O("tab-count",{"tab-count--active":i===r.id}),children:r.count})]}),e("div",{className:O("ff-tab-bar",{"ff-tab-bar--active":i===r.id})}),e("span",{className:"ff-defaultStatus "+("success"===r.status?"ff-successStatus":"error"===r.status?"ff-dangerStatus":"")})]},r.id)))})}),r.length>4&&e(B,{className:"ff-tab-icon ff-tab-icon--next",name:""+(d<Math.ceil(r.length/4)-1?"arrow_right_icon":""),onClick:()=>{d<Math.ceil(r.length/4)-1&&u((e=>e+1))},hoverEffect:!0})]}),e("div",{className:"ff-tab-content",children:r.find((e=>e.id===i))?.component})]})},fE=o((({label:t="Status",iconName:r="update_icon",onClick:i,isDisable:o=!1,variant:a="default",backgroundColor:l=!1,border:s=!1},c)=>{const d={default:"var(--ff-avatar-background-color)",success:"var(--status-success-text-color)",danger:"var(--ff-delete-button-attachment)"};return e("button",{disabled:o,onClick:i,className:`\n ff-status-indicator\n ff-status-indicator--${a}\n ${l?`ff-status-indicator--with-bg ff-status-indicator--${a}-bg`:""}\n ${s?`ff-status-indicator--with-border ff-status-indicator--${a}-border`:""}\n `,ref:c,children:n("div",{className:"ff-status-indicator__content",children:[e(B,{name:"danger"===a?"close":r,color:d[a]||d.default,className:`ff-status-indicator__icon ff-status-indicator__icon--${a}`}),e(P,{as:"div",fontSize:12,className:`ff-status-indicator__label ff-status-indicator__label--${a}`,fontWeight:"medium",lineHeight:"20px",children:t})]})})})),hE=({rootLabel:t,childrenLabels:r,align:i="center",direction:o="horizontal"})=>{const a=r.length;return n("div","vertical"===o?{className:"ff-os-tree-vertical",style:{"--child-count":a},children:[n("div",{className:`ff-os-tree-vertical__row ff-os-tree-vertical__row--${i}`,children:[e("div",{className:"ff-os-tree-vertical__root-label",children:t}),e("div",{className:"ff-os-tree-vertical__horizontal-line"})]}),n("div",{className:"ff-os-tree-vertical__vertical-line-wrapper",children:[e("div",{className:"ff-os-tree-vertical__vertical-line"}),r.map(((t,r)=>n("div",{className:"ff-os-tree-vertical__child",children:[e("div",{className:"ff-os-tree-vertical__child-connector"}),e("div",{className:"ff-os-tree-vertical__child-label",children:t})]},r)))]})]}:{className:`ff-os-tree ff-os-tree--${i}`,style:{"--child-count":a},children:[n("div",{className:"ff-os-tree__root-wrapper",children:[e("div",{className:"ff-os-tree__root-label",children:t}),e("div",{className:"ff-os-tree__vertical-root"})]}),e("div",{className:"ff-os-tree__horizontal-connector",children:r.map(((t,n)=>e("div",{className:"ff-os-tree__vertical-child"},n)))}),e("div",{className:"ff-os-tree__children",children:r.map(((t,n)=>e("div",{className:"ff-os-tree__child-container",children:e("div",{className:"ff-os-tree__child-label",children:t})},n)))})]})},CE=({handleClose:t,handleResend:r,handleOtp:i,resendTimeout:o=30})=>{const[s,d]=c(Array(6).fill("")),[u,f]=c(o),[h,C]=c(!0),p=a(Array(6).fill(null));l((()=>{h||p.current[0]?.focus()}),[h]),l((()=>{let e;return u>0&&(e=window.setInterval((()=>f((e=>e-1))),1e3)),0===u&&C(!1),()=>clearInterval(e)}),[u]);const m=e=>{e.preventDefault();const t=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6),n=Array(6).fill("");t.split("").forEach(((e,t)=>{n[t]=e})),d(n);const r=Math.min(t.length,5);p.current[r]?.focus()};return e(_f,{isOpen:!0,onClose:t,isFooterDisplayed:!1,isHeaderDisplayed:!1,zIndex:999999,customWidth:"340px",children:n("div",{className:"ff-otp-popup",children:[n("div",{className:"ff-otp-header",children:[e(P,{fontSize:24,lineHeight:"36px",fontWeight:"semi-bold",children:"OTP Verification"}),e(B,{name:"close",height:16,width:16,onClick:t,className:"ff-close-icon"})]}),e("div",{className:"ff-otp-boxes",children:s.map(((t,n)=>e("input",{type:"text",maxLength:1,className:`ff-otp-input ${t?"filled":""} ${n===s.findIndex((e=>""===e))?"active":""}`,value:t,onKeyDown:e=>((e,t)=>{const{key:n}=e;if(/^[0-9]$/.test(n)){e.preventDefault();const r=[...s];r[t]=n,d(r),t<5&&p.current[t+1]?.focus()}else if("Backspace"===n){e.preventDefault();const n=[...s];n[t]="",d(n),t>0&&p.current[t-1]?.focus()}})(e,n),onPaste:m,ref:e=>p.current[n]=e,readOnly:!0},n)))}),e(F,{variant:"primary",label:"Submit",onClick:()=>i(s.join("")),disabled:s.includes(""),className:"ff-submit-btn"}),n("div",{className:"ff-resend "+(h?"disabled":""),onClick:h?void 0:()=>{f(o),C(!0),d(Array(6).fill("")),r()},children:["Re-send OTP",u>0?` (${u}s)`:""]})]})})},pE=({isOpen:t,onClose:r,isPlaying:i,onTogglePlay:o,mediaType:s,src:d,headerTitle:u,onDownload:f,onExpand:h,showHeader:p=!0,showDownload:m=!0,showExpand:g=!0,width:v="800px",height:y="432px",showControls:w=!0,customStyle:b,overlay:E=!0,children:M,showControlDownload:A=!1,showControlExpand:x=!1,isFullscreen:L=!1})=>{const k=a(null),H=a(null),[S,V]=c(0),[_,O]=c(0),[N,z]=c(!1),[T,D]=c(0);l((()=>{"video"===s&&k.current&&!M&&(i?k.current.play():k.current.pause())}),[i,s,M]);const I=C((()=>{if(k.current&&!N){const e=k.current.currentTime/k.current.duration*100;D(e||0),V(k.current.currentTime)}}),[N]),Z=C((()=>{k.current&&O(k.current.duration)}),[]),j=C((()=>{V(0),D(0),o?.()}),[o]),R=C((e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`),[]),F=C((e=>{if(k.current){const t=e/100*k.current.duration;k.current.currentTime=t,D(e),V(t)}}),[]),U=C((e=>{if(N||!H.current)return;const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));F(i)}),[F,N]),q=C((e=>{if(!H.current)return;z(!0);const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));F(i)}),[F]),W=C((e=>{if(!N||!H.current||!k.current)return;const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));F(i)}),[N,F]),Q=C((()=>{z(!1)}),[]);return l((()=>{if(N)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",Q)}}),[N,W,Q]),t?e(Vs,{isOpen:t,onClose:r,isMaximized:!1,showHeader:p,overlay:E,downloadHandler:()=>{},customStyle:b,header:n("div",{className:"ff-header-content",children:[e(B,{width:23,height:23,name:"automatic_locator"}),e(P,{children:e("span",{className:"ff-header-title",children:u})})]}),icons:e(G,{title:"Close",children:e(B,{name:"close",onClick:r})}),width:v,height:y,zIndex:999,children:n("div",{className:"ff-video-wrapper",children:[M||("video"===s?e("video",{ref:k,src:d,className:"ff-media-video",onTimeUpdate:I,onLoadedMetadata:Z,onEnded:j}):e("img",{src:d,alt:"Preview",className:"ff-media-image"})),n("div",{className:"ff-top-right-icons",children:[m&&e(G,{title:"Download",children:e(B,{name:"download_file",color:"white",onClick:f})}),g&&e(G,{title:L?"Minimize":"Maximize",children:e(B,{name:L?"collapse_icon":"expand_icon",color:"white",onClick:h})})]}),"video"===s&&w&&!M&&n("div",{className:"ff-media-controls",children:[e("button",{onClick:o,className:"ff-play-pause-btn",children:e(G,{title:i?"Pause":"Play",children:e(B,{width:35,height:35,name:i?"pause_button":"play_button",color:"white"})})}),n("div",{className:"ff-progress-bar",children:[e("span",{className:"ff-current-time",children:R(S)}),e("input",{type:"range",className:"ff-seek-bar",min:0,max:100,value:T,onChange:e=>F(parseFloat(e.target.value)),onClick:U,onMouseDown:q,ref:H}),e("span",{className:"ff-total-time",children:R(_)})]}),n("div",{className:"ff-control-icons",children:[A&&e(G,{title:"Download",children:e(B,{name:"download_file",color:"white",onClick:f,cursorType:"pointer"})}),x&&e(G,{title:L?"Minimize":"Maximize",children:e(B,{name:L?"collapse_icon":"expand_icon",color:"white",onClick:h,cursorType:"pointer"})})]})]})]})}):null},mE=({header:r,secondaryHeader:i,primaryCount:o,secondaryCount:a,primaryItems:l,secondaryItems:s,width:c,activeTab:d="primary",activeTabId:u,onPrimaryTabClick:f,onSecondaryTabClick:h,onTabClick:C,actions:p,tabsData:m,notchPosition:g="top-left"})=>{const v=i&&"secondary"===d?s:l,y=a&&parseInt(a)>0,w=o&&parseInt(o)>0,b=i&&(w||y),{tooltip:E="Download",iconName:M="download_file",disabled:A=!1,onClick:x,className:L=""}=p?.download||{},{tooltip:k="Delete",iconName:H="delete_icon",disabled:S=!1,onClick:V,className:_=""}=p?.delete||{},O=()=>n("div",{className:"ff-dropdown-header-icons",children:[p?.download&&e(G,{title:E,children:e(B,{name:M||"",className:`ff-dropdown-icon ff-download-icon ${L}`,onClick:x,width:18,height:20,disabled:A,hoverEffect:!0})}),p?.delete&&e(G,{title:k,children:e(B,{name:H||"",className:`ff-dropdown-icon ff-delete-icon ${_}`,onClick:V,width:25,height:25,disabled:S,hoverEffect:!0})})]});return n("div",{className:"ff-resolution-dropdown",style:c?{minWidth:c}:{},children:[e("div",{className:"ff-dropdown-notch "+("bottom-center"===g?"bottom-center":"top-left")}),e("div",{className:"ff-dropdown-header",children:e("div",{className:"ff-dropdown-header-content",children:i&&m&&u?n(t,{children:[e(Ps,{tabsData:m,activeTabId:u,onTabClick:e=>{C&&C(e),"tab-1"===e&&f?f():"tab-2"===e&&h&&h()}}),b&&O()]}):i&&b?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(P,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,children:[e(P,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]}),O()]}):i?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(P,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,children:[e(P,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]})]}):e(P,{fontSize:16,fontWeight:"semi-bold",children:r})})}),e("ul",{className:"ff-dropdown-list",children:v?.map(((t,n)=>e("li",{className:"ff-dropdown-item",children:t},n)))})]})},gE=(e,t)=>"string"==typeof e?re(e,t):i.isValidElement(e)?i.cloneElement(e,{},gE(e.props.children,t)):Array.isArray(e)?e.map((e=>gE(e,t))):e,vE=(e,t,n,r)=>{const i=e[t.accessor];if(t.cell){const o=e._id||e.id;return t.cell({value:i,row:e,column:t.accessor,index:n,tableType:r,...o&&{refId:o}})}return t.accessor||i&&"object"!=typeof i?i:"--"},yE=(t,n=[],r,i,o)=>{let a=n;const l=void 0!==i?!i:r;return Q(n)&&(isNaN(t)||(a=Array(t).fill(!0))),e("div",{className:"tree-table-fn-space-container",children:a?.map(((n,r)=>e("span",{className:`tree-table-fn-space-block tree-table-fn-space-block-${r} ${n?"":"no-lines"} ${l&&r===t-1?"last-node":""} ${o?"folder":""}`},r)))})},wE=i.memo((({treeRowRef:r,col:i,colIndex:o,columnMeta:a,node:l,selected:s,select:c,onCheckBoxChange:d,onToggleExpand:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,isExpanding:p,columnTextColor:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M})=>{const A={color:`${m||"var(--ff-primary-text-color)"}`,width:a?.width??i?.width,position:a?.sticky?"sticky":void 0,left:a?.sticky?a.left:void 0,zIndex:a?.sticky?a.zIndex:void 0};return n("div",{className:`ff-table-tree-fn-td ${i.isTree&&l.container?"folder":""} ${a?.sticky?"sticky-tree-column":""}`,"data-col-index":o,style:A,children:[i.isTree&&yE(l.hierarchy,l.parentSiblings,l.lastChild,l.nextSibling,l.container),n("div",{className:"tree-fn-title-container",children:[i.isTree&&e("span",{className:`tree-table-fn-space-block last-tree-fn-block last-tree-fn-block tree-table-fn-space-block-${l.hierarchy} ${l?.expanded?"tree-fn-row-expanded":"tree-fn-row-collapsed"} ${l.container&&l.expandable?"":"no-tree-folder"}`,children:l.container&&l.expandable&&n("span",{onClick:()=>u(l),children:[" ",e(p?Ds:N,{})]})}),n("span",{className:"tree-table-fn-td-content "+(i.isTree&&l.container?"folder":""),children:[!l?.isNewNode&&n(t,{children:[i.isTree&&"checkbox"===c&&!(g&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:"none"===l.selectedStatus?e(G,{title:l?.currentEnvId&&l?.envId&&l?.currentEnvId!==l?.envId?"This script is assigned to another environment. Selecting it will reassign it to the current environment.":void 0,children:e(ee,{checked:"completely"===l.selectedStatus,partial:"partially"===l.selectedStatus,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable,isDefaultHover:"none"===l.selectedStatus&&!!l.machine})}):e(ee,{checked:"completely"===l.selectedStatus,partial:"partially"===l.selectedStatus,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable})}),i.isTree&&"radio"===c&&!(g&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:e(Za,{name:l.key,checked:s.includes(l.key),value:l.key,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable})})]}),l.isNewNode&&i.isTree?e(Ts,{onCancel:h,onConfirm:f,value:l.value,label:l?.label,optionsList:l.options,selectedOption:l.selectedOption,withDropdown:"inputWithDropdown"===l.type,handleCustomError:C,inputFieldWidth:y,selectFieldWidth:w,confirmIconTooltip:l.confirmIconTooltip,cancelIconTooltip:l.cancelIconTooltip,isEditable:E,setIsEditable:M,isOnBlurTrue:!1,isDisable:{confirm:b},isTableTree:!0}):e("span",{className:"tree-table-fn-td-content-text",children:gE(vE(l,i),v)})]})]}),i.actions&&!l?.isNewNode&&e("div",{className:"table-tree-fn-row-action",children:i.actions(l,r)})]})}));wE.displayName="TableCell";const bE=i.memo((({node:t,columnsData:n,columnMeta:r,selected:i,select:o,onRowClick:l,onToggleExpand:s,onCheckBoxChange:c,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,index:C,selectedNode:p,hideOnDisable:m,scriptLengthTruncate:g,addModuleInputWidth:v,addModuleSelectWidth:y,disableEditLabelConfirmIcon:w,isEditable:b,setIsEditable:E,style:M})=>{const A=a(null);return e("div",{"data-level":t.hierarchy,ref:A,className:"ff-table-tree-fn-row show-tree "+(p&&p===t.key?"fn-selected-node":""),onClick:e=>l(e,t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||l(e,t)},role:"button",tabIndex:0,id:0===C?"table-fn-first-row":t.key,style:M,children:n.map(((n,a)=>e(wE,{treeRowRef:A,col:n,colIndex:a,node:t,selected:i,select:o,onCheckBoxChange:c,onToggleExpand:s,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,hideOnDisable:m,scriptLengthTruncate:g,addModuleInputWidth:v,addModuleSelectWidth:y,disableEditLabelConfirmIcon:w,isEditable:b,setIsEditable:E,columnMeta:r?.[a]},n.name)))})}));bE.displayName="TableRow";const EE=({flattenedTreeData:t,columnsData:n,columnMeta:r,rowHeight:i=32,startIndex:o=0,totalHeight:a=0,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,expanding:p,selectedNode:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M})=>e("div",{className:"ff-table-tree-fn-body",style:{height:`${a}px`,position:"relative"},children:t?.map(((t,a)=>e(bE,{node:t,columnsData:n,columnMeta:r,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,isExpanding:t.key===p,index:o+a,selectedNode:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M,style:{transform:`translateY(${(o+a)*i}px)`,height:`${i}px`,position:"absolute",top:0,left:0,right:0}},t.key)))}),ME=i.memo((({columnsData:t,columnMeta:r,totalWidth:i,rootNode:o,selected:s,onCheckBoxChange:d,selectedNode:u,tableHeaderBgColor:f,hideOnDisable:h,transparentHeader:C,scriptLengthTruncate:p=25,showHeader:m=!0})=>{const g=a(null),[v,y]=c(!1),[w,b]=c(!1);l((()=>{y(!0)}),[]);const E=(e,t)=>{const n=r?.[e];return{width:n?.width??t,position:n?.sticky?"sticky":void 0,left:n?.sticky?n.left:void 0,zIndex:n?.sticky?n.zIndex:void 0}};return n("div",{className:"ff-table-tree-fn-head",children:[m&&e("div",{className:"ff-table-tree-fn-row no-hover",style:{minWidth:i},children:t.map((({name:t,width:n},i)=>e("div",{className:"ff-table-tree-fn-th "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:{...E(i,n),backgroundColor:C?"transparent":f,pointerEvents:C?"none":"auto"},children:t},t)))}),o&&e("div",{className:"ff-table-tree-fn-row show-tree "+(u&&u===o?.node?.key?"hover":""),ref:g,onMouseEnter:e=>{e.stopPropagation(),b(!0)},onMouseLeave:e=>{e.stopPropagation(),b(!1)},children:t.map(((t,i)=>e("div",{className:"ff-table-tree-fn-td "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:E(i,t.width),children:n("span",{className:"tree-table-fn-default-content",children:[0===i&&"checkbox"===o.select&&!(h&&o.node.isDisabled)&&e(ee,{checked:"partially"!==o?.node?.selectedStatus&&("completely"===o?.node?.selectedStatus||!1),partial:"partially"===o.node.selectedStatus,onChange:e=>d(e,o.node),disabled:o.node.isDisabled}),0===i&&"radio"===o.select&&!(h&&o.node.isDisabled)&&e(Za,{name:o.node.key,checked:s.includes(o.node.key),value:o.node.key,onChange:e=>d(e,o.node),disabled:o.node.isDisabled}),n("span",{className:"tree-table-fn-td-content-text",children:["name"===t.accessor?e("span",{children:o.node[t.accessor]}):e("span",{children:gE(vE(o.node,t),p)}),o.cell&&0===i&&e("span",{className:"table-tree--fn-root-cell",children:o.cell(o.node)})]}),w&&o.actions&&0===i&&v&&g.current&&e("div",{className:"table-tree-fn-row-action",children:o.actions(o.node,g)})]})},i)))})]})}));ME.displayName="TableHead";const AE=32,xE="__root__",LE=(e,t)=>{if(!e?.length)return[];const n=new Map,r=new Map,i=new Map,o=new Map;t&&t.key&&n.set(t.key,t),e.forEach((e=>{n.set(e.key,e);const t=e.parentId??xE;r.has(t)||(r.set(t,[]),o.set(t,{container:0,resource:0})),r.get(t)?.push(e);const i=o.get(t);i&&(e.container?i.container++:i.resource++)})),r.forEach((e=>{e.forEach(((e,t)=>{i.set(e.key,t)}))}));const a=e=>{const t=e.parentId??xE,a=r.get(t);if(!a||0===a.length)return!1;if((i.get(e.key)??0)<a.length-1)return!0;const l=n.get(t),s=o.get(t);if(l&&s){const t=a.filter((e=>e.container)).reduce(((e,t)=>e+(t.totalResourceCount??0)),0),n=a.filter((e=>!e.container)).length,r=Math.max(0,(l.totalResourceCount??0)-(t+n));if(e.container){return s.container<(l.subContainerCount??0)||r>0}return s.resource<r}return!1},l=e=>{if(void 0!==e.selectedStatus)return e.selectedStatus;let r=e;for(;r?.parentId;){const e=n.get(r.parentId);if(!e)break;if("completely"===e.selectedStatus)return"completely";if("none"===e.selectedStatus)return"none";r=e}return"completely"===t?.selectedStatus?"completely":"none"===t?.selectedStatus?"none":e.selectedStatus};return e.map((e=>{const t=e,r=t.parentSiblings&&t.parentSiblings.length>0?t.parentSiblings:(e=>{const t=e.hierarchy??0;if(t<=0)return[];const r=[];let i=e;for(;i&&(r.unshift(i),i.parentId);){const e=n.get(i.parentId);if(!e)break;i=e}const o=r.map((e=>a(e)));return o.length===t?o:o.length>t?o.slice(o.length-t):new Array(t-o.length).fill(!1).concat(o)})(e);return{...e,lastChild:!a(e),parentSiblings:r,selectedStatus:l(e)}}))},kE=o((({treeData:t,columnsData:r,selected:i=[],select:o=null,onChange:s=()=>{},onClick:d=()=>{},onExpand:f=()=>{},loadMore:p=()=>{},tableBorder:m,height:g="calc(100vh - 134px)",newNode:v,onAddConfirm:y=()=>{},onAddCancel:w=()=>{},handleEditFieldError:b,loading:E=!1,rootNode:M,pagination:A=!0,selectedNode:x,tableHeaderBgColor:L="var(--border-color)",hideOnDisable:k=!1,freezeColumns:H,scriptLengthTruncate:S=25,addModuleInputWidth:V=150,addModuleSelectWidth:_,onScroll:O,onScrollEnd:N,disableEditLabelConfirmIcon:z=!1,transparentHeader:T=!1,navigateTreeNode:D=null,handleRemoveNavigateTreeNode:I=()=>{},scrollThreshold:Z=128,showHeader:j=!0},R)=>{const[B,P]=c(null),[F,U]=c(null),[q,W]=c({start:0,end:20}),[G,K]=c(!1),Y=a(null),X=a(null),J=a(0),$=a(E),ee=a(null),te=a(null),ne=a({lastScrollTop:0}),re=a(null),ie=a(0),oe=a(null),ae=a(null),le=a(null),se=a({key:null,attempts:0}),ce=a(null),de=(e,t)=>{const n=String(e??t);return n.endsWith("%")?{value:parseFloat(n),unit:"%"}:{value:parseFloat(n)||0,unit:"px"}},ue=h((()=>{let e=0,t=0;return r.map(((n,r)=>{const{value:i,unit:o}=de(n.width,400),a=!!H&&r<H,l="%"===o?`${i}%`:`${i}px`,s=`calc(${e}px + ${t}%)`;return a&&("%"===o?t+=i:e+=i),{width:l,sticky:a,left:s,zIndex:a?100+(H??0)-r:1}}))}),[r,H]),fe=h((()=>{let e=0,t=0;return r.forEach((n=>{const{value:r,unit:i}=de(n.width,400);"%"===i?t+=r:e+=r})),`calc(${e}px + ${t}%)`}),[r]),he=h((()=>{if(!H)return"0px";let e=0,t=0;return ue.slice(0,H).forEach((n=>{const r=parseFloat(n.width)||0;n.width.endsWith("%")?t+=r:e+=r})),`calc(${e}px + ${t}%)`}),[ue,H]),Ce=h((()=>((e,t,n)=>{if(!t?.sourceId||!t.action)return e;const{sourceId:r,action:i,value:o="",error:a="",label:l,type:s,options:c,selectedOption:d,confirmIconTooltip:u,cancelIconTooltip:f,payloadSourceId:h}=t,C=t?.parentId,p=t?.hierarchy,m=c?.map((e=>({label:e,value:e}))),g=d?{label:d,value:d}:void 0,v=new Map;e.forEach((e=>v.set(e.key,e))),n&&v.set(n.key,n);const y=v.get(r);let w;h&&(w=v.get(h));let b=y??("addInside"===i?w:void 0);!b&&"addInside"===i&&C&&(b=v.get(C));const E="addInside"===i&&!b&&e.length>=0;if(!b&&!E)return e;const M=[...e],A=b?e.findIndex((e=>e.key===b.key)):-1;let x=null,L=0,k=A+1;switch(i){case"addAbove":{const t=b;if(!t)return e;x=t.parentId,L=t.hierarchy;break}case"addBelow":{const t=b;if(!t)return e;x=w?.parentId??t.parentId,L=w?.hierarchy??t.hierarchy;break}case"addInside":{if(E){x=C??h??r??null,L=p??1,k=M.length;break}const t=w??b;if(!t)return e;x=t.key,L=(t.hierarchy??0)+1;const n=M.findIndex((e=>e.key===r));-1!==n&&(k=n+1);break}}const H={hierarchy:L,parentId:x,sourceId:b?.key??r??h??"new-node",isNewNode:!0,key:"new-node",value:o,error:a,label:l,type:s,options:m,selectedOption:g,confirmIconTooltip:u,cancelIconTooltip:f};switch(i){case"addAbove":M.splice(A,0,H);break;case"addBelow":M.splice(A+1,0,H);break;case"addInside":M.splice(Math.max(0,k),0,H)}return M})(t,v,M?.node)),[t,v,M]),pe=h((()=>LE(Ce,M?.node)),[Ce,M?.node]),me=h((()=>pe.filter((e=>!e.hide))),[pe]),ge=h((()=>{const e=new Map;return pe.forEach((t=>e.set(t.key,t))),e}),[pe]),ve=h((()=>{const e=new Map;return me.forEach(((t,n)=>e.set(t.key,n))),e}),[me]),ye=C((e=>{P((t=>t?e&&t!==e?t:null:t)),e&&ae.current?.key!==e||(ae.current=null),le.current&&(clearTimeout(le.current),le.current=null)}),[]);l((()=>{$.current=E}),[E]),l((()=>{ee.current=F}),[F]);const we=C((e=>{ee.current=e,U(e)}),[]),be=C((()=>{const e=Y.current;if(!e)return;const t=J.current||0,n=Math.max(0,e.scrollTop-t),r=e.clientHeight-t;let i=Math.floor(n/AE)-6,o=Math.ceil((n+r)/AE)+6;i=Math.max(0,i),o=Math.min(me.length,o),W((e=>e.start===i&&e.end===o?e:{start:i,end:o}))}),[me.length]),Ee=C((()=>{null===te.current&&(te.current=requestAnimationFrame((()=>{te.current=null,be()})))}),[be]);u((()=>{const e=Y.current;if(!e)return;const t=me.length*AE,n=Math.max(0,t-(e.clientHeight-J.current));ne.current.lastScrollTop>n&&me.length>0&&(v||D?(e.scrollTop=0,ne.current.lastScrollTop=0):B?(e.scrollTop=n,ne.current.lastScrollTop=n):ne.current.lastScrollTop-n>e.clientHeight&&(e.scrollTop=0,ne.current.lastScrollTop=0)),be()}),[me.length,be,v,D,B]);const Me=C((()=>{const e=Y.current;if(!e)return;const n=e.scrollTop,r=n>ne.current.lastScrollTop?"down":"up";if(ne.current.lastScrollTop=n,Ee(),O?.(),oe.current?.(),!A||E||ee.current||Q(t))return;const i=e.scrollHeight-(n+e.clientHeight)<Z,o=n<Z+J.current;"down"===r&&i&&!t[t.length-1]?.lastResource&&(we("below"),p("below")),"up"===r&&o&&!t[0]?.lastResource&&(we("above"),re.current=t[0]?.key??null,p("above"))}),[t,A,E,F,Z,Ee,O,p,we]);l((()=>{if(E||!A||Q(t))return;const e=t[0],n=!e?.lastResource,{totalSubContainerCount:r=0,totalResourceCount:i=0}=M?.node||{},o=r+i,a=me.length<10&&me.length<o;n&&a&&(re.current=e?.key??null,we("above"),p("above"))}),[E,A,t,me.length,M,p,we]),u((()=>{if(E||"above"!==F)E||"below"!==F||we(null);else{const e=Y.current,t=re.current;if(e&&t){const n=ve.get(t);void 0!==n&&n>0&&(e.scrollTop+=n*AE)}re.current=null,we(null)}}),[E,F,ve,we]),l((()=>{const e=Y.current;if(!e)return;const n=n=>{n.deltaY>=0||!A||Q(t)||$.current||ee.current||e.scrollTop>1||t[0]?.lastResource||(re.current=t[0]?.key??null,we("above"),p("above"))};return e.addEventListener("wheel",n,{passive:!0}),()=>{e.removeEventListener("wheel",n)}}),[A,t,p,we]),l((()=>{const e=Y.current;if(e)return oe.current=N?Aa((()=>{N?.()}),150):null,e.addEventListener("scroll",Me,{passive:!0}),()=>{e.removeEventListener("scroll",Me),oe.current?.cancel()}}),[Me,N]),l((()=>{const e=Y.current;if(!e)return;const t=e=>{Date.now()<ie.current&&e.stopImmediatePropagation()};return e.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{e.removeEventListener("scroll",t,!0)}}),[]),l((()=>{const e=X.current;if(!e)return;const t=new ResizeObserver((()=>{J.current=e.getBoundingClientRect().height,be()}));return t.observe(e),()=>t.disconnect()}),[be]),u((()=>{if(!v||!Y.current)return;const e=Y.current,t=ve.get("new-node");if(void 0===t)return;const n=J.current||0,r=e.clientHeight-n;if(r<=0)return;const i=t*AE,o=i+AE,a=Math.max(0,e.scrollTop-n);let l=a;i<a?l=i:o>a+r&&(l=Math.max(0,o-r)),l!==a&&(ie.current=Date.now()+300,e.scrollTop=l+n,be());const s=requestAnimationFrame((()=>{K(!0)}));return()=>cancelAnimationFrame(s)}),[v,ve,be]),l((()=>{v||K(!1)}),[v]),u((()=>{if(!B||E)return;const e=ae.current;if(!e||e.key!==B){const e=requestAnimationFrame((()=>{ye(B)}));return()=>cancelAnimationFrame(e)}const t=ge.get(e.key);if(!t){const t=requestAnimationFrame((()=>{ye(e.key)}));return()=>cancelAnimationFrame(t)}if(Boolean(t.expanded)!==e.expanded)return;const n=requestAnimationFrame((()=>{ye(e.key)}));return()=>cancelAnimationFrame(n)}),[ge,B,E,ye]),l((()=>{se.current.key!==D&&(se.current={key:D,attempts:0}),!D&&ce.current&&(clearTimeout(ce.current),ce.current=null)}),[D]),u((()=>{if(!D||v)return;const e=Y.current;if(!e)return;const n=ve.get(D);if(void 0!==n){se.current={key:D,attempts:0};const t=J.current||0,r=Math.max(AE,e.clientHeight-t),i=n*AE+16,o=Math.max(0,i-r/2)+t;return ie.current=Date.now()+400,e.scrollTo({top:o,behavior:"smooth"}),Ee(),ce.current&&clearTimeout(ce.current),void(ce.current=setTimeout((()=>{I?.()}),350))}if(E||F)return;const r=se.current;if(r.key!==D&&(r.key=D,r.attempts=0),r.attempts+=1,!(r.attempts>30))return A&&!0!==t[0]?.lastResource?(re.current=null,we("above"),void p("above")):void(r.attempts>2&&I?.());I?.()}),[D,v,ve,E,F,A,t,p,Ee,I,we]);const Ae=C((e=>{if(B)return;const t=!e?.expanded;P(e.key),ae.current={key:e.key,expanded:t},le.current&&clearTimeout(le.current);const n=Date.now(),r=()=>{if(ae.current?.key!==e.key)return;const t=$.current,i=Date.now()-n>=2e3;!t||i?ye(e.key):le.current=setTimeout(r,1e3)};le.current=setTimeout(r,1e3),f?.(e)}),[B,f,ye]),xe=C(((e,t)=>{B||s?.(e,t)}),[s,B]),Le=C(((e,t)=>{B||d?.(e,t)}),[d,B]);l((()=>()=>{null!==te.current&&(cancelAnimationFrame(te.current),te.current=null),le.current&&clearTimeout(le.current),ce.current&&clearTimeout(ce.current)}),[]);const ke=me.length*AE,He=me.slice(q.start,q.end);return e("div",{className:"tree-table-wrapper-container table-tree-fn",children:e("div",{className:"tree-table-fn-wrap",ref:R,children:e("div",{className:"table-fn-scrollable "+(me.length?"":"table-fn-empty"),ref:Y,style:{"--table-height":me.length?g:"auto","--frozen-column-width":he,border:m},children:n("div",{className:"tree-table-fn",style:{width:fe},children:[e("div",{ref:X,style:{position:"sticky",top:0,zIndex:98},children:e(ME,{columnsData:r,columnMeta:ue,totalWidth:fe,rootNode:M,onCheckBoxChange:xe,selected:i,selectedNode:x,tableHeaderBgColor:L,hideOnDisable:k,transparentHeader:T,scriptLengthTruncate:S,showHeader:j})}),e(EE,{flattenedTreeData:He,columnsData:r,columnMeta:ue,totalWidth:fe,rowHeight:AE,startIndex:q.start,totalHeight:ke,selected:i,select:o,onRowClick:Le,onToggleExpand:Ae,onCheckBoxChange:xe,onAddConfirm:y,onAddCancel:w,handleEditFieldError:b,expanding:B,selectedNode:x,hideOnDisable:k,scriptLengthTruncate:S,addModuleInputWidth:V,addModuleSelectWidth:_,disableEditLabelConfirmIcon:z,isEditable:v?G:void 0,setIsEditable:v?e=>{K(Boolean(e))}:void 0})]})})})})}));function HE(e,t,n,r,i,o="children"){return function e(a){for(let l=0;l<a.length;l++){const s=a[l];if(s&&s[t]===n){const e=[...a];return"replace"===i?e[l]=r:e.splice("above"===i?l:l+1,0,r),{updatedArray:e}}if(s&&s[o]&&Array.isArray(s[o])){const t=e(s[o]);if(t)return{updatedArray:a.map(((e,n)=>n===l?{...e,[o]:t.updatedArray}:e))}}}return null}(e)}kE.displayName="TableTreeFn";const SE=(e,t)=>{if(e===t)return!0;if(null==e||null==t||"object"!=typeof e||"object"!=typeof t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Array.isArray(e),r=Array.isArray(t);if(n!==r)return!1;const i=n?e:Object.keys(e),o=r?t:Object.keys(t);if(i.length!==o.length)return!1;if(n)return i.every(((e,t)=>SE(e,o[t])));{const n=new Set(o);return i.every((r=>n.has(r)&&SE(e[r],t[r])))}},VE=(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every(((e,n)=>{const r=t[n];return SE(e,r)})));function _E(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function OE(e,t){return e&t}function NE(e,t){return e|t}function zE(e,t){return e^t}function TE(e,t){return e&~t}function DE(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function IE(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var ZE,jE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function RE(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=jE.charAt(n>>6)+jE.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=jE.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=jE.charAt(n>>2)+jE.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function BE(e){var t,n="",r=0,i=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var o=jE.indexOf(e.charAt(t));o<0||(0==r?(n+=_E(o>>2),i=3&o,r=1):1==r?(n+=_E(i<<2|o>>4),i=15&o,r=2):2==r?(n+=_E(i),n+=_E(o>>2),i=3&o,r=3):(n+=_E(i<<2|o>>4),n+=_E(15&o),r=0))}return 1==r&&(n+=_E(i<<2)),n}var PE,FE=function(e){var t;if(void 0===ZE){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(ZE={},t=0;t<16;++t)ZE[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)ZE[n.charAt(t)]=t;for(t=0;t<8;++t)ZE[r.charAt(t)]=-1}var i=[],o=0,a=0;for(t=0;t<e.length;++t){var l=e.charAt(t);if("="==l)break;if(-1!=(l=ZE[l])){if(void 0===l)throw new Error("Illegal character at offset "+t);o|=l,++a>=2?(i[i.length]=o,o=0,a=0):o<<=4}}if(a)throw new Error("Hex encoding incomplete: 4 bits missing");return i},UE={decode:function(e){var t;if(void 0===PE){var n="= \f\n\r\t \u2028\u2029";for(PE=Object.create(null),t=0;t<64;++t)PE["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(PE["-"]=62,PE._=63,t=0;t<9;++t)PE[n.charAt(t)]=-1}var r=[],i=0,o=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=PE[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);i|=a,++o>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=i>>10;break;case 3:r[r.length]=i>>16,r[r.length]=i>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=UE.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return UE.decode(e)}},qE=1e13,WE=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,r,i=this.buf,o=i.length;for(n=0;n<o;++n)(r=i[n]*e+t)<qE?t=0:r-=(t=0|r/qE)*qE,i[n]=r;t>0&&(i[n]=t)},e.prototype.sub=function(e){var t,n,r=this.buf,i=r.length;for(t=0;t<i;++t)(n=r[t]-e)<0?(n+=qE,e=1):e=0,r[t]=n;for(;0===r[r.length-1];)r.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),r=t.length-2;r>=0;--r)n+=(qE+t[r]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*qE+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),QE=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,GE=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function KE(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}var YE,XE=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var r="",i=e;i<t;++i)if(r+=this.hexByte(this.get(i)),!0!==n)switch(15&i){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(r++)):String.fromCharCode((15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,r,i="",o=e;o<t;)n=this.get(o++),r=this.get(o++),i+=String.fromCharCode(n<<8|r);return i},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?QE:GE).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(r+=":"+i[5],i[6]&&(r+=":"+i[6],i[7]&&(r+="."+i[7]))),i[8]&&(r+=" UTC","Z"!=i[8]&&(r+=i[8],i[9]&&(r+=":"+i[9]))),r):"Unrecognized time: "+r},e.prototype.parseInteger=function(e,t){for(var n,r=this.get(e),i=r>127,o=i?255:0,a="";r==o&&++e<t;)r=this.get(e);if(0===(n=t-e))return i?-1:0;if(n>4){for(a=r,n<<=3;!(128&(+a^o));)a=+a<<1,--n;a="("+n+" bit)\n"}i&&(r-=256);for(var l=new WE(r),s=e+1;s<t;++s)l.mulAdd(256,this.get(s));return a+l.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),i="("+((t-e-1<<3)-r)+" bit)\n",o="",a=e+1;a<t;++a){for(var l=this.get(a),s=a==t-1?r:0,c=7;c>=s;--c)o+=l>>c&1?"1":"0";if(o.length>n)return i+KE(o,n)}return i+o},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return KE(this.parseStringISO(e,t),n);var r=t-e,i="("+r+" byte)\n";r>(n/=2)&&(t=e+n);for(var o=e;o<t;++o)i+=this.hexByte(this.get(o));return r>n&&(i+="…"),i},e.prototype.parseOID=function(e,t,n){for(var r="",i=new WE,o=0,a=e;a<t;++a){var l=this.get(a);if(i.mulAdd(128,127&l),o+=7,!(128&l)){if(""===r)if((i=i.simplify())instanceof WE)i.sub(80),r="2."+i.toString();else{var s=i<80?i<40?0:1:2;r=s+"."+(i-40*s)}else r+="."+i.toString();if(r.length>n)return KE(r,n);i=new WE,o=0}}return o>0&&(r+=".incomplete"),r},e}(),JE=function(){function e(e,t,n,r,i){if(!(r instanceof $E))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=r,this.sub=i}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return KE(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return KE(this.stream.parseStringISO(t,t+n),e);case 30:return KE(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var r=0;r<n;++r)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substr(t,n)},e.decode=function(t){var n;n=t instanceof XE?t:new XE(t,0);var r=new XE(n),i=new $E(n),o=e.decodeLength(n),a=n.pos,l=a-r.pos,s=null,c=function(){var t=[];if(null!==o){for(var r=a+o;n.pos<r;)t[t.length]=e.decode(n);if(n.pos!=r)throw new Error("Content size is not correct for container starting at offset "+a)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}o=a-n.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return t};if(i.tagConstructed)s=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");s=c();for(var d=0;d<s.length;++d)if(s[d].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){s=null}if(null===s){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+a);n.pos=a+Math.abs(o)}return new e(r,l,o,i,s)},e}(),$E=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new WE;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),eM=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],tM=(1<<26)/eM[eM.length-1],nM=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<<t)-1,i=!1,o="",a=this.t,l=this.DB-a*this.DB%t;if(a-- >0)for(l<this.DB&&(n=this[a]>>l)>0&&(i=!0,o=_E(n));a>=0;)l<t?(n=(this[a]&(1<<l)-1)<<t-l,n|=this[--a]>>(l+=this.DB-t)):(n=this[a]>>(l-=t)&r,l<=0&&(l+=this.DB,--a)),n>0&&(i=!0),i&&(o+=_E(n));return i?o:"0"},e.prototype.negate=function(){var t=lM();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+pM(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=lM();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new iM(t):new oM(t),this.exp(e,n)},e.prototype.clone=function(){var e=lM();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,r=this.DB-e*this.DB%8,i=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),128&n&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=lM();return this.bitwiseTo(e,OE,t),t},e.prototype.or=function(e){var t=lM();return this.bitwiseTo(e,NE,t),t},e.prototype.xor=function(e){var t=lM();return this.bitwiseTo(e,zE,t),t},e.prototype.andNot=function(e){var t=lM();return this.bitwiseTo(e,TE,t),t},e.prototype.not=function(){for(var e=lM(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=lM();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=lM();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+DE(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=IE(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,NE)},e.prototype.clearBit=function(e){return this.changeBit(e,TE)},e.prototype.flipBit=function(e){return this.changeBit(e,zE)},e.prototype.add=function(e){var t=lM();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=lM();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=lM();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=lM();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=lM();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=lM(),n=lM();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),o=CM(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new iM(t):t.isEven()?new aM(t):new oM(t);var a=[],l=3,s=n-1,c=(1<<n)-1;if(a[1]=r.convert(this),n>1){var d=lM();for(r.sqrTo(a[1],d);l<=c;)a[l]=lM(),r.mulTo(d,a[l-2],a[l]),l+=2}var u,f,h=e.t-1,C=!0,p=lM();for(i=pM(e[h])-1;h>=0;){for(i>=s?u=e[h]>>i-s&c:(u=(e[h]&(1<<i+1)-1)<<s-i,h>0&&(u|=e[h-1]>>this.DB+i-s)),l=n;!(1&u);)u>>=1,--l;if((i-=l)<0&&(i+=this.DB,--h),C)a[u].copyTo(o),C=!1;else{for(;l>1;)r.sqrTo(o,p),r.sqrTo(p,o),l-=2;l>0?r.sqrTo(o,p):(f=o,o=p,p=f),r.mulTo(p,a[u],o)}for(;h>=0&&!(e[h]&1<<i);)r.sqrTo(o,p),f=o,o=p,p=f,--i<0&&(i=this.DB-1,--h)}return r.revert(o)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var r=t.clone(),i=this.clone(),o=CM(1),a=CM(0),l=CM(0),s=CM(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);for(;i.isEven();)i.rShiftTo(1,i),n?(l.isEven()&&s.isEven()||(l.addTo(this,l),s.subTo(t,s)),l.rShiftTo(1,l)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);r.compareTo(i)>=0?(r.subTo(i,r),n&&o.subTo(l,o),a.subTo(s,a)):(i.subTo(r,i),n&&l.subTo(o,l),s.subTo(a,s))}return 0!=i.compareTo(e.ONE)?e.ZERO:s.compareTo(t)>=0?s.subtract(t):s.signum()<0?(s.addTo(t,s),s.signum()<0?s.add(t):s):s},e.prototype.pow=function(e){return this.exp(e,new rM)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=eM[eM.length-1]){for(t=0;t<eM.length;++t)if(n[0]==eM[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<eM.length;){for(var r=eM[t],i=t+1;i<eM.length&&r<tM;)r*=eM[i++];for(r=n.modInt(r);t<i;)if(r%eM[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(t,n);r=2}this.t=0,this.s=0;for(var i=t.length,o=!1,a=0;--i>=0;){var l=8==r?255&+t[i]:hM(t,i);l<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==a?this[this.t++]=l:a+r>this.DB?(this[this.t-1]|=(l&(1<<this.DB-a)-1)<<a,this[this.t++]=l>>this.DB-a):this[this.t-1]|=l<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM,l=this.t-1;l>=0;--l)t[l+o+1]=this[l]>>r|a,a=(this[l]&i)<<n;for(l=o-1;l>=0;--l)t[l]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&o)<<i,t[a-n]=this[a]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),i=t.abs(),o=r.t;for(n.t=o+i.t;--o>=0;)n[o]=0;for(o=0;o<i.t;++o)n[o+r.t]=r.am(0,i[o],n,o,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var i=t.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=lM());var a=lM(),l=this.s,s=t.s,c=this.DB-pM(i[i.t-1]);c>0?(i.lShiftTo(c,a),o.lShiftTo(c,r)):(i.copyTo(a),o.copyTo(r));var d=a.t,u=a[d-1];if(0!=u){var f=u*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),h=this.FV/f,C=(1<<this.F1)/f,p=1<<this.F2,m=r.t,g=m-d,v=null==n?lM():n;for(a.dlShiftTo(g,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),e.ONE.dlShiftTo(d,v),v.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--g>=0;){var y=r[--m]==u?this.DM:Math.floor(r[m]*h+(r[m-1]+p)*C);if((r[m]+=a.am(0,y,r,g,0,d))<y)for(a.dlShiftTo(g,v),r.subTo(v,r);r[m]<--y;)r.subTo(v,r)}null!=n&&(r.drShiftTo(d,n),l!=s&&e.ZERO.subTo(n,n)),r.t=d,r.clamp(),c>0&&r.rShiftTo(c,r),l<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=lM(),i=lM(),o=n.convert(this),a=pM(t)-1;for(o.copyTo(r);--a>=0;)if(n.sqrTo(r,i),(t&1<<a)>0)n.mulTo(i,o,r);else{var l=r;r=i,i=l}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=CM(n),i=lM(),o=lM(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),o=!1,a=0,l=0,s=0;s<t.length;++s){var c=hM(t,s);c<0?"-"==t.charAt(s)&&0==this.signum()&&(o=!0):(l=n*l+c,++a>=r&&(this.dMultiply(i),this.dAddOffset(l,0),a=0,l=0))}a>0&&(this.dMultiply(Math.pow(n,a)),this.dAddOffset(l,0)),o&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),NE,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var i=[],o=7&t;i.length=1+(t>>3),n.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r<o;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=o;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);(t=t+1>>1)>eM.length&&(t=eM.length);for(var o=lM(),a=0;a<t;++a){o.fromInt(eM[Math.floor(Math.random()*eM.length)]);var l=o.modPow(i,this);if(0!=l.compareTo(e.ONE)&&0!=l.compareTo(n)){for(var s=1;s++<r&&0!=l.compareTo(n);)if(0==(l=l.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=l.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=lM();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var o=n.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)t(n);else{o<a&&(a=o),a>0&&(n.rShiftTo(a,n),r.rShiftTo(a,r));var l=function(){(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(l,0):(a>0&&r.lShiftTo(a,r),setTimeout((function(){t(r)}),0))};setTimeout(l,10)}},e.prototype.fromNumberAsync=function(t,n,r,i){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),NE,this),this.isEven()&&this.dAddOffset(1,0);var o=this,a=function(){o.dAddOffset(2,0),o.bitLength()>t&&o.subTo(e.ONE.shiftLeft(t-1),o),o.isProbablePrime(n)?setTimeout((function(){i()}),0):setTimeout(a,0)};setTimeout(a,0)}else{var l=[],s=7&t;l.length=1+(t>>3),n.nextBytes(l),s>0?l[0]&=(1<<s)-1:l[0]=0,this.fromString(l,256)}},e}(),rM=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),iM=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),oM=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=lM();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(nM.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=lM();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),aM=function(){function e(e){this.m=e,this.r2=lM(),this.q3=lM(),nM.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=lM();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function lM(){return new nM(null)}function sM(e,t){return new nM(e,t)}var cM="undefined"!=typeof navigator;cM&&"Microsoft Internet Explorer"==navigator.appName?(nM.prototype.am=function(e,t,n,r,i,o){for(var a=32767&t,l=t>>15;--o>=0;){var s=32767&this[e],c=this[e++]>>15,d=l*s+c*a;i=((s=a*s+((32767&d)<<15)+n[r]+(1073741823&i))>>>30)+(d>>>15)+l*c+(i>>>30),n[r++]=1073741823&s}return i},YE=30):cM&&"Netscape"!=navigator.appName?(nM.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var a=t*this[e++]+n[r]+i;i=Math.floor(a/67108864),n[r++]=67108863&a}return i},YE=26):(nM.prototype.am=function(e,t,n,r,i,o){for(var a=16383&t,l=t>>14;--o>=0;){var s=16383&this[e],c=this[e++]>>14,d=l*s+c*a;i=((s=a*s+((16383&d)<<14)+n[r]+i)>>28)+(d>>14)+l*c,n[r++]=268435455&s}return i},YE=28),nM.prototype.DB=YE,nM.prototype.DM=(1<<YE)-1,nM.prototype.DV=1<<YE;nM.prototype.FV=Math.pow(2,52),nM.prototype.F1=52-YE,nM.prototype.F2=2*YE-52;var dM,uM,fM=[];for(dM="0".charCodeAt(0),uM=0;uM<=9;++uM)fM[dM++]=uM;for(dM="a".charCodeAt(0),uM=10;uM<36;++uM)fM[dM++]=uM;for(dM="A".charCodeAt(0),uM=10;uM<36;++uM)fM[dM++]=uM;function hM(e,t){var n=fM[e.charCodeAt(t)];return null==n?-1:n}function CM(e){var t=lM();return t.fromInt(e),t}function pM(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}nM.ZERO=CM(0),nM.ONE=CM(1);var mM=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,r;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();var gM,vM,yM=null;if(null==yM){yM=[],vM=0;var wM=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var bM=new Uint32Array(256);for(window.crypto.getRandomValues(bM),wM=0;wM<bM.length;++wM)yM[vM++]=255&bM[wM]}var EM=0,MM=function(e){if((EM=EM||0)>=256||vM>=256)window.removeEventListener?window.removeEventListener("mousemove",MM,!1):window.detachEvent&&window.detachEvent("onmousemove",MM);else try{var t=e.x+e.y;yM[vM++]=255&t,EM+=1}catch(e){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",MM,!1):window.attachEvent&&window.attachEvent("onmousemove",MM))}function AM(){if(null==gM){for(gM=new mM;vM<256;){var e=Math.floor(65536*Math.random());yM[vM++]=255&e}for(gM.init(yM),vM=0;vM<yM.length;++vM)yM[vM]=0;vM=0}return gM.next()}var xM=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=AM()},e}();var LM=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=sM(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=function(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=63&i|128,n[--t]=i>>6|192):(n[--t]=63&i|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var o=new xM,a=[];t>2;){for(a[0]=0;0==a[0];)o.nextBytes(a);n[--t]=a[0]}return n[--t]=2,n[--t]=0,new nM(n)}(e,t);if(null==n)return null;var r=this.doPublic(n);if(null==r)return null;for(var i=r.toString(16),o=i.length,a=0;a<2*t-o;a++)i="0"+i;return i},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=sM(e,16),this.e=parseInt(t,16),this.d=sM(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,r,i,o,a,l){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=sM(e,16),this.e=parseInt(t,16),this.d=sM(n,16),this.p=sM(r,16),this.q=sM(i,16),this.dmp1=sM(o,16),this.dmq1=sM(a,16),this.coeff=sM(l,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new xM,r=e>>1;this.e=parseInt(t,16);for(var i=new nM(t,16);;){for(;this.p=new nM(e-r,1,n),0!=this.p.subtract(nM.ONE).gcd(i).compareTo(nM.ONE)||!this.p.isProbablePrime(10););for(;this.q=new nM(r,1,n),0!=this.q.subtract(nM.ONE).gcd(i).compareTo(nM.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var a=this.p.subtract(nM.ONE),l=this.q.subtract(nM.ONE),s=a.multiply(l);if(0==s.gcd(i).compareTo(nM.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(s),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(l),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=sM(e,16),n=this.doPrivate(t);return null==n?null:function(e,t){var n=e.toByteArray(),r=0;for(;r<n.length&&0==n[r];)++r;if(n.length-r!=t-1||2!=n[r])return null;++r;for(;0!=n[r];)if(++r>=n.length)return null;var i="";for(;++r<n.length;){var o=255&n[r];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new xM,i=e>>1;this.e=parseInt(t,16);var o=new nM(t,16),a=this,l=function(){var t=function(){if(a.p.compareTo(a.q)<=0){var e=a.p;a.p=a.q,a.q=e}var t=a.p.subtract(nM.ONE),r=a.q.subtract(nM.ONE),i=t.multiply(r);0==i.gcd(o).compareTo(nM.ONE)?(a.n=a.p.multiply(a.q),a.d=o.modInverse(i),a.dmp1=a.d.mod(t),a.dmq1=a.d.mod(r),a.coeff=a.q.modInverse(a.p),setTimeout((function(){n()}),0)):setTimeout(l,0)},s=function(){a.q=lM(),a.q.fromNumberAsync(i,1,r,(function(){a.q.subtract(nM.ONE).gcda(o,(function(e){0==e.compareTo(nM.ONE)&&a.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(s,0)}))}))},c=function(){a.p=lM(),a.p.fromNumberAsync(e-i,1,r,(function(){a.p.subtract(nM.ONE).gcda(o,(function(e){0==e.compareTo(nM.ONE)&&a.p.isProbablePrime(10)?setTimeout(s,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(l,0)},e.prototype.sign=function(e,t,n){var r=function(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,r="",i=0;i<n;i+=2)r+="ff";return sM("0001"+r+"00"+e,16)}((kM[n]||"")+t(e).toString(),this.n.bitLength()/4);if(null==r)return null;var i=this.doPrivate(r);if(null==i)return null;var o=i.toString(16);return 1&o.length?"0"+o:o},e.prototype.verify=function(e,t,n){var r=sM(t,16),i=this.doPublic(r);return null==i?null:function(e){for(var t in kM)if(kM.hasOwnProperty(t)){var n=kM[t],r=n.length;if(e.substr(0,r)==n)return e.substr(r)}return e}
27
+ */function dg(){return lg||(lg=1,e=cg,"production"!==process.env.NODE_ENV&&function(){var t,n,r,i,o;if("undefined"==typeof window||"function"!=typeof MessageChannel){var a=null,l=null,s=function(){if(null!==a)try{var t=e.unstable_now();a(!0,t),a=null}catch(e){throw setTimeout(s,0),e}},c=Date.now();e.unstable_now=function(){return Date.now()-c},t=function(e){null!==a?setTimeout(t,0,e):(a=e,setTimeout(s,0))},n=function(e,t){l=setTimeout(e,t)},r=function(){clearTimeout(l)},i=function(){return!1},o=e.unstable_forceFrameRate=function(){}}else{var d=window.performance,u=window.Date,f=window.setTimeout,h=window.clearTimeout;if("undefined"!=typeof console){var C=window.requestAnimationFrame,p=window.cancelAnimationFrame;"function"!=typeof C&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof d&&"function"==typeof d.now)e.unstable_now=function(){return d.now()};else{var m=u.now();e.unstable_now=function(){return u.now()-m}}var g=!1,v=null,y=-1,w=5,b=0;i=function(){return e.unstable_now()>=b},o=function(){},e.unstable_forceFrameRate=function(e){e<0||e>125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):w=e>0?Math.floor(1e3/e):5};var E=new MessageChannel,M=E.port2;E.port1.onmessage=function(){if(null!==v){var t=e.unstable_now();b=t+w;try{v(!0,t)?M.postMessage(null):(g=!1,v=null)}catch(e){throw M.postMessage(null),e}}else g=!1},t=function(e){v=e,g||(g=!0,M.postMessage(null))},n=function(t,n){y=f((function(){t(e.unstable_now())}),n)},r=function(){h(y),y=-1}}function A(e,t){var n=e.length;e.push(t),function(e,t,n){for(var r=n;;){var i=r-1>>>1,o=e[i];if(!(void 0!==o&&k(o,t)>0))return;e[i]=t,e[r]=o,r=i}}(e,t,n)}function x(e){var t=e[0];return void 0===t?null:t}function L(e){var t=e[0];if(void 0!==t){var n=e.pop();return n!==t&&(e[0]=n,function(e,t,n){for(var r=n,i=e.length;r<i;){var o=2*(r+1)-1,a=e[o],l=o+1,s=e[l];if(void 0!==a&&k(a,t)<0)void 0!==s&&k(s,a)<0?(e[r]=s,e[l]=t,r=l):(e[r]=a,e[o]=t,r=o);else{if(!(void 0!==s&&k(s,t)<0))return;e[r]=s,e[l]=t,r=l}}}(e,n,0)),t}return null}function k(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var H=0,S=0,V="function"==typeof SharedArrayBuffer?new SharedArrayBuffer(4*Int32Array.BYTES_PER_ELEMENT):"function"==typeof ArrayBuffer?new ArrayBuffer(4*Int32Array.BYTES_PER_ELEMENT):null,_=null!==V?new Int32Array(V):[];_[0]=0,_[3]=0,_[1]=0;var O=0,N=null,z=null,T=0;function D(e){if(null!==z){var t=T;if((T+=e.length)+1>O){if((O*=2)>524288)return console.error("Scheduler Profiling: Event log exceeded maximum size. Don't forget to call `stopLoggingProfilingEvents()`."),void I();var n=new Int32Array(4*O);n.set(z),N=n.buffer,z=n}z.set(e,t)}}function I(){var e=N;return O=0,N=null,z=null,T=0,e}function Z(e,t){_[3]++,null!==z&&D([1,1e3*t,e.id,e.priorityLevel])}function j(e,t){_[0]=0,_[1]=0,_[3]--,null!==z&&D([2,1e3*t,e.id])}function R(e,t){H++,_[0]=e.priorityLevel,_[1]=e.id,_[2]=H,null!==z&&D([5,1e3*t,e.id,H])}function B(e,t){_[0]=0,_[1]=0,_[2]=0,null!==z&&D([6,1e3*t,e.id,H])}var P=[],F=[],U=1,q=null,W=3,Q=!1,G=!1,K=!1;function Y(e){for(var t=x(F);null!==t;){if(null===t.callback)L(F);else{if(!(t.startTime<=e))return;L(F),t.sortIndex=t.expirationTime,A(P,t),Z(t,e),t.isQueued=!0}t=x(F)}}function X(e){if(K=!1,Y(e),!G)if(null!==x(P))G=!0,t(J);else{var r=x(F);null!==r&&n(X,r.startTime-e)}}function J(t,o){var a;a=o,null!==z&&D([8,1e3*a,S]),G=!1,K&&(K=!1,r()),Q=!0;var l=W;try{try{return function(t,r){var o=r;for(Y(o),q=x(P);null!==q&&(!(q.expirationTime>o)||t&&!i());){var a=q.callback;if(null!==a){q.callback=null,W=q.priorityLevel;var l=q.expirationTime<=o;R(q,o);var s=a(l);o=e.unstable_now(),"function"==typeof s?(q.callback=s,B(q,o)):(j(q,o),q.isQueued=!1,q===x(P)&&L(P)),Y(o)}else L(P);q=x(P)}if(null!==q)return!0;var c=x(F);return null!==c&&n(X,c.startTime-o),!1}(t,o)}catch(t){if(null!==q){var s=e.unstable_now();!function(e,t){_[0]=0,_[1]=0,_[3]--,null!==z&&D([3,1e3*t,e.id])}(q,s),q.isQueued=!1}throw t}}finally{q=null,W=l,Q=!1,function(e){S++,null!==z&&D([7,1e3*e,S])}(e.unstable_now())}}function $(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var ee=o,te={startLoggingProfilingEvents:function(){O=131072,N=new ArrayBuffer(4*O),z=new Int32Array(N),T=0},stopLoggingProfilingEvents:I,sharedProfilingBuffer:V};e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=te,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.isQueued&&(function(e,t){_[3]--,null!==z&&D([4,1e3*t,e.id])}(t,e.unstable_now()),t.isQueued=!1),t.callback=null},e.unstable_continueExecution=function(){G||Q||(G=!0,t(J))},e.unstable_getCurrentPriorityLevel=function(){return W},e.unstable_getFirstCallbackNode=function(){return x(P)},e.unstable_next=function(e){var t;switch(W){case 1:case 2:case 3:t=3;break;default:t=W}var n=W;W=t;try{return e()}finally{W=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=ee,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=W;W=e;try{return t()}finally{W=n}},e.unstable_scheduleCallback=function(i,o,a){var l,s,c=e.unstable_now();if("object"==typeof a&&null!==a){var d=a.delay;l="number"==typeof d&&d>0?c+d:c,s="number"==typeof a.timeout?a.timeout:$(i)}else s=$(i),l=c;var u=l+s,f={id:U++,callback:o,priorityLevel:i,startTime:l,expirationTime:u,sortIndex:-1,isQueued:!1};return l>c?(f.sortIndex=l,A(F,f),null===x(P)&&f===x(F)&&(K?r():K=!0,n(X,l-c))):(f.sortIndex=u,A(P,f),Z(f,c),f.isQueued=!0,G||Q||(G=!0,t(J))),f},e.unstable_shouldYield=function(){var t=e.unstable_now();Y(t);var n=x(P);return n!==q&&null!==q&&null!==n&&null!==n.callback&&n.startTime<=t&&n.expirationTime<q.expirationTime||i()},e.unstable_wrapCallback=function(e){var t=W;return function(){var n=W;W=t;try{return e.apply(this,arguments)}finally{W=n}}}}()),cg;var e}var ug=(sg||(sg=1,"production"===process.env.NODE_ENV?og.exports=(ig||(ig=1,function(e){var t,n,r,i,o;if("undefined"==typeof window||"function"!=typeof MessageChannel){var a=null,l=null,s=function(){if(null!==a)try{var t=e.unstable_now();a(!0,t),a=null}catch(e){throw setTimeout(s,0),e}},c=Date.now();e.unstable_now=function(){return Date.now()-c},t=function(e){null!==a?setTimeout(t,0,e):(a=e,setTimeout(s,0))},n=function(e,t){l=setTimeout(e,t)},r=function(){clearTimeout(l)},i=function(){return!1},o=e.unstable_forceFrameRate=function(){}}else{var d=window.performance,u=window.Date,f=window.setTimeout,h=window.clearTimeout;if("undefined"!=typeof console){var C=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof C&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof d&&"function"==typeof d.now)e.unstable_now=function(){return d.now()};else{var p=u.now();e.unstable_now=function(){return u.now()-p}}var m=!1,g=null,v=-1,y=5,w=0;i=function(){return e.unstable_now()>=w},o=function(){},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):y=0<e?Math.floor(1e3/e):5};var b=new MessageChannel,E=b.port2;b.port1.onmessage=function(){if(null!==g){var t=e.unstable_now();w=t+y;try{g(!0,t)?E.postMessage(null):(m=!1,g=null)}catch(e){throw E.postMessage(null),e}}else m=!1},t=function(e){g=e,m||(m=!0,E.postMessage(null))},n=function(t,n){v=f((function(){t(e.unstable_now())}),n)},r=function(){h(v),v=-1}}function M(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,i=e[r];if(!(void 0!==i&&0<L(i,t)))break e;e[r]=t,e[n]=i,n=r}}function A(e){return void 0===(e=e[0])?null:e}function x(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length;r<i;){var o=2*(r+1)-1,a=e[o],l=o+1,s=e[l];if(void 0!==a&&0>L(a,n))void 0!==s&&0>L(s,a)?(e[r]=s,e[l]=n,r=l):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==s&&0>L(s,n)))break e;e[r]=s,e[l]=n,r=l}}}return t}return null}function L(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var k=[],H=[],S=1,V=null,_=3,O=!1,N=!1,z=!1;function T(e){for(var t=A(H);null!==t;){if(null===t.callback)x(H);else{if(!(t.startTime<=e))break;x(H),t.sortIndex=t.expirationTime,M(k,t)}t=A(H)}}function D(e){if(z=!1,T(e),!N)if(null!==A(k))N=!0,t(I);else{var r=A(H);null!==r&&n(D,r.startTime-e)}}function I(t,o){N=!1,z&&(z=!1,r()),O=!0;var a=_;try{for(T(o),V=A(k);null!==V&&(!(V.expirationTime>o)||t&&!i());){var l=V.callback;if(null!==l){V.callback=null,_=V.priorityLevel;var s=l(V.expirationTime<=o);o=e.unstable_now(),"function"==typeof s?V.callback=s:V===A(k)&&x(k),T(o)}else x(k);V=A(k)}if(null!==V)var c=!0;else{var d=A(H);null!==d&&n(D,d.startTime-o),c=!1}return c}finally{V=null,_=a,O=!1}}function Z(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var j=o;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){N||O||(N=!0,t(I))},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_getFirstCallbackNode=function(){return A(k)},e.unstable_next=function(e){switch(_){case 1:case 2:case 3:var t=3;break;default:t=_}var n=_;_=t;try{return e()}finally{_=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=j,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=_;_=e;try{return t()}finally{_=n}},e.unstable_scheduleCallback=function(i,o,a){var l=e.unstable_now();if("object"==typeof a&&null!==a){var s=a.delay;s="number"==typeof s&&0<s?l+s:l,a="number"==typeof a.timeout?a.timeout:Z(i)}else a=Z(i),s=l;return i={id:S++,callback:o,priorityLevel:i,startTime:s,expirationTime:a=s+a,sortIndex:-1},s>l?(i.sortIndex=s,M(H,i),null===A(k)&&i===A(H)&&(z?r():z=!0,n(D,s-l))):(i.sortIndex=a,M(k,i),N||O||(N=!0,t(I))),i},e.unstable_shouldYield=function(){var t=e.unstable_now();T(t);var n=A(k);return n!==V&&null!==V&&null!==n&&null!==n.callback&&n.startTime<=t&&n.expirationTime<V.expirationTime||i()},e.unstable_wrapCallback=function(e){var t=_;return function(){var n=_;_=t;try{return e.apply(this,arguments)}finally{_=n}}}}(ag)),ag):og.exports=dg()),og.exports);const fg=Symbol(),hg=Symbol(),Cg="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?l:u,pg=ug.unstable_runWithPriority?e=>{try{ug.unstable_runWithPriority(ug.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e();function mg(e,t){const n=d(e)[fg];if("object"==typeof process&&"production"!==process.env.NODE_ENV&&!n)throw new Error("useContextSelector requires special context");const{v:{current:r},n:{current:i},l:o}=n,a=t(r),[l,s]=v(((e,n)=>{if(!n)return[r,a];if("p"in n)throw n.p;if(n.n===i)return Object.is(e[1],a)?e:[r,a];try{if("v"in n){if(Object.is(e[0],n.v))return e;const r=t(n.v);return Object.is(e[1],r)?e:[n.v,r]}}catch(e){}return[...e]}),[r,a]);return Object.is(l[1],a)||s(),Cg((()=>(o.add(s),()=>{o.delete(s)})),[o]),l[1]}const gg=function(e){const t=s({[fg]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[hg]=t.Provider,t.Provider=(n=t.Provider,({value:e,children:t})=>{const r=a(e),i=a(0),[o,l]=c(null);o&&(o(e),l(null));const s=a();if(!s.current){const e=new Set,t=(t,n)=>{i.current+=1;const r={n:i.current};(null==n?void 0:n.suspense)&&(r.n*=-1,r.p=new Promise((e=>{l((()=>t=>{r.v=t,delete r.p,e(t)}))}))),e.forEach((e=>e(r))),t()};s.current={[fg]:{v:r,n:i,l:e,u:t}}}return Cg((()=>{r.current=e,i.current+=1,pg((()=>{s.current[fg].l.forEach((t=>{t({n:i.current,v:e})}))}))}),[e]),p(n,{value:s.current},t)}),delete t.Consumer,t}([ng,()=>{}]),vg=({children:t,useTableRef:n,totalWidth:r})=>{const i=a(null);return l((()=>{n&&i.current&&n(i)}),[n]),e("table",{className:"ff-spreadsheet-table",ref:i,style:{minWidth:`${60+r}px`,tableLayout:"fixed"},children:t})},yg=t=>e("tr",{...t}),wg=t=>e("tr",{className:"ff-spreadsheet-row-header",...t});function bg(){return mg(gg,(([,e])=>e))}function Eg(e){return mg(gg,(([t])=>e(t)))}const Mg=({selected:t,onSelect:n})=>{const i=r.useCallback((()=>{n()}),[n]);return e("th",{className:"ff-spreadsheet-corner-header",onClick:i,tabIndex:0,children:e("div",{className:O("corner-header",{"ff-spreadsheet-header--selected":t}),children:e(B,{variant:t?"dark":"light",color:t?"var(--hover-color)":"var(--text-color)",name:"excel_corner_menu"})})})},Ag=t=>function(n){const i=bg(),o=r.useCallback((()=>i({type:CC})),[i]),a=Eg((e=>e.selected instanceof Yp));return e(t,{...n,selected:a,onSelect:o})},xg=t=>function(n){const i=bg(),o=r.useCallback(((e,t)=>i(function(e,t){return{type:hC,payload:{column:e,extend:t}}}(e,t))),[i]),a=Eg((e=>e.selected.hasEntireColumn(n.column))),l=Eg((e=>e.selectedColumn??void 0)),s=Eg((e=>e.active?Np(e.active,e.model.data):void 0));return e(t,{...n,cell:s,selected:a,selectedColumn:l,onSelect:o,scrollToColumn:n.scrollToColumn})},Lg=xg((({column:t,label:i,selected:o,onSelect:a,setContextMenu:l,deleteColumn:s,addColumnLeft:c,addColumnRight:d,columnContextEnable:u,cell:f,selectedColumn:C,minimumColumnWidth:p,maxColLimit:m,disableDeleteOption:g,contextMenu:v,onAddColumn:y,onDeleteColumn:w,setVisibleRange:b,scrollToColumn:E})=>{const M=bg(),A=Eg((e=>e.model.data)),x=p,L=Eg((e=>e.columnDimensions[t]?.width||x)),k=Eg((e=>e.model.data)),{columnCount:H}=xm(k),S=e=>{b((t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return C&&E(C),n}))},V=h((()=>[{label:"Add Column Left",value:"Add Column Left",iconName:"plus_icon",action:()=>{S("increment"),c(x),y?.(C??t,!0)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Left"]??!1,disable:H>=m},{label:"Add Column Right",value:"Add Column Right",iconName:"plus_icon",action:()=>{S("increment"),d(x),y?.(C??t,!1)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Right"]??!1,disable:H>=m},...g?[]:[{label:"Delete Column",value:"Delete Column",iconName:"delete",action:()=>{S("decrement"),s(),w?.(C??t)},disableTooltip:"",visible:f?.contextDisable?.["Delete Column"]??!1,disable:!1}]]),[C,t,A]),_=r.useCallback(((e,n)=>{const r=n?t-1:t,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientX,l=L,s=e=>{const t=Math.max(x,l+(e.clientX-o));M(np(i,t))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),M(Sp())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),M(Hp())}),[t,L]),N=r.useCallback((e=>M(Mp(e))),[M]),z=r.useCallback((e=>{a(t,e.shiftKey)}),[a,t]),T=r.useCallback((e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"column",options:V})}),[t,C,u,V]);return r.useEffect((()=>{void 0!==C&&"column"===v?.contextType&&l((e=>({open:e.open,contextType:"column",options:V})))}),[t,C,u,V,"column"===v?.contextType]),n("th",{className:O("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{minWidth:`${L}px`},onClick:z,onContextMenu:T,tabIndex:0,children:[e(P,{fontWeight:"medium",children:i??kg(t)}),e("div",{className:"drag-column-selector drag-column-left",onMouseDown:e=>_(e,!1),onDoubleClick:()=>M(np(t,x)),onClick:()=>N({row:-1,column:t})}),e("div",{className:"drag-column-selector drag-column-right",onMouseDown:e=>_(e,!0),onDoubleClick:()=>M(np(t,x)),onClick:()=>N({row:-1,column:t})})]},t)}));function kg(e){let t="",n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}const Hg=({row:t,label:i,selected:o,onSelect:a,setContextMenu:l,addRowTop:s,addRowBottom:c,deleteRow:d,rowContextEnable:u,selectedRow:f,cell:h,maxRowLimit:C,disableDeleteOption:p,contextMenu:m,setVisibleRange:g,scrollToRow:v})=>{const y=bg(),w=Eg((e=>e.rowDimensions[t]?.height||32)),b=Eg((e=>e.model.data)),{rowCount:E}=xm(b),M=e=>{g((t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return f&&v(f),n}))},A=r.useMemo((()=>[{label:"Add Row Top",value:"Add Row Top",iconName:"plus_icon",action:()=>{M("increment"),s()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Top"]??!1,disable:E>=C},{label:"Add Row Bottom",value:"Add Row Bottom",iconName:"plus_icon",action:()=>{M("increment"),c()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Bottom"]??!1,disable:E>=C},...p?[]:[{label:"Delete Row",value:"Delete Row",iconName:"delete",action:()=>{M("decrement"),d()},disableTooltip:"",visible:h?.contextDisable?.["Delete Row"]??!1,disable:!1}]]),[f,t]),x=r.useCallback(((e,n)=>{const r=n?t:t-1,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientY,l=w,s=e=>{const t=Math.max(32,l+(e.clientY-o));y(tp(i,t))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),y(Sp())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),y(Sp())}),[w,t]),L=r.useCallback((e=>y(Mp(e))),[y]),k=r.useCallback((e=>{a(t,e.shiftKey)}),[t]),H=r.useCallback((e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"row",options:A})}),[t,u,A,f]);return r.useEffect((()=>{void 0!==f&&"row"===m?.contextType&&l((e=>({open:e.open,contextType:"row",options:A})))}),[t,u,A,f,"row"===m?.contextType]),n("th",{className:O("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{height:`${w}px`,minWidth:"60px"},onClick:k,onContextMenu:H,tabIndex:0,children:[e(P,{fontWeight:"medium",children:void 0!==i?i:t+1}),e("div",{className:"drag-row-selector drag-row-down",onMouseDown:e=>x(e,!0),onDoubleClick:()=>y(tp(t,32)),onClick:()=>L({row:t,column:-1})}),e("div",{className:"drag-row-selector drag-row-up",onMouseDown:e=>x(e,!1),onDoubleClick:()=>y(tp(t,32)),onClick:()=>L({row:t,column:-1})})]})},Sg=t=>function(n){const i=bg(),o=Eg((e=>e.selected.hasEntireRow(n.row))),a=Eg((e=>e.active?Np(e.active,e.model.data):void 0)),l=Eg((e=>e.selectedRow??void 0)),s=r.useCallback(((e,t)=>i(function(e,t){return{type:fC,payload:{row:e,extend:t}}}(e,t))),[i]);return e(t,{...n,selected:o,cell:a,selectedRow:l,onSelect:s,scrollToRow:n.scrollToRow})},Vg=({row:t,column:n,DataViewer:i,active:o,dragging:a,mode:l,data:s,evaluatedData:c,select:d,activate:u,setCellDimensions:f,setCellData:h})=>{const C=r.useRef(null),p=r.useMemo((()=>({row:t,column:n})),[t,n]),m=r.useCallback((e=>{e.preventDefault(),window.getSelection()?.removeAllRanges(),"view"===l&&(f(p,am(e.currentTarget)),e.shiftKey?d(p):u(p))}),[l,f,p,d,u]),g=r.useCallback((e=>{a&&(f(p,am(e.currentTarget)),d(p))}),[f,d,a,p]);return r.useEffect((()=>{const e=C.current;if(!e)return;const t=()=>{f(p,am(e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()}),[f,p]),s&&s.DataViewer&&(i=s.DataViewer),e("td",{ref:C,style:{...s?.style,..."dropDown"===s?.inputType?.type&&{fontSize:"12px"},textDecoration:"underline"===s?.style?.textDecoration?s?.style?.textDecoration:"none"},className:O("ff-spreadsheet-cell",s?.className,{"ff-spreadsheet-active-cell":o||a}),onMouseEnter:g,onMouseDown:m,tabIndex:0,children:e(i,{row:t,column:n,cell:s,active:o,evaluatedCell:c,setCellData:h,inputValue:()=>null})})},_g=t=>function(n){const{row:i,column:o}=n,a=bg(),l=r.useMemo((()=>({row:i,column:o})),[i,o]),s=r.useCallback((e=>a(Ap(l,e))),[a,l]),c=r.useCallback((e=>a(function(e){return{type:mC,payload:{point:e}}}(e))),[a]),d=r.useCallback((e=>a(Mp(e))),[a]),u=r.useCallback(((e,t)=>a(xp(e,t))),[a]),f=Eg((e=>om(e.active,l))),h=Eg((e=>f?e.mode:"view")),C=Eg((e=>Np(l,e.model.data))),p=Eg((e=>Np(l,e.model.evaluatedData))),m=Eg((e=>e.dragging)),g=Eg((e=>e.copied?.has(l)||!1));return e(t,{...n,active:f,copied:g,dragging:m,mode:h,evaluatedData:p,data:C,select:c,activate:d,setCellDimensions:u,setCellData:s})},Og=({cell:r,evaluatedCell:i,active:o})=>{const a=function(e,t){const n=t?.value??e?.value;if(n&&"object"==typeof n)return n.toString();return n}(r,i);return e("span","boolean"==typeof a?{className:"ff-spreadsheet-data-viewer ff-spreadsheet-data-viewer--boolean",children:Ng(a)}:{className:O("ff-spreadsheet-data-viewer",{"ff-spreadsheet-data-viewer--preserve-breaks":vm(a)}),children:o||"dropDown"!==r?.inputType?.type?o||"file"!==r?.inputType?.type?!o&&a:e(t,{children:Q(r?.value)?n("div",{className:"ff-spreadsheet-data-viewer--without-fileType",children:[e(B,{name:"attachment_icon"})," Attachment"]}):(n=>{if(Q(n))return e(t,{});return JSON.parse(n).map((t=>e("div",{className:"ff-spreadsheet-data-viewer--fileType",children:e(sn,{width:r?.style?.width??100,title:t?.name?.split("*")?.[0]??""})},t.name)))})(a)}):n("div",{className:"ff-spreadsheet-data-viewer--dropdownType",children:[a,e(B,{name:"arrow_down",height:8,className:"dropdownType-icon"})]})})};function Ng(e){return e?"TRUE":"FALSE"}const zg=i.forwardRef((({initialValue:t="",onChange:n,className:r="",style:o={}},s)=>{const c=a(null);i.useImperativeHandle(s,(()=>c.current)),l((()=>{if(c.current&&document.activeElement!==c.current){const e=t.endsWith("\n")?`${t}\n`:t;e!==c.current.innerText&&(c.current.innerText=e)}}),[t]);return e("div",{style:o,children:e("div",{ref:c,className:`editable-cell ${r}`,contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:e=>{if("Enter"===e.key){if(e.altKey||e.shiftKey)return e.preventDefault(),void document.execCommand("insertLineBreak");c.current?.blur()}"Delete"!==e.key&&"Backspace"!==e.key||e.stopPropagation()},onInput:()=>{if(c.current){let e=c.current.innerText;e.endsWith("\n")&&(e=e.slice(0,-1)),n?.(e)}},onPaste:e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{outline:"none",transition:"border 0.2s",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"inherit",fontSize:"inherit",lineHeight:"normal",minHeight:"24px",verticalAlign:"middle",caretColor:"black",height:"inherit",maxHeight:"inherit",display:"block",position:"relative",paddingBottom:"2px"}})})})),Tg=({onChange:t,cell:n})=>{const i=r.useRef(null),o=r.useCallback((e=>{const{contextDisable:r,...i}=n;t({...i,value:e,inputType:i.inputType??{type:"text"}})}),[t,n]);r.useEffect((()=>{i.current&&function(e){if(e)if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)e.selectionStart=e.selectionEnd=e.value.length;else if(e.isContentEditable){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)}}(i.current)}),[]);return e("div",{className:"ff-spreadsheet-data-editor",children:e(zg,{ref:i,initialValue:n?.value??"",onChange:o,className:"ff-spreadsheet-cell-textarea",style:{...n?.style,borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})})},Dg=t=>{const i=r.useRef(null),o=r.useRef(null),a=bg(),l=r.useCallback(((e,t)=>a(Ap(e,t))),[a]),s=r.useCallback((e=>a(Mp(e))),[a]),c=r.useCallback((()=>a({type:MC})),[a]),d=r.useCallback((e=>a({type:KC,payload:{autofill:e}})),[a]),u=r.useCallback((e=>a(function(e){return{type:VC,payload:{changes:e}}}(e))),[a]),f=r.useCallback((()=>{a({type:AC})}),[a]),h=Eg((e=>e.rowDimensions)),C=Eg((e=>e.active)),p=Eg((e=>e.mode)),m=Eg((e=>e.active?Np(e.active,e.model.data):void 0)),g=Eg((e=>e.selected)),v=Eg((e=>g&&Cm(e.rowDimensions,e.columnDimensions,e.model.data,e.selected))),y=Eg((e=>{let t=C?fm(C,e.rowDimensions,e.columnDimensions):void 0;return t={top:t?.top?t?.top:0,height:t?.height?t?.height:0,left:t?.left?t?.left:0,width:t?.width?t?.width:0},t})),w=r.useMemo((()=>!C||!y||C.row<t.visibleRowRange.start||C.row>=t.visibleRowRange.end||C.column<t.visibleColRange.start||C.column>=t.visibleColRange.end),[C,y,t.visibleRowRange,t.visibleColRange]),b=r.useRef(void 0),E=r.useRef(null),M=r.useRef(void 0),A=r.useCallback((e=>{C&&l(C,e)}),[l,C]),[x,L]=r.useState({value:"",name:""}),[k,H]=r.useState(!1),[S,V]=r.useState(),[_,N]=r.useState([]);r.useEffect((()=>{m&&C&&t.getActiveCell({value:m.value,active:C});const n=i.current;if(!w&&n){if(n.focus({preventScroll:!0}),"file"===m?.inputType?.type&&m?.value)try{const e=JSON.parse(m.value).map((e=>new File([new Blob],e.name.split("*")[0]??"default")));N(e)}catch(e){console.error("Error parsing cell value for files:",e),N([])}else N([]);if("dropDown"===m?.inputType?.type){L({value:m?.value,name:m?.value}),H((e=>!e));const t=m?.inputType?.options?.map((t=>({disable:t.disable,label:e("span",{style:{color:t.color},children:t.label}),value:t.value})));V(t)}}}),[i,w,C?.row,C?.column]),r.useEffect((()=>{"dropDown"===m?.inputType?.type&&m?.value!==x.value&&L({value:m?.value,name:m?.value})}),[m?.value,m?.inputType?.type,x.value]),r.useEffect((()=>{const e=E.current,t=M.current;if(E.current=C,M.current=m,!e||!t)return;const n=C?.row!==e.row||C?.column!==e.column;if(n||"edit"!==p){const e=b.current;t!==e?u([{prevCell:e||null,nextCell:t}]):n||m===t||u([{prevCell:t,nextCell:m||null}]),b.current=m}}));const z=m&&m.DataEditor||t.DataEditor,T=m&&m.readOnly,D=r.useCallback((e=>{if(!C)return;const t=e.currentTarget.closest(".ff-excel-spreadsheet");if(!t)return void e.preventDefault();e.stopPropagation();const n=document.body.style.userSelect,r=document.body.style.overflow;document.body.style.userSelect="none",document.body.style.overflow="hidden";let i=null;const o=()=>{i&&(cancelAnimationFrame(i),i=null)},a=e=>{const n=t.getBoundingClientRect();let r=0,a=0;e.clientY<n.top+50?a=-12:e.clientY>n.bottom-50&&(a=12),e.clientX<n.left+50?r=-12:e.clientX>n.right-50&&(r=12),0!==r||0!==a?(e=>{o();const n=()=>{const{x:r,y:o}=e;0!==r&&(t.scrollLeft+=r),0!==o&&(t.scrollTop+=o),i=requestAnimationFrame(n)};i=requestAnimationFrame(n)})({x:r,y:a}):o()},l=()=>{o(),document.body.style.userSelect=n,document.body.style.overflow=r,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),d(!0)}),[s,d,C]),I=r.useCallback((e=>{e.preventDefault(),t.setContextMenu({open:t.contextOption?.open??!1,contextType:t.contextOption?.contextType??null,options:t.contextOption?.options||[]})}),[t]),Z=v?.height!==y?.height||v?.width!==y?.width,j=r.useCallback((e=>{C&&Z&&(xp(C,am(e.currentTarget)),s(C))}),[C,Z]),R=t.isAtRight?t.maxWidth-(y?.left-t.scrollPos.left)+100:t.maxWidth,B=t.isAtBottom?t.maxHeight-(y?.top-t.scrollPos.top)+64:t.maxHeight,P=["file","dropDown"].includes(m?.inputType?.type||"");return n("div",{ref:i,className:O("ff-spreadsheet-active-cell",`ff-spreadsheet-active-cell--${p}`,{"ff-spreadsheet-active-cell--hidden":w,"ff-spreadsheet-active-cell--dragging":Z&&"text"!==m?.inputType?.type}),onMouseDown:j,style:{...y,backgroundColor:m?.style?.backgroundColor,...P?{display:"flex",alignItems:m?.style?.alignContent,justifyContent:m?.style?.textAlign}:{},..."edit"===p&&C?{minWidth:Math.min(y?.width,t.maxWidth),minHeight:Math.min(y?.height,t.maxHeight),height:"auto",maxWidth:`${R}px`,maxHeight:`${B}px`,overflow:"auto",..."dropDown"===m?.inputType?.type?{}:{padding:"2px 4px 0px 4px",width:"max-content"}}:{}},onContextMenu:I,onClick:"view"!==p||T?void 0:c,tabIndex:0,children:[e("div",{className:P?"":"active-cell-main",children:"dropDown"===m?.inputType?.type?e(or,{...m?.inputType?.inputProps,dropDownRef:o,showOptions:{open:!("edit"!==p||!C),toggle:k},selectedOption:x,optionsList:S||[],height:26,showLabel:!1,disabled:!t.editable,showBorder:!1,optionZIndex:5e3,onChange:e=>{L({value:e.value,name:e.label}),A({...m,value:e.value,style:m?.style,inputType:m?.inputType})}}):"file"===m?.inputType?.type?e(nC,{...m?.inputType?.inputProps,label:"",onFileListClick:e=>{const n=e.target.closest(".ff-attachment-files"),r=e.target.closest(".ff-icon-container, .ff-icon-click, .ff-icon-danger");if(n&&!r&&m?.value&&t.attachmentAction?.viewAttachment)try{const e=JSON.parse(m.value),r=n.parentElement?.querySelectorAll(".ff-attachment-files")||[],i=Array.from(r).indexOf(n);if(-1===i||!e[i])return void console.error("File index not found or invalid");const o=e[i];t.attachmentAction.viewAttachment(o.id,o.name?.split("*")[0]??"default")}catch(e){console.error("Error parsing cell value:",e)}else console.warn("Missing file element, icon click, cell value, or viewAttachment action")},selectedFiles:_,onFilesChange:async(e,n,r)=>{try{if("ADD"===r&&"file"===m?.inputType?.type){let n=[];try{m?.value&&(n=JSON.parse(m.value))}catch(e){console.error("Error parsing cell.value:",e)}let r=0;const i=e.filter(((e,t,i)=>{const o=e.name.split("*")[0],a=i.findIndex((e=>e.name.split("*")[0]===o))!==t,l=n.some((e=>e.name.split("*")[0]===o));return!a&&!l||(r++,!1)}));if(n.length+i.length>5)return void Da.info("Cannot upload more than 5 files.");if(t.attachmentAction?.addAttachment&&i.length>0)try{let e=0,r=0,o=0;const l=_?.length+i?.length,s=l>0?25*l:1,c=[...n],d=i?.map((async e=>{try{if(e.name.includes("*"))return{file:e,status:"existing",data:{name:e.name}};const n=await(t?.attachmentAction?.addAttachment(e));if(!n||"string"==typeof n&&0===n.trim().length)return{file:e,status:"failed",reason:"no response"};if("string"==typeof n)try{const t=JSON.parse(n);return 507===t.responseCode?{file:e,status:"memory_full",reason:"no memory"}:400===t.responseCode?{file:e,status:"failed",reason:"invalid file"}:t?.id&&t?.name?{file:e,status:"success",data:t}:(console.error(`Invalid response structure for ${e.name}:`,t),{file:e,status:"failed",reason:"invalid response"})}catch(t){return console.error(`Parse error for ${e.name}:`,t),{file:e,status:"failed",reason:"parse error"}}if("object"==typeof n&&null!==n){const t=n;return t?.id&&t?.name?{file:e,status:"success",data:t}:(console.error(`Invalid response structure for ${e.name}:`,n),{file:e,status:"failed",reason:"invalid response"})}return console.error(`Unknown response for ${e.name}:`,n),{file:e,status:"failed",reason:"unknown"}}catch(t){return console.error(`Upload failed for ${e.name}:`,t),{file:e,status:"failed",reason:"upload error"}}}));if((await Promise.allSettled(d)).forEach((t=>{if("fulfilled"===t.status&&t.value){const{status:n,data:i}=t.value;"success"===n&&i?.id&&i?.name?(c.push(i),e++):"existing"===n&&i?.name?c.push(i):"memory_full"===n?o++:r++}else r++})),e>0||c.length>n.length){const e=c.length>0?JSON.stringify(c):"";A({...m,value:e,style:m?.style,inputType:m?.inputType}),a(tp(C?.row||0,Math.max(s,h?.[C.row]?.height||s))),N(c.map((e=>new File([new Blob],e.name?.split("*")[0]??"default"))))}o>0&&Da.info("No memory available to add the file"),e>0&&Da.success(`${e} file${e>1?"s":""} uploaded successfully`),r>0&&Da.info(`${r} unsupported ${r>1?"files":"file"}. Please check the file formats.`)}catch(e){console.error("Upload operation failed:",e),Da.error("Operation failed")}}else if("DELETE"===r&&"file"===m?.inputType?.type)try{let e=[...m&&JSON.parse(m.value)],r=0;for(const i of n||[]){const n=e.findIndex((e=>e.name.split("*")[0]===i.name.split("*")[0])),o=e[n]?.id;if(-1!==n&&o&&t.attachmentAction?.deleteAttachment)try{const a=await t.attachmentAction.deleteAttachment(o);"SUCCESS"===a||"object"==typeof a&&null!==a&&("status"in a&&"SUCCESS"===a.status||"responseCode"in a&&200===a.responseCode)?(e.splice(n,1),r++):console.error(`Delete failed for ${i.name}: Invalid response`,a)}catch(e){console.error(`Delete error for ${i.name}:`,e),Da.error("Error deleting file")}else console.error(`Cannot delete ${i.name}: Invalid fileId or no match`,{index:n,fileId:o,hasDeleteAttachment:!!t.attachmentAction?.deleteAttachment}),Da.error("Failed to delete file: Invalid file data")}if(r>0){const t=e.length>0?JSON.stringify(e):"";A({...m,value:t,style:m?.style,inputType:m?.inputType}),N(e?.map((e=>new File([new Blob],e.name.split("*")[0])))),Da.success(`${r} file${r>1?"s":""} deleted successfully`)}else if(n?.length){const t=e?.filter((e=>e.id&&e.name));if(t.length<e.length){const e=t.length>0?JSON.stringify(t):"";A({...m,value:e,style:m?.style,inputType:m?.inputType}),N(t.map((e=>new File([new Blob],e.name.split("*")[0])))),Da.error("Failed to delete file(s). Invalid file data detected.")}else Da.error("Failed to delete file(s). No valid files removed.")}}catch(e){console.error("Delete operation failed:",e),Da.error("Delete operation failed")}}catch(e){console.error("handleFilesChange error:",e),Da.error("Operation failed")}},disabled:!t.editable,maxFiles:5,buttonLabel:"+ Attachments",buttonVariant:"tertiary",deleteButton:t.editable,selectedFileMessage:"Duplicate attachments not allowed within the same row",addAttachmentButton:t.editable,isInfoIconRequired:!1,truncateMaxLimit:(y?.width??0)-60}):"edit"===p&&C&&t.editable?e(z,{row:C.row,column:C.column,cell:m,onChange:A,exitEditMode:f}):e(zg,{initialValue:m?.value,onChange:()=>{},className:"ff-spreadsheet-cell-textarea",style:{...m?.style,textDecoration:"underline"===m?.style?.textDecoration?"underline":"none",backgroundColor:Z?"#1e161f00":m?.style?.backgroundColor,pointerEvents:"none",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})}),!["file"].includes(m?.inputType?.type??"")&&("edit"===p||C&&e("div",{onMouseDown:D,className:"select_dot"}))]},`${C?.row}-${C?.column}`)},Ig=({dimensions:t,dragging:n,hidden:r,variant:i})=>{const o=Eg((e=>e.active)),a=Eg((e=>e.autoFill)),l=Eg((e=>o?fm(o,e.rowDimensions,e.columnDimensions):void 0)),{width:s,height:c,top:d,left:u}=t||{};let f=l?.height??0,h=l?.width??0,C=s,p=c;return a.open&&s&&c&&l&&(s-h>c-f?(C=s,p=l.height):(p=c,C=l.width)),e("div",{className:O("ff-spreadsheet-floating-rect",{[`ff-spreadsheet-floating-rect--${i}`]:i,"ff-spreadsheet-floating-rect--dragging":n,"ff-spreadsheet-floating-rect--hidden":r}),style:{width:(C??0)+1,height:(p??0)+1,top:d,left:u}})},Zg=({scrollPos:t={top:0,left:0}})=>{const n=Eg((e=>e.selected)),i=Eg((e=>e.dragging)),o=Eg((e=>e.selected.size(e.model.data)<2)),a=Eg((e=>n&&Cm(e.rowDimensions,e.columnDimensions,e.model.data,e.selected))),l=r.useMemo((()=>{if(a)return{...a,top:a.top-1,left:a.left-1,height:a.height-1,width:a.width-1}}),[a,t]);return e(Ig,{variant:"selected",dimensions:l,dragging:i,hidden:o||!a})},jg=({scrollPos:t={top:0,left:0}})=>{const n=Eg((e=>e.copied)),i=null===n,o=Eg((e=>n&&hm(e.rowDimensions,e.columnDimensions,n))),a=r.useMemo((()=>{if(o)return{...o,top:o.top-1,left:o.left-1,height:o.height-1,width:o.width-1}}),[o,t]);return e(Ig,{variant:"copied",dimensions:a,hidden:i||!o,dragging:!1})},Rg=i.forwardRef((({getColorValue:t,disabled:n,initialColor:r},o)=>{const l=a(null);i.useImperativeHandle(o,(()=>l.current));const[s,d]=c(r);return e("div",{className:O("ff-excel-color-selector",{"color-selector-disabled":n}),style:{backgroundColor:s},onClick:()=>{l.current&&!n&&l.current.click()},children:e("input",{type:"color",disabled:n,className:O("ff-excel-color-selector-picker",{"color-selector-disabled":n}),ref:l,onChange:e=>{d(e.target.value),t(e.target.value.replace("#",""))}})})}));Rg.displayName="ColorBarSelector";const Bg=e=>{switch(e.toUpperCase()){case"LEFT":default:return"left";case"RIGHT":return"right";case"CENTER":return"center";case"JUSTIFY":return"justify";case"BOTTOM":return"end";case"TOP":return"start"}},Pg=e=>{switch(e){case"left":return"LEFT";case"right":return"RIGHT";case"center":return"CENTER";case"justify":return"JUSTIFY";case"end":default:return"BOTTOM";case"start":return"TOP"}},Fg=e=>Mm.reduce(((t,n)=>Math.abs(n-parseFloat(e))<Math.abs(t-parseFloat(e))?n:t));function Ug(e){const{border:t}=e;let n="",r="",i="",o="";return"THIN"!==t.top&&(n="MEDIUM"===t.top?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.right&&(r="MEDIUM"===t.right?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.bottom&&(i="MEDIUM"===t.bottom?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.left&&(o="MEDIUM"===t.left?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),{fontSize:ym(Fg(String(e.size))),fontFamily:(a=e.name,Em.some((e=>e.label===a))?a:"Poppins"),color:`#${e.color}`,backgroundColor:`#${e.backgroundColor}`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":"normal",borderTop:n,borderRight:r,borderBottom:i,borderLeft:o,textAlign:Bg(e.alignment.horizontal),alignContent:Bg(e.alignment.vertical)};var a}const qg=e=>{if(!e||"none"===e)return"THIN";if(e.includes("solid")||e.includes("dashed")||e.includes("dotted")){if(e.includes("2px")||e.includes("medium"))return"MEDIUM";if(e.includes("3px")||e.includes("medium"))return"THICK"}return"THIN"},Wg=e=>({name:e.fontFamily||"Arial",size:wm(e.fontSize?.toString()||"12"),bold:"bold"===e.fontWeight,italic:"italic"===e.fontStyle,underline:"underline"===e.textDecoration,color:e.color?.replace("#","")||"000000",backgroundColor:e.backgroundColor?.replace("#","")||"FFFFFF",borderColor:"F2F2F2",border:{top:qg(e.borderTop?e.borderTop.toString():void 0),right:qg(e.borderRight?e.borderRight.toString():void 0),bottom:qg(e.borderBottom?e.borderBottom.toString():void 0),left:qg(e.borderLeft?e.borderLeft.toString():void 0)},alignment:{horizontal:Pg(e.textAlign),vertical:Pg(e.alignContent),wrapText:!1}}),Qg=({toolbar:t="show",editable:r,onBold:i,onItalic:o,setUnderlineType:s,setColor:d,setFontSize:u,setFontFamily:f,setTextAlign:h,setBackgroundColor:C,setBorderType:p,setFormatePainter:m})=>{const g=Eg((e=>e.selected instanceof Yp)),[v,y]=c("disable"===t||!r),w=Eg((e=>e.active?Np(e.active,e.model.data):null)),b=Eg((e=>e.model.data)),E=Eg((e=>e.formattedStyle.open)),M={...bm.style,color:"#1e161f",backgroundColor:"#ffffff",borderColor:"#1e161f"},[A,x]=c(w?.style||M),L=a(null);l((()=>{w?.style&&JSON.stringify(w.style)!==JSON.stringify(A)&&x(w?.style||M),g?y(!r):w&&"boolean"==typeof w.readOnly&&y(w.readOnly||"disable"===t||!r||"dropDown"===w?.inputType?.type)}),[w,r]);const k=Wg(A),[H,S]=c("border-none"),[V,_]=c({label:"",value:""}),[O,N]=c({label:"",value:""}),[z,T]=c({color:M.color,backgroundColor:M.backgroundColor,borderColor:M.borderColor}),D=[{value:"border-all-sides",label:"All Border",icon:"all_borders"},{value:"border-bottom",label:"Border Bottom",icon:"border_bottom"},{value:"border-left",label:"Border Left",icon:"border_left"},{value:"border-right",label:"Border Right",icon:"border_right"},{value:"border-top",label:"Border Top",icon:"border_top"},{value:"border-none",label:"No Border",icon:"no_border"}],I=Mm.map((e=>({label:e,value:e}))),Z=a(null),j=a(null);l((()=>{let e=setTimeout((()=>{d(b,z.color)}),0);return()=>{clearTimeout(e)}}),[z.color]),l((()=>{let e=setTimeout((()=>{C(b,z.backgroundColor)}),0);return()=>{clearTimeout(e)}}),[z.backgroundColor]);return l((()=>{const e=A.fontFamily,t=`${wm(A.fontSize)}`;_({label:e??"Times New Roman",value:e??"Times New Roman"}),N({label:t??"11",value:t??"11"})}),[A]),n("div",{className:"ff-excel-toolbar",children:[n("div",{className:"ff-excel-toolbar-font ",children:[e("div",{className:"ff-excel-toolbar-font-family",children:e(or,{disabled:v,height:24,tooltip:!0,showToolTip:!0,showLabel:!1,optionZIndex:2e3,onChange:e=>{_({label:e.label,value:e.label}),f(b,e.value)},required:!1,optionsList:Em,selectedOption:V})}),e("div",{className:"ff-excel-toolbar-font-size",children:e(or,{disabled:v,height:24,showLabel:!1,optionZIndex:2e3,required:!1,onChange:e=>{N({label:e.label,value:e.value}),u(b,e.value)},optionsList:I,selectedOption:O})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(G,{placement:"top",title:"Text Left",children:e(B,{disabled:v,variant:"left"===A.textAlign?"dark":"light",hoverEffect:"left"!==A.textAlign,onClick:()=>h(b,"left"),name:"text_align_left"})}),e(G,{placement:"top",title:"Text Center",children:e(B,{disabled:v,variant:"center"===A.textAlign?"dark":"light",hoverEffect:"center"!==A.textAlign,onClick:()=>h(b,"center"),name:"text_align_center"})}),e(G,{placement:"top",title:"Text Right",children:e(B,{disabled:v,variant:"right"===A.textAlign?"dark":"light",hoverEffect:"right"!==A.textAlign,onClick:()=>h(b,"right"),name:"text_align_right"})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-text",children:[e(G,{placement:"top",title:"Bold",children:e(B,{disabled:v,variant:k.bold?"dark":"light",hoverEffect:!k.bold,onClick:()=>i(b),name:"bold"})}),e(G,{placement:"top",title:"Italic",children:e(B,{disabled:v,variant:k.italic?"dark":"light",hoverEffect:!k.italic,onClick:()=>o(b),name:"italic"})}),e(G,{placement:"top",title:"Underline",children:e("div",{className:"ff-excel-toolbar-icon-underline",children:e(B,{disabled:v,variant:"underline"===A.textDecoration?"dark":"light",hoverEffect:"underline"!==A.textDecoration,onClick:()=>s(b),name:"underline"})})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(G,{placement:"top",title:"Format Painter",children:e(B,{disabled:v,variant:E?"dark":"light",hoverEffect:!E,onClick:()=>{m(b)},name:"formate_painter"})}),e(G,{placement:"top",title:"Text Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(B,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{d(b,z.color),Z.current?.click()},name:"text_color"}),e(Rg,{ref:Z,disabled:v,getColorValue:e=>{T((t=>({...t,color:e})))},initialColor:z.color})]})}),e(G,{placement:"top",title:"Background Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(B,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{C(b,z.backgroundColor),j.current?.click()},name:"fill_color"}),e(Rg,{ref:j,disabled:v,getColorValue:e=>{T((t=>({...t,backgroundColor:e})))},initialColor:z.backgroundColor})]})})]}),e("div",{className:"ff-excel-toolbar-divider"}),e("div",{className:"ff-excel-toolbar-menu",children:n("div",{className:"ff-excel-toolbar-menu-option",children:[e(G,{placement:"top",title:"Border Type",children:e(B,{hoverEffect:!0,disabled:v,onClick:()=>p(b,H,"var(--input-hover-border-color)"),name:(()=>{const e=D.find((e=>e.value===H));return e?e.icon:""})()})}),e("span",{ref:L,children:e(ur,{disabled:v,iconName:"arrow_down",targetRef:L,iconSize:12,zIndex:2e3,options:D,tooltipTitle:"Border Type",tooltipPlacement:"top",onOptionClick:e=>{let t=e.value;p(b,t,"var(--input-hover-border-color)"),S(t)}})})]})})]})},Gg=(e,t)=>{let n,r=null;const i=function(...i){const o=this;null===r||Date.now()-r>=t?(e.apply(o,i),r=Date.now()):(n&&clearTimeout(n),n=setTimeout((()=>{e.apply(o,i),r=Date.now()}),t-(Date.now()-r)))};return i.cancel=()=>{n&&clearTimeout(n),n=null,r=null},i},Kg=r.forwardRef((function(t,i){const{className:o,columnLabels:a=[],rowLabels:l=[],toolbar:s,editable:c,onKeyDown:d,Table:u=vg,Row:f=yg,sheetHeight:h,HeaderRow:C=wg,DataEditor:p=Tg,DataViewer:m=Og,onSelect:g=()=>{},onActivate:v=()=>{},onEvaluatedDataChange:y=()=>{},contextOption:w,attachmentAction:b,workRef:E,minimumColumnWidth:M,setContextMenu:A,maxRowLimit:x,maxColLimit:L,disableDeleteOption:k,contextMenu:H,getActiveCell:S,onAddColumn:V,onDeleteColumn:_}=t,N=M||100,z=r.useRef(!1),T=Eg((e=>e.model.data)),[D,I]=r.useState(!1),[Z,j]=r.useState(0),[R,B]=r.useState(0),[P,F]=r.useState({top:0,left:0}),[U,q]=r.useState(!1),[W,Q]=r.useState(!1),G=r.useMemo((()=>{const e=t.createFormulaParser||km,n=new Om(e,t.data);return I((e=>!e)),{...ng,model:n,selected:t.selected||ng.selected}}),[t.createFormulaParser,t.data,t.selected]),K=r.useReducer(rg,G),[Y,X]=K,J=r.useMemo((()=>function(e,t,n){const{columns:r,rows:i}=Rp(e);return{rows:t?Math.max(i,t.length):i,columns:n?Math.max(r,n.length):r}}(Y.model.data,l,a)),[Y.model.data,l,a]),[$,ee]=r.useState({start:0,end:Math.min(20,J.rows)}),[te,ne]=r.useState({start:0,end:Math.min(15,J.columns)}),re=r.useCallback((e=>{let t=0;for(let n=0;n<e;n++)t+=Y.rowDimensions[n]?.height||32;return t}),[Y.rowDimensions,32]),ie=r.useCallback((e=>{let t=0;for(let n=0;n<e;n++)t+=Y.columnDimensions[n]?.width||N;return t}),[Y.columnDimensions,N]);r.useEffect((()=>{X(function(e){return{type:YC,payload:{minimumColumnWidth:e}}}(M))}),[M]);const oe=re(J.rows),ae=ie(J.columns),le=re($.start),se=oe-re($.end),ce=ie(te.start),de=ae-ie(te.end),ue=Y.mode,fe=r.useRef(null),he=e=>r.useCallback(((...t)=>X(e(...t))),[e]),Ce=he(ep),pe=he(_p),me=he(Vp),ge=he(Op),ve=he(Lp),ye=he(kp),we=he(yp),be=he(Hp),Ee=he(Sp),Me=he(wp),Ae=he(bp),xe=he(Ep),Le=he(rp),ke=he(ip),He=he(ap),Se=he(cp),Ve=he(lp),_e=he(sp),Oe=he(op),Ne=he(dp),ze=he(up),Te=he(fp),De=he($C),Ie=he(hp),Ze=he(Cp),je=he(pp),Re=he(mp),Be=he(gp),Pe=he(vp);r.useImperativeHandle(i,(()=>({removeSelect:ge})));const Fe=r.useRef(Y.active);r.useEffect((()=>{if(Y.active!==Fe.current)if(Y.active)v(Y.active);else{const e=E.current;e&&gm(e)&&document.activeElement&&document.activeElement.blur()}Fe.current=Y.active}),[v,Y.active]);const Ue=r.useRef(Y.model.evaluatedData);r.useEffect((()=>{Y?.model?.evaluatedData!==Ue?.current&&y(Y?.model?.evaluatedData),Ue.current=Y.model.evaluatedData}),[Y?.model?.evaluatedData,y]);const qe=r.useRef(Y.selected);r.useEffect((()=>{Y.selected.equals(qe.current)||t.selected&&Y.selected.equals(t.selected)||g(Y.selected),qe.current=Y.selected}),[Y.selected,g,t.selected]);const We=r.useRef(t.selected);r.useEffect((()=>{t.selected&&We.current&&!t.selected.equals(We.current)&&xe(t.selected),We.current=t.selected}),[t.selected,xe]);let Qe=r.useRef(t.data);r.useEffect((()=>{Ce(c),t.data!==Qe.current&&Me(t.data),Qe.current=t.data}),[t.data,Me,c]);const Ge=r.useRef(t.createFormulaParser);r.useEffect((()=>{t.createFormulaParser!==Ge.current&&t.createFormulaParser&&Ae(t.createFormulaParser),Ge.current=t.createFormulaParser}),[t.createFormulaParser,Ae]);const Ke=r.useCallback((e=>{const{model:t,selected:n}=Y,{data:r}=t,i=n.toRange(r);if(i){!function(e,t){e.clipboardData?.setData(rm,t)}(e,pm(function(e,t,n){const r=[],i=t.column-e.column;for(let o=e.row;o<=t.row;o++){const a=o-e.row;r[a]=r[a]||Array(i);for(let i=e.column;i<=t.column;i++)r[a][i-e.column]=Np({row:o,column:i},n)}return r}(i.start,i.end,r)))}}),[Y]),Ye=r.useCallback((e=>{mm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),Ke(e),pe())}),[ue,Ke,pe]),Xe=r.useCallback((e=>{mm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),Ke(e),me())}),[ue,Ke,me]),Je=r.useCallback((e=>{if(mm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),e.clipboardData)){const t=function(e){return window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData?e.clipboardData.getData(rm):""}(e);ve(t)}}),[ue,ve]),$e=r.useCallback((e=>{e.persist();const t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();t&&"b"===n?(e.preventDefault(),Le(T)):t&&"i"===n?(e.preventDefault(),ke(T)):t&&"u"===n&&(e.preventDefault(),He(T)),d&&d(e),e.defaultPrevented||(function(e,t){return void 0!==Xm(e,t)}(Y,e)&&e.nativeEvent.preventDefault(),ye(e))}),[Y,d,ye]),et=r.useCallback((()=>{Y.formattedStyle.open&&Y.active&&De(Y.active)}),[Y]),tt=r.useCallback((()=>{Ee(),document.removeEventListener("mouseup",tt)}),[Ee]),nt=r.useCallback((e=>{Y.dragging||1!==e.buttons||"view"!==ue||(be(),document.addEventListener("mouseup",tt))}),[Y,be,tt,ue]),rt=r.useMemo((()=>_g(t.Cell||Vg)),[t.Cell,D,c]),it=r.useMemo((()=>Ag(t.CornerIndicator||Mg)),[t.CornerIndicator,D]),ot=r.useMemo((()=>Sg(t.RowIndicator||Hg)),[t.RowIndicator,D]),at=r.useMemo((()=>xg(t.ColumnIndicator||Lg)),[t.ColumnIndicator,D]);r.useEffect((()=>(document.addEventListener("cut",Ye),document.addEventListener("copy",Xe),document.addEventListener("paste",Je),()=>{document.removeEventListener("cut",Ye),document.removeEventListener("copy",Xe),document.removeEventListener("paste",Je)})),[Ye,Xe,Je]);const lt=e=>{const t=new ResizeObserver((e=>{const t=e[0];if(t&&fe.current){const e=t.target;if(e){const{clientWidth:t,clientHeight:n}=e;B(Math.min(fe.current.clientHeight,n)),j(Math.min(fe.current.clientWidth,t))}}})),n=e.current;n&&t.observe(n)},st=r.useCallback((e=>{const t=e.target,{scrollTop:n,clientHeight:r,scrollLeft:i,clientWidth:o}=t;F({top:n,left:i});let a=0;for(;a<J.rows&&re(a)<n;)a++;let l=a;for(;l<J.rows&&re(l)<n+r;)l++;a=Math.max(0,a-10),l=Math.min(J.rows,l+10),ee({start:a,end:l});const s=l===J.rows;q(s);let c=0;for(;c<J.columns&&ie(c)<i;)c++;let d=c;for(;d<J.columns&&ie(d)<i+o;)d++;c=Math.max(0,c-10),d=Math.min(J.columns,d+10),ne({start:c,end:d});const u=d===J.columns;Q(u),H.open&&A({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})}),[J.rows,J.columns,re,ie]),ct=r.useMemo((()=>Gg(st,16)),[st]),dt=e=>{z.current=!0,requestAnimationFrame((()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.rowDimensions?.[n]?.height||32;requestAnimationFrame((()=>{fe.current&&e>=J.rows-1&&fe?.current?.scrollTo({top:t+32,behavior:"smooth"})}))}))},ut=e=>{z.current=!0,requestAnimationFrame((()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.columnDimensions?.[n]?.width||N;requestAnimationFrame((()=>{fe.current&&e>=J.columns-1&&fe.current.scrollTo({left:t+60,behavior:"smooth"})}))}))};r.useEffect((()=>{z.current||(ee({start:0,end:Math.min(20,J.rows)}),ne({start:0,end:Math.min(15,J.columns)}))}),[J.rows,J.columns,z.current]);const ft=im($.end,$.start),ht=im(te.end,te.start),Ct=n("colgroup",{children:[e("col",{style:{width:"60px"}},"row-indicator")," ",e("col",{style:{width:`${ce}px`}},"left-spacer")," ",ht.map((t=>e("col",{style:{width:`${Y.columnDimensions[t]?.width||N}px`}},t))),e("col",{style:{width:`${de}px`}},"right-spacer")," "]}),pt=r.useMemo((()=>n(u,{useTableRef:lt,totalWidth:ae,children:[Ct,n("tbody",{children:[n(C,{children:[e(it,{}),e("div",{className:"spacer left"}),ht.map((n=>e(at,{column:n,minimumColumnWidth:M,setContextMenu:t.setContextMenu,label:n in a?a[n]:void 0,deleteColumn:Pe,addColumnLeft:je,addColumnRight:Re,columnContextEnable:t.columnContextEnable,maxColLimit:L,disableDeleteOption:k,contextMenu:H,onAddColumn:V,onDeleteColumn:_,setVisibleRange:ne,scrollToColumn:ut},n))),e("div",{className:"spacer right"})]}),e("tr",{style:{height:`${le}px`}}),ft.map((r=>n(f,{row:r,children:[e(ot,{label:r in l?l?.[r]:void 0,row:r,addRowTop:Ie,addRowBottom:Ze,deleteRow:Be,setContextMenu:t.setContextMenu,rowContextEnable:t.rowContextEnable,maxRowLimit:x,disableDeleteOption:k,contextMenu:H,setVisibleRange:ee,scrollToRow:dt},r),e("div",{className:"spacer left"}),ht.map((t=>e(rt,{row:r,column:t,DataViewer:m},t))),e("div",{className:"spacer right"})]},r))),e("tr",{style:{height:`${se}px`}})]})]})),[u,J.rows,J.columns,f,C,it,a,at,l,ot,rt,m,$,te,le,se,ce,de,Y.rowDimensions,Y.columnDimensions]),mt=r.useMemo((()=>e(Dg,{attachmentAction:b,contextOption:w,getActiveCell:S,setContextMenu:t.setContextMenu,DataEditor:p,visibleRowRange:$,visibleColRange:te,maxHeight:R-64,maxWidth:Z-M,totalHeight:oe,totalWidth:ae,isAtBottom:U,isAtRight:W,scrollPos:P,editable:c},Y.active?`${Y.active.row}-${Y.active.column}`:"no-active")),[p,$,te,Y.active,R,Z,oe,ae,U,W,c]),gt=r.useMemo((()=>n("div",{className:"ff-excel-spreadsheet-container",children:[e("div",{style:{width:`${Z}px`},className:O("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),e("div",{style:{height:`${R}px`},className:O("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),"hide"!==s&&e("div",{className:"ff-excel-toolbar-container",children:e(Qg,{editable:c,toolbar:s,onBold:Le,onItalic:ke,setUnderlineType:He,setColor:Ne,setBorderType:Oe,setFontSize:Ve,setFontFamily:_e,setTextAlign:Se,setBackgroundColor:ze,setFormatePainter:Te})}),n("div",{ref:fe,style:{height:h},className:O("ff-excel-spreadsheet",o),onKeyPress:we,onKeyDown:$e,onClick:et,onMouseMove:nt,onScroll:e=>ct(e),children:[pt,mt,e(Zg,{scrollPos:P}),e(jg,{scrollPos:P})]})]})),[o,we,$e,nt,pt,mt,Z]);return e(gg.Provider,{value:K,children:gt})})),Yg=({contextMenu:t,position:r,editable:i})=>{if(!t.open)return null;return i&&e("div",{onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},className:"ff-excel-menu",style:{left:r.x,top:r.y,position:"absolute",zIndex:9999999999},children:t.options.map((t=>{if(!t.visible){const i=t.disable;return e(G,{title:i?t.disableTooltip:"",children:n("div",{className:"ff-excel-menu-options "+(i?"disabled":""),onClick:()=>{i||t.action()},children:[t.iconName&&e(B,{name:t.iconName,height:16,width:16,color:(r=t.label,r.includes("Delete")?"var(--label-edit-error-text)":"var(--brand-color)"),disabled:i}),e(P,{as:"label",children:t.label})]})},t.label)}var r;return null}))})},Xg=({excelData:r,contextOption:o,toolbar:s="show",sheetBar:d="show",rowCount:u=26,colCount:f=26,sheetHeight:h="100%",editable:C=!0,contextHeightPositioning:p=0,contextWidthPositioning:m=0,onSave:g=()=>Promise.resolve(),onSaveInfoChange:v,attachmentAction:y={addAttachment:()=>Promise.resolve(""),deleteAttachment:()=>Promise.resolve(""),viewAttachment:()=>Promise.resolve()},onSaveDelay:w=3e3,scroller:b=!1,columnContextEnable:E=!0,rowContextEnable:M=!0,sheetBarContextEnable:A=!0,minimumColumnWidth:x=100,disableDeleteOption:L=!1,maxRowLimit:k=1/0,maxColLimit:H=1/0,maxSheetLimit:S=1/0,getActiveCell:V=()=>{}})=>{const _=a(null),[N,z]=c([]),[T,D]=c(""),[I,Z]=i.useState({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",disable:!1,visible:!1}]}),[j,R]=c({name:"defaultSheet",index:0}),[F,U]=c({defaultSheet:[[bm]]}),[q,W]=c([[bm]]),[K,Y]=c((g.length,{})),[X,J]=c({x:0,y:0}),$=a(""),ee=a(null),te=a(null),ne=a(null);l((()=>{const e=r;if(e){const t=e.map((e=>e.sheetName));z(t),Q(t.length)||($.current=t[0]||"",R({name:t[0]||"",index:0}));const n={},r={};e.forEach((e=>{const t=e.sheetName,i=e.data,o=Math.max(u,i.length),a=Math.max(f,Math.max(...i.map((e=>e.length))));let l=Array.from({length:o},(()=>Array(a).fill({value:"",style:bm.style,readOnly:!1,inputType:void 0})));i.forEach(((e,t)=>{e.forEach(((e,n)=>{var r;t<o&&n<a&&(l[t]||(l[t]=[]),l[t][n]={value:(r=e.value,null==r?null:r),style:Q(e?.style)?bm.style:Ug(e?.style),readOnly:!!e?.readOnly&&e?.readOnly,inputType:e?.inputType??void 0,contextDisable:e.contextDisable})}))}));const s=new Set([...e?.rows?.readOnly?e.rows.readOnly.map((e=>`r${e}`)):[],...e?.columns?.readOnly?e.columns.readOnly.map((e=>`c${e}`)):[],...e?.cells?.readOnly?e.cells.readOnly.map((([e,t])=>`${e},${t}`)):[]]);if(l.forEach(((t,n)=>{t.forEach(((t,r)=>{l[n]||(l[n]=[]);const i=s.has(`r${n+1}`)||s.has(`c${r+1}`)||s.has(`${n+1},${r+1}`),o=((t,n,r)=>r?.inputType?r.inputType:e?.rows?.inputType?.[t+1]||e?.columns?.inputType?.[n+1]||e?.cells?.inputType?.[`${t+1},${n+1}`]||{type:"text"})(n,r,t||bm);l[n][r]={...t,value:t?.value??"",readOnly:t?.readOnly?t.readOnly:i,inputType:o,contextDisable:t?.contextDisable}}))})),n[t]=l,g.length>1){const e=i[0]||[];r[t]=Array.from({length:a},((t,n)=>({newData:"",oldData:e[n]?.value||""})))}})),U(n),g.length>1&&Y(r);const i=Object.keys(n)[0];i&&void 0!==n[i]&&W(n[i])}}),[r]),l((()=>{v&&v(T),"File saved"===T&&setTimeout((()=>{D("")}),2e3)}),[T]),l((()=>{D("Saving..."),oe(le())}),[F,$.current]);const oe=i.useCallback(Aa((e=>{if(g.length>1){const t={...K};N.forEach(((n,r)=>{const i=(e[r].data[0]||[]).map((e=>e?.value||""));t[n]=(t[n]||[]).map(((e,t)=>({...e,newData:i[t]||""})))})),Y(t);const n=N.map((e=>({sheetName:e,headers:t[e]||[]})));g(e,n)}else g(e);D("File saved")}),w),[g,K,N]),ae=i.useCallback((e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),oe(le()))}),[g]);i.useEffect((()=>(document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)})),[ae]);const le=()=>N.map((e=>{const t=F[e]?.map((e=>{const t=e.reduce(((e,t,n)=>""!==String(t?.value??"").trim()?n:e),-1),n=e.map(((e,n)=>e&&e.style&&n<=t?{value:e.value,style:Wg(e.style),readOnly:e.readOnly,inputType:e.inputType,contextDisable:e.contextDisable}:null)).filter((e=>null!==e));return n.length>0?n:[]}))||[],n=t.filter(((e,n)=>{const r=t.slice(n+1).some((e=>e.length>0));return e.length>0||r}));return{sheetName:e,data:Q(n.length)?[[]]:n}})),[se,ce]=c(null),de=()=>N.length>=S,ue=()=>{if(de())return;const e=((e,t)=>{const n=t.map((e=>e.toLowerCase()));let r=`${e}1`,i=2;for(;n.includes(r.toLowerCase());)r=`${e}${i}`,i++;return r})("Sheet",N),t=Array.from({length:u},(()=>Array.from({length:f},(()=>bm))));z((t=>[...t,e])),R({index:N?.length,name:e}),U({...F,[e]:t}),W(t),g.length>1&&Y((t=>({...t,[e]:Array.from({length:f},(()=>({newData:"",oldData:""})))}))),$.current=e},fe=(e=[[bm]])=>{W(e)},he=(e,t,n)=>{const r=e.target;if(!r||r?.textContent?.trim()===n?.trim())return void ce(null);const i=(r.textContent||"").trim();if(!i)return Da.warning("Sheet name cannot be empty."),r.textContent=j.name,void ce(null);if(i.length>50)return Da.warning("The sheet name cannot be greater than 50 characters"),r.textContent=j.name,void ce(null);if(N.map((e=>e.toLowerCase())).includes(i.toLowerCase())&&n.trim()?.toLowerCase()!==i?.toLowerCase())return Da.warning("Sheet name already exists"),r.textContent=j.name,void ce(null);let o=N;fe(F?.[n]),o.splice(t,1,i);const a=function(e,t,n){if(!(t in e))throw new Error(`Key "${t}" not found in object`);const{[t]:r,...i}=e;return{...i,[n]:r??[]}}(F,n,i);$.current=i,R((e=>({...e,name:i}))),U(a),g.length>1&&Y((e=>{const t={...e},r=t[n];return delete t[n],t[i]=r??[],t})),ce(null)};const Ce=(e,t)=>{e!==j.name&&t!==j.index&&(R({index:t,name:e}),z((n=>{const r=[...n];return r[t]=e,r})),fe(F[e]),$.current=e)},pe=i.useCallback(((e,t=!1)=>{const n=e.target;(!n.closest(".ff-excel-tab-list")&&!n.closest(".ff-excel-sheet")||t)&&I.open&&(Z({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]}),t||(e.preventDefault(),e.stopPropagation()))}),[I.open]);i.useEffect((()=>(document.addEventListener("contextmenu",pe),document.addEventListener("click",(e=>pe(e,!0))),()=>{document.removeEventListener("contextmenu",pe),document.removeEventListener("click",(e=>pe(e,!0)))})),[pe]);const me=(e,t,n)=>{e.preventDefault();const r=[{label:"Add Sheet",value:"Add Sheet",iconName:"plus_icon",action:()=>ue(),disableTooltip:"Sheet limit reached",visible:!1,disable:de()},...L?[]:[{label:"Delete Sheet",value:"Delete Sheet",iconName:"delete",action:()=>((e,t)=>{if(N.length>1){let n=N.slice();n.splice(t,1);const r={...F};delete r[e];const i=Math.min(t,n.length-1);z(n),U(r),g.length>1&&Y((t=>{const n={...t};return delete n[e],n}));const o=n[i]?n[i]:"";R({index:i,name:o}),fe(r?.[o]),$.current=o}else Da.warning("Cannot delete the last sheet.")})(t,n),disableTooltip:"",visible:!1,disable:!1}]];Z((e=>({...e,open:!0,contextType:"sheet",options:r})))};l((()=>{ne.current?.removeSelect()}),[j.name]);return e(t,{children:N.length>0&&n("div",{ref:ee,className:"ff-excel",onContextMenu:e=>{e.preventDefault();const t=te.current?.parentElement?.getBoundingClientRect(),n=window.scrollX,r=window.scrollY;let i=e.clientX-(t?.left||0)+n,o=e.clientY-(t?.top||0)+r;const a=300,l=window.innerWidth,s=window.innerHeight,c=l-e.clientX,d=e.clientX,u=s-e.clientY,f=e.clientY;c<a&&d>=a?i=e.clientX-(t?.left||0)+n-150:i+=2,u<200&&f>=200?o=e.clientY-(t?.top||0)+r-20:o+=2,e.target.classList.contains("ff-excel-tab-list")?J({x:i,y:o-(L?32:65)}):(i+a>l&&(i=l-a-2),i<0&&(i=2),J({x:i+m,y:o+p}))},onClick:e=>{e.stopPropagation(),I.open&&Z({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},children:[e("div",{ref:te,className:"ff-excel-sheet",children:e(Kg,{ref:ne,editable:C,attachmentAction:y,toolbar:s,sheetHeight:h,setContextMenu:Z,contextOption:o,data:q,columnContextEnable:E,rowContextEnable:M,minimumColumnWidth:x,onEvaluatedDataChange:e=>{U((t=>({...t,[$.current]:e})))},workRef:ee,scroller:b,maxRowLimit:k,maxColLimit:H,disableDeleteOption:L,contextMenu:I,getActiveCell:V,onAddColumn:(e,t)=>{g.length>1&&Y((n=>{const r=j.name,i=[...n[r]||[]],o=t?e:e+1;return i.splice(o,0,{newData:"",oldData:""}),{...n,[r]:i}}))},onDeleteColumn:e=>{g.length>1&&Y((t=>{const n=j.name,r=[...t[n]||[]];return r.splice(e,1),{...t,[n]:r}}))}},j.name)}),"hide"!==d&&n("div",{className:"ff-excel-sheet-bar",children:["show"===d&&n("div",{className:"ff-excel-add-sheet-set",children:[e(G,{title:de()?"Sheet limit reached":"Add Sheet",placement:"top",children:e(B,{disabled:!C||de(),className:"ff-excel-add-sheet-icon",hoverEffect:!0,onClick:ue,name:"plus_icon",height:20,width:20})}),e(ur,{options:(t=>t.map(((t,r)=>({label:n("div",{style:{display:"flex",gap:"8px"},children:[j?.name===t?e(B,{height:16,width:16,name:"tick"}):e("div",{style:{height:"16px",width:"24px"}}),e(G,{title:ie(t,20,"count")?t:"",children:e(P,{children:re(t,20,"count")})})]}),name:r,value:t}))))(N),targetRef:_,onOptionClick:e=>{const{value:t,name:n=""}=e;Ce(t,parseInt(n))},dropdownPlacement:"top",iconName:"show_script",tooltipTitle:"All Sheets",tooltipPlacement:"top",dropdownHeight:215,selectedValue:j.name})]}),e("div",{className:"ff-excel-tab-container",children:N.map(((t,n)=>e(P,{lineHeight:"16px",children:e("div",{onContextMenu:e=>{Ce(t,n),A&&me(e,t,n)},className:O("ff-excel-tab-list",{active:t===j.name}),onClick:()=>{Ce(t,n)},suppressContentEditableWarning:se===n,onDoubleClick:e=>{"show"===d&&(ce(n),null===se&&setTimeout((()=>(e=>{const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)})(e.target)),0))},contentEditable:C&&se===n,onBlur:e=>{he(e,n,t)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),he(e,n,t))},children:t})},t)))})]}),I.open&&e(Yg,{contextMenu:I,position:X,editable:C}),e(Ta,{})]})})},Jg=({label:t="",isActive:n=!0,onClick:r=()=>{},isFilterChip:i=!1})=>{const o=i?"filter":"module";return e("div",{className:O("ff-module-chip",{"ff-filter-chip":i,[`ff-${o}-chip--active`]:n,[`ff-${o}-chip--hover`]:!n}),onClick:r,children:e(P,{lineHeight:"18px",className:"module-typography",children:t})})},$g=({x:e,y:t,radius:n,startAngle:r,endAngle:i})=>{const o=e+n*Math.cos(r),a=t+n*Math.sin(r),l=e+n*Math.cos(i),s=t+n*Math.sin(i),c=i-r>Math.PI?1:0;return i-r>=2*Math.PI?`\n M ${e+n} ${t}\n A ${n} ${n} 0 1 1 ${e-n} ${t} \n A ${n} ${n} 0 1 1 ${e+n} ${t}\n `:`M ${o} ${a} A ${n} ${n} 0 ${c} 1 ${l} ${s}`},ev=({radius:t=15,lineWidth:r=5,label:i,percentageValue:o,icon:l,fontSize:s=10,labelColor:d="",arcColor:u="var(--brand-color)",backgroundArcColor:f="var(--ff-select-scroll-thumb-color)",isSelectedArch:h=!1,onSelect:C})=>{const[p,m]=c({x:0,y:0}),[g,v]=c(!1),y=a(null);let w=-Math.PI/2;const b=2*(t+r),{backgroundArcPath:E,foregroundArcPath:M}=((e,t,n)=>{const r=t,i=r+Math.max(0,Math.min(e,100))/100*2*Math.PI;return{backgroundArcPath:$g({x:0,y:0,radius:n,startAngle:0,endAngle:2*Math.PI}),foregroundArcPath:$g({x:0,y:0,radius:n,startAngle:r,endAngle:i})}})(o,w,t),A=()=>{v(!0)},x=()=>{m({x:0,y:0}),v(!1)},L=e=>{if(y.current){const t=y.current.getBoundingClientRect();m({x:e.clientX-t.left,y:e.clientY-t.top})}};return n("div",{ref:y,className:"ff-icon-radial-chart-container",style:{"--fontSize":`${s}px`},onClick:C,children:[e("svg",{width:b,height:b,viewBox:`0 0 ${b} ${b}`,role:"img",children:n("g",{transform:`translate(${t+r}, ${t+r})`,children:[e("path",{d:E,fill:"none",stroke:f,strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),e("path",{d:M,fill:"none",stroke:u,strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),h&&e("path",{d:M,fill:"none",stroke:"var(--dotted-border-color)",strokeOpacity:"0.4",strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),l?e("foreignObject",{x:"-10",y:"-10",width:"20",height:"20",children:e(B,{className:"ff-radial-chart-icon-padding",name:l,height:20,width:20})}):e("text",{x:"0",y:"0",fill:d||u,textAnchor:"middle",dominantBaseline:"central",children:`${Math.round(o)}%`})]})}),g&&n("div",{className:"ff-icon-radial-chart-tooltip",style:{position:"absolute",left:`${p.x+15}px`,top:p.y-5+"px"},children:[e(P,{children:`${i} : `}),n(P,{children:[o,"%"]})]})]})},tv=({mediaSrc:t,fileId:r,onExpandClick:i,onDeleteClick:o,onDownloadClick:a,height:l="75px",width:s="79px",fileName:c,thumbnailMediaSrc:d,isDelete:u})=>e("div",{className:"ff-attach-media-container",style:{height:l,width:s},children:n("div",{className:"ff-media-wrapper",style:{height:l,width:s},children:[e("img",{src:d||t,alt:"Attached"}),n("div",{className:"ff-hover-icons",children:[n("div",{className:"ff-top-icons",children:[e("div",{className:"ff-icon-container",children:e(G,{title:"Download File",placement:"bottom",children:e(B,{name:"download_file_icon",height:10,width:10,onClick:a,color:"var(--icons-default-color)"})})}),u&&e("div",{className:"ff-icon-container",children:e(G,{title:"Delete",placement:"bottom",children:e(B,{name:"delete",height:10,width:10,color:"var(--ff-delete-button-attachment)",onClick:()=>{o&&o(r)}})})})]}),e("div",{className:"ff-expand-icon-container",children:e(G,{title:"Maximize",placement:"bottom",children:e(B,{name:"expand_icon",height:16,width:16,onClick:i})})})]}),e(P,{color:"var(--text-area-default-color)",fontWeight:"medium",className:"ff-media-text",children:c})]})}),nv=({icon:r,status:i,count:o,text:a,style:s={width:"196.4px"},resetToggle:d,onSelectedStatus:u=e=>{}})=>{const[f,h]=c(!1),C=["total defects","defect density","open defects","closed defects","quality score"],p=C.includes(i.toLowerCase()),m=C.includes(i.toLowerCase());l((()=>{h(!d)}),[d]);return n("div",{className:`ff-card-container ${i.toLowerCase()} ${f?"toggled":""}`,style:s,onClick:()=>(e=>{C.includes(e.toLowerCase())||(h(!0),u(e))})(i),children:[n("div",{className:"ff-status-bar",children:[e("div",{children:e(B,{name:r,height:20,width:20,hoverEffect:!1})}),!C.includes(i.toLowerCase())&&e(P,{fontWeight:"semi-bold",fontSize:"10px",textAlign:"center",lineHeight:"15px",className:"ff-status-text",as:"div",children:i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()})]}),e("div",{className:"ff-content "+(m?"red-background":""),children:n(t,p?{children:[e(P,{fontWeight:"semi-bold",fontSize:"10px",className:"ff-text",lineHeight:"15px",color:"var(--ff-chip-text-color)",children:a}),e(P,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"36px",children:"defect density"===i.toLowerCase()?n(t,{children:[o.toString().padStart(2,"0"),e(P,{fontSize:"15px",fontWeight:"semi-bold",children:"/ Modules"})]}):"quality score"===i.toLowerCase()?`${parseFloat(o.toString()).toFixed(2)}%`:o.toString().padStart(2,"0")})]}:{children:[e(P,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"24px",color:f?"var(--base-bg-color)":"",children:o.toString().padStart(2,"0")}),e(P,{className:"ff-text",lineHeight:"18px",color:f?"var(--base-bg-color)":"var(--ff-chip-text-color)",children:a})]})})]})},rv=({option:t})=>{const r=a(null),[i,o]=c(!1);l((()=>{const e=r.current;if(!e)return;const t=()=>{o(e.scrollWidth>e.clientWidth)},n=requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t)}}),[t]);const s={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},d=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;return n("div",{style:{width:"-webkit-fill-available"},className:"ff-variable-option ff-variable-data",children:[e(G,{title:i?d(t):"",style:{width:"calc(100% - 32px)"},children:e("span",{ref:r,className:"ff-truncated_text",children:d(t)})}),e(B,{name:(e=>{if(!e)return"";const t=e._id||e.id;return t?.startsWith("PARAMETER")?"step_group_parameter":"LOCAL"===e.type&&"STEPGROUP"===e?.parentVariableType?"step_group_variable":"_startforloop"===e.type?"for_loop_variable":"DATAPROVIDER"===e.type?"data_provider_variable":s[e.type||""]||""})(t),height:24,width:24,hoverEffect:!0})]})};function iv(e){return()=>e}function ov(e){e()}function av(e,t){return n=>e(t(n))}function lv(e,t){return()=>e(t)}function sv(e){return void 0!==e}function cv(){}function dv(e,t){return t(e),e}function uv(e,t){return t(e)}function fv(...e){return e}function hv(e,t){return e(1,t)}function Cv(e,t){e(0,t)}function pv(e){e(2)}function mv(e){return e(4)}function gv(e,t){return hv(e,function(e,t){return n=>e(t,n)}(t,0))}function vv(e,t){const n=e(1,(e=>{n(),t(e)}));return n}function yv(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout((()=>{r(t)}),e)}}function wv(e,t){return e===t}function bv(e=wv){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Ev(e){return t=>n=>{e(n)&&t(n)}}function Mv(e){return t=>av(t,e)}function Av(e){return t=>()=>{t(e)}}function xv(e,...t){const n=function(...e){return t=>e.reduceRight(uv,t)}(...t);return(t,r)=>{switch(t){case 2:return void pv(e);case 1:return hv(e,n(r))}}}function Lv(e,t){return n=>r=>{n(t=e(t,r))}}function kv(e){return t=>n=>{e>0?e--:t(n)}}function Hv(e){let t,n=null;return r=>i=>{n=i,!t&&(t=setTimeout((()=>{t=void 0,r(n)}),e))}}function Sv(...e){const t=new Array(e.length);let n=0,r=null;const i=Math.pow(2,e.length)-1;return e.forEach(((e,o)=>{const a=Math.pow(2,o);hv(e,(e=>{const l=n;n|=a,t[o]=e,l!==i&&n===i&&r&&(r(),r=null)}))})),e=>o=>{const a=()=>{e([o].concat(t))};n===i?a():r=a}}function Vv(e){let t=e;const n=Ov();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function _v(e,t){return dv(Vv(t),(t=>gv(e,t)))}function Ov(){const e=[];return(t,n)=>{switch(t){case 0:return void e.slice().forEach((e=>{e(n)}));case 2:return void e.splice(0,e.length);case 1:return e.push(n),()=>{const t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function Nv(e){return dv(Ov(),(t=>gv(e,t)))}function zv(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Tv(),singleton:n}}const Tv=()=>Symbol();function Dv(...e){const t=Ov(),n=new Array(e.length);let r=0;const i=Math.pow(2,e.length)-1;return e.forEach(((e,o)=>{const a=Math.pow(2,o);hv(e,(e=>{n[o]=e,r|=a,r===i&&Cv(t,n)}))})),function(e,o){switch(e){case 2:return void pv(t);case 1:return r===i&&o(n),hv(t,o)}}}function Iv(e,t=wv){return xv(e,bv(t))}function Zv(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(ov)}}(...e.map((e=>hv(e,n))))}}}var jv=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(jv||{});const Rv={0:"debug",3:"error",1:"log",2:"warn"},Bv=zv((()=>{const e=Vv(3);return{log:Vv(((t,n,r=1)=>{var i;r>=(null!=(i=(typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:mv(e))&&console[Rv[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)})),logLevel:e}}),[],{singleton:!0});function Pv(e,t,n){return Fv(e,t,n).callbackRef}function Fv(e,t,n){const r=i.useRef(null);let o=e=>{};const a=i.useMemo((()=>typeof ResizeObserver<"u"?new ResizeObserver((t=>{const r=()=>{const n=t[0].target;null!==n.offsetParent&&e(n)};n?r():requestAnimationFrame(r)})):null),[e,n]);return o=e=>{e&&t?(null==a||a.observe(e),r.current=e):(r.current&&(null==a||a.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function Uv(e,t,n,r,o,a,l,s,c){const d=i.useCallback((n=>{const i=function(e,t,n,r){const i=e.length;if(0===i)return null;const o=[];for(let a=0;a<i;a++){const i=e.item(a);if(void 0===i.dataset.index)continue;const l=parseInt(i.dataset.index),s=parseFloat(i.dataset.knownSize),c=t(i,n);if(0===c&&r("Zero-sized element, this should not happen",{child:i},jv.ERROR),c===s)continue;const d=o[o.length-1];0===o.length||d.size!==c||d.endIndex!==l-1?o.push({endIndex:l,size:c,startIndex:l}):o[o.length-1].endIndex++}return o}(n.children,t,s?"offsetWidth":"offsetHeight",o);let c=n.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const d="window"===c.lastElementChild.dataset.viewportType;let u;d&&(u=c.ownerDocument.defaultView);const f=l?s?l.scrollLeft:l.scrollTop:d?s?u.scrollX||u.document.documentElement.scrollLeft:u.scrollY||u.document.documentElement.scrollTop:s?c.scrollLeft:c.scrollTop,h=l?s?l.scrollWidth:l.scrollHeight:d?s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight:s?c.scrollWidth:c.scrollHeight,C=l?s?l.offsetWidth:l.offsetHeight:d?s?u.innerWidth:u.innerHeight:s?c.offsetWidth:c.offsetHeight;r({scrollHeight:h,scrollTop:Math.max(f,0),viewportHeight:C}),null==a||a(s?qv("column-gap",getComputedStyle(n).columnGap,o):qv("row-gap",getComputedStyle(n).rowGap,o)),null!==i&&e(i)}),[e,t,o,a,l,r,s]);return Fv(d,n,c)}function qv(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,jv.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}function Wv(e,t,n){const r=i.useRef(null),o=i.useCallback((n=>{if(null==n||!n.offsetParent)return;const i=n.getBoundingClientRect(),o=i.width;let a,s;if(t){const e=t.getBoundingClientRect(),n=i.top-e.top;s=e.height-Math.max(0,n),a=n+t.scrollTop}else{const e=l.current.ownerDocument.defaultView;s=e.innerHeight-Math.max(0,i.top),a=i.top+e.scrollY}r.current={offsetTop:a,visibleHeight:s,visibleWidth:o},e(r.current)}),[e,t]),{callbackRef:a,ref:l}=Fv(o,!0,n),s=i.useCallback((()=>{o(l.current)}),[o,l]);return i.useEffect((()=>{var e;if(t){t.addEventListener("scroll",s);const e=new ResizeObserver((()=>{requestAnimationFrame(s)}));return e.observe(t),()=>{t.removeEventListener("scroll",s),e.unobserve(t)}}{const t=null==(e=l.current)?void 0:e.ownerDocument.defaultView;return null==t||t.addEventListener("scroll",s),null==t||t.addEventListener("resize",s),()=>{null==t||t.removeEventListener("scroll",s),null==t||t.removeEventListener("resize",s)}}}),[s,t,l]),a}const Qv=zv((()=>{const e=Ov(),t=Ov(),n=Vv(0),r=Ov(),i=Vv(0),o=Ov(),a=Ov(),l=Vv(0),s=Vv(0),c=Vv(0),d=Vv(0),u=Ov(),f=Ov(),h=Vv(!1),C=Vv(!1),p=Vv(!1);return gv(xv(e,Mv((({scrollTop:e})=>e))),t),gv(xv(e,Mv((({scrollHeight:e})=>e))),a),gv(t,i),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:s,footerHeight:d,headerHeight:l,horizontalDirection:C,scrollBy:f,scrollContainerState:e,scrollHeight:a,scrollingInProgress:h,scrollTo:u,scrollTop:t,skipAnimationFrameInResizeObserver:p,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:o}}),[],{singleton:!0}),Gv={lvl:0};function Kv(e,t){const n=e.length;if(0===n)return[];let{index:r,value:i}=t(e[0]);const o=[];for(let a=1;a<n;a++){const{index:n,value:l}=t(e[a]);o.push({end:n-1,start:r,value:i}),r=n,i=l}return o.push({end:1/0,start:r,value:i}),o}function Yv(e){return e===Gv}function Xv(e,t){if(!Yv(e))return t===e.k?e.v:t<e.k?Xv(e.l,t):Xv(e.r,t)}function Jv(e,t,n="k"){if(Yv(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Jv(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Jv(e.l,t,n)}function $v(e,t,n){return Yv(e)?dy(t,n,1):t===e.k?ay(e,{k:t,v:n}):t<e.k?uy(ay(e,{l:$v(e.l,t,n)})):uy(ay(e,{r:$v(e.r,t,n)}))}function ey(){return Gv}function ty(e,t,n){if(Yv(e))return[];return function(e){return Kv(e,(({k:e,v:t})=>({index:e,value:t})))}(iy(e,Jv(e,t)[0],n))}function ny(e,t){if(Yv(e))return Gv;const{k:n,l:r,r:i}=e;if(t===n){if(Yv(r))return i;if(Yv(i))return r;{const[t,n]=cy(r);return oy(ay(e,{k:t,l:ly(r),v:n}))}}return oy(ay(e,t<n?{l:ny(r,t)}:{r:ny(i,t)}))}function ry(e){return Yv(e)?[]:[...ry(e.l),{k:e.k,v:e.v},...ry(e.r)]}function iy(e,t,n){if(Yv(e))return[];const{k:r,l:i,r:o,v:a}=e;let l=[];return r>t&&(l=l.concat(iy(i,t,n))),r>=t&&r<=n&&l.push({k:r,v:a}),r<=n&&(l=l.concat(iy(o,t,n))),l}function oy(e){const{l:t,lvl:n,r:r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(sy(t))return fy(ay(e,{lvl:n-1}));if(!Yv(t)&&!Yv(t.r))return ay(t.r,{l:ay(t,{r:t.r.l}),lvl:n,r:ay(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(sy(e))return hy(ay(e,{lvl:n-1}));if(Yv(r)||Yv(r.l))throw new Error("Unexpected empty nodes");{const t=r.l,i=sy(t)?r.lvl-1:r.lvl;return ay(t,{l:ay(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:hy(ay(r,{l:t.r,lvl:i}))})}}function ay(e,t){return dy(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function ly(e){return Yv(e.r)?e.l:oy(ay(e,{r:ly(e.r)}))}function sy(e){return Yv(e)||e.lvl>e.r.lvl}function cy(e){return Yv(e.r)?[e.k,e.v]:cy(e.r)}function dy(e,t,n,r=Gv,i=Gv){return{k:e,l:r,lvl:n,r:i,v:t}}function uy(e){return hy(fy(e))}function fy(e){const{l:t}=e;return Yv(t)||t.lvl!==e.lvl?e:ay(t,{r:ay(e,{l:t.r})})}function hy(e){const{lvl:t,r:n}=e;return Yv(n)||Yv(n.r)||n.lvl!==t||n.r.lvl!==t?e:ay(n,{l:ay(e,{r:n.l}),lvl:t+1})}function Cy(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function py(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const my=zv((()=>({recalcInProgress:Vv(!1)})),[],{singleton:!0});function gy(e,t,n){return e[vy(e,t,n)]}function vy(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const o=Math.floor((r+i)/2),a=n(e[o],t);if(0===a)return o;if(-1===a){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function yy(e,t){return Math.round(e.getBoundingClientRect()[t])}function wy(e){return!Yv(e.groupOffsetTree)}function by({index:e},t){return t===e?0:t<e?-1:1}function Ey({offset:e},t){return t===e?0:t<e?-1:1}function My(e,t,n){if(0===t.length)return 0;const{index:r,offset:i,size:o}=gy(t,e,by),a=e-r,l=o*a+(a-1)*n+i;return l>0?l+n:l}function Ay(e,t){if(!wy(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function xy(e,t,n){if(function(e){return typeof e.groupIndex<"u"}(e))return t.groupIndices[e.groupIndex]+1;{let r=Ay("LAST"===e.index?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}}function Ly(e,t,n,r=0){return r>0&&(t=Math.max(t,gy(e,r,by).offset)),Kv(function(e,t,n,r){const i=vy(e,t,r),o=vy(e,n,r,i);return e.slice(i,o+1)}(e,t,n,Ey),Vy)}function ky(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,jv.DEBUG);const o=e.sizeTree;let a=o,l=0;if(n.length>0&&Yv(o)&&2===t.length){const e=t[0].size,r=t[1].size;a=n.reduce(((t,n)=>$v($v(t,n,e),n+1,r)),a)}else[a,l]=function(e,t){let n=Yv(e)?0:1/0;for(const r of t){const{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),Yv(e)){e=$v(e,0,i);continue}const a=ty(e,o-1,t+1);if(a.some(_y(r)))continue;let l=!1,s=!1;for(const{end:n,start:r,value:o}of a)l?(t>=r||i===o)&&(e=ny(e,r)):(s=o!==i,l=!0),n>t&&t>=r&&o!==i&&(e=$v(e,t+1,o));s&&(e=$v(e,o,i))}return[e,n]}(a,t);if(a===o)return e;const{lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u}=Sy(e.offsetTree,l,a,i);return{groupIndices:n,groupOffsetTree:n.reduce(((e,t)=>$v(e,t,My(t,u,i))),ey()),lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:a}}function Hy(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function Sy(e,t,n,r){let i=e,o=0,a=0,l=0,s=0;if(0!==t){s=vy(i,t-1,by),l=i[s].offset;const e=Jv(n,t-1);o=e[0],a=e[1],i.length&&i[s].size===Jv(n,t)[1]&&(s-=1),i=i.slice(0,s+1)}else i=[];for(const{start:e,value:s}of ty(n,t,1/0)){const t=e-o,n=t*a+l+t*r;i.push({index:e,offset:n,size:s}),o=e,l=n,a=s}return{lastIndex:o,lastOffset:l,lastSize:a,offsetTree:i}}function Vy(e){return{index:e.index,value:e}}function _y(e){const{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}const Oy={offsetHeight:"height",offsetWidth:"width"},Ny=zv((([{log:e},{recalcInProgress:t}])=>{const n=Ov(),r=Ov(),i=_v(r,0),o=Ov(),a=Ov(),l=Vv(0),s=Vv([]),c=Vv(void 0),d=Vv(void 0),u=Vv(((e,t)=>yy(e,Oy[t]))),f=Vv(void 0),h=Vv(0),C={groupIndices:[],groupOffsetTree:ey(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ey()},p=_v(xv(n,Sv(s,e,h),Lv(ky,C),bv()),C),m=_v(xv(s,bv(),Lv(((e,t)=>({current:t,prev:e.current})),{current:[],prev:[]}),Mv((({prev:e})=>e))),[]);gv(xv(s,Ev((e=>e.length>0)),Sv(p,h),Mv((([e,t,n])=>{const r=e.reduce(((e,r,i)=>$v(e,r,My(r,t.offsetTree,n)||i)),ey());return{...t,groupIndices:e,groupOffsetTree:r}}))),p),gv(xv(r,Sv(p),Ev((([e,{lastIndex:t}])=>e<t)),Mv((([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}]))),n),gv(c,d);const g=_v(xv(c,Mv((e=>void 0===e))),!0);gv(xv(d,Ev((e=>void 0!==e&&Yv(mv(p).sizeTree))),Mv((e=>[{endIndex:0,size:e,startIndex:0}]))),n);const v=Nv(xv(n,Sv(p),Lv((({sizes:e},[t,n])=>({changed:n!==e,sizes:n})),{changed:!1,sizes:C}),Mv((e=>e.changed))));hv(xv(l,Lv(((e,t)=>({diff:e.prev-t,prev:t})),{diff:0,prev:0}),Mv((e=>e.diff))),(e=>{const{groupIndices:n}=mv(p);if(e>0)Cv(t,!0),Cv(o,e+Hy(e,n));else if(e<0){const t=mv(m);t.length>0&&(e-=Hy(-e,t)),Cv(a,e)}})),hv(xv(l,Sv(e)),(([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},jv.ERROR)}));const y=Nv(o);gv(xv(o,Sv(p),Mv((([e,t])=>{const n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){const n=Xv(t.sizeTree,0);let o=0,a=0;for(;o<e;){const e=t.groupIndices[a],l=t.groupIndices.length===a+1?1/0:t.groupIndices[a+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+l-1,size:i,startIndex:e+1}),a++,o+=l+1}const l=ry(t.sizeTree);return o!==e&&l.shift(),l.reduce(((t,{k:n,v:r})=>{let i=t.ranges;return 0!==t.prevSize&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}}),{prevIndex:e,prevSize:0,ranges:r}).ranges}return ry(t.sizeTree).reduce(((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]})),{prevIndex:0,prevSize:i,ranges:[]}).ranges}))),n);const w=Nv(xv(a,Sv(p,h),Mv((([e,{offsetTree:t},n])=>My(-e,t,n)))));return gv(xv(a,Sv(p,h),Mv((([e,t,n])=>{if(t.groupIndices.length>0){if(Yv(t.sizeTree))return t;let r=ey();const i=mv(m);let o=0,a=0,l=0;for(;o<-e;){l=i[a];const e=i[a+1]-l-1;a++,o+=e+1}if(r=ry(t.sizeTree).reduce(((t,{k:n,v:r})=>$v(t,Math.max(0,n+e),r)),r),o!==-e){r=$v(r,0,Xv(t.sizeTree,l));r=$v(r,1,Jv(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...Sy(t.offsetTree,0,r,n)}}{const r=ry(t.sizeTree).reduce(((t,{k:n,v:r})=>$v(t,Math.max(0,n+e),r)),ey());return{...t,sizeTree:r,...Sy(t.offsetTree,0,r,n)}}}))),p),{beforeUnshiftWith:y,data:f,defaultItemSize:d,firstItemIndex:l,fixedItemSize:c,gap:h,groupIndices:s,itemSize:u,listRefresh:v,shiftWith:a,shiftWithOffset:w,sizeRanges:n,sizes:p,statefulTotalCount:i,totalCount:r,trackItemSizes:g,unshiftWith:o}}),fv(Bv,my),{singleton:!0});function zy(e){return e.reduce(((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e)),{groupIndices:[],totalCount:0})}const Ty=zv((([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{const o=Ov(),a=Ov(),l=Nv(xv(o,Mv(zy)));return gv(xv(l,Mv((e=>e.totalCount))),n),gv(xv(l,Mv((e=>e.groupIndices))),e),gv(xv(Dv(i,t,r),Ev((([e,t])=>wy(t))),Mv((([e,t,n])=>Jv(t.groupOffsetTree,Math.max(e-n,0),"v")[0])),bv(),Mv((e=>[e]))),a),{groupCounts:o,topItemsIndexes:a}}),fv(Ny,Qv)),Dy=zv((([{log:e}])=>{const t=Vv(!1),n=Nv(xv(t,Ev((e=>e)),bv()));return hv(t,(t=>{t&&mv(e)("props updated",{},jv.DEBUG)})),{didMount:n,propsReady:t}}),fv(Bv),{singleton:!0}),Iy=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Zy(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Iy)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const jy=zv((([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:a,headerHeight:l,scrollingInProgress:s,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:u},{log:f}])=>{const h=Ov(),C=Ov(),p=Vv(0);let m=null,g=null,v=null;function y(){m&&(m(),m=null),v&&(v(),v=null),g&&(clearTimeout(g),g=null),Cv(s,!1)}return gv(xv(h,Sv(n,u,r,p,l,a,f),Sv(e,o,i),Mv((([[e,n,r,i,o,a,l,c],u,f,p])=>{const w=Zy(e),{align:b,behavior:E,offset:M}=w,A=i-1,x=xy(w,n,A);let L=My(x,n.offsetTree,u)+a;"end"===b?(L+=f+Jv(n.sizeTree,x)[1]-r+p,x===A&&(L+=l)):"center"===b?L+=(f+Jv(n.sizeTree,x)[1]-r+p)/2:L-=o,M&&(L+=M);const k=t=>{y(),t?(c("retrying to scroll to",{location:e},jv.DEBUG),Cv(h,e)):(Cv(C,!0),c("list did not change, scroll successful",{},jv.DEBUG))};if(y(),"smooth"===E){let e=!1;v=hv(t,(t=>{e=e||t})),m=vv(d,(()=>{k(e)}))}else m=vv(xv(t,function(e){return t=>{const n=setTimeout((()=>{t(!1)}),e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),k);return g=setTimeout((()=>{y()}),1200),Cv(s,!0),c("scrolling from index to",{behavior:E,index:x,top:L},jv.DEBUG),{behavior:E,top:L}}))),c),{scrollTargetReached:C,scrollToIndex:h,topListHeight:p}}),fv(Ny,Qv,Bv),{singleton:!0});function Ry(e,t){0==e?t():requestAnimationFrame((()=>{Ry(e-1,t)}))}function By(e,t){const n=t-1;return"number"==typeof e?e:"LAST"===e.index?n:e.index}const Py=zv((([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:a}])=>{const l=Vv(!0),s=Vv(0),c=Vv(!0);return gv(xv(a,Sv(s),Ev((([e,t])=>!!t)),Av(!1)),l),gv(xv(a,Sv(s),Ev((([e,t])=>!!t)),Av(!1)),c),hv(xv(Dv(t,a),Sv(l,n,e,c),Ev((([[,e],t,{sizeTree:n},r,i])=>e&&(!Yv(n)||sv(r))&&!t&&!i)),Sv(s)),(([,e])=>{vv(i,(()=>{Cv(c,!0)})),Ry(4,(()=>{vv(r,(()=>{Cv(l,!0)})),Cv(o,e)}))})),{initialItemFinalLocationReached:c,initialTopMostItemIndex:s,scrolledToInitialItem:l}}),fv(Ny,Qv,jy,Dy),{singleton:!0});function Fy(e,t){return Math.abs(e-t)<1.01}const Uy="up",qy="down",Wy={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Qy=zv((([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{const a=Vv(!1),l=Vv(!0),s=Ov(),c=Ov(),d=Vv(4),u=Vv(0),f=_v(xv(Zv(xv(Iv(i),kv(1),Av(!0)),xv(Iv(i),kv(1),Av(!1),yv(100))),bv()),!1),h=_v(xv(Zv(xv(n,Av(!0)),xv(n,Av(!1),yv(200))),bv()),!1);gv(xv(Dv(Iv(i),Iv(u)),Mv((([e,t])=>e<=t)),bv()),l),gv(xv(l,Hv(50)),c);const C=Nv(xv(Dv(r,Iv(o),Iv(t),Iv(e),Iv(d)),Lv(((e,[{scrollHeight:t,scrollTop:n},r,i,o,a])=>{const l={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-a){let t,r;return n>e.state.scrollTop?(t="SCROLLED_DOWN",r=e.state.scrollTop-n):(t="SIZE_DECREASED",r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:l}}let s;return s=l.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":r<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":n<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:s,state:l}}),Wy),bv(((e,t)=>e&&e.atBottom===t.atBottom)))),p=_v(xv(r,Lv(((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(Fy(e.scrollHeight,t))return{changed:!1,jump:0,scrollHeight:t,scrollTop:n};{const i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}}),{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ev((e=>e.changed)),Mv((e=>e.jump))),0);gv(xv(C,Mv((e=>e.atBottom))),a),gv(xv(a,Hv(50)),s);const m=Vv(qy);gv(xv(r,Mv((({scrollTop:e})=>e)),bv(),Lv(((e,t)=>mv(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Uy:qy,prevScrollTop:t}),{direction:qy,prevScrollTop:0}),Mv((e=>e.direction))),m),gv(xv(r,Hv(50),Av("none")),m);const g=Vv(0);return gv(xv(f,Ev((e=>!e)),Av(0)),g),gv(xv(i,Hv(100),Sv(f),Ev((([e,t])=>!!t)),Lv((([e,t],[n])=>[t,n]),[0,0]),Mv((([e,t])=>t-e))),g),{atBottomState:C,atBottomStateChange:s,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:a,isAtTop:l,isScrolling:f,lastJumpDueToItemResize:p,scrollDirection:m,scrollVelocity:g}}),fv(Qv)),Gy="top",Ky="bottom",Yy="none";function Xy(e,t,n){return"number"==typeof e?n===Uy&&t===Gy||n===qy&&t===Ky?e:0:n===Uy?t===Gy?e.main:e.reverse:t===Ky?e.main:e.reverse}function Jy(e,t){var n;return"number"==typeof e?e:null!=(n=e[t])?n:0}const $y=zv((([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const o=Ov(),a=Vv(0),l=Vv(0),s=Vv(0),c=_v(xv(Dv(Iv(r),Iv(i),Iv(n),Iv(o,py),Iv(s),Iv(a),Iv(t),Iv(e),Iv(l)),Mv((([e,t,n,[r,i],o,a,l,s,c])=>{const d=e-s,u=a+l,f=Math.max(n-d,0);let h=Yy;const C=Jy(c,Gy),p=Jy(c,Ky);return r-=s,i+=n+l,(r+=n+l)>e+u-C&&(h=Uy),(i-=s)<e-f+t+p&&(h=qy),h!==Yy?[Math.max(d-n-Xy(o,Gy,h)-C,0),d-f-l+t+Xy(o,Ky,h)+p]:null})),Ev((e=>null!=e)),bv(py)),[0,0]);return{increaseViewportBy:l,listBoundary:o,overscan:s,topListHeight:a,visibleRange:c}}),fv(Qv),{singleton:!0});const ew={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function tw(e,t,n,r,i,o){const{lastIndex:a,lastOffset:l,lastSize:s}=i;let c=0,d=0;if(e.length>0){c=e[0].offset;const t=e[e.length-1];d=t.offset+t.size}const u=n-a,f=c,h=l+u*s+(u-1)*r-d;return{bottom:d,firstItemIndex:o,items:rw(e,i,o),offsetBottom:h,offsetTop:c,top:f,topItems:rw(t,i,o),topListHeight:t.reduce(((e,t)=>t.size+e),0),totalCount:n}}function nw(e,t,n,r,i,o){let a=0;if(n.groupIndices.length>0)for(const t of n.groupIndices){if(t-a>=e)break;a++}const l=e+a,s=By(t,l);return tw(Array.from({length:l}).map(((e,t)=>({data:o[t+s],index:t+s,offset:0,size:0}))),[],l,i,n,r)}function rw(e,t,n){if(0===e.length)return[];if(!wy(t))return e.map((e=>({...e,index:e.index+n,originalIndex:e.index})));const r=e[0].index,i=e[e.length-1].index,o=[],a=ty(t.groupOffsetTree,r,i);let l,s=0;for(const r of e){let e;(!l||l.end<r.index)&&(l=a.shift(),s=t.groupIndices.indexOf(l.start)),e=r.index===l.start?{index:s,type:"group"}:{groupIndex:s,index:r.index-(s+1)+n},o.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return o}const iw=zv((([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:a,topListHeight:l,visibleRange:s},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:u},f,{didMount:h},{recalcInProgress:C}])=>{const p=Vv([]),m=Vv(0),g=Ov();gv(o.topItemsIndexes,p);const v=_v(xv(Dv(h,C,Iv(s,py),Iv(i),Iv(r),Iv(c),d,Iv(p),Iv(t),Iv(n),e),Ev((([e,t,,n,,,,,,,r])=>{const i=r&&r.length!==n;return e&&!t&&!i})),Mv((([,,[e,t],n,r,i,o,a,l,s,c])=>{const d=r,{offsetTree:u,sizeTree:f}=d,h=mv(m);if(0===n)return{...ew,totalCount:n};if(0===e&&0===t)return 0===h?{...ew,totalCount:n}:nw(h,i,r,l,s,c||[]);if(Yv(f))return h>0?null:tw(function(e,t,n){if(wy(t)){const r=Ay(e,t);return[{index:Jv(t.groupOffsetTree,r)[0],offset:0,size:0},{data:null==n?void 0:n[0],index:r,offset:0,size:0}]}return[{data:null==n?void 0:n[0],index:e,offset:0,size:0}]}(By(i,n),d,c),[],n,s,d,l);const C=[];if(a.length>0){const e=a[0],t=a[a.length-1];let n=0;for(const r of ty(f,e,t)){const i=r.value,o=Math.max(r.start,e),a=Math.min(r.end,t);for(let e=o;e<=a;e++)C.push({data:null==c?void 0:c[e],index:e,offset:n,size:i}),n+=i}}if(!o)return tw([],C,n,s,d,l);const p=a.length>0?a[a.length-1]+1:0,g=Ly(u,e,t,p);if(0===g.length)return null;const v=n-1,y=dv([],(n=>{for(const r of g){const i=r.value;let o=i.offset,a=r.start;const l=i.size;if(i.offset<e){a+=Math.floor((e-i.offset+s)/(l+s));const t=a-r.start;o+=t*l+t*s}a<p&&(o+=(p-a)*l,a=p);const d=Math.min(r.end,v);for(let e=a;e<=d&&!(o>=t);e++)n.push({data:null==c?void 0:c[e],index:e,offset:o,size:l}),o+=l+s}}));return tw(y,C,n,s,d,l)})),Ev((e=>null!==e)),bv()),ew);gv(xv(e,Ev(sv),Mv((e=>null==e?void 0:e.length))),i),gv(xv(v,Mv((e=>e.topListHeight))),u),gv(u,l),gv(xv(v,Mv((e=>[e.top,e.bottom]))),a),gv(xv(v,Mv((e=>e.items))),g);const y=Nv(xv(v,Ev((({items:e})=>e.length>0)),Sv(i,e),Ev((([{items:e},t])=>e[e.length-1].originalIndex===t-1)),Mv((([,e,t])=>[e-1,t])),bv(py),Mv((([e])=>e)))),w=Nv(xv(v,Hv(200),Ev((({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length)),Mv((({items:e})=>e[0].index)),bv())),b=Nv(xv(v,Ev((({items:e})=>e.length>0)),Mv((({items:e})=>{let t=0,n=e.length-1;for(;"group"===e[t].type&&t<n;)t++;for(;"group"===e[n].type&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}})),bv(Cy)));return{endReached:y,initialItemCount:m,itemsRendered:g,listState:v,rangeChanged:b,startReached:w,topItemsIndexes:p,...f}}),fv(Ny,Ty,$y,Py,jy,Qy,Dy,my),{singleton:!0}),ow=zv((([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const o=Ov(),a=_v(xv(Dv(n,e,r,t,i),Mv((([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom))),0);return gv(Iv(a),o),{totalListHeight:a,totalListHeightChanged:o}}),fv(Qv,iw),{singleton:!0}),aw=zv((([{viewportHeight:e},{totalListHeight:t}])=>{const n=Vv(!1);return{alignToBottom:n,paddingTopAddition:_v(xv(Dv(n,e,t),Ev((([e])=>e)),Mv((([,e,t])=>Math.max(0,e-t))),Hv(0),bv()),0)}}),fv(Qv,ow),{singleton:!0}),lw=zv((()=>({context:Vv(null)}))),sw=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:a})=>t<a?{...i,align:null!=n?n:"start",behavior:r}:e>o?{...i,align:null!=n?n:"end",behavior:r}:null,cw=zv((([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:a,scrollTop:l,viewportHeight:s},{scrollToIndex:c}])=>{const d=Ov();return gv(xv(d,Sv(t,s,n,o,i,r,l),Sv(e),Mv((([[e,t,n,r,i,o,l,s],c])=>{const{align:d,behavior:u,calculateViewLocation:f=sw,done:h,...C}=e,p=xy(e,t,r-1),m=My(p,t.offsetTree,c)+i+o,g=f({itemBottom:m+Jv(t.sizeTree,p)[1],itemTop:m,locationParams:{align:d,behavior:u,...C},viewportBottom:s+n-l,viewportTop:s+o});return g?h&&vv(xv(a,Ev((e=>!e)),kv(mv(a)?1:2)),h):h&&h(),g})),Ev((e=>null!==e))),c),{scrollIntoView:d}}),fv(Ny,Qv,jy,iw,Bv),{singleton:!0});function dw(e){return!!e&&("smooth"===e?"smooth":"auto")}const uw=zv((([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:o},{scrollToIndex:a},{scrolledToInitialItem:l},{didMount:s,propsReady:c},{log:d},{scrollingInProgress:u},{context:f},{scrollIntoView:h}])=>{const C=Vv(!1),p=Ov();let m=null;function g(e){Cv(a,{align:"end",behavior:e,index:"LAST"})}function v(e){const t=vv(i,(t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&!m&&(mv(d)("scrolling to bottom due to increased size",{},jv.DEBUG),g("auto"))}));setTimeout(t,100)}hv(xv(Dv(xv(Iv(t),kv(1)),s),Sv(Iv(C),o,l,u),Mv((([[e,t],n,r,i,o])=>{let a=t&&i,l="auto";return a&&(l=((e,t)=>"function"==typeof e?dw(e(t)):t&&dw(e))(n,r||o),a=a&&!!l),{followOutputBehavior:l,shouldFollow:a,totalCount:e}})),Ev((({shouldFollow:e})=>e))),(({followOutputBehavior:t,totalCount:r})=>{m&&(m(),m=null),mv(n)?requestAnimationFrame((()=>{mv(d)("following output to ",{totalCount:r},jv.DEBUG),g(t)})):m=vv(e,(()=>{mv(d)("following output to ",{totalCount:r},jv.DEBUG),g(t),m=null}))})),hv(xv(Dv(Iv(C),t,c),Ev((([e,,t])=>e&&t)),Lv((({value:e},[,t])=>({refreshed:e===t,value:t})),{refreshed:!1,value:0}),Ev((({refreshed:e})=>e)),Sv(C,t)),(([,e])=>{mv(l)&&v(!1!==e)})),hv(p,(()=>{v(!1!==mv(C))})),hv(Dv(Iv(C),i),(([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&g("auto")}));const y=Vv(null),w=Ov();return gv(Zv(xv(Iv(r),Mv((e=>{var t;return null!=(t=null==e?void 0:e.length)?t:0}))),xv(Iv(t))),w),hv(xv(Dv(xv(w,kv(1)),s),Sv(Iv(y),l,u,f),Mv((([[e,t],n,r,i,o])=>t&&r&&(null==n?void 0:n({context:o,totalCount:e,scrollingInProgress:i})))),Ev((e=>!!e)),Hv(0)),(t=>{m&&(m(),m=null),mv(n)?requestAnimationFrame((()=>{mv(d)("scrolling into view",{}),Cv(h,t)})):m=vv(e,(()=>{mv(d)("scrolling into view",{}),Cv(h,t),m=null}))})),{autoscrollToBottom:p,followOutput:C,scrollIntoViewOnChange:y}}),fv(Ny,Qy,jy,Py,Dy,Bv,Qv,lw,cw)),fw=zv((([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:a},{didMount:l}])=>(gv(xv(l,Sv(o),Ev((([,e])=>0!==e)),Sv(i,r,t,n,e),Mv((([[,e],t,n,r,i,o=[]])=>nw(e,t,n,r,i,o)))),a),{})),fv(Ny,Py,iw,Dy),{singleton:!0}),hw=zv((([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Vv(0);return hv(xv(e,Sv(r),Ev((([,e])=>0!==e)),Mv((([,e])=>({top:e})))),(e=>{vv(xv(n,kv(1),Ev((e=>e.items.length>1))),(()=>{requestAnimationFrame((()=>{Cv(t,e)}))}))})),{initialScrollTop:r}}),fv(Dy,Qv,iw),{singleton:!0}),Cw=zv((([{scrollVelocity:e}])=>{const t=Vv(!1),n=Ov(),r=Vv(!1);return gv(xv(e,Sv(r,t,n),Ev((([e,t])=>!!t)),Mv((([e,t,n,r])=>{const{enter:i,exit:o}=t;if(n){if(o(e,r))return!1}else if(i(e,r))return!0;return n})),bv()),t),hv(xv(Dv(t,e,n),Sv(r)),(([[e,t,n],r])=>{e&&r&&r.change&&r.change(t,n)})),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}}),fv(Qy),{singleton:!0}),pw=zv((([{scrollContainerState:e,scrollTo:t}])=>{const n=Ov(),r=Ov(),i=Ov(),o=Vv(!1),a=Vv(void 0);return gv(xv(Dv(n,r),Mv((([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n})))),e),gv(xv(t,Sv(r),Mv((([e,{offsetTop:t}])=>({...e,top:e.top+t})))),i),{customScrollParent:a,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}}),fv(Qv)),mw=zv((([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:a,windowScrollContainerState:l,windowViewportRect:s}])=>{const c=Ov(),d=Vv(void 0),u=Vv(null),f=Vv(null);return gv(l,u),gv(s,f),hv(xv(c,Sv(t,r,a,u,f,n)),(([e,t,n,r,i,o,a])=>{const l=function(e){return ry(e).map((({k:e,v:t},n,r)=>{const i=r[n+1];return{endIndex:i?i.k-1:1/0,size:t,startIndex:e}}))}(t.sizeTree);r&&null!==i&&null!==o&&(n=i.scrollTop-o.offsetTop),e({ranges:l,scrollTop:n-=a})})),gv(xv(d,Ev(sv),Mv(gw)),i),gv(xv(o,Sv(d),Ev((([,e])=>void 0!==e)),bv(),Mv((([,e])=>e.ranges))),e),{getState:c,restoreStateFrom:d}}),fv(Ny,Qv,Py,Dy,pw));function gw(e){return{align:"start",index:0,offset:e.scrollTop}}const vw=zv((([{topItemsIndexes:e}])=>{const t=Vv(0);return gv(xv(t,Ev((e=>e>=0)),Mv((e=>Array.from({length:e}).map(((e,t)=>t))))),e),{topItemCount:t}}),fv(iw));function yw(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const ww=yw((()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent))),bw=zv((([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:o,lastJumpDueToItemResize:a,scrollDirection:l},{listState:s},{beforeUnshiftWith:c,gap:d,shiftWithOffset:u,sizes:f},{log:h},{recalcInProgress:C}])=>{const p=Nv(xv(s,Sv(a),Lv((([,e,t,n],[{bottom:r,items:i,offsetBottom:o,totalCount:a},l])=>{const s=r+o;let c=0;return t===a&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||(c=s-n,0!==c&&(c+=l))),[c,i,a,s]}),[0,[],0,0]),Ev((([e])=>0!==e)),Sv(r,l,n,i,h,C),Ev((([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===Uy)),Mv((([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},jv.DEBUG),e)))));function m(n){n>0?(Cv(t,{behavior:"auto",top:-n}),Cv(e,0)):(Cv(e,0),Cv(t,{behavior:"auto",top:-n}))}return hv(xv(p,Sv(e,o)),(([t,n,r])=>{r&&ww()?Cv(e,n-t):m(-t)})),hv(xv(Dv(_v(o,!1),e,C),Ev((([e,t,n])=>!e&&!n&&0!==t)),Mv((([e,t])=>t)),Hv(1)),m),gv(xv(u,Mv((e=>({top:-e})))),t),hv(xv(c,Sv(f,d),Mv((([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function o(e){return e*(n+i)}if(0===t.length)return o(e);{let n=0;const i=Xv(r,0);let a=0,l=0;for(;a<e;){a++,n+=i;let r=t.length===l+1?1/0:t[l+1]-t[l]-1;a+r>e&&(n-=i,r=e-a+1),a+=r,n+=o(r),l++}return n}}))),(n=>{Cv(e,n),requestAnimationFrame((()=>{Cv(t,{top:n}),requestAnimationFrame((()=>{Cv(e,0),Cv(C,!1)}))}))})),{deviation:e}}),fv(Qv,Qy,iw,Ny,Bv,my)),Ew=zv((([e,t,n,r,i,o,a,l,s,c,d])=>({...e,...t,...n,...r,...i,...o,...a,...l,...s,...c,...d})),fv($y,fw,Dy,Cw,ow,hw,aw,pw,cw,Bv,lw)),Mw=zv((([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,gap:i,groupIndices:o,itemSize:a,sizeRanges:l,sizes:s,statefulTotalCount:c,totalCount:d,trackItemSizes:u},{initialItemFinalLocationReached:f,initialTopMostItemIndex:h,scrolledToInitialItem:C},p,m,g,{listState:v,topItemsIndexes:y,...w},{scrollToIndex:b},E,{topItemCount:M},{groupCounts:A},x])=>(gv(w.rangeChanged,x.scrollSeekRangeChanged),gv(xv(x.windowViewportRect,Mv((e=>e.visibleHeight))),p.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,gap:i,groupCounts:A,initialItemFinalLocationReached:f,initialTopMostItemIndex:h,scrolledToInitialItem:C,sizeRanges:l,topItemCount:M,topItemsIndexes:y,totalCount:d,...g,groupIndices:o,itemSize:a,listState:v,scrollToIndex:b,statefulTotalCount:c,trackItemSizes:u,...w,...x,...p,sizes:s,...m})),fv(Ny,Py,Qv,mw,uw,iw,jy,bw,vw,Ty,Ew));function Aw(e,t){const n={},r={};let i=0;const o=e.length;for(;i<o;)r[e[i]]=1,i+=1;for(const e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}const xw=typeof document<"u"?i.useLayoutEffect:i.useEffect;function Lw(t,n,r){const o=Object.keys(n.required||{}),a=Object.keys(n.optional||{}),l=Object.keys(n.methods||{}),s=Object.keys(n.events||{}),c=i.createContext({});function d(e,t){e.propsReady&&Cv(e.propsReady,!1);for(const r of o){Cv(e[n.required[r]],t[r])}for(const r of a)if(r in t){Cv(e[n.optional[r]],t[r])}e.propsReady&&Cv(e.propsReady,!0)}function u(e){return s.reduce(((t,r)=>(t[r]=function(e){let t,n;const r=()=>null==t?void 0:t();return function(i,o){switch(i){case 1:return o?n===o?void 0:(r(),n=o,t=hv(e,o),t):(r(),cv);case 2:return r(),void(n=null)}}}(e[n.events[r]]),t)),{})}const f=i.forwardRef(((f,h)=>{const{children:C,...p}=f,[m]=i.useState((()=>dv(function(e){const t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:o})=>{if(o&&t.has(i))return t.get(i);const a=e(r.map((e=>n(e))));return o&&t.set(i,a),a};return n(e)}(t),(e=>{d(e,p)})))),[g]=i.useState(lv(u,m));xw((()=>{for(const e of s)e in p&&hv(g[e],p[e]);return()=>{Object.values(g).map(pv)}}),[p,g,m]),xw((()=>{d(m,p)})),i.useImperativeHandle(h,iv(function(e){return l.reduce(((t,r)=>(t[r]=t=>{Cv(e[n.methods[r]],t)},t)),{})}(m)));const v=r;return e(c.Provider,{value:m,children:r?e(v,{...Aw([...o,...a,...s],p),children:C}):C})}));return{Component:f,useEmitter:(e,t)=>{const n=i.useContext(c)[e];xw((()=>hv(n,t)),[t,n])},useEmitterValue:i.version.startsWith("18")?e=>{const t=i.useContext(c)[e],n=i.useCallback((e=>hv(t,e)),[t]);return i.useSyncExternalStore(n,(()=>mv(t)),(()=>mv(t)))}:e=>{const t=i.useContext(c)[e],[n,r]=i.useState(lv(mv,t));return xw((()=>hv(t,(e=>{e!==n&&r(iv(e))}))),[t,n]),n},usePublisher:e=>{const t=i.useContext(c);return i.useCallback((n=>{Cv(t[e],n)}),[t,e])}}}const kw=i.createContext(void 0),Hw=i.createContext(void 0),Sw=typeof document<"u"?i.useLayoutEffect:i.useEffect;function Vw(e){return"self"in e}function _w(e,t,n,r=cv,o,a){const l=i.useRef(null),s=i.useRef(null),c=i.useRef(null),d=i.useCallback((n=>{let r,i,o;const l=n.target;if(function(e){return"body"in e}(l)||Vw(l)){const e=Vw(l)?l:l.defaultView;o=a?e.scrollX:e.scrollY,r=a?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a?e.innerWidth:e.innerHeight}else o=a?l.scrollLeft:l.scrollTop,r=a?l.scrollWidth:l.scrollHeight,i=a?l.offsetWidth:l.offsetHeight;const d=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync?d():M.flushSync(d),null!==s.current&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))}),[e,t,a]);return i.useEffect((()=>{const e=o||l.current;return r(o||l.current),d({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",d,{passive:!0}),()=>{r(null),e.removeEventListener("scroll",d)}}),[l,d,n,r,o]),{scrollByCallback:function(e){a&&(e={behavior:e.behavior,left:e.top}),l.current.scrollBy(e)},scrollerRef:l,scrollToCallback:function(n){const r=l.current;if(!r||(a?"offsetWidth"in r&&0===r.offsetWidth:"offsetHeight"in r&&0===r.offsetHeight))return;const i="smooth"===n.behavior;let o,d,u;Vw(r)?(d=Math.max(yy(r.document.documentElement,a?"width":"height"),a?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),o=a?r.innerWidth:r.innerHeight,u=a?window.scrollX:window.scrollY):(d=r[a?"scrollWidth":"scrollHeight"],o=yy(r,a?"width":"height"),u=r[a?"scrollLeft":"scrollTop"]);const f=d-o;if(n.top=Math.ceil(Math.max(Math.min(f,n.top),0)),Fy(o,d)||n.top===u)return e({scrollHeight:d,scrollTop:u,viewportHeight:o}),void(i&&t(!0));i?(s.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout((()=>{c.current=null,s.current=null,t(!0)}),1e3)):s.current=null,a&&(n={behavior:n.behavior,left:n.top}),r.scrollTo(n)}}}const Ow="-webkit-sticky",Nw="sticky",zw=yw((()=>{if(typeof document>"u")return Nw;const e=document.createElement("div");return e.style.position=Ow,e.style.position===Ow?Ow:Nw}));function Tw(e){return e}const Dw=zv((()=>{const e=Vv((e=>`Item ${e}`)),t=Vv((e=>`Group ${e}`)),n=Vv({}),r=Vv(Tw),i=Vv("div"),o=Vv(cv),a=(e,t=null)=>_v(xv(n,Mv((t=>t[e])),bv()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:a("EmptyPlaceholder"),FooterComponent:a("Footer"),GroupComponent:a("Group","div"),groupContent:t,HeaderComponent:a("Header"),HeaderFooterTag:i,ItemComponent:a("Item","div"),itemContent:e,ListComponent:a("List","div"),ScrollerComponent:a("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TopItemListComponent:a("TopItemList")}})),Iw=zv((([e,t])=>({...e,...t})),fv(Mw,Dw)),Zw=({height:t})=>e("div",{style:{height:t}}),jw={overflowAnchor:"none",position:zw(),zIndex:1},Rw={overflowAnchor:"none"},Bw={...Rw,display:"inline-block",height:"100%"},Pw=i.memo((function({showTopList:t=!1}){const n=ob("listState"),r=ab("sizeRanges"),o=ob("useWindowScroll"),a=ob("customScrollParent"),l=ab("windowScrollContainerState"),s=ab("scrollContainerState"),c=a||o?l:s,d=ob("itemContent"),u=ob("context"),f=ob("groupContent"),h=ob("trackItemSizes"),C=ob("itemSize"),m=ob("log"),g=ab("gap"),v=ob("horizontalDirection"),{callbackRef:y}=Uv(r,C,h,t?cv:c,m,g,a,v,ob("skipAnimationFrameInResizeObserver")),[w,b]=i.useState(0);ib("deviation",(e=>{w!==e&&b(e)}));const E=ob("EmptyPlaceholder"),M=ob("ScrollSeekPlaceholder")||Zw,A=ob("ListComponent"),x=ob("ItemComponent"),L=ob("GroupComponent"),k=ob("computeItemKey"),H=ob("isSeeking"),S=ob("groupIndices").length>0,V=ob("alignToBottom"),_=ob("initialItemFinalLocationReached"),O=t?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:0!==w?w:V?"auto":0,paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,whiteSpace:"nowrap"}:{marginTop:0!==w?w:V?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},..._?{}:{visibility:"hidden"}};return!t&&0===n.totalCount&&E?e(E,{...Qw(E,u)}):e(A,{...Qw(A,u),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:y,style:O,children:(t?n.topItems:n.items).map((e=>{const t=e.originalIndex,r=k(t+n.firstItemIndex,e.data,u);return H?p(M,{...Qw(M,u),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?p(L,{...Qw(L,u),"data-index":t,"data-item-index":e.index,"data-known-size":e.size,key:r,style:jw},f(e.index,u)):p(x,{...Qw(x,u),...Gw(x,e.data),"data-index":t,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:v?Bw:Rw},S?d(e.index,e.groupIndex,e.data,u):d(e.index,e.data,u))}))})})),Fw={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Uw={outline:"none",overflowX:"auto",position:"relative"},qw=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Ww={position:zw(),top:0,width:"100%",zIndex:1};function Qw(e,t){if("string"!=typeof e)return{context:t}}function Gw(e,t){return{item:"string"==typeof e?void 0:t}}const Kw=i.memo((function(){const t=ob("HeaderComponent"),n=ab("headerHeight"),r=ob("HeaderFooterTag"),o=Pv(i.useMemo((()=>e=>{n(yy(e,"height"))}),[n]),!0,ob("skipAnimationFrameInResizeObserver")),a=ob("context");return t?e(r,{ref:o,children:e(t,{...Qw(t,a)})}):null})),Yw=i.memo((function(){const t=ob("FooterComponent"),n=ab("footerHeight"),r=ob("HeaderFooterTag"),o=Pv(i.useMemo((()=>e=>{n(yy(e,"height"))}),[n]),!0,ob("skipAnimationFrameInResizeObserver")),a=ob("context");return t?e(r,{ref:o,children:e(t,{...Qw(t,a)})}):null}));function Xw({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo((function({children:i,style:o,...a}){const l=r("scrollContainerState"),s=n("ScrollerComponent"),c=r("smoothScrollTargetReached"),d=n("scrollerRef"),u=n("context"),f=n("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:C,scrollToCallback:p}=_w(l,c,s,d,void 0,f);return t("scrollTo",p),t("scrollBy",h),e(s,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:C,style:{...f?Uw:Fw,...o},tabIndex:0,...a,...Qw(s,u),children:i})}))}function Jw({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo((function({children:o,style:a,...l}){const s=r("windowScrollContainerState"),c=n("ScrollerComponent"),d=r("smoothScrollTargetReached"),u=n("totalListHeight"),f=n("deviation"),h=n("customScrollParent"),C=n("context"),p=i.useRef(null),m=n("scrollerRef"),{scrollByCallback:g,scrollerRef:v,scrollToCallback:y}=_w(s,d,c,m,h);return Sw((()=>{var e;return v.current=h||(null==(e=p.current)?void 0:e.ownerDocument.defaultView),()=>{v.current=null}}),[v,h]),t("windowScrollTo",y),t("scrollBy",g),e(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...0!==u?{height:u+f}:{}},...l,...Qw(c,C),children:o})}))}const $w=({children:t})=>{const n=i.useContext(kw),r=ab("viewportHeight"),o=ab("fixedItemHeight"),a=ob("alignToBottom"),l=ob("horizontalDirection"),s=Pv(i.useMemo((()=>av(r,(e=>yy(e,l?"width":"height")))),[r,l]),!0,ob("skipAnimationFrameInResizeObserver"));return i.useEffect((()=>{n&&(r(n.viewportHeight),o(n.itemHeight))}),[n,r,o]),e("div",{"data-viewport-type":"element",ref:s,style:qw(a),children:t})},eb=({children:t})=>{const n=i.useContext(kw),r=ab("windowViewportRect"),o=ab("fixedItemHeight"),a=ob("customScrollParent"),l=Wv(r,a,ob("skipAnimationFrameInResizeObserver")),s=ob("alignToBottom");return i.useEffect((()=>{n&&(o(n.itemHeight),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))}),[n,r,o]),e("div",{"data-viewport-type":"window",ref:l,style:qw(s),children:t})},tb=({children:t})=>{const n=ob("TopItemListComponent")||"div",r=ob("headerHeight"),i={...Ww,marginTop:`${r}px`},o=ob("context");return e(n,{style:i,...Qw(n,o),children:t})},nb=i.memo((function(t){const r=ob("useWindowScroll"),i=ob("topItemsIndexes").length>0,o=ob("customScrollParent"),a=ob("context"),l=o||r?sb:lb,s=o||r?eb:$w;return n(l,{...t,...Qw(l,a),children:[i&&e(tb,{children:e(Pw,{showTopList:!0})}),n(s,{children:[e(Kw,{}),e(Pw,{}),e(Yw,{})]})]})})),{Component:rb,useEmitter:ib,useEmitterValue:ob,usePublisher:ab}=Lw(Iw,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},nb),lb=Xw({useEmitter:ib,useEmitterValue:ob,usePublisher:ab}),sb=Jw({useEmitter:ib,useEmitterValue:ob,usePublisher:ab}),cb=rb,db=zv((()=>{const e=Vv((e=>n("td",{children:["Item $",e]}))),t=Vv(null),r=Vv((e=>n("td",{colSpan:1e3,children:["Group ",e]}))),i=Vv(null),o=Vv(null),a=Vv({}),l=Vv(Tw),s=Vv(cv),c=(e,t=null)=>_v(xv(a,Mv((t=>t[e])),bv()),t);return{components:a,computeItemKey:l,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:o,fixedHeaderContent:i,itemContent:e,groupContent:r,ScrollerComponent:c("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}}));fv(Mw,db),zw();const ub={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},fb={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:hb,floor:Cb,max:pb,min:mb,round:gb}=Math;function vb(e,t,n){return Array.from({length:t-e+1}).map(((t,r)=>({data:null===n?null:n[r+e],index:r+e})))}function yb(e,t){return e&&e.width===t.width&&e.height===t.height}function wb(e,t){return e&&e.column===t.column&&e.row===t.row}const bb=zv((([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:a,scrollContainerState:l,scrollTo:s,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:u},f,h,{didMount:C,propsReady:p},{customScrollParent:m,useWindowScroll:g,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:w},b])=>{const E=Vv(0),M=Vv(0),A=Vv(ub),x=Vv({height:0,width:0}),L=Vv({height:0,width:0}),k=Ov(),H=Ov(),S=Vv(0),V=Vv(null),_=Vv({column:0,row:0}),O=Ov(),N=Ov(),z=Vv(!1),T=Vv(0),D=Vv(!0),I=Vv(!1),Z=Vv(!1);hv(xv(C,Sv(T),Ev((([e,t])=>!!t))),(()=>{Cv(D,!1)})),hv(xv(Dv(C,D,L,x,T,I),Ev((([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i))),(([,,,,e])=>{Cv(I,!0),Ry(1,(()=>{Cv(k,e)})),vv(xv(c),(()=>{Cv(t,[0,0]),Cv(D,!0)}))})),gv(xv(N,Ev((e=>null!=e&&e.scrollTop>0)),Av(0)),M),hv(xv(C,Sv(N),Ev((([,e])=>null!=e))),(([,e])=>{e&&(Cv(x,e.viewport),Cv(L,e.item),Cv(_,e.gap),e.scrollTop>0&&(Cv(z,!0),vv(xv(c,kv(1)),(e=>{Cv(z,!1)})),Cv(s,{top:e.scrollTop})))})),gv(xv(x,Mv((({height:e})=>e))),u),gv(xv(Dv(Iv(x,yb),Iv(L,yb),Iv(_,((e,t)=>e&&e.column===t.column&&e.row===t.row)),Iv(c)),Mv((([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e})))),O),gv(xv(Dv(Iv(E),r,Iv(_,wb),Iv(L,yb),Iv(x,yb),Iv(V),Iv(M),Iv(z),Iv(D),Iv(T)),Ev((([,,,,,,,e])=>!e)),Mv((([e,[t,n],r,i,o,a,l,,s,c])=>{const{column:d,row:u}=r,{height:f,width:h}=i,{width:C}=o;if(0===l&&(0===e||0===C))return ub;if(0===h){const t=By(c,e);return function(e){return{...fb,items:e}}(vb(t,t+Math.max(l-1,0),a))}const p=Eb(C,h,d);let m,g;s?0===t&&0===n&&l>0?(m=0,g=l-1):(m=p*Cb((t+u)/(f+u)),g=p*hb((n+u)/(f+u))-1,g=mb(e-1,pb(g,p-1)),m=mb(g,pb(0,m))):(m=0,g=-1);const v=vb(m,g,a),{bottom:y,top:w}=Mb(o,r,i,v),b=hb(e/p);return{bottom:y,itemHeight:f,items:v,itemWidth:h,offsetBottom:b*f+(b-1)*u-y,offsetTop:w,top:w}}))),A),gv(xv(V,Ev((e=>null!==e)),Mv((e=>e.length))),E),gv(xv(Dv(x,L,A,_),Ev((([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height)),Mv((([e,t,{items:n},r])=>{const{bottom:i,top:o}=Mb(e,r,t,n);return[o,i]})),bv(py)),t);const j=Vv(!1);gv(xv(c,Sv(j),Mv((([e,t])=>t||0!==e))),j);const R=Nv(xv(Dv(A,E),Ev((([{items:e}])=>e.length>0)),Sv(j),Ev((([[e,t],n])=>{const r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&0===e.offsetBottom&&e.items.length===t)&&r})),Mv((([[,e]])=>e-1)),bv())),B=Nv(xv(Iv(A),Ev((({items:e})=>e.length>0&&0===e[0].index)),Av(0),bv())),P=Nv(xv(Iv(A),Sv(z),Ev((([{items:e},t])=>e.length>0&&!t)),Mv((([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index}))),bv(Cy),Hv(0)));gv(P,h.scrollSeekRangeChanged),gv(xv(k,Sv(x,L,E,_),Mv((([e,t,n,r,i])=>{const o=Zy(e),{align:a,behavior:l,offset:s}=o;let c=o.index;"LAST"===c&&(c=r-1),c=pb(0,c,mb(r-1,c));let d=Ab(t,i,n,c);return"end"===a?d=gb(d-t.height+n.height):"center"===a&&(d=gb(d-t.height/2+n.height/2)),s&&(d+=s),{behavior:l,top:d}}))),s);const F=_v(xv(A,Mv((e=>e.offsetBottom+e.bottom))),0);return gv(xv(w,Mv((e=>({height:e.visibleHeight,width:e.visibleWidth})))),x),{customScrollParent:m,data:V,deviation:S,footerHeight:i,gap:_,headerHeight:o,increaseViewportBy:e,initialItemCount:M,itemDimensions:L,overscan:n,restoreStateFrom:N,scrollBy:a,scrollContainerState:l,scrollHeight:H,scrollTo:s,scrollToIndex:k,scrollTop:c,smoothScrollTargetReached:d,totalCount:E,useWindowScroll:g,viewportDimensions:x,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:w,...h,gridState:A,horizontalDirection:Z,initialTopMostItemIndex:T,totalListHeight:F,...f,endReached:R,propsReady:p,rangeChanged:P,startReached:B,stateChanged:O,stateRestoreInProgress:z,...b}}),fv($y,Qv,Qy,Cw,Dy,pw,Bv));function Eb(e,t,n){return pb(1,Cb((e+n)/(Cb(t)+n)))}function Mb(e,t,n,r){const{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};const o=Ab(e,t,n,r[0].index);return{bottom:Ab(e,t,n,r[r.length-1].index)+i,top:o}}function Ab(e,t,n,r){const i=Eb(e.width,n.width,t.column),o=Cb(r/i),a=o*n.height+pb(0,o-1)*t.row;return a>0?a+t.row:a}const xb=zv((()=>{const e=Vv((e=>`Item ${e}`)),t=Vv({}),n=Vv(null),r=Vv("virtuoso-grid-item"),i=Vv("virtuoso-grid-list"),o=Vv(Tw),a=Vv("div"),l=Vv(cv),s=(e,n=null)=>_v(xv(t,Mv((t=>t[e])),bv()),n),c=Vv(!1),d=Vv(!1);return gv(Iv(d),c),{components:t,computeItemKey:o,context:n,FooterComponent:s("Footer"),HeaderComponent:s("Header"),headerFooterTag:a,itemClassName:r,ItemComponent:s("Item","div"),itemContent:e,listClassName:i,ListComponent:s("List","div"),readyStateChanged:c,reportReadyState:d,ScrollerComponent:s("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}})),Lb=zv((([e,t])=>({...e,...t})),fv(bb,xb)),kb=i.memo((function(){const t=zb("gridState"),n=zb("listClassName"),r=zb("itemClassName"),o=zb("itemContent"),a=zb("computeItemKey"),l=zb("isSeeking"),s=Tb("scrollHeight"),c=zb("ItemComponent"),d=zb("ListComponent"),u=zb("ScrollSeekPlaceholder"),f=zb("context"),h=Tb("itemDimensions"),C=Tb("gap"),m=zb("log"),g=zb("stateRestoreInProgress"),v=Tb("reportReadyState"),y=Pv(i.useMemo((()=>e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const n=e.firstChild;if(n){const{height:e,width:t}=n.getBoundingClientRect();h({height:e,width:t})}C({column:Zb("column-gap",getComputedStyle(e).columnGap,m),row:Zb("row-gap",getComputedStyle(e).rowGap,m)})}),[s,h,C,m]),!0,!1);return Sw((()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)}),[t]),g?null:e(d,{className:n,ref:y,...Qw(d,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map((n=>{const i=a(n.index,n.data,f);return l?e(u,{...Qw(u,f),height:t.itemHeight,index:n.index,width:t.itemWidth},i):p(c,{...Qw(c,f),className:r,"data-index":n.index,key:i},o(n.index,n.data,f))}))})})),Hb=i.memo((function(){const t=zb("HeaderComponent"),n=Tb("headerHeight"),r=zb("headerFooterTag"),o=Pv(i.useMemo((()=>e=>{n(yy(e,"height"))}),[n]),!0,!1),a=zb("context");return t?e(r,{ref:o,children:e(t,{...Qw(t,a)})}):null})),Sb=i.memo((function(){const t=zb("FooterComponent"),n=Tb("footerHeight"),r=zb("headerFooterTag"),o=Pv(i.useMemo((()=>e=>{n(yy(e,"height"))}),[n]),!0,!1),a=zb("context");return t?e(r,{ref:o,children:e(t,{...Qw(t,a)})}):null})),Vb=({children:t})=>{const n=i.useContext(Hw),r=Tb("itemDimensions"),o=Tb("viewportDimensions"),a=Pv(i.useMemo((()=>e=>{o(e.getBoundingClientRect())}),[o]),!0,!1);return i.useEffect((()=>{n&&(o({height:n.viewportHeight,width:n.viewportWidth}),r({height:n.itemHeight,width:n.itemWidth}))}),[n,o,r]),e("div",{ref:a,style:qw(!1),children:t})},_b=({children:t})=>{const n=i.useContext(Hw),r=Tb("windowViewportRect"),o=Tb("itemDimensions"),a=zb("customScrollParent"),l=Wv(r,a,!1);return i.useEffect((()=>{n&&(o({height:n.itemHeight,width:n.itemWidth}),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:n.viewportWidth}))}),[n,r,o]),e("div",{ref:l,style:qw(!1),children:t})},Ob=i.memo((function({...t}){const r=zb("useWindowScroll"),i=zb("customScrollParent"),o=i||r?Ib:Db,a=i||r?_b:Vb,l=zb("context");return e(o,{...t,...Qw(o,l),children:n(a,{children:[e(Hb,{}),e(kb,{}),e(Sb,{})]})})})),{useEmitter:Nb,useEmitterValue:zb,usePublisher:Tb}=Lw(Lb,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Ob),Db=Xw({useEmitter:Nb,useEmitterValue:zb,usePublisher:Tb}),Ib=Jw({useEmitter:Nb,useEmitterValue:zb,usePublisher:Tb});function Zb(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,jv.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}const jb=({optionsList:r=[],onSelectVariable:i,dropdownPosition:o,position:a="relative",width:l,height:s="160px",zIndex:c=9999})=>{const d={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},u=e=>{if(!e)return"";const t=e._id||e.id;return t?.startsWith("PARAMETER")?"step_group_parameter":"STEPGROUP"!==e?.parentVariableType||"LOCAL"!==e.type&&"STEPGROUP"!==e?.type?"_startforloop"===e.type?"for_loop_variable":"DATAPROVIDER"===e.type?"data_provider_variable":d[e.type||""]||"":"step_group_variable"},f=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;function h(e){if(e.endsWith("px")){const t=parseInt(e.slice(0,-2),10);return isNaN(t)?212:t-66}return 212}return e("div",{className:O("ff-variable-dropdown",a),style:o?{top:o.top+30,left:o.left-30,width:l,height:s,zIndex:c}:{width:l,height:s,zIndex:c},children:Q(r)?e("div",{className:"ff-variable-option ff-variable-option-no-data",children:e(P,{as:"span",fontSize:12,children:"No Option"})}):e(cb,{totalCount:r.length,itemContent:o=>{const a=r[o];return a?e("div",{className:"ff-variable-data",onMouseDown:()=>i(a),children:l.endsWith("px")?n(t,{children:[e(G,{title:ie(f(a),h(l),"pixel")?f(a):"",style:{width:`${h(l)}px`},children:e(P,{as:"span",fontSize:12,className:"ff-truncated_text",children:f(a)})}),e(B,{name:u(a),height:24,width:24,hoverEffect:!0})]}):e(rv,{option:a})},`${a.id}-${o}`):null},style:{height:s,fontSize:"12px"},overscan:10,fixedItemHeight:32})})},Rb=({data:r=[],width:i,height:o,lineChartWidth:a,yAxisLabel:s,xAxisLabel:d,yAxisValueColor:u,xAxisColor:f,yAxisColor:h,yAxisLabelColor:C,textSize:p,fontWeight:m,numberSize:g,chartName:v,shouldCenterSinglePoint:y,xAxisLabelGap:w=16,isLeftOverflow:b=!1})=>{const E=40,M=i-80,A=o-80,[x,L]=c(!1),[k,H]=c({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});l((()=>{const e=()=>{L(!1),H((e=>({...e,tooltip:{...e.tooltip,visible:!1}})))};return window.addEventListener("scroll",e,!0),()=>window.removeEventListener("scroll",e,!0)}),[]);if(!(r&&r.length>0&&r?.some((e=>Array.isArray(e?.data)&&e?.data?.length>0)))){const t=[];for(let e=6;e>=0;e--){const n=new Date;n.setDate(n.getDate()-e);const r=n?.toLocaleDateString("en-US",{day:"numeric",month:"short"});t.push(r)}const r=1024,a=6,l=7;return n("div",{className:"ff-line-chart-text",style:{width:i+20+w,gap:w},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(P,{className:"ff-line-chart-yAxisLabel",fontSize:p,fontWeight:"semi-bold",children:s})}),e("div",{className:"ff-line-chart-svg",children:e("svg",{height:o,width:i,className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:A,x2:M,y2:A,stroke:f,strokeWidth:1}),e("text",{x:M/2.1,y:A+E/1.2,textAnchor:"middle",fill:C,className:"ff-line-chart-x-axis-label",style:{fontSize:p,fontWeight:m},children:d}),t.map(((t,n)=>e("text",{x:n*(M/(l-1)),y:A+15,textAnchor:0===n?"start":n===l-1?"end":"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:t},t))),Array.from({length:a}).map(((t,n)=>{const i=n*r/(a-1),o=i/1024;return e("text",{x:-10,y:A-i*A/r,textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:o?.toFixed(1)},`y-${n}`)}))]})})})]})}function S(e){if(!isNaN(e))return parseFloat(e);const t=ot,n=e.match(t);if(!n)throw new Error("Invalid input format. Use '<value> <unit>' format (e.g., '10.9580078125 KB') or just a number.");const r=parseFloat(n[1]);switch(n[2]?n[2].toUpperCase():null){case"GB":return parseFloat((1024*r).toFixed(2));case"MB":return parseFloat(r.toFixed(2));case"KB":return parseFloat((r/1024).toFixed(2));default:throw new Error("Invalid unit. Supported units are GB, MB, and KB.")}}const V=r?.[0]?.data?.[0]?.hasOwnProperty("date")&&r?.[0]?.data?.[0]?.hasOwnProperty("totalMemory"),_="date",O=V?"totalMemory":"value",N=e=>{const t=r?.[0]?.data?.length;if(1===t)return y?M/2:M;const n=r[0].data.findIndex((t=>t[_]===e));return-1===n?0:n/(t-1)*M},z=Math.max(...r?.flatMap((e=>e?.data?.map((e=>S(e[O]))))),5),T=e=>{if("memory"===v){const t=Math.max(...r?.flatMap((e=>e?.data?.map((e=>S(e[O]))))));return A-e*A/(t>1024?t:1024)}return A-e*A/(0===z?1024:z)},D=e=>{if(1===e?.length){const t=e?.[0],n=N(t[_]),r=T(S(t[O]));return`M 0 ${T(0)} L ${n} ${r}`}return e?.reduce(((t,n,r)=>{const i=N(n[_]),o=T(S(n[O]));if(0===r)return`M ${i} ${o}`;const a=e[r-1],l=a?N(a[_]):0;return`${t} C ${l+(i-l)/2} ${a?T(S(a[O])):0}, ${i-(i-l)/2} ${o}, ${i} ${o}`}),"")},I=r[0].data;return n("div",{className:"ff-line-chart-text",style:{width:i+20+w,gap:w},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(P,{className:"ff-line-chart-yAxisLabel",fontSize:p,fontWeight:"semi-bold",children:s})}),n("div",{className:"ff-line-chart-svg",children:[e("svg",{height:o,width:i,onMouseMove:e=>{const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-E;if(e.clientY-t.top-E>A)return L(!1),void H({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});let i={hoverValues:{},dotPositions:{}},o=null;r.forEach(((e,t)=>{const r=e.data.reduce(((e,t)=>{const r=Math.abs(n-N(t[_]));return r<e.distance?{point:t,distance:r}:e}),{point:null,distance:1/0}).point;r&&(o=r[_],i.hoverValues[t]=((e,t=2)=>{let n="";if("string"==typeof e){const t=e.match(nt),r=e.match(rt);t&&(e=parseFloat(t[0])),r&&(n=r[0])}const r=Math.pow(10,t);return`${Math.ceil(e*r)/r} ${n}`.trim()})(r[O]),i.dotPositions[t]={x:N(r[_]),y:T(S(r[O]))})})),L(!0),H({cursorX:n,hoverValues:i.hoverValues,dotPositions:i.dotPositions,currentXValue:o,tooltip:o?{visible:!0,left:e.clientX+10,top:e.clientY-20}:{visible:!1,left:0,top:0}})},onMouseLeave:()=>H({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null}),className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:0,x2:0,y2:A,strokeWidth:2}),e("line",{x1:0,y1:A,x2:M,y2:A,stroke:f,strokeWidth:1}),e("text",{x:M/2.1,y:A+E/1.2,textAnchor:"middle",fill:C,className:"ff-line-chart-x-axis-label",style:{fontSize:p,fontWeight:m},children:d}),r.map(((r,i)=>{return!1!==r.show?n("g",{children:[e("path",{d:D(r.data),fill:"none",stroke:r.color,strokeWidth:a,opacity:(o=r.data,o.every((e=>0===S(e[O])))?.5:1)}),k.dotPositions[i]&&n(t,{children:[e("line",{x1:k.dotPositions[i].x,y1:0,x2:k.dotPositions[i].x,y2:A,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"}),e("circle",{cx:k.dotPositions[i].x,cy:k.dotPositions[i].y,r:5,fill:"white",stroke:r.color,strokeWidth:a,style:{transition:"cx 0.1s, cy 0.1s"}}),e("line",{x1:0,y1:k.dotPositions[i].y,x2:M,y2:k.dotPositions[i].y,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"})]})]},i):null;var o})),(()=>{if(1===I.length){const t=I?.[0];return e("text",{x:y?M/2:M,y:A+15,textAnchor:y?"middle":"end",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=t[_]?String(t[_]):""},String(t[_]))}if(I.length<7)return I.map((t=>e("text",{x:N(t[_]),y:A+15,textAnchor:"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=t[_]?String(t[_]):""},String(t[_]))));{const t=(i-80-7*9.2)/6;return Array.from({length:7}).map(((n,r)=>{const i=Math.floor(r*(I?.length-1)/6),o=I[i];return e("text",{x:r*t,y:A+15,fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=o?.[_]?String(o?.[_]):""},String(o?.[_]))}))}})(),(()=>{if("memory"===v){const t=Math.max(z,1024);return Array.from({length:6}).map(((n,r)=>{const i=r*t/5,o=i/1024;return e("text",{x:-10,y:T(i),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:o.toFixed(1)},`y-${r}`)}))}return Array.from({length:6}).map(((t,n)=>{const r=n*z/5;return e("text",{x:-10,y:T(r),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:r.toFixed(0)},`y-${n}`)}))})()]})}),x&&k.tooltip.visible&&n("div",{className:"ff-line-chart-tooltip",style:{left:b&&k.tooltip.left/2>i/1.75?k.tooltip.left-180:k.tooltip.left,top:k.tooltip.top},children:[e("div",{className:"ff-line-chart-date",children:k.currentXValue}),Object.entries(k.hoverValues).map((([t,i])=>!1!==r[Number(t)]?.show&&n("div",{className:"ff-line-chart-inner-tooltip",children:["default"!==r[Number(t)]?.name&&e("div",{className:"ff-line-chart-status-dot",style:{backgroundColor:r[Number(t)]?.color}}),r[Number(t)]?.name,": ",i]},t)))]})]})]})},Bb=({onClose:t,top:r="100px",left:i="0px",className:o,description:a="Download and Install the fireflink client to run the script",onClick:s=()=>{},optionZIndex:c=10000001})=>{l((()=>{const e=e=>{"Escape"===e.key&&t?.()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[t]);return n("div",{className:`ff-download-client-wrapper ${o}`,style:{top:r,left:i,zIndex:c},children:[n("div",{className:"ff-download-client-header-wrapper",children:[e("div",{className:"ff-download-client-hollow-triangle"}),e(P,{fontWeight:"semi-bold",lineHeight:"32px",className:"ff-download-client-header-text",children:"Download client"}),e(B,{name:"close",color:"var(--brand-color)",className:"ff-download-client-close-icon",height:12,width:12})]}),n("div",{className:"ff-download-client-content-text",children:[e(P,{as:"div",color:"var(--download-client-content-text-color)",fontWeight:"semi-bold",textAlign:"center",lineHeight:"26px",children:a}),e(P,{as:"div",className:"ff-download-client-description-text",textAlign:"center",fontWeight:"medium",lineHeight:"26px",children:"Choose OS to Download"}),e("div",{className:"ff-download-client-os-wrapper",children:["windows","mac_icon","linux"].map((t=>e("div",{className:"ff-os-version-wrapper",onClick:()=>{s("mac_icon"===t?"mac":t)},children:e(B,{name:t,height:36,width:36})},t)))})]})]})},Pb=({legendName:t,height:r,width:i,children:o})=>e("div",{className:"ff_fieldSet_container",children:n("fieldset",{className:"ff_fieldSet",style:{height:r,width:i},children:[e("legend",{className:"ff_legend_container",children:e(P,{color:"var(--license_header_text_color)",fontSize:8,lineHeight:"12px",children:t})}),e("div",{className:"ff_children_container",children:o})]})}),Fb=({onSelectVariable:t,dropdownPosition:n,filteredOptions:r=[],position:i="relative",width:o="100%",zIndex:a,truncateTextValue:l=34})=>e("div",{className:O(`ff-variable-dropdown-container ${i}`),style:n?{top:n.top+30,left:n.left-30,width:o,zIndex:a}:{width:o,zIndex:a},children:Q(r)?e("div",{className:"ff-variable-option no-data",children:e(P,{as:"div",children:"No Option",fontSize:14})}):r?.map((n=>e("div",{className:"ff-variable-option",onMouseDown:()=>t(n),children:e(G,{title:ie(n?.name,l,"pixel")?n?.name:"",children:e(P,{children:re(n?.name,l,"pixel")})})},n?.id)))}),Ub=o((({label:t="",hashInputValue:r="",setHashInputValue:i,variableList:o=[],placeholder:s="Enter text",onChange:d,onPaste:u,onCreateVariableClick:f,handleClearInput:h,value:C="",dropdownWidth:p="100%",dropdownHeight:m="160px",isHash:g=!1,isOnlyHash:v=!1,dataFiles:y=[],showAddVariableIcon:w=!0,helperText:E="",error:M,autoComplete:A="off",required:x=!1,zIndex:L=9999,truncateTextValue:k=34,formProps:H={},getSelectedVariable:S=()=>{},symbol:V="$",type:_="text",clearIcon:N=!0,inputTitle:z="",onBlur:T,helperTextWidth:D,iconProps:I={isShowIcon:!1,iconName:"",iconToolTipTitle:"",isIconDisable:!1,iconColor:"",onIconClick:()=>{}},...Z},j)=>{const[R,F]=c(!1),[U,q]=c(!1),[W,K]=c(!1),[Y,X]=c(null),[J,$]=c(0),[ee,te]=c(!1),[ne,re]=c([]),ie=a(null),oe=a(null),[ae,le]=c("auto"),se=I?.isShowIcon;l((()=>{const e=oe.current?.querySelector(".ff-input-container");if(!e)return;const t=new ResizeObserver((e=>{for(let t of e){const e=`${t.contentRect.width}px`;le(e)}}));return t.observe(e),()=>{t.disconnect()}}),[]),b(j,(()=>ie.current)),l((()=>{null!==Y&&ie.current&&(ie.current.setSelectionRange(Y,Y),ie.current.focus())}),[Y]),l((()=>{g&&F(C.startsWith("#"));const e=y?.find((e=>e.name===C)),t=o?.find((e=>e?.name===C));if(C.startsWith("#")&&g){const e=C.slice(1).toLowerCase(),t=y.filter((t=>t.name.toLowerCase().includes(e)));re(t),F(!0)}const n=null!==e&&C.startsWith("#"),r=null!==t&&C.startsWith("$"),i=C.length>(t?.name.length||0),a=C.length>0&&!r||C.startsWith("#");v?te(!1):r||n||C.includes("$")||C.includes("#")?(te(!1),a&&te(!0)):i&&!C.includes("$")&&te(!0)}),[C]);const ce=()=>{ie.current&&$(ie.current.selectionStart||0)},de=ce,ue=ce;l((()=>{ie.current&&$(ie.current.selectionStart||0)}),[C]);const fe=e=>{if(ie.current){const{selectionStart:t,selectionEnd:n}=ie.current,r=`${e.name}`;let o;if(o=g&&"#"===C[0]?e.name+C.slice(n||1):e.name,d){d({target:{value:o}},e),S(e.name)}ie.current.value=o,i?.(e),X((t||0)+r.length),F(!1),q(!0)}};const he=function(e,t,n){let r=!1,i="";const o="}"===C[t-1];if(t<0||t>e.length)return{showDropdown:r,searchString:i};const a=e.lastIndexOf(V,t-1),l=e.indexOf(V,t);if(-1!==a&&(v&&"$"===e[a]?r=!1:t===a+1?(r=!0,i=""):(i=e.slice(a+1,-1===l?void 0:l),t>a+1&&(i=e.slice(a+1,t)),r=!0),U&&o&&(r=!1),(/[{}]/.test(i)||0===t)&&(r=!1,i=""),i)){n.some((e=>e.name.toLowerCase().includes(i.toLowerCase())))||(n=[])}return{showDropdown:r,searchString:i}}(C,J,o),Ce=()=>o?.filter((e=>e?.name?.toLowerCase()?.includes(he?.searchString?.toLowerCase())));return n("div",{className:"ff-add-variable-container",children:[n("div",{className:"ff-add-variable-input",ref:oe,children:[e(G,{title:z,style:{width:"100%"},children:e(nn,{...Z,name:"add_variable",ref:ie,type:_,className:O("ff-variable-input-container",{"ff-variable-input-container--show-icon":se}),value:C,onChange:d,onPaste:()=>{te(!0)},variant:"primary",label:t,placeholder:s,onClick:de,onKeyUp:ue,onFocus:()=>K(!0),onBlur:e=>{(e=>{e.relatedTarget&&e.relatedTarget.closest(".dropdown-container")||K(!1)})(e),T?.(e)},autoComplete:A,helperText:E,error:M,required:x,helperTextWidth:D,...H})}),!Q(C)&&ee&&w&&e("div",{className:"ff-create-variable-container",onClick:f,children:e(P,{fontWeight:"regular",fontSize:"10px",color:"var(--brand-color)",cursor:"pointer",children:"Create Variable"})}),!Q(C)&&!v&&e("div",{className:O("ff-cancel-icon-container",{"ff-cancel-icon-container--show-icon":se}),children:N&&e(G,{title:"Cancel",style:{zIndex:99999},children:e(B,{onClick:h,name:"close",height:16,width:16,hoverEffect:!0})})}),se&&e("div",{className:"ff-info-icon-container",children:e(G,{title:se&&!I?.isIconDisable?I?.iconToolTipTitle:"",children:e(B,{name:I?.iconName||"",hoverEffect:!1,height:16,width:16,color:I?.iconColor||"var(--text-area-default-color)",onClick:e=>{I?.onIconClick&&I?.onIconClick(e)},disabled:I?.isIconDisable,cursorType:"pointer"})})})]}),he?.showDropdown&&W&&e(jb,{position:"absolute",zIndex:L,truncateTextValue:k,width:ae,height:Q(Ce())?"auto":m,optionsList:Ce(),onSelectVariable:fe}),R&&g&&W&&e(Fb,{position:"relative",zIndex:L,truncateTextValue:k,width:ae,filteredOptions:ne,onSelectVariable:fe})]})})),qb=({isOpen:t,variableTypesList:r=[],onClose:i,onNameChange:o,onValueChange:a,variableName:s,variableValue:d,onVariableTypeChange:u,selectedVariableType:f,hideValue:h=!1,onHideChange:C,handleSubmit:p,mode:m="create",disabled:g,dataFiles:v=[],truncateTextValue:y=34,isEnterKeySubmit:w=!1})=>{const[b,E]=c(!1),[M,A]=c(""),[x,L]=c(),[k,H]=c(!1),[S,V]=c(!1),[_,O]=c({name:"",value:"",isChecked:!1});l((()=>{t&&"edit"===m&&O({name:s,value:d,isChecked:h})}),[]);const N=e=>e&&0!==e.length?" "===e[0]||" "===e[e.length-1]?"Space is not allowed at starting and at the end":be.test(e)?e.length<3?"Name should contain at least 3 characters":e.length>25?"Name can contain at most 25 characters":"":"Name should be alphanumeric":"Variable Name is required";function z(e){const t=!!e,n=be.test(e),r=Vt.test(e),i=e.length>=3&&e.length<=25;return t&&n&&r&&i}l((()=>{const e=N(s);E(!!e),A(e)}),[s]),l((()=>{if("edit"!==m)return;const{name:e,value:t,isChecked:n}=_;V(s!==e||d!==t||h!==n)}),[m,s,d,h,_]);const T=()=>{!k&&z(s)&&(H(!0),p())};l((()=>{if(!w)return;const e=e=>{if("Enter"===e.key){e.preventDefault();!z(s)||k||"edit"===m&&!S||T()}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}}),[w,s,d,h,k,m,S,f]);return e(Y,{zIndex:1350,onClose:i,isOpen:t,title:"create"===m?"Create Variable":"Edit Variable",width:"284px",height:"280px",top:"30%",right:8,isFooterRequired:!0,overlay:!0,footerContent:e((()=>n("div",{className:"ff-create-slider-footer",children:[e(F,{onClick:i,label:"Cancel",variant:"tertiary"}),e(F,{variant:"primary",label:"create"===m?"Create":"Update",type:"submit",onClick:T,disabled:!z(s)||k||"edit"===m&&!S})]})),{}),children:n("div",{className:"ff-create-variable-slider",children:[e("div",{className:"ff-create-variable-slider-input",children:e(nn,{label:"Variable Name",required:!0,type:"text",name:"variableName",value:s||"",onChange:e=>{H(!1),o(e.target.value)},error:b,helperText:M,onBlur:e=>{const t=e.target.value,n=N(t);E(!!n),A(n)}})}),e(or,{label:"Variable Type",required:!0,onChange:e=>{u(e),H(!1)},selectedOption:f,optionsList:r,optionZIndex:99999,valueAccessor:"label",disabled:"edit"===m}),e(Ub,{label:"Variable Value",placeholder:"Enter Variable value or select path using #",isHash:!0,isOnlyHash:!0,zIndex:99999,truncateTextValue:y,dataFiles:v,dropdownWidth:"100%",setHashInputValue:L,hashInputValue:x||{},value:d||"",type:h?"password":"text",onChange:(e,t)=>{const n=e.target.value;a(n,t)},showAddVariableIcon:!1}),n("div",{className:"ff-hide-value-content",children:[e(ee,{onChange:e=>C(e.target.checked),name:"hideValue",label:"Hide Value",checked:h,disabled:g}),e(G,{title:"Once the value is hidden, it cannot be undone",children:e(B,{name:"info",width:12,height:12})})]})]})})},Wb=({highlightText:t="",tableMeta:r=[],tableData:i=[],accordionType:o="row",noDataContent:a,height:l="100%",withFixedHeader:s=!1,headerType:d,TableAccordionStateIconWidth:u=4,TableAccordionStateIconHeight:f=8})=>{const[h,C]=c(-1),p=(e,t)=>{let n=e[t.accessor];return t.cell?t.cell({value:n,row:e,column:t.accessor}):t.accessor||n&&"object"!=typeof n?n:"--"},m=t=>{const n=t.map(((t,n)=>e("table",{className:"ff-accordion-table",cellSpacing:0,children:e("tbody",{className:"ff-table-body",children:e("tr",{className:"ff-table-row",children:r.map(((n,r)=>e("td",{className:"ff-table-cell",style:{width:n.width},children:"column"===o&&0===r?"":e(P,{children:p(t,n)})},n.accessor+r)))},t.id||n)})},`accordion-table-${n}`)));return n};return n("div",{style:{height:l},className:O("ff-accordion-table-container",{"ff-accordion-fixed-header-table":s}),children:[e("table",{cellSpacing:0,className:O("ff-accordion-table",{"ff-accordion-fixed-header":s}),children:e("thead",{children:e("tr",{className:"ff-table-row",children:r.map((t=>e("th",{style:{width:t.width},className:O("ff-table-header",d&&`ff-accordion-table--${d}-bg`),children:e("div",{children:e(P,{fontWeight:"semi-bold",fontSize:12,children:t.header})})},`header-${t.header}`)))})})}),"row"===o&&i.map(((n,r)=>e(J,{highlightText:t,headerTitle:n.title,color:"var(--text-color)",accordionContent:m(n.data),disable:n.disable,disableInfoMessage:n.disableInfoMessage,accordionStateIconName:"arrows_down_icon",AccordionStateIconWidth:u,AccordionStateIconHeight:f},`accordion-row-${r}`))),"column"===o&&i.map(((i,o)=>n("div",{className:"column-table-accordion",children:[e("div",{className:"ff-display-flex",children:e(G,{title:i.disable?i?.disableInfoMessage:"string"==typeof i.title&&ie(i.title,r[0]?.width,"pixel")?i.title:"",placement:"bottom-start",children:n("div",{className:`accordion-header ${i.disable&&"accordion-header--disabled"}`,children:[e("div",{className:"header-title",children:e("span",{children:e(P,{children:e(X,{text:re(i.title,r[0]?.width,"pixel"),highlight:t})})})}),e("div",{className:"accordion-arrow",onClick:()=>{!i.disable&&(e=>{C(e===h?-1:e)})(o)},children:e(B,{name:h===o?"arrows_down_icon":"arrows_right_icon",color:"var(--table-with-accordion-icon-color)",width:u,height:f,hoverEffect:!1})})]})})}),h===o&&e("div",{children:m(i.data)})]},`column-accordion-${o}`))),i.length<=0&&e("div",{className:"no-data-content",style:{height:`calc(${l} - 50px)`},children:a})]})},Qb=({progressPercentage:t,totalMemory:r,usedMemory:i,color:o="var(--brand-color)",trackColor:a="#f0f0f0",height:l=10,label:s,labelFontSize:c=12,labelTextColor:d="var(--ff-card-status-text-color)",showPercentage:u=!1,percentageFontSize:f=10,percentageTextColor:h="var(--tooltip-text-color)",progressBarWidth:C="200px"})=>{const p=e=>{const t=e.trim().toLowerCase();if("0"===t)return 0;const n=t.match(/^(\d+(?:\.\d+)?)\s*(kb|mb|gb)$/);if(!n||!n[1])return 0;const r=parseFloat(n[1]),i=n[2];return"gb"===i?1024*r:"kb"===i?r/1024:r};let m=0,g=s;if(void 0!==r&&void 0!==i){const e=p(i),t=p(r);t>0?(m=e/t*100,g=s||i):(m=0,g="0MB")}else m=t||0;const v=Math.max(0,Math.min(m,100));return n("div",{className:"ff-progress-bar-container "+(g?"ff-has-label":""),style:{width:C},children:[e("div",{className:"ff-progress-bar-track",style:{backgroundColor:a,height:`${l}px`},children:e("div",{className:"ff-progress-bar",style:{width:`${v}%`,backgroundColor:o,height:`${l}px`},children:u&&e(P,{className:"ff-progress-bar-percentage",fontSize:f,color:h,children:`${Math.round(v)}%`})})}),g&&e("div",{className:"ff-progress-bar-label",children:e(P,{fontSize:c,color:d,children:e(G,{title:ie(g,10,"count")?g:"",children:re(g,10,"count")})})})]})},Gb=({variant:t="primary",size:n="small",onClick:r,label:i="Choose File",disabled:o=!1,type:l="button",className:s="",style:d={},iconName:f,isChooseFile:h=!1,buttonWidth:C="auto",buttonHeight:p="auto",selectedFile:m={},handleCloseIcon:g,isMandatory:v=!1})=>{const y=a(null),[w,b]=c(0);u((()=>{y.current&&b(y.current.getBoundingClientRect().width-10)}),[C]);const E=m?.name||i,M=w?re(E,w,"pixel"):E,A=!!w&&ie(E,w,"pixel");return e("div",{ref:y,style:{width:C},children:e(G,{title:A?E:"",children:e(F,{variant:t,label:M,type:l,onClick:r,buttonWidth:C,buttonHeight:p,isChooseFile:h,size:n,disabled:o,className:s,iconName:f,style:d,iconPosition:"right",selectedFile:m,handleCloseIcon:g,isMandatory:v})})})},Kb=({selected:t="text",handleClick:r,tabList:i})=>{const o=i?.includes("Automation"),a=i?.includes("Manual");return n("div",{className:"ff-script-switch-container",children:[e(G,{title:o?"Automation":"Add Automation",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Automation"===t?"active":""),onClick:()=>r(o?"Automation":"Add Automation"),children:e(B,{name:o?"automation_testcase":"add_testcase",color:"Automation"===t?"var(--primary-button-text-color)":"var(--description-text)"})})}),e(G,{title:a?"Manual":"Add Manual",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Manual"===t?"active":""),onClick:()=>r(a?"Manual":"Add Manual"),children:e(B,{name:a?"manual_testcase":"add_testcase",color:"Manual"===t?"var(--primary-button-text-color)":"var(--description-text)"})})})]})},Yb=({selected:t,handleClick:n,tabList:r})=>e("div",{className:"ff-switch-container",children:r.map((r=>e(G,{title:t===r.name?null:r.tooltip,zIndex:1e3,children:e("div",{className:"ff-switch-button "+(t===r.name?"active":""),onClick:()=>n(r.name),children:e(B,{name:r.icon,color:t===r.name?"var(--primary-button-text-color)":"var(--description-text)"})})},r.name)))}),Xb=({onModalClose:t,MediaSrc:r,fileName:o,onDeleteClick:a,mediaType:s,fileId:d,thumbnailMediaSrc:u,isDelete:f=!0,onExpandClick:h,onDownloadClick:C,isMediaIcon:p=!1,previewOnly:m=!1,iconName:g="video_preview",isDisabled:v=!1})=>{const[y,w]=c(!1),b=i.useRef(null),E=()=>{w(!0),h&&h(d)},M=()=>{t?.(),w(!1)},A=()=>{C&&C(d)};return l((()=>{m&&w(!0)}),[m]),n("div",{children:[!m&&(p?e(B,{name:g,hoverEffect:!0,onClick:E,disabled:v}):e(tv,{mediaSrc:r,mediaType:s,onDownloadClick:A,onDeleteClick:()=>a?.(r),onExpandClick:E,fileName:o,fileId:d,thumbnailMediaSrc:u,isDelete:f})),y&&e(_f,{isOpen:y,onClose:M,isFooterDisplayed:!1,isHeaderDisplayed:!1,customWidth:"1130px",customHeight:"570px",zIndex:1e4,children:n("div",{className:"media-wrapper",children:[n("div",{className:"ff-expand-icons",children:[e(G,{title:"Download File",children:e(B,{name:"download_file_icon",onClick:A,color:"var(--icons-default-color)",className:"header-icons"})}),e(G,{title:"Expand",children:e(B,{name:"expand",onClick:E,color:"var(--icons-default-color)",className:"header-icons"})}),e(G,{title:"close",children:e(B,{name:"close",onClick:M,color:"var(--icons-default-color)",className:"header-icons"})})]}),"image"===s&&e("img",{src:r,alt:"fileName",height:"auto"}),"video"===s&&e("video",{src:r,controls:!0,controlsList:"nodownload",className:"ff-video-preview",ref:b,onCanPlay:()=>{if(b.current){const e=b.current.play();void 0!==e&&e.catch((e=>{console.error("Autoplay failed:",e)}))}}})]})})]})},Jb=({children:t,orientation:r="",navBarIcons:o=[],mobileHeight:a=448,mobileWidth:l=220,UtilityBar:s,tooltip:c={},background:d,navBarPosition:u="bottom"})=>{const f="portrait"===r,h=f?a:l,C=f?l:a,p=s&&"top"===u,m=s&&"bottom"===u,g=s&&"left"===u;return n("div",{className:["ff-mobileskin-wrapper",f?"portrait":"landscape",g?"ff-side-nav-left":"",p?"navbar-top":"",m?"navbar-bottom":""].filter(Boolean).join(" "),children:[p&&e("div",{className:"ff-nav-bar top-nav-bar",children:o.map((({title:t,name:n,className:r,...i},a)=>{const l=c?.[n]??a;return e(G,{title:c?.[n]||"",placement:"top",children:e("div",{className:`ff-nav-bar-icon ${r||""} ${a===o.length-1?"last-icon":""} ${p?"navbar-top":""}`,children:e(B,{name:n,...i})})},l)}))}),e("div",{className:"ff-mobileskin-container",style:{height:h+16,width:C+16},children:e("div",{className:"ff-mobile-container",style:{width:C,height:h,background:d||"transparent"},children:e("div",{className:"ff-mobile-image-container",children:i.isValidElement(t)?t:e("img",{src:t,alt:"Mobile content",style:{width:f?"100%":2.1*l+"px",height:f?"100%":.5*a+"px"}})})})}),s&&m&&e("div",{className:"ff-nav-bar",children:o?.map(((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-nav-bar-icon ${t?.className||""} ${n===o.length-1?"last-icon":""}`,children:e(G,{title:r,children:e(B,{...i})})},n)}))}),s&&g&&e("div",{className:"ff-side-nav-bar",children:o?.map(((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-sidebar ${t?.className||""} ${n===o.length-1?"last-icon":""}`,children:e(G,{title:r,placement:"bottom",children:e(B,{...i})})},n)}))})]})},$b=o((({width:t=300,height:r=40,iconHeight:i=16,iconWidth:o=16,placeholder:l="Enter text",iconName:s="right_arrow_filled_icon",iconPosition:c="left",borderRadius:d=4,autoFocus:u=!1,value:f="",iconColor:h="var(--brand-color)",tooltipTitle:C="send",submitPrompt:p,onPromptChange:m,onBlur:g,onFocus:v,disableInput:y,isAdditionalIcon:w=!1,additionalIconName:b,additionIconToolTip:E,onAdditionalIconClick:M},A)=>{const x=a(null);se([{key:"Enter",action:()=>L()}],x);const L=e=>{f&&p?.(f.trim())};return n("div",{className:O("ff-prompt-container",{"icon-left":"left"===c,"icon-right":"left"!==c}),style:{width:`${t}px`,height:`${r}px`,borderRadius:d},ref:x,children:[e(G,{placement:"top",title:C,children:e(B,{name:s,className:"ff-prompt-icon",height:i,width:o,onClick:p,color:h,disabled:Q(f)})}),e("input",{ref:A,className:"ff-prompt-input",type:"text",placeholder:l,autoFocus:u,onChange:m,onFocus:v,onBlur:g,value:f,readOnly:y}),w&&b&&e(G,{placement:"top",title:E,children:e(B,{name:b,className:"ff-prompt-icon additional-icon",height:i,width:o,onClick:M})})]})})),eE=({content:t,isVisible:n,maxWidth:r=300,onClick:i,isClickable:o=!0,arrowPosition:a="left"})=>e("div",{onClick:i,style:{width:`${r}px`,"--triangle-position":r-4+"px"},className:O("ff-chat-msg-box",{visible:n,hidden:!n,pointer:o,default:!o,"chat-arrow-left":"left"===a,"chat-arrow-right":"left"!==a}),children:e("div",{className:O("content",`arrow-${a}`),children:e(P,{children:t})})}),tE=({iconName:r,iconPosition:{top:i,left:o,bottom:a,right:l},hoverIconPosition:{top:s,left:d,bottom:u,right:f},modalPosition:{top:h,left:C,bottom:p,right:m},modalWidth:g,modalHeight:v,headerContent:y="Header Content",footerContent:w="Footer Content",iconWidth:b,iconHeight:E,modalHeading:M="Ask Fia",children:x,onClearChat:L})=>{const[k,H]=c(!1),[S,V]=c(!1);return n(t,{children:[n("div",{style:{top:void 0!==i?`${i}px`:void 0,left:void 0!==o?`${o}px`:void 0,bottom:void 0!==a?`${a}px`:void 0,right:void 0!==l?`${l}px`:void 0},className:"ff-dynamic-icon-container",children:[e(B,{className:"ff-dynamic-icon",name:r,onClick:()=>{V((e=>!e)),setTimeout((()=>H((e=>!e))),10)},height:E,width:b}),e("div",{style:{top:void 0!==s?`${s}px`:void 0,left:void 0!==d?`${d}px`:void 0,bottom:void 0!==u?`${u}px`:void 0,right:void 0!==f?`${f}px`:void 0},className:"ff-chat-icon-hover",children:e(B,{name:"ask_fia_icon",height:32,width:82})})]}),S&&A(e("div",{className:O("ff-dynamic-modal",{open:k}),style:{top:void 0!==h?`${h}px`:void 0,left:void 0!==C?`${C}px`:void 0,bottom:void 0!==p?`${p}px`:void 0,right:void 0!==m?`${m}px`:void 0,position:"fixed",height:v,width:g},children:n("div",{className:"ff-dynamic-modal-content",children:[y&&e("div",{className:"ff-dynamic-modal-header",children:n("div",{className:"header-container",children:[n("div",{className:"header-left",children:[e(B,{height:16,width:16,name:"fia_icon"}),e(P,{fontWeight:"medium",children:M})]}),n("div",{className:"header-right",children:[e("span",{className:"action",children:e(G,{title:"Clear chat",placement:"bottom",children:e(B,{height:16,width:16,name:"delete",color:"var(--tooltip-text-color)",onClick:L})})}),e("span",{className:"action",children:e(G,{title:"Close",placement:"bottom",children:e(B,{height:16,width:16,name:"close",color:"var(--tooltip-text-color)",onClick:()=>(H(!1),void setTimeout((()=>V(!1)),300))})})})]})]})}),e("div",{className:"ff-dynamic-modal-body",children:x}),w&&e("div",{className:"ff-dynamic-modal-footer",children:w})]})}),document.body)]})},nE=o((({iconName:r,hoverTitle:i,iconPosition:{top:o,left:s,bottom:d,right:u},hoverIconPosition:{top:f,left:h,bottom:C,right:p},modalPosition:{top:m,left:g,bottom:v,right:y},modalWidth:w,modalHeight:E,headerContent:M="Header Content",footerContent:x="Footer Content",iconWidth:L,iconHeight:k,children:H,onVisibilityChange:S},V)=>{const[_,N]=c(!1),[z,T]=c(!1),D=a(null),I=()=>{D.current&&clearTimeout(D.current),N(!1),D.current=setTimeout((()=>{T(!1),S?.(!1)}),300)};return b(V,(()=>({closeModal:I}))),l((()=>()=>{D.current&&clearTimeout(D.current)}),[]),n(t,{children:[n("div",{style:{top:void 0!==o?`${o}px`:void 0,left:void 0!==s?`${s}px`:void 0,bottom:void 0!==d?`${d}px`:void 0,right:void 0!==u?`${u}px`:void 0},className:"ff-ai-dynamic-icon-container",children:[e(B,{className:"ff-ai-dynamic-icon",name:r,onClick:()=>{D.current&&clearTimeout(D.current),T((e=>!e)),S?.(!z),D.current=setTimeout((()=>N((e=>!e))),10)},height:k,width:L}),e("div",{style:{top:void 0!==f?`${f}px`:void 0,left:void 0!==h?`${h}px`:void 0,bottom:void 0!==C?`${C}px`:void 0,right:void 0!==p?`${p}px`:void 0},className:"ff-ai-chat-icon-hover",children:e("div",{className:"ai-hover-leaf",children:e(P,{fontWeight:"bold",fontSize:14,color:"var(--chatbot-leaf-text)",children:i})})})]}),z&&A(e("div",{className:O("ff-ai-dynamic-modal",{open:_}),style:{top:void 0!==m?`${m}px`:void 0,left:void 0!==g?`${g}px`:void 0,bottom:void 0!==v?`${v}px`:void 0,right:void 0!==y?`${y}px`:void 0,position:"fixed",height:E,width:w},children:n("div",{className:"ff-ai-dynamic-modal-content",children:[M&&e("div",{className:"ff-ai-dynamic-modal-header",children:M}),e("div",{className:"ff-ai-dynamic-modal-body",children:H}),x&&e("div",{className:"ff-ai-dynamic-modal-footer",children:x})]})}),document.body)]})})),rE=({variant:t,title:r,tabTitle:i,comment:o,profileShortName:a})=>n("div",{className:"ff-history-card",children:[e("div",{className:O("header",`header--${t}`),children:e(P,{fontWeight:"semi-bold",children:i})}),n("div",{className:"body",children:[e("div",{className:"title",children:n("div",{className:"profile",children:[e(P,{className:O("avatar",`avatar--${t}`),children:a}),e(P,{children:r})]})}),n("div",{className:"comment-container",children:[e(P,{fontWeight:"semi-bold",className:"heading",children:"Comments:"}),e(P,{color:"var(--details-page-value-color)",className:"comment",children:o})]})]})]}),iE=({onChange:t,disabled:r,checked:i=!1,id:o="toggle",path:a})=>n("div",{className:"ff--ai-switch-container",children:[e("input",{className:"ff--ai-switch-checkbox",id:`ff-toggle-${o}`,type:"checkbox",disabled:!!r,onChange:e=>{t&&t(e)},checked:i}),e("label",{className:O("ff--ai-switch-label",{"ff--ai-switch-label--disabled":r}),htmlFor:`ff-toggle-${o}`,children:e("span",{className:"ff--ai-switch-content",children:n("span",{className:"ff--ai-switch-content",children:[e(P,{className:O("ff--ai-switch-typography",{left:i,right:!i}),as:"div",fontWeight:"bold",fontSize:18,color:i?"var(--base-bg-color)":"var(--ff-ai-toggle-text-color)",children:"AI"}),e("img",{className:"ff--ai-switch-image",src:a,alt:"AI image"})]})})})]}),oE=o((({name:t,height:n=30,width:r=30,path:i="",onClick:o,color:s="var(--brand-color)",hoverEffect:c=!1,className:d="",disabled:u=!1,variant:f="light",isSelected:h=!1,x:C,y:p,tabIndex:m=-1,...g},v)=>{if(!R[t])return null;const y=a(null);l((()=>{y.current&&(void 0!==C&&y.current.setAttribute("x",String(C)),void 0!==p&&y.current.setAttribute("y",String(p)))}),[C,p]);const w={ref:v,onClick:u?void 0:o,style:{height:`${n}px`,width:`${r}px`,cursor:u?"not-allowed":"pointer",opacity:u?.3:1},tabIndex:m,...g};return e("span",{...w,children:e("img",{height:n,width:r,src:i,alt:""})})})),aE=({id:r=0,serialNumber:i,activeId:o,setActiveId:s,children:d,onIconClick:u,numberChildren:f,onContainerClick:h,onNextClick:C,onPreviousClick:p,disabled:m,isEditAccess:g,versionsLength:v,count:y,hiddenActions:w=[]})=>{const[b,E]=c(!1),[M,A]=c(!1),x=a(null),L=Array.isArray(w)?w:w?[w]:[],k=(e,t)=>{e.stopPropagation(),t()};l((()=>{x.current&&(()=>{if(x.current){const e=getComputedStyle(x.current),t=1.2*parseFloat(e.fontSize)*6;x.current.scrollHeight>t&&A(!0)}})()}),[]);const H=e=>{e.stopPropagation(),E(!b)};return n("div",{className:`ff-prompt-container-Block ${o===r?"active":"inactive"} `,onClick:()=>{s(r),h()},children:[e(P,{fontSize:8,className:"ff-prompt-number-bg-color",as:"span",children:`Test cases ${i}`}),n(t,{children:[n("div",{className:"ff-prompt-content "+(b?"expanded":""),ref:x,children:[d,b&&n(t,{children:[e("span",{role:"button","aria-label":"toggleExpand",onClick:H,className:"read-less-btn",children:e(P,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read Less"})})," "]})]}),M&&!b&&e("div",{role:"button","aria-label":"toggleExpand",onClick:H,className:"read-more-btn",children:e(P,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read More"})})]}),n("div",{className:"ff-prompt-icons",children:[e("div",{className:"ff-prompt-icons-leftside",children:[{action:"delete",title:"Delete",color:"var(--ff-delete-button-attachment)"},{action:"edit",title:"Edit",color:"var(--label-edit-text-label-color)"},{action:"regenerate",title:"Regenerate",color:"var(--label-edit-text-label-color)"}].filter((e=>!L.includes(e.action))).map(((t,n)=>{const r=g&&"delete"===t?.action||"regenerate"===t?.action&&(v??0)>=3||m;return e(G,{title:t.title,placement:"bottom",children:e(B,{disabled:r,name:t.action,color:t.color,hoverEffect:!0,onClick:e=>((e,t)=>{e.stopPropagation(),u(t)})(e,t.action)})},`${t?.title}-${n}`)}))}),n("div",{className:"ff-prompt-icons-rightside",children:[e(B,{disabled:1===y,className:"ff-prompt-icons-style",name:"arrow_left_accordian",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>k(e,p),cursorType:"pointer"}),f,e(B,{disabled:y===v,className:"ff-prompt-icons-style",name:"arrow_right_icon",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>k(e,C),cursorType:"pointer"})]})]})]})},lE=o((({type:t="text",variant:r="primary",name:i="",label:o,disabled:a=!1,disableLinkIcon:l=!1,required:s=!1,placeholder:c="Attach Link",value:d,error:u,helperText:f,noBorder:h,className:C="",onChange:p,onBlur:m,onFocus:g,autoComplete:v="off",autoFocus:y=!1,minValue:w=-1/0,maxValue:b=1/0,transparentBackground:E=!1,size:M="small",isLabelRequired:A=!0,onClick:x,onKeyUp:L,isViewMode:k=!1,...H},S)=>{const V=!Q(d);return n("fieldset",{className:O("ff-link-input-fieldset",{"ff-link-input-fieldset--disabled":a}),children:[n("div",{className:O("ff-link-input-container",{"ff-link-input-container--float":V,"ff-link-input-container--disabled":!!a}),children:[A&&n("label",{className:O(`ff-link-input-label-container ff-link-input-label-container--${M}`,{"ff-link-input-label-container--danger":!!u}),htmlFor:i,children:[s&&e("span",{className:"required-asterisk",children:"*"}),e("span",{className:O(`ff-link-input-label ff-link-input-label--${r}`,{"ff-link-input-label--no-hover":!!d,"ff-link-input-label--disabled":!!a,"ff-link-input-label--danger":!!u}),children:o})]}),e("input",{ref:S,name:i,value:d,type:t,spellCheck:!1,id:i,className:O(`ff-link-input ff-link-input-${r} default-input ff-link-input--${M}`,{"ff-link-input--transparentBackground":!!E,"ff-link-input--no-hover":!!d,"ff-link-input--disabled":!!a,"ff-link-input--danger":!!u,"ff-link-input--no-border":!!h,"ff-link-input--placeholder":!A},`${C}`),placeholder:c,disabled:k||a,onChange:p,onFocus:g,onBlur:m,autoComplete:v,autoFocus:y,min:w,max:b,onClick:x,onKeyUp:L,...H}),e("div",{className:"input-link-icon",children:l||u||!V?e(B,{name:"link",disabled:!0}):e(G,{title:"Click here to navigate",children:e("span",{children:e(B,{name:"link",disabled:!1,onClick:()=>{d&&!u&&window.open(d,"_blank")}})})})})]}),f&&u&&e("span",{className:O("ff-link-input-message",{"ff-link-input-message--danger":!!u}),children:f})]})})),sE=({labelsList:r=[],height:i=""})=>{const o=e("div",{className:"ff-chip-tooltip",children:r.filter(((e,t)=>t>0)).map(((t,n)=>e(P,{as:"div",className:"ff-chip-tooltip-label",children:t},`label-${n}-${t}`)))});return e(t,{children:!Q(r)&&n("div",{className:"ff-chip-with-count-container",children:[e(G,{title:r[0],children:e(P,{as:"div",children:re(r[0]||"",10),className:"ff-chip-label",fontWeight:"medium",style:i?{height:i}:void 0})}),r.length>1&&e(G,{title:e(P,{as:"div",children:o}),children:e(P,{as:"div",children:"+"+(r.length-1),className:"ff-chip-count",fontWeight:"medium"})})]})})};class cE extends E{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?this.props.fallback:this.props.children}}const dE=({iconName:t="",onButtonClick:r,buttonLabel:i="Label",buttonText:o="To Add Group",disableButton:a=!1,stepCount:l=1,iconWidth:s=120,iconHeight:c=120,addContentLabel:d="step"})=>n("div",{className:"add-content-button "+(a?"disabled":""),children:[!Q(t)&&e("div",{className:"icon-container",children:e(B,{name:t,width:s,height:c})}),n("div",{className:"typography-label-button",children:[n(P,{fontSize:"12px",fontWeight:"regular",lineHeight:"18px",children:[d+l," :"]}),e(P,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:"Click"}),e(Vf,{label:i,onClick:r,iconName:"plus_user_icon",isDisable:a}),e(P,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:o})]})]}),uE=({variant:t="default",tabsData:r,activeTabId:i,onTabClick:o,noBorder:a=!1,noPadding:l=!1,titleSize:s="12px"})=>{const[d,u]=c(0);return n("div",{className:"ff-tabs-slider-container",children:[n("div",{className:O(`ff-tab-row--${t} ff-tab-row-section`,{"ff-tab-row--no-border":a,"ff-tab-row--no-padding":l,"ff-tab-row--position":r.length>4}),children:[r.length>4&&e(B,{className:"ff-tab-icon ff-tab-icon--previous",name:""+(d?"arrow_left_accordian":""),onClick:()=>{d>0&&u((e=>e-1))},hoverEffect:!0}),e("div",{className:"ff-tab-row-carousel",children:e("div",{className:"carousel_inner",style:{transform:`translateX(-${100*d}%)`},children:r.map((r=>n("button",{onClick:()=>!r.disabled&&o(r.id),disabled:r.disabled,className:O(`ff-tab-button--${t}`,{disabled:r.disabled,active:i===r.id}),style:{flex:"0 0 25%"},children:[n("div",{className:"label-count-section",children:[e(G,{title:r.label.length>9?r.label:"",children:e(P,{children:r.label.length>9?r.label.slice(0,9)+"...":r.label,fontSize:s,lineHeight:"18px",fontWeight:i===r.id?"semi-bold":"regular",color:i===r.id?"var(--tabs-label-active-color)":"var(--tabs-label-default-color)",className:O("ff-tab-label",{"ff-tab-label--active":i===r.id})})}),"default"===t&&r.count&&e("span",{className:O("tab-count",{"tab-count--active":i===r.id}),children:r.count})]}),e("div",{className:O("ff-tab-bar",{"ff-tab-bar--active":i===r.id})}),e("span",{className:"ff-defaultStatus "+("success"===r.status?"ff-successStatus":"error"===r.status?"ff-dangerStatus":"")})]},r.id)))})}),r.length>4&&e(B,{className:"ff-tab-icon ff-tab-icon--next",name:""+(d<Math.ceil(r.length/4)-1?"arrow_right_icon":""),onClick:()=>{d<Math.ceil(r.length/4)-1&&u((e=>e+1))},hoverEffect:!0})]}),e("div",{className:"ff-tab-content",children:r.find((e=>e.id===i))?.component})]})},fE=o((({label:t="Status",iconName:r="update_icon",onClick:i,isDisable:o=!1,variant:a="default",backgroundColor:l=!1,border:s=!1},c)=>{const d={default:"var(--ff-avatar-background-color)",success:"var(--status-success-text-color)",danger:"var(--ff-delete-button-attachment)"};return e("button",{disabled:o,onClick:i,className:`\n ff-status-indicator\n ff-status-indicator--${a}\n ${l?`ff-status-indicator--with-bg ff-status-indicator--${a}-bg`:""}\n ${s?`ff-status-indicator--with-border ff-status-indicator--${a}-border`:""}\n `,ref:c,children:n("div",{className:"ff-status-indicator__content",children:[e(B,{name:"danger"===a?"close":r,color:d[a]||d.default,className:`ff-status-indicator__icon ff-status-indicator__icon--${a}`}),e(P,{as:"div",fontSize:12,className:`ff-status-indicator__label ff-status-indicator__label--${a}`,fontWeight:"medium",lineHeight:"20px",children:t})]})})})),hE=({rootLabel:t,childrenLabels:r,align:i="center",direction:o="horizontal"})=>{const a=r.length;return n("div","vertical"===o?{className:"ff-os-tree-vertical",style:{"--child-count":a},children:[n("div",{className:`ff-os-tree-vertical__row ff-os-tree-vertical__row--${i}`,children:[e("div",{className:"ff-os-tree-vertical__root-label",children:t}),e("div",{className:"ff-os-tree-vertical__horizontal-line"})]}),n("div",{className:"ff-os-tree-vertical__vertical-line-wrapper",children:[e("div",{className:"ff-os-tree-vertical__vertical-line"}),r.map(((t,r)=>n("div",{className:"ff-os-tree-vertical__child",children:[e("div",{className:"ff-os-tree-vertical__child-connector"}),e("div",{className:"ff-os-tree-vertical__child-label",children:t})]},r)))]})]}:{className:`ff-os-tree ff-os-tree--${i}`,style:{"--child-count":a},children:[n("div",{className:"ff-os-tree__root-wrapper",children:[e("div",{className:"ff-os-tree__root-label",children:t}),e("div",{className:"ff-os-tree__vertical-root"})]}),e("div",{className:"ff-os-tree__horizontal-connector",children:r.map(((t,n)=>e("div",{className:"ff-os-tree__vertical-child"},n)))}),e("div",{className:"ff-os-tree__children",children:r.map(((t,n)=>e("div",{className:"ff-os-tree__child-container",children:e("div",{className:"ff-os-tree__child-label",children:t})},n)))})]})},CE=({handleClose:t,handleResend:r,handleOtp:i,resendTimeout:o=30})=>{const[s,d]=c(Array(6).fill("")),[u,f]=c(o),[h,C]=c(!0),p=a(Array(6).fill(null));l((()=>{h||p.current[0]?.focus()}),[h]),l((()=>{let e;return u>0&&(e=window.setInterval((()=>f((e=>e-1))),1e3)),0===u&&C(!1),()=>clearInterval(e)}),[u]);const m=e=>{e.preventDefault();const t=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6),n=Array(6).fill("");t.split("").forEach(((e,t)=>{n[t]=e})),d(n);const r=Math.min(t.length,5);p.current[r]?.focus()};return e(_f,{isOpen:!0,onClose:t,isFooterDisplayed:!1,isHeaderDisplayed:!1,zIndex:999999,customWidth:"340px",children:n("div",{className:"ff-otp-popup",children:[n("div",{className:"ff-otp-header",children:[e(P,{fontSize:24,lineHeight:"36px",fontWeight:"semi-bold",children:"OTP Verification"}),e(B,{name:"close",height:16,width:16,onClick:t,className:"ff-close-icon"})]}),e("div",{className:"ff-otp-boxes",children:s.map(((t,n)=>e("input",{type:"text",maxLength:1,className:`ff-otp-input ${t?"filled":""} ${n===s.findIndex((e=>""===e))?"active":""}`,value:t,onKeyDown:e=>((e,t)=>{const{key:n}=e;if(/^[0-9]$/.test(n)){e.preventDefault();const r=[...s];r[t]=n,d(r),t<5&&p.current[t+1]?.focus()}else if("Backspace"===n){e.preventDefault();const n=[...s];n[t]="",d(n),t>0&&p.current[t-1]?.focus()}})(e,n),onPaste:m,ref:e=>p.current[n]=e,readOnly:!0},n)))}),e(F,{variant:"primary",label:"Submit",onClick:()=>i(s.join("")),disabled:s.includes(""),className:"ff-submit-btn"}),n("div",{className:"ff-resend "+(h?"disabled":""),onClick:h?void 0:()=>{f(o),C(!0),d(Array(6).fill("")),r()},children:["Re-send OTP",u>0?` (${u}s)`:""]})]})})},pE=({isOpen:t,onClose:r,isPlaying:i,onTogglePlay:o,mediaType:s,src:d,headerTitle:u,onDownload:f,onExpand:h,showHeader:p=!0,showDownload:m=!0,showExpand:g=!0,width:v="800px",height:y="432px",showControls:w=!0,customStyle:b,overlay:E=!0,children:M,showControlDownload:A=!1,showControlExpand:x=!1,isFullscreen:L=!1})=>{const k=a(null),H=a(null),[S,V]=c(0),[_,O]=c(0),[N,z]=c(!1),[T,D]=c(0);l((()=>{"video"===s&&k.current&&!M&&(i?k.current.play():k.current.pause())}),[i,s,M]);const I=C((()=>{if(k.current&&!N){const e=k.current.currentTime/k.current.duration*100;D(e||0),V(k.current.currentTime)}}),[N]),Z=C((()=>{k.current&&O(k.current.duration)}),[]),j=C((()=>{V(0),D(0),o?.()}),[o]),R=C((e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`),[]),F=C((e=>{if(k.current){const t=e/100*k.current.duration;k.current.currentTime=t,D(e),V(t)}}),[]),U=C((e=>{if(N||!H.current)return;const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));F(i)}),[F,N]),q=C((e=>{if(!H.current)return;z(!0);const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));F(i)}),[F]),W=C((e=>{if(!N||!H.current||!k.current)return;const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));F(i)}),[N,F]),Q=C((()=>{z(!1)}),[]);return l((()=>{if(N)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",Q)}}),[N,W,Q]),t?e(Vs,{isOpen:t,onClose:r,isMaximized:!1,showHeader:p,overlay:E,downloadHandler:()=>{},customStyle:b,header:n("div",{className:"ff-header-content",children:[e(B,{width:23,height:23,name:"automatic_locator"}),e(P,{children:e("span",{className:"ff-header-title",children:u})})]}),icons:e(G,{title:"Close",children:e(B,{name:"close",onClick:r})}),width:v,height:y,zIndex:999,children:n("div",{className:"ff-video-wrapper",children:[M||("video"===s?e("video",{ref:k,src:d,className:"ff-media-video",onTimeUpdate:I,onLoadedMetadata:Z,onEnded:j}):e("img",{src:d,alt:"Preview",className:"ff-media-image"})),n("div",{className:"ff-top-right-icons",children:[m&&e(G,{title:"Download",children:e(B,{name:"download_file",color:"white",onClick:f})}),g&&e(G,{title:L?"Minimize":"Maximize",children:e(B,{name:L?"collapse_icon":"expand_icon",color:"white",onClick:h})})]}),"video"===s&&w&&!M&&n("div",{className:"ff-media-controls",children:[e("button",{onClick:o,className:"ff-play-pause-btn",children:e(G,{title:i?"Pause":"Play",children:e(B,{width:35,height:35,name:i?"pause_button":"play_button",color:"white"})})}),n("div",{className:"ff-progress-bar",children:[e("span",{className:"ff-current-time",children:R(S)}),e("input",{type:"range",className:"ff-seek-bar",min:0,max:100,value:T,onChange:e=>F(parseFloat(e.target.value)),onClick:U,onMouseDown:q,ref:H}),e("span",{className:"ff-total-time",children:R(_)})]}),n("div",{className:"ff-control-icons",children:[A&&e(G,{title:"Download",children:e(B,{name:"download_file",color:"white",onClick:f,cursorType:"pointer"})}),x&&e(G,{title:L?"Minimize":"Maximize",children:e(B,{name:L?"collapse_icon":"expand_icon",color:"white",onClick:h,cursorType:"pointer"})})]})]})]})}):null},mE=({header:r,secondaryHeader:i,primaryCount:o,secondaryCount:a,primaryItems:l,secondaryItems:s,width:c,activeTab:d="primary",activeTabId:u,onPrimaryTabClick:f,onSecondaryTabClick:h,onTabClick:C,actions:p,tabsData:m,notchPosition:g="top-left"})=>{const v=i&&"secondary"===d?s:l,y=a&&parseInt(a)>0,w=o&&parseInt(o)>0,b=i&&(w||y),{tooltip:E="Download",iconName:M="download_file",disabled:A=!1,onClick:x,className:L=""}=p?.download||{},{tooltip:k="Delete",iconName:H="delete_icon",disabled:S=!1,onClick:V,className:_=""}=p?.delete||{},O=()=>n("div",{className:"ff-dropdown-header-icons",children:[p?.download&&e(G,{title:E,children:e(B,{name:M||"",className:`ff-dropdown-icon ff-download-icon ${L}`,onClick:x,width:18,height:20,disabled:A,hoverEffect:!0})}),p?.delete&&e(G,{title:k,children:e(B,{name:H||"",className:`ff-dropdown-icon ff-delete-icon ${_}`,onClick:V,width:25,height:25,disabled:S,hoverEffect:!0})})]});return n("div",{className:"ff-resolution-dropdown",style:c?{minWidth:c}:{},children:[e("div",{className:"ff-dropdown-notch "+("bottom-center"===g?"bottom-center":"top-left")}),e("div",{className:"ff-dropdown-header",children:e("div",{className:"ff-dropdown-header-content",children:i&&m&&u?n(t,{children:[e(Ps,{tabsData:m,activeTabId:u,onTabClick:e=>{C&&C(e),"tab-1"===e&&f?f():"tab-2"===e&&h&&h()}}),b&&O()]}):i&&b?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(P,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,children:[e(P,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]}),O()]}):i?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(P,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,children:[e(P,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]})]}):e(P,{fontSize:16,fontWeight:"semi-bold",children:r})})}),e("ul",{className:"ff-dropdown-list",children:v?.map(((t,n)=>e("li",{className:"ff-dropdown-item",children:t},n)))})]})},gE=(e,t)=>"string"==typeof e?re(e,t):i.isValidElement(e)?i.cloneElement(e,{},gE(e.props.children,t)):Array.isArray(e)?e.map((e=>gE(e,t))):e,vE=(e,t,n,r)=>{const i=e[t.accessor];if(t.cell){const o=e._id||e.id;return t.cell({value:i,row:e,column:t.accessor,index:n,tableType:r,...o&&{refId:o}})}return t.accessor||i&&"object"!=typeof i?i:"--"},yE=(t,n=[],r,i,o)=>{let a=n;const l=void 0!==i?!i:r;return Q(n)&&(isNaN(t)||(a=Array(t).fill(!0))),e("div",{className:"tree-table-fn-space-container",children:a?.map(((n,r)=>e("span",{className:`tree-table-fn-space-block tree-table-fn-space-block-${r} ${n?"":"no-lines"} ${l&&r===t-1?"last-node":""} ${o?"folder":""}`},r)))})},wE=i.memo((({treeRowRef:r,col:i,colIndex:o,columnMeta:a,node:l,selected:s,select:c,onCheckBoxChange:d,onToggleExpand:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,isExpanding:p,columnTextColor:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M})=>{const A={color:`${m||"var(--ff-primary-text-color)"}`,width:a?.width??i?.width,position:a?.sticky?"sticky":void 0,left:a?.sticky?a.left:void 0,zIndex:a?.sticky?a.zIndex:void 0};return n("div",{className:`ff-table-tree-fn-td ${i.isTree&&l.container?"folder":""} ${a?.sticky?"sticky-tree-column":""}`,"data-col-index":o,style:A,children:[i.isTree&&yE(l.hierarchy,l.parentSiblings,l.lastChild,l.nextSibling,l.container),n("div",{className:"tree-fn-title-container",children:[i.isTree&&e("span",{className:`tree-table-fn-space-block last-tree-fn-block last-tree-fn-block tree-table-fn-space-block-${l.hierarchy} ${l?.expanded?"tree-fn-row-expanded":"tree-fn-row-collapsed"} ${l.container&&l.expandable?"":"no-tree-folder"}`,children:l.container&&l.expandable&&n("span",{onClick:()=>u(l),children:[" ",e(p?Ds:N,{})]})}),n("span",{className:"tree-table-fn-td-content "+(i.isTree&&l.container?"folder":""),children:[!l?.isNewNode&&n(t,{children:[i.isTree&&"checkbox"===c&&!(g&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:"none"===l.selectedStatus?e(G,{title:l?.currentEnvId&&l?.envId&&l?.currentEnvId!==l?.envId?"This script is assigned to another environment. Selecting it will reassign it to the current environment.":void 0,children:e(ee,{checked:"completely"===l.selectedStatus,partial:"partially"===l.selectedStatus,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable,isDefaultHover:"none"===l.selectedStatus&&!!l.machine})}):e(ee,{checked:"completely"===l.selectedStatus,partial:"partially"===l.selectedStatus,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable})}),i.isTree&&"radio"===c&&!(g&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:e(Za,{name:l.key,checked:s.includes(l.key),value:l.key,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable})})]}),l.isNewNode&&i.isTree?e(Ts,{onCancel:h,onConfirm:f,value:l.value,label:l?.label,optionsList:l.options,selectedOption:l.selectedOption,withDropdown:"inputWithDropdown"===l.type,handleCustomError:C,inputFieldWidth:y,selectFieldWidth:w,confirmIconTooltip:l.confirmIconTooltip,cancelIconTooltip:l.cancelIconTooltip,isEditable:E,setIsEditable:M,isOnBlurTrue:!1,isDisable:{confirm:b},isTableTree:!0}):e("span",{className:"tree-table-fn-td-content-text",children:gE(vE(l,i),v)})]})]}),i.actions&&!l?.isNewNode&&e("div",{className:"table-tree-fn-row-action",children:i.actions(l,r)})]})}));wE.displayName="TableCell";const bE=i.memo((({node:t,columnsData:n,columnMeta:r,selected:i,select:o,onRowClick:l,onToggleExpand:s,onCheckBoxChange:c,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,index:C,selectedNode:p,hideOnDisable:m,scriptLengthTruncate:g,addModuleInputWidth:v,addModuleSelectWidth:y,disableEditLabelConfirmIcon:w,isEditable:b,setIsEditable:E,style:M})=>{const A=a(null);return e("div",{"data-level":t.hierarchy,ref:A,className:"ff-table-tree-fn-row show-tree "+(p&&p===t.key?"fn-selected-node":""),onClick:e=>l(e,t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||l(e,t)},role:"button",tabIndex:0,id:0===C?"table-fn-first-row":t.key,style:M,children:n.map(((n,a)=>e(wE,{treeRowRef:A,col:n,colIndex:a,node:t,selected:i,select:o,onCheckBoxChange:c,onToggleExpand:s,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,hideOnDisable:m,scriptLengthTruncate:g,addModuleInputWidth:v,addModuleSelectWidth:y,disableEditLabelConfirmIcon:w,isEditable:b,setIsEditable:E,columnMeta:r?.[a]},n.name)))})}));bE.displayName="TableRow";const EE=({flattenedTreeData:t,columnsData:n,columnMeta:r,rowHeight:i=32,startIndex:o=0,totalHeight:a=0,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,expanding:p,selectedNode:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M})=>e("div",{className:"ff-table-tree-fn-body",style:{height:`${a}px`,position:"relative"},children:t?.map(((t,a)=>e(bE,{node:t,columnsData:n,columnMeta:r,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,isExpanding:t.key===p,index:o+a,selectedNode:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M,style:{transform:`translateY(${(o+a)*i}px)`,height:`${i}px`,position:"absolute",top:0,left:0,right:0}},t.key)))}),ME=i.memo((({columnsData:t,columnMeta:r,totalWidth:i,rootNode:o,selected:s,onCheckBoxChange:d,selectedNode:u,tableHeaderBgColor:f,hideOnDisable:h,transparentHeader:C,scriptLengthTruncate:p=25,showHeader:m=!0})=>{const g=a(null),[v,y]=c(!1),[w,b]=c(!1);l((()=>{y(!0)}),[]);const E=(e,t)=>{const n=r?.[e];return{width:n?.width??t,position:n?.sticky?"sticky":void 0,left:n?.sticky?n.left:void 0,zIndex:n?.sticky?n.zIndex:void 0}};return n("div",{className:"ff-table-tree-fn-head",children:[m&&e("div",{className:"ff-table-tree-fn-row no-hover",style:{minWidth:i},children:t.map((({name:t,width:n},i)=>e("div",{className:"ff-table-tree-fn-th "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:{...E(i,n),backgroundColor:C?"transparent":f,pointerEvents:C?"none":"auto"},children:t},t)))}),o&&e("div",{className:"ff-table-tree-fn-row show-tree "+(u&&u===o?.node?.key?"hover":""),ref:g,onMouseEnter:e=>{e.stopPropagation(),b(!0)},onMouseLeave:e=>{e.stopPropagation(),b(!1)},children:t.map(((t,i)=>e("div",{className:"ff-table-tree-fn-td "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:E(i,t.width),children:n("span",{className:"tree-table-fn-default-content",children:[0===i&&"checkbox"===o.select&&!(h&&o.node.isDisabled)&&e(ee,{checked:"partially"!==o?.node?.selectedStatus&&("completely"===o?.node?.selectedStatus||!1),partial:"partially"===o.node.selectedStatus,onChange:e=>d(e,o.node),disabled:o.node.isDisabled}),0===i&&"radio"===o.select&&!(h&&o.node.isDisabled)&&e(Za,{name:o.node.key,checked:s.includes(o.node.key),value:o.node.key,onChange:e=>d(e,o.node),disabled:o.node.isDisabled}),n("span",{className:"tree-table-fn-td-content-text",children:["name"===t.accessor?e("span",{children:o.node[t.accessor]}):e("span",{children:gE(vE(o.node,t),p)}),o.cell&&0===i&&e("span",{className:"table-tree--fn-root-cell",children:o.cell(o.node)})]}),w&&o.actions&&0===i&&v&&g.current&&e("div",{className:"table-tree-fn-row-action",children:o.actions(o.node,g)})]})},i)))})]})}));ME.displayName="TableHead";const AE=32,xE="__root__",LE=(e,t)=>{if(!e?.length)return[];const n=new Map,r=new Map,i=new Map,o=new Map;t&&t.key&&n.set(t.key,t),e.forEach((e=>{n.set(e.key,e);const t=e.parentId??xE;r.has(t)||(r.set(t,[]),o.set(t,{container:0,resource:0})),r.get(t)?.push(e);const i=o.get(t);i&&(e.container?i.container++:i.resource++)})),r.forEach((e=>{e.forEach(((e,t)=>{i.set(e.key,t)}))}));const a=e=>{const t=e.parentId??xE,a=r.get(t);if(!a||0===a.length)return!1;if((i.get(e.key)??0)<a.length-1)return!0;const l=n.get(t),s=o.get(t);if(l&&s){const t=a.filter((e=>e.container)).reduce(((e,t)=>e+(t.totalResourceCount??0)),0),n=a.filter((e=>!e.container)).length,r=Math.max(0,(l.totalResourceCount??0)-(t+n));if(e.container){return s.container<(l.subContainerCount??0)||r>0}return s.resource<r}return!1},l=e=>{if(void 0!==e.selectedStatus)return e.selectedStatus;let r=e;for(;r?.parentId;){const e=n.get(r.parentId);if(!e)break;if("completely"===e.selectedStatus)return"completely";if("none"===e.selectedStatus)return"none";r=e}return"completely"===t?.selectedStatus?"completely":"none"===t?.selectedStatus?"none":e.selectedStatus};return e.map((e=>{const t=e,r=t.parentSiblings&&t.parentSiblings.length>0?t.parentSiblings:(e=>{const t=e.hierarchy??0;if(t<=0)return[];const r=[];let i=e;for(;i&&(r.unshift(i),i.parentId);){const e=n.get(i.parentId);if(!e)break;i=e}const o=r.map((e=>a(e)));return o.length===t?o:o.length>t?o.slice(o.length-t):new Array(t-o.length).fill(!1).concat(o)})(e);return{...e,lastChild:!a(e),parentSiblings:r,selectedStatus:l(e)}}))},kE=o((({treeData:t,columnsData:r,selected:i=[],select:o=null,onChange:s=()=>{},onClick:d=()=>{},onExpand:f=()=>{},loadMore:p=()=>{},tableBorder:m,height:g="calc(100vh - 134px)",newNode:v,onAddConfirm:y=()=>{},onAddCancel:w=()=>{},handleEditFieldError:b,loading:E=!1,rootNode:M,pagination:A=!0,selectedNode:x,tableHeaderBgColor:L="var(--border-color)",hideOnDisable:k=!1,freezeColumns:H,scriptLengthTruncate:S=25,addModuleInputWidth:V=150,addModuleSelectWidth:_,onScroll:O,onScrollEnd:N,disableEditLabelConfirmIcon:z=!1,transparentHeader:T=!1,navigateTreeNode:D=null,handleRemoveNavigateTreeNode:I=()=>{},scrollThreshold:Z=128,showHeader:j=!0},R)=>{const[B,P]=c(null),[F,U]=c(null),[q,W]=c({start:0,end:20}),[G,K]=c(!1),Y=a(null),X=a(null),J=a(0),$=a(E),ee=a(null),te=a(null),ne=a({lastScrollTop:0}),re=a(null),ie=a(0),oe=a(null),ae=a(null),le=a(null),se=a({key:null,attempts:0}),ce=a(null),de=(e,t)=>{const n=String(e??t);return n.endsWith("%")?{value:parseFloat(n),unit:"%"}:{value:parseFloat(n)||0,unit:"px"}},ue=h((()=>{let e=0,t=0;return r.map(((n,r)=>{const{value:i,unit:o}=de(n.width,400),a=!!H&&r<H,l="%"===o?`${i}%`:`${i}px`,s=`calc(${e}px + ${t}%)`;return a&&("%"===o?t+=i:e+=i),{width:l,sticky:a,left:s,zIndex:a?100+(H??0)-r:1}}))}),[r,H]),fe=h((()=>{let e=0,t=0;return r.forEach((n=>{const{value:r,unit:i}=de(n.width,400);"%"===i?t+=r:e+=r})),`calc(${e}px + ${t}%)`}),[r]),he=h((()=>{if(!H)return"0px";let e=0,t=0;return ue.slice(0,H).forEach((n=>{const r=parseFloat(n.width)||0;n.width.endsWith("%")?t+=r:e+=r})),`calc(${e}px + ${t}%)`}),[ue,H]),Ce=h((()=>((e,t,n)=>{if(!t?.sourceId||!t.action)return e;const{sourceId:r,action:i,value:o="",error:a="",label:l,type:s,options:c,selectedOption:d,confirmIconTooltip:u,cancelIconTooltip:f,payloadSourceId:h}=t,C=t?.parentId,p=t?.hierarchy,m=c?.map((e=>({label:e,value:e}))),g=d?{label:d,value:d}:void 0,v=new Map;e.forEach((e=>v.set(e.key,e))),n&&v.set(n.key,n);const y=v.get(r);let w;h&&(w=v.get(h));let b=y??("addInside"===i?w:void 0);!b&&"addInside"===i&&C&&(b=v.get(C));const E="addInside"===i&&!b&&e.length>=0;if(!b&&!E)return e;const M=[...e],A=b?e.findIndex((e=>e.key===b.key)):-1;let x=null,L=0,k=A+1;switch(i){case"addAbove":{const t=b;if(!t)return e;x=t.parentId,L=t.hierarchy;break}case"addBelow":{const t=b;if(!t)return e;x=w?.parentId??t.parentId,L=w?.hierarchy??t.hierarchy;break}case"addInside":{if(E){x=C??h??r??null,L=p??1,k=M.length;break}const t=w??b;if(!t)return e;x=t.key,L=(t.hierarchy??0)+1;const n=M.findIndex((e=>e.key===r));-1!==n&&(k=n+1);break}}const H={hierarchy:L,parentId:x,sourceId:b?.key??r??h??"new-node",isNewNode:!0,key:"new-node",value:o,error:a,label:l,type:s,options:m,selectedOption:g,confirmIconTooltip:u,cancelIconTooltip:f};switch(i){case"addAbove":M.splice(A,0,H);break;case"addBelow":M.splice(A+1,0,H);break;case"addInside":M.splice(Math.max(0,k),0,H)}return M})(t,v,M?.node)),[t,v,M]),pe=h((()=>LE(Ce,M?.node)),[Ce,M?.node]),me=h((()=>pe.filter((e=>!e.hide))),[pe]),ge=h((()=>{const e=new Map;return pe.forEach((t=>e.set(t.key,t))),e}),[pe]),ve=h((()=>{const e=new Map;return me.forEach(((t,n)=>e.set(t.key,n))),e}),[me]),ye=C((e=>{P((t=>t?e&&t!==e?t:null:t)),e&&ae.current?.key!==e||(ae.current=null),le.current&&(clearTimeout(le.current),le.current=null)}),[]);l((()=>{$.current=E}),[E]),l((()=>{ee.current=F}),[F]);const we=C((e=>{ee.current=e,U(e)}),[]),be=C((()=>{const e=Y.current;if(!e)return;const t=J.current||0,n=Math.max(0,e.scrollTop-t),r=e.clientHeight-t;let i=Math.floor(n/AE)-6,o=Math.ceil((n+r)/AE)+6;i=Math.max(0,i),o=Math.min(me.length,o),W((e=>e.start===i&&e.end===o?e:{start:i,end:o}))}),[me.length]),Ee=C((()=>{null===te.current&&(te.current=requestAnimationFrame((()=>{te.current=null,be()})))}),[be]);u((()=>{const e=Y.current;if(!e)return;const t=me.length*AE,n=Math.max(0,t-(e.clientHeight-J.current));ne.current.lastScrollTop>n&&me.length>0&&(v||D?(e.scrollTop=0,ne.current.lastScrollTop=0):B?(e.scrollTop=n,ne.current.lastScrollTop=n):ne.current.lastScrollTop-n>e.clientHeight&&(e.scrollTop=0,ne.current.lastScrollTop=0)),be()}),[me.length,be,v,D,B]);const Me=C((()=>{const e=Y.current;if(!e)return;const n=e.scrollTop,r=n>ne.current.lastScrollTop?"down":"up";if(ne.current.lastScrollTop=n,Ee(),O?.(),oe.current?.(),!A||E||ee.current||Q(t))return;const i=e.scrollHeight-(n+e.clientHeight)<Z,o=n<Z+J.current;"down"===r&&i&&!t[t.length-1]?.lastResource&&(we("below"),p("below")),"up"===r&&o&&!t[0]?.lastResource&&(we("above"),re.current=t[0]?.key??null,p("above"))}),[t,A,E,F,Z,Ee,O,p,we]);l((()=>{if(E||!A||Q(t))return;const e=t[0],n=!e?.lastResource,{totalSubContainerCount:r=0,totalResourceCount:i=0}=M?.node||{},o=r+i,a=me.length<10&&me.length<o;n&&a&&(re.current=e?.key??null,we("above"),p("above"))}),[E,A,t,me.length,M,p,we]),u((()=>{if(E||"above"!==F)E||"below"!==F||we(null);else{const e=Y.current,t=re.current;if(e&&t){const n=ve.get(t);void 0!==n&&n>0&&(e.scrollTop+=n*AE)}re.current=null,we(null)}}),[E,F,ve,we]),l((()=>{const e=Y.current;if(!e)return;const n=n=>{n.deltaY>=0||!A||Q(t)||$.current||ee.current||e.scrollTop>1||t[0]?.lastResource||(re.current=t[0]?.key??null,we("above"),p("above"))};return e.addEventListener("wheel",n,{passive:!0}),()=>{e.removeEventListener("wheel",n)}}),[A,t,p,we]),l((()=>{const e=Y.current;if(e)return oe.current=N?Aa((()=>{N?.()}),150):null,e.addEventListener("scroll",Me,{passive:!0}),()=>{e.removeEventListener("scroll",Me),oe.current?.cancel()}}),[Me,N]),l((()=>{const e=Y.current;if(!e)return;const t=e=>{Date.now()<ie.current&&e.stopImmediatePropagation()};return e.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{e.removeEventListener("scroll",t,!0)}}),[]),l((()=>{const e=X.current;if(!e)return;const t=new ResizeObserver((()=>{J.current=e.getBoundingClientRect().height,be()}));return t.observe(e),()=>t.disconnect()}),[be]),u((()=>{if(!v||!Y.current)return;const e=Y.current,t=ve.get("new-node");if(void 0===t)return;const n=J.current||0,r=e.clientHeight-n;if(r<=0)return;const i=t*AE,o=i+AE,a=Math.max(0,e.scrollTop-n);let l=a;i<a?l=i:o>a+r&&(l=Math.max(0,o-r)),l!==a&&(ie.current=Date.now()+300,e.scrollTop=l+n,be());const s=requestAnimationFrame((()=>{K(!0)}));return()=>cancelAnimationFrame(s)}),[v,ve,be]),l((()=>{v||K(!1)}),[v]),u((()=>{if(!B||E)return;const e=ae.current;if(!e||e.key!==B){const e=requestAnimationFrame((()=>{ye(B)}));return()=>cancelAnimationFrame(e)}const t=ge.get(e.key);if(!t){const t=requestAnimationFrame((()=>{ye(e.key)}));return()=>cancelAnimationFrame(t)}if(Boolean(t.expanded)!==e.expanded)return;const n=requestAnimationFrame((()=>{ye(e.key)}));return()=>cancelAnimationFrame(n)}),[ge,B,E,ye]),l((()=>{se.current.key!==D&&(se.current={key:D,attempts:0}),!D&&ce.current&&(clearTimeout(ce.current),ce.current=null)}),[D]),u((()=>{if(!D||v)return;const e=Y.current;if(!e)return;const n=ve.get(D);if(void 0!==n){se.current={key:D,attempts:0};const t=J.current||0,r=Math.max(AE,e.clientHeight-t),i=n*AE+16,o=Math.max(0,i-r/2)+t;return ie.current=Date.now()+400,e.scrollTo({top:o,behavior:"smooth"}),Ee(),ce.current&&clearTimeout(ce.current),void(ce.current=setTimeout((()=>{I?.()}),350))}if(E||F)return;const r=se.current;if(r.key!==D&&(r.key=D,r.attempts=0),r.attempts+=1,!(r.attempts>30))return A&&!0!==t[0]?.lastResource?(re.current=null,we("above"),void p("above")):void(r.attempts>2&&I?.());I?.()}),[D,v,ve,E,F,A,t,p,Ee,I,we]);const Ae=C((e=>{if(B)return;const t=!e?.expanded;P(e.key),ae.current={key:e.key,expanded:t},le.current&&clearTimeout(le.current);const n=Date.now(),r=()=>{if(ae.current?.key!==e.key)return;const t=$.current,i=Date.now()-n>=2e3;!t||i?ye(e.key):le.current=setTimeout(r,1e3)};le.current=setTimeout(r,1e3),f?.(e)}),[B,f,ye]),xe=C(((e,t)=>{B||s?.(e,t)}),[s,B]),Le=C(((e,t)=>{B||d?.(e,t)}),[d,B]);l((()=>()=>{null!==te.current&&(cancelAnimationFrame(te.current),te.current=null),le.current&&clearTimeout(le.current),ce.current&&clearTimeout(ce.current)}),[]);const ke=me.length*AE,He=me.slice(q.start,q.end);return e("div",{className:"tree-table-wrapper-container table-tree-fn",children:e("div",{className:"tree-table-fn-wrap",ref:R,children:e("div",{className:"table-fn-scrollable "+(me.length?"":"table-fn-empty"),ref:Y,style:{"--table-height":me.length?g:"auto","--frozen-column-width":he,border:m},children:n("div",{className:"tree-table-fn",style:{width:fe},children:[e("div",{ref:X,style:{position:"sticky",top:0,zIndex:98},children:e(ME,{columnsData:r,columnMeta:ue,totalWidth:fe,rootNode:M,onCheckBoxChange:xe,selected:i,selectedNode:x,tableHeaderBgColor:L,hideOnDisable:k,transparentHeader:T,scriptLengthTruncate:S,showHeader:j})}),e(EE,{flattenedTreeData:He,columnsData:r,columnMeta:ue,totalWidth:fe,rowHeight:AE,startIndex:q.start,totalHeight:ke,selected:i,select:o,onRowClick:Le,onToggleExpand:Ae,onCheckBoxChange:xe,onAddConfirm:y,onAddCancel:w,handleEditFieldError:b,expanding:B,selectedNode:x,hideOnDisable:k,scriptLengthTruncate:S,addModuleInputWidth:V,addModuleSelectWidth:_,disableEditLabelConfirmIcon:z,isEditable:v?G:void 0,setIsEditable:v?e=>{K(Boolean(e))}:void 0})]})})})})}));function HE(e,t,n,r,i,o="children"){return function e(a){for(let l=0;l<a.length;l++){const s=a[l];if(s&&s[t]===n){const e=[...a];return"replace"===i?e[l]=r:e.splice("above"===i?l:l+1,0,r),{updatedArray:e}}if(s&&s[o]&&Array.isArray(s[o])){const t=e(s[o]);if(t)return{updatedArray:a.map(((e,n)=>n===l?{...e,[o]:t.updatedArray}:e))}}}return null}(e)}kE.displayName="TableTreeFn";const SE=(e,t)=>{if(e===t)return!0;if(null==e||null==t||"object"!=typeof e||"object"!=typeof t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Array.isArray(e),r=Array.isArray(t);if(n!==r)return!1;const i=n?e:Object.keys(e),o=r?t:Object.keys(t);if(i.length!==o.length)return!1;if(n)return i.every(((e,t)=>SE(e,o[t])));{const n=new Set(o);return i.every((r=>n.has(r)&&SE(e[r],t[r])))}},VE=(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every(((e,n)=>{const r=t[n];return SE(e,r)})));function _E(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function OE(e,t){return e&t}function NE(e,t){return e|t}function zE(e,t){return e^t}function TE(e,t){return e&~t}function DE(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function IE(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var ZE,jE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function RE(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=jE.charAt(n>>6)+jE.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=jE.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=jE.charAt(n>>2)+jE.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function BE(e){var t,n="",r=0,i=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var o=jE.indexOf(e.charAt(t));o<0||(0==r?(n+=_E(o>>2),i=3&o,r=1):1==r?(n+=_E(i<<2|o>>4),i=15&o,r=2):2==r?(n+=_E(i),n+=_E(o>>2),i=3&o,r=3):(n+=_E(i<<2|o>>4),n+=_E(15&o),r=0))}return 1==r&&(n+=_E(i<<2)),n}var PE,FE=function(e){var t;if(void 0===ZE){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(ZE={},t=0;t<16;++t)ZE[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)ZE[n.charAt(t)]=t;for(t=0;t<8;++t)ZE[r.charAt(t)]=-1}var i=[],o=0,a=0;for(t=0;t<e.length;++t){var l=e.charAt(t);if("="==l)break;if(-1!=(l=ZE[l])){if(void 0===l)throw new Error("Illegal character at offset "+t);o|=l,++a>=2?(i[i.length]=o,o=0,a=0):o<<=4}}if(a)throw new Error("Hex encoding incomplete: 4 bits missing");return i},UE={decode:function(e){var t;if(void 0===PE){var n="= \f\n\r\t \u2028\u2029";for(PE=Object.create(null),t=0;t<64;++t)PE["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(PE["-"]=62,PE._=63,t=0;t<9;++t)PE[n.charAt(t)]=-1}var r=[],i=0,o=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=PE[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);i|=a,++o>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=i>>10;break;case 3:r[r.length]=i>>16,r[r.length]=i>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=UE.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return UE.decode(e)}},qE=1e13,WE=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,r,i=this.buf,o=i.length;for(n=0;n<o;++n)(r=i[n]*e+t)<qE?t=0:r-=(t=0|r/qE)*qE,i[n]=r;t>0&&(i[n]=t)},e.prototype.sub=function(e){var t,n,r=this.buf,i=r.length;for(t=0;t<i;++t)(n=r[t]-e)<0?(n+=qE,e=1):e=0,r[t]=n;for(;0===r[r.length-1];)r.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),r=t.length-2;r>=0;--r)n+=(qE+t[r]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*qE+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),QE=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,GE=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function KE(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}var YE,XE=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var r="",i=e;i<t;++i)if(r+=this.hexByte(this.get(i)),!0!==n)switch(15&i){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(r++)):String.fromCharCode((15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,r,i="",o=e;o<t;)n=this.get(o++),r=this.get(o++),i+=String.fromCharCode(n<<8|r);return i},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?QE:GE).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(r+=":"+i[5],i[6]&&(r+=":"+i[6],i[7]&&(r+="."+i[7]))),i[8]&&(r+=" UTC","Z"!=i[8]&&(r+=i[8],i[9]&&(r+=":"+i[9]))),r):"Unrecognized time: "+r},e.prototype.parseInteger=function(e,t){for(var n,r=this.get(e),i=r>127,o=i?255:0,a="";r==o&&++e<t;)r=this.get(e);if(0===(n=t-e))return i?-1:0;if(n>4){for(a=r,n<<=3;!(128&(+a^o));)a=+a<<1,--n;a="("+n+" bit)\n"}i&&(r-=256);for(var l=new WE(r),s=e+1;s<t;++s)l.mulAdd(256,this.get(s));return a+l.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),i="("+((t-e-1<<3)-r)+" bit)\n",o="",a=e+1;a<t;++a){for(var l=this.get(a),s=a==t-1?r:0,c=7;c>=s;--c)o+=l>>c&1?"1":"0";if(o.length>n)return i+KE(o,n)}return i+o},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return KE(this.parseStringISO(e,t),n);var r=t-e,i="("+r+" byte)\n";r>(n/=2)&&(t=e+n);for(var o=e;o<t;++o)i+=this.hexByte(this.get(o));return r>n&&(i+="…"),i},e.prototype.parseOID=function(e,t,n){for(var r="",i=new WE,o=0,a=e;a<t;++a){var l=this.get(a);if(i.mulAdd(128,127&l),o+=7,!(128&l)){if(""===r)if((i=i.simplify())instanceof WE)i.sub(80),r="2."+i.toString();else{var s=i<80?i<40?0:1:2;r=s+"."+(i-40*s)}else r+="."+i.toString();if(r.length>n)return KE(r,n);i=new WE,o=0}}return o>0&&(r+=".incomplete"),r},e}(),JE=function(){function e(e,t,n,r,i){if(!(r instanceof $E))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=r,this.sub=i}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return KE(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return KE(this.stream.parseStringISO(t,t+n),e);case 30:return KE(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var r=0;r<n;++r)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substr(t,n)},e.decode=function(t){var n;n=t instanceof XE?t:new XE(t,0);var r=new XE(n),i=new $E(n),o=e.decodeLength(n),a=n.pos,l=a-r.pos,s=null,c=function(){var t=[];if(null!==o){for(var r=a+o;n.pos<r;)t[t.length]=e.decode(n);if(n.pos!=r)throw new Error("Content size is not correct for container starting at offset "+a)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}o=a-n.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return t};if(i.tagConstructed)s=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");s=c();for(var d=0;d<s.length;++d)if(s[d].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){s=null}if(null===s){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+a);n.pos=a+Math.abs(o)}return new e(r,l,o,i,s)},e}(),$E=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new WE;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),eM=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],tM=(1<<26)/eM[eM.length-1],nM=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<<t)-1,i=!1,o="",a=this.t,l=this.DB-a*this.DB%t;if(a-- >0)for(l<this.DB&&(n=this[a]>>l)>0&&(i=!0,o=_E(n));a>=0;)l<t?(n=(this[a]&(1<<l)-1)<<t-l,n|=this[--a]>>(l+=this.DB-t)):(n=this[a]>>(l-=t)&r,l<=0&&(l+=this.DB,--a)),n>0&&(i=!0),i&&(o+=_E(n));return i?o:"0"},e.prototype.negate=function(){var t=lM();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+pM(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=lM();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new iM(t):new oM(t),this.exp(e,n)},e.prototype.clone=function(){var e=lM();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,r=this.DB-e*this.DB%8,i=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),128&n&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=lM();return this.bitwiseTo(e,OE,t),t},e.prototype.or=function(e){var t=lM();return this.bitwiseTo(e,NE,t),t},e.prototype.xor=function(e){var t=lM();return this.bitwiseTo(e,zE,t),t},e.prototype.andNot=function(e){var t=lM();return this.bitwiseTo(e,TE,t),t},e.prototype.not=function(){for(var e=lM(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=lM();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=lM();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+DE(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=IE(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,NE)},e.prototype.clearBit=function(e){return this.changeBit(e,TE)},e.prototype.flipBit=function(e){return this.changeBit(e,zE)},e.prototype.add=function(e){var t=lM();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=lM();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=lM();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=lM();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=lM();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=lM(),n=lM();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),o=CM(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new iM(t):t.isEven()?new aM(t):new oM(t);var a=[],l=3,s=n-1,c=(1<<n)-1;if(a[1]=r.convert(this),n>1){var d=lM();for(r.sqrTo(a[1],d);l<=c;)a[l]=lM(),r.mulTo(d,a[l-2],a[l]),l+=2}var u,f,h=e.t-1,C=!0,p=lM();for(i=pM(e[h])-1;h>=0;){for(i>=s?u=e[h]>>i-s&c:(u=(e[h]&(1<<i+1)-1)<<s-i,h>0&&(u|=e[h-1]>>this.DB+i-s)),l=n;!(1&u);)u>>=1,--l;if((i-=l)<0&&(i+=this.DB,--h),C)a[u].copyTo(o),C=!1;else{for(;l>1;)r.sqrTo(o,p),r.sqrTo(p,o),l-=2;l>0?r.sqrTo(o,p):(f=o,o=p,p=f),r.mulTo(p,a[u],o)}for(;h>=0&&!(e[h]&1<<i);)r.sqrTo(o,p),f=o,o=p,p=f,--i<0&&(i=this.DB-1,--h)}return r.revert(o)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var r=t.clone(),i=this.clone(),o=CM(1),a=CM(0),l=CM(0),s=CM(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);for(;i.isEven();)i.rShiftTo(1,i),n?(l.isEven()&&s.isEven()||(l.addTo(this,l),s.subTo(t,s)),l.rShiftTo(1,l)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);r.compareTo(i)>=0?(r.subTo(i,r),n&&o.subTo(l,o),a.subTo(s,a)):(i.subTo(r,i),n&&l.subTo(o,l),s.subTo(a,s))}return 0!=i.compareTo(e.ONE)?e.ZERO:s.compareTo(t)>=0?s.subtract(t):s.signum()<0?(s.addTo(t,s),s.signum()<0?s.add(t):s):s},e.prototype.pow=function(e){return this.exp(e,new rM)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=eM[eM.length-1]){for(t=0;t<eM.length;++t)if(n[0]==eM[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<eM.length;){for(var r=eM[t],i=t+1;i<eM.length&&r<tM;)r*=eM[i++];for(r=n.modInt(r);t<i;)if(r%eM[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(t,n);r=2}this.t=0,this.s=0;for(var i=t.length,o=!1,a=0;--i>=0;){var l=8==r?255&+t[i]:hM(t,i);l<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==a?this[this.t++]=l:a+r>this.DB?(this[this.t-1]|=(l&(1<<this.DB-a)-1)<<a,this[this.t++]=l>>this.DB-a):this[this.t-1]|=l<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM,l=this.t-1;l>=0;--l)t[l+o+1]=this[l]>>r|a,a=(this[l]&i)<<n;for(l=o-1;l>=0;--l)t[l]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&o)<<i,t[a-n]=this[a]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),i=t.abs(),o=r.t;for(n.t=o+i.t;--o>=0;)n[o]=0;for(o=0;o<i.t;++o)n[o+r.t]=r.am(0,i[o],n,o,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var i=t.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=lM());var a=lM(),l=this.s,s=t.s,c=this.DB-pM(i[i.t-1]);c>0?(i.lShiftTo(c,a),o.lShiftTo(c,r)):(i.copyTo(a),o.copyTo(r));var d=a.t,u=a[d-1];if(0!=u){var f=u*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),h=this.FV/f,C=(1<<this.F1)/f,p=1<<this.F2,m=r.t,g=m-d,v=null==n?lM():n;for(a.dlShiftTo(g,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),e.ONE.dlShiftTo(d,v),v.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--g>=0;){var y=r[--m]==u?this.DM:Math.floor(r[m]*h+(r[m-1]+p)*C);if((r[m]+=a.am(0,y,r,g,0,d))<y)for(a.dlShiftTo(g,v),r.subTo(v,r);r[m]<--y;)r.subTo(v,r)}null!=n&&(r.drShiftTo(d,n),l!=s&&e.ZERO.subTo(n,n)),r.t=d,r.clamp(),c>0&&r.rShiftTo(c,r),l<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=lM(),i=lM(),o=n.convert(this),a=pM(t)-1;for(o.copyTo(r);--a>=0;)if(n.sqrTo(r,i),(t&1<<a)>0)n.mulTo(i,o,r);else{var l=r;r=i,i=l}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=CM(n),i=lM(),o=lM(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),o=!1,a=0,l=0,s=0;s<t.length;++s){var c=hM(t,s);c<0?"-"==t.charAt(s)&&0==this.signum()&&(o=!0):(l=n*l+c,++a>=r&&(this.dMultiply(i),this.dAddOffset(l,0),a=0,l=0))}a>0&&(this.dMultiply(Math.pow(n,a)),this.dAddOffset(l,0)),o&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),NE,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var i=[],o=7&t;i.length=1+(t>>3),n.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r<o;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=o;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);(t=t+1>>1)>eM.length&&(t=eM.length);for(var o=lM(),a=0;a<t;++a){o.fromInt(eM[Math.floor(Math.random()*eM.length)]);var l=o.modPow(i,this);if(0!=l.compareTo(e.ONE)&&0!=l.compareTo(n)){for(var s=1;s++<r&&0!=l.compareTo(n);)if(0==(l=l.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=l.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=lM();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var o=n.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)t(n);else{o<a&&(a=o),a>0&&(n.rShiftTo(a,n),r.rShiftTo(a,r));var l=function(){(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(l,0):(a>0&&r.lShiftTo(a,r),setTimeout((function(){t(r)}),0))};setTimeout(l,10)}},e.prototype.fromNumberAsync=function(t,n,r,i){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),NE,this),this.isEven()&&this.dAddOffset(1,0);var o=this,a=function(){o.dAddOffset(2,0),o.bitLength()>t&&o.subTo(e.ONE.shiftLeft(t-1),o),o.isProbablePrime(n)?setTimeout((function(){i()}),0):setTimeout(a,0)};setTimeout(a,0)}else{var l=[],s=7&t;l.length=1+(t>>3),n.nextBytes(l),s>0?l[0]&=(1<<s)-1:l[0]=0,this.fromString(l,256)}},e}(),rM=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),iM=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),oM=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=lM();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(nM.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=lM();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),aM=function(){function e(e){this.m=e,this.r2=lM(),this.q3=lM(),nM.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=lM();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function lM(){return new nM(null)}function sM(e,t){return new nM(e,t)}var cM="undefined"!=typeof navigator;cM&&"Microsoft Internet Explorer"==navigator.appName?(nM.prototype.am=function(e,t,n,r,i,o){for(var a=32767&t,l=t>>15;--o>=0;){var s=32767&this[e],c=this[e++]>>15,d=l*s+c*a;i=((s=a*s+((32767&d)<<15)+n[r]+(1073741823&i))>>>30)+(d>>>15)+l*c+(i>>>30),n[r++]=1073741823&s}return i},YE=30):cM&&"Netscape"!=navigator.appName?(nM.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var a=t*this[e++]+n[r]+i;i=Math.floor(a/67108864),n[r++]=67108863&a}return i},YE=26):(nM.prototype.am=function(e,t,n,r,i,o){for(var a=16383&t,l=t>>14;--o>=0;){var s=16383&this[e],c=this[e++]>>14,d=l*s+c*a;i=((s=a*s+((16383&d)<<14)+n[r]+i)>>28)+(d>>14)+l*c,n[r++]=268435455&s}return i},YE=28),nM.prototype.DB=YE,nM.prototype.DM=(1<<YE)-1,nM.prototype.DV=1<<YE;nM.prototype.FV=Math.pow(2,52),nM.prototype.F1=52-YE,nM.prototype.F2=2*YE-52;var dM,uM,fM=[];for(dM="0".charCodeAt(0),uM=0;uM<=9;++uM)fM[dM++]=uM;for(dM="a".charCodeAt(0),uM=10;uM<36;++uM)fM[dM++]=uM;for(dM="A".charCodeAt(0),uM=10;uM<36;++uM)fM[dM++]=uM;function hM(e,t){var n=fM[e.charCodeAt(t)];return null==n?-1:n}function CM(e){var t=lM();return t.fromInt(e),t}function pM(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}nM.ZERO=CM(0),nM.ONE=CM(1);var mM=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,r;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();var gM,vM,yM=null;if(null==yM){yM=[],vM=0;var wM=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var bM=new Uint32Array(256);for(window.crypto.getRandomValues(bM),wM=0;wM<bM.length;++wM)yM[vM++]=255&bM[wM]}var EM=0,MM=function(e){if((EM=EM||0)>=256||vM>=256)window.removeEventListener?window.removeEventListener("mousemove",MM,!1):window.detachEvent&&window.detachEvent("onmousemove",MM);else try{var t=e.x+e.y;yM[vM++]=255&t,EM+=1}catch(e){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",MM,!1):window.attachEvent&&window.attachEvent("onmousemove",MM))}function AM(){if(null==gM){for(gM=new mM;vM<256;){var e=Math.floor(65536*Math.random());yM[vM++]=255&e}for(gM.init(yM),vM=0;vM<yM.length;++vM)yM[vM]=0;vM=0}return gM.next()}var xM=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=AM()},e}();var LM=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=sM(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=function(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=63&i|128,n[--t]=i>>6|192):(n[--t]=63&i|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var o=new xM,a=[];t>2;){for(a[0]=0;0==a[0];)o.nextBytes(a);n[--t]=a[0]}return n[--t]=2,n[--t]=0,new nM(n)}(e,t);if(null==n)return null;var r=this.doPublic(n);if(null==r)return null;for(var i=r.toString(16),o=i.length,a=0;a<2*t-o;a++)i="0"+i;return i},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=sM(e,16),this.e=parseInt(t,16),this.d=sM(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,r,i,o,a,l){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=sM(e,16),this.e=parseInt(t,16),this.d=sM(n,16),this.p=sM(r,16),this.q=sM(i,16),this.dmp1=sM(o,16),this.dmq1=sM(a,16),this.coeff=sM(l,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new xM,r=e>>1;this.e=parseInt(t,16);for(var i=new nM(t,16);;){for(;this.p=new nM(e-r,1,n),0!=this.p.subtract(nM.ONE).gcd(i).compareTo(nM.ONE)||!this.p.isProbablePrime(10););for(;this.q=new nM(r,1,n),0!=this.q.subtract(nM.ONE).gcd(i).compareTo(nM.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var a=this.p.subtract(nM.ONE),l=this.q.subtract(nM.ONE),s=a.multiply(l);if(0==s.gcd(i).compareTo(nM.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(s),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(l),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=sM(e,16),n=this.doPrivate(t);return null==n?null:function(e,t){var n=e.toByteArray(),r=0;for(;r<n.length&&0==n[r];)++r;if(n.length-r!=t-1||2!=n[r])return null;++r;for(;0!=n[r];)if(++r>=n.length)return null;var i="";for(;++r<n.length;){var o=255&n[r];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new xM,i=e>>1;this.e=parseInt(t,16);var o=new nM(t,16),a=this,l=function(){var t=function(){if(a.p.compareTo(a.q)<=0){var e=a.p;a.p=a.q,a.q=e}var t=a.p.subtract(nM.ONE),r=a.q.subtract(nM.ONE),i=t.multiply(r);0==i.gcd(o).compareTo(nM.ONE)?(a.n=a.p.multiply(a.q),a.d=o.modInverse(i),a.dmp1=a.d.mod(t),a.dmq1=a.d.mod(r),a.coeff=a.q.modInverse(a.p),setTimeout((function(){n()}),0)):setTimeout(l,0)},s=function(){a.q=lM(),a.q.fromNumberAsync(i,1,r,(function(){a.q.subtract(nM.ONE).gcda(o,(function(e){0==e.compareTo(nM.ONE)&&a.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(s,0)}))}))},c=function(){a.p=lM(),a.p.fromNumberAsync(e-i,1,r,(function(){a.p.subtract(nM.ONE).gcda(o,(function(e){0==e.compareTo(nM.ONE)&&a.p.isProbablePrime(10)?setTimeout(s,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(l,0)},e.prototype.sign=function(e,t,n){var r=function(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,r="",i=0;i<n;i+=2)r+="ff";return sM("0001"+r+"00"+e,16)}((kM[n]||"")+t(e).toString(),this.n.bitLength()/4);if(null==r)return null;var i=this.doPrivate(r);if(null==i)return null;var o=i.toString(16);return 1&o.length?"0"+o:o},e.prototype.verify=function(e,t,n){var r=sM(t,16),i=this.doPublic(r);return null==i?null:function(e){for(var t in kM)if(kM.hasOwnProperty(t)){var n=kM[t],r=n.length;if(e.substr(0,r)==n)return e.substr(r)}return e}
28
28
  /*!
29
29
  Copyright (c) 2011, Yahoo! Inc. All rights reserved.
30
30
  Code licensed under the BSD License: