pixel-priya 1.3.56 → 1.3.57

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 Fm(){return Nm||(Nm=1,"production"===process.env.NODE_ENV?Zm.exports=function(){if(Sm)return Om;Sm=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,p=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,A=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case s:case c:case r:case o:case i:case u:return e;default:switch(e=e&&e.$$typeof){case l:case d:case C:case h:case a:return e;default:return f}}case n:return f}}}function y(e){return v(e)===c}return Om.AsyncMode=s,Om.ConcurrentMode=c,Om.ContextConsumer=l,Om.ContextProvider=a,Om.Element=t,Om.ForwardRef=d,Om.Fragment=r,Om.Lazy=C,Om.Memo=h,Om.Portal=n,Om.Profiler=o,Om.StrictMode=i,Om.Suspense=u,Om.isAsyncMode=function(e){return y(e)||v(e)===s},Om.isConcurrentMode=y,Om.isContextConsumer=function(e){return v(e)===l},Om.isContextProvider=function(e){return v(e)===a},Om.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Om.isForwardRef=function(e){return v(e)===d},Om.isFragment=function(e){return v(e)===r},Om.isLazy=function(e){return v(e)===C},Om.isMemo=function(e){return v(e)===h},Om.isPortal=function(e){return v(e)===n},Om.isProfiler=function(e){return v(e)===o},Om.isStrictMode=function(e){return v(e)===i},Om.isSuspense=function(e){return v(e)===u},Om.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===o||e===i||e===u||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===h||e.$$typeof===a||e.$$typeof===l||e.$$typeof===d||e.$$typeof===m||e.$$typeof===A||e.$$typeof===g||e.$$typeof===p)},Om.typeOf=v,Om}():Zm.exports=(zm||(zm=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,p=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,A=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var p=e.type;switch(p){case s:case c:case r:case o:case i:case u:return p;default:var m=p&&p.$$typeof;switch(m){case l:case d:case C:case h:case a:return m;default:return f}}case n:return f}}}var y=s,w=c,E=l,b=a,M=t,L=d,x=r,H=C,V=h,k=n,S=o,Z=i,O=u,z=!1;function N(e){return v(e)===c}Dm.AsyncMode=y,Dm.ConcurrentMode=w,Dm.ContextConsumer=E,Dm.ContextProvider=b,Dm.Element=M,Dm.ForwardRef=L,Dm.Fragment=x,Dm.Lazy=H,Dm.Memo=V,Dm.Portal=k,Dm.Profiler=S,Dm.StrictMode=Z,Dm.Suspense=O,Dm.isAsyncMode=function(e){return z||(z=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),N(e)||v(e)===s},Dm.isConcurrentMode=N,Dm.isContextConsumer=function(e){return v(e)===l},Dm.isContextProvider=function(e){return v(e)===a},Dm.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Dm.isForwardRef=function(e){return v(e)===d},Dm.isFragment=function(e){return v(e)===r},Dm.isLazy=function(e){return v(e)===C},Dm.isMemo=function(e){return v(e)===h},Dm.isPortal=function(e){return v(e)===n},Dm.isProfiler=function(e){return v(e)===o},Dm.isStrictMode=function(e){return v(e)===i},Dm.isSuspense=function(e){return v(e)===u},Dm.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===o||e===i||e===u||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===h||e.$$typeof===a||e.$$typeof===l||e.$$typeof===d||e.$$typeof===m||e.$$typeof===A||e.$$typeof===g||e.$$typeof===p)},Dm.typeOf=v}()),Dm)),Zm.exports}var Rm=function(){if(Tm)return Im;Tm=1;var e=Fm(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function o(n){return e.isMemo(n)?r:i[n.$$typeof]||t}i[e.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[e.Memo]=r;var a=Object.defineProperty,l=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,c=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,u=Object.prototype;return Im=function e(t,r,i){if("string"!=typeof r){if(u){var f=d(r);f&&f!==u&&e(t,f,i)}var h=l(r);s&&(h=h.concat(s(r)));for(var C=o(t),p=o(r),m=0;m<h.length;++m){var A=h[m];if(!(n[A]||i&&i[A]||p&&p[A]||C&&C[A])){var g=c(r,A);try{a(t,A,g)}catch(e){}}}}return t},Im}(),Pm=S(Rm);function Bm(){return Bm=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bm.apply(this,arguments)}var jm={},_m=0;var qm="onloadcallback";function Um(){return"undefined"!=typeof window&&window.recaptchaOptions||{}}var Wm=function(e,t){return t=t||{},function(n){var r=n.displayName||n.name||"Component",i=function(r){var i,o;function a(e,t){var n;return(n=r.call(this,e,t)||this).state={},n.__scriptURL="",n}o=r,(i=a).prototype=Object.create(o.prototype),i.prototype.constructor=i,i.__proto__=o;var l=a.prototype;return l.asyncScriptLoaderGetScriptLoaderID=function(){return this.__scriptLoaderID||(this.__scriptLoaderID="async-script-loader-"+_m++),this.__scriptLoaderID},l.setupScriptURL=function(){return this.__scriptURL="function"==typeof e?e():e,this.__scriptURL},l.asyncScriptLoaderHandleLoad=function(e){var t=this;this.setState(e,function(){return t.props.asyncScriptOnLoad&&t.props.asyncScriptOnLoad(t.state)})},l.asyncScriptLoaderTriggerOnScriptLoaded=function(){var e=jm[this.__scriptURL];if(!e||!e.loaded)throw new Error("Script is not loaded.");for(var n in e.observers)e.observers[n](e);delete window[t.callbackName]},l.componentDidMount=function(){var e=this,n=this.setupScriptURL(),r=this.asyncScriptLoaderGetScriptLoaderID(),i=t,o=i.globalName,a=i.callbackName,l=i.scriptId;if(o&&void 0!==window[o]&&(jm[n]={loaded:!0,observers:{}}),jm[n]){var s=jm[n];return s&&(s.loaded||s.errored)?void this.asyncScriptLoaderHandleLoad(s):void(s.observers[r]=function(t){return e.asyncScriptLoaderHandleLoad(t)})}var c={};c[r]=function(t){return e.asyncScriptLoaderHandleLoad(t)},jm[n]={loaded:!1,observers:c};var d=document.createElement("script");for(var u in d.src=n,d.async=!0,t.attributes)d.setAttribute(u,t.attributes[u]);l&&(d.id=l);var f=function(e){if(jm[n]){var t=jm[n].observers;for(var r in t)e(t[r])&&delete t[r]}};a&&"undefined"!=typeof window&&(window[a]=function(){return e.asyncScriptLoaderTriggerOnScriptLoaded()}),d.onload=function(){var e=jm[n];e&&(e.loaded=!0,f(function(t){return!a&&(t(e),!0)}))},d.onerror=function(){var e=jm[n];e&&(e.errored=!0,f(function(t){return t(e),!0}))},document.body.appendChild(d)},l.componentWillUnmount=function(){var e=this.__scriptURL;if(!0===t.removeOnUnmount)for(var n=document.getElementsByTagName("script"),r=0;r<n.length;r+=1)n[r].src.indexOf(e)>-1&&n[r].parentNode&&n[r].parentNode.removeChild(n[r]);var i=jm[e];i&&(delete i.observers[this.asyncScriptLoaderGetScriptLoaderID()],!0===t.removeOnUnmount&&delete jm[e])},l.render=function(){var e=t.globalName,r=this.props;r.asyncScriptOnLoad;var i=r.forwardedRef,o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(r,["asyncScriptOnLoad","forwardedRef"]);return e&&"undefined"!=typeof window&&(o[e]=void 0!==window[e]?window[e]:void 0),o.ref=i,p(n,o)},a}(E),a=o(function(e,t){return p(i,Bm({},e,{forwardedRef:t}))});return a.displayName="AsyncScriptLoader("+r+")",a.propTypes={asyncScriptOnLoad:Mm.func},Pm(a,n)}}(function(){var e=Um(),t=e.useRecaptchaNet?"recaptcha.net":"www.google.com";return e.enterprise?"https://"+t+"/recaptcha/enterprise.js?onload="+qm+"&render=explicit":"https://"+t+"/recaptcha/api.js?onload="+qm+"&render=explicit"},{callbackName:qm,globalName:"grecaptcha",attributes:Um().nonce?{nonce:Um().nonce}:{}})(km);const Xm=Wm,Qm=o(({onVerify:t,className:r="",error:i,sitekey:o,...a},l)=>{const[s,d]=c(null),u=i||s;return n("div",{className:I("ff-recaptcha-wrapper",r),children:[e(Xm,{ref:l,sitekey:o,onChange:e=>{e?(d(null),t(e)):d("Please complete the CAPTCHA")},...a}),u&&e("div",{className:"ff-recaptcha-error",children:e(U,{fontSize:12,children:u})})]})}),Gm={margin:6,optionHeight:32,selectInputHeight:38,dropDownWrapperPadding:0},Km=({onSelectBlur:r,onSelectOptionSelector:i,dropdownPosition:o,options:s=[],optionZIndex:u=100,inputRef:f,webServiceClick:h=()=>{},accessibilityClick:C=()=>{},containerWidth:p,loadMoreOptions:m,chipRef:A,isWebservice:g=!0,isAccessibility:v=!1,dropDownMessage:y=""})=>{const[w,E]=c(null),[b,M]=c(""),L=d(Q),x=L?.currentTheme,H=a(null),[V,k]=c(-1);J(H,r,[f,A]);const{positionX:S,positionY:Z,width:O,fromBottom:z}=o,{margin:N,optionHeight:T,selectInputHeight:D,dropDownWrapperPadding:F}=Gm,R=e=>{let t="",n="";return"NLP"===e?(t="NLP",n="ff-nlp"):"STEP_GROUP"===e?(t="SG",n="ff-sg"):"PROGRAM_ELEMENTS"===e?(t="PE",n="ff-pe"):"WORKBENCH_REQUEST"===e?(t="WS",n="ff-ws"):(t="--",n="nlp-default"),{label:t,className:n}},P=({platform:n,nlpType:r})=>"NLP"===r?e(q,"Web"===n?{name:"web_icon",height:10,width:10}:"Android"===n?{name:"android_icon",height:10,width:10}:"iOS"===n?{name:"ios_icon",height:10,width:10,color:"var(--dotted-border-color)"}:"Generic"===n?{name:"mobile_icon",height:10,width:10}:{name:"common_nlp",height:10,width:10}):"WORKBENCH_REQUEST"===r&&"Webservice"===n?e(q,{name:"web_service_icon",height:8,width:8}):e(t,{});Sn(["ff-nlp-dropdown-pagination"],{root:document.getElementById("ff-nlp-dropdown-options-wrapper"),rootMargin:"0px",threshold:.1,onIntersect:(e,t)=>{e.isIntersecting&&m&&m()}}),l(()=>{if(V>=0&&V<s.length){const e=s[V];E(e),M("show")}else V>=s.length&&(E(null),M(""),k(-1));const e=e=>{if(s.length)switch(e.key){case"ArrowDown":e.preventDefault(),k(e=>e<s.length-1?e+1:0);break;case"ArrowUp":e.preventDefault(),k(e=>e>0?e-1:s.length-1);break;case"Enter":V>=0&&s[V]&&i(s[V])}};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[s,V]),l(()=>{if(V<0)return;const e=document.getElementById(`ff-nlp-option-${V}`);e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})},[V]),l(()=>{if(!s?.length)return;const e=H.current;if(!e)return;const t=t=>{e.contains(t.target)||(t.stopPropagation(),t.preventDefault())};return document.body.addEventListener("wheel",t,{passive:!1}),document.body.addEventListener("touchmove",t,{passive:!1}),()=>{document.body.removeEventListener("wheel",t),document.body.removeEventListener("touchmove",t)}},[s]);const B=e=>e?.searchName||e?.displayName||e?.desc||e?.name||e?.nlpName||"---";return e("div",{className:"ff-nlp-dropdown-wrapper",children:n("div",{ref:H,style:{...(()=>{let e;return e=K(s)||s.length>0?5*T+2*F:s.length*T+2*F,z>e+N+80?{left:S,top:Z,width:O,zIndex:u}:{zIndex:u,left:S,width:O,top:Z-D-92-e-N}})(),width:p},className:I("ff-nlp-options-wrapper",x),onMouseLeave:()=>M("hide"),children:[n("div",{className:"ff-nlp-options-wrapper-main",children:[e("div",{className:"ff-nlp-options-primary-wrapper",id:"ff-nlp-dropdown-options-wrapper",children:K(s)?e(U,{textAlign:"center",lineHeight:"32px",as:"p",color:"var(--ff-nlp-text-color)",className:"ff-nlp-no-option",children:K(y)?"No Results Found":y}):n(t,{children:[s.map((t,r)=>e("div",{onMouseEnter:()=>{E(t),M("show")},id:`ff-nlp-option-${r}`,children:e("div",{onMouseEnter:()=>k(r),onClick:()=>i(t),onKeyDown:e=>{"Enter"===e.key&&i(t)},children:n(U,{as:"div",lineHeight:"30px",fontSize:12,className:I("ff-nlp-option",x,{"ff-nlp-option--selected":V===r}),children:[e(Y,{title:t.platform,children:e("span",{children:e(U,{className:`nlp-categories ${R(t.nlpType).className}`,fontWeight:"regular",fontSize:8,lineHeight:"32px",children:R(t.nlpType).label})})}),e("span",{children:P(t)}),B(t)]})})},`ff-nlp-option-${r}`)),e("div",{id:"ff-nlp-dropdown-pagination"})]})}),n("div",{className:I("show"===b?"ff-nlp-web-service-div":"ff-nlp-primary-web-service-div",{"ff-nlp-web-service-div--gap":v}),children:[g&&e(kp,{iconName:"plus_user_icon",label:"Web Service",onClick:()=>{r(),h()}}),v&&e(kp,{iconName:"plus_user_icon",label:"Accessibility",onClick:()=>{r(),C()}})]})]}),e("div",{className:"show"===b?"ff-nlp-data-show":"ff-nlp-data-hide",children:n("div",{className:"ff-nlp-data-side-menu",children:[w?.videoSrc&&n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:10,children:["Video",e("div",{className:"nlp-details ",children:e("video",{src:w.videoSrc,controls:!0,className:"nlp-video-player",width:"100%",children:"Your browser does not support the video tag."})})]}),n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["STEP_GROUP"===w?.nlpType?"Step Group Details":"NLP Details",e(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:B(w)})]}),n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["Description",e(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:w?.description||"--"})]}),"STEP_GROUP"===w?.nlpType&&e(t,{children:n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["Path",e(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:w?.path?w?.path:"---"})]})}),e(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:"Inputs"}),w?.stepInputs?.length?w.stepInputs.map((t,r)=>{const i=t.type?t?.type?.split(".")?.pop():"--";return e("div",{children:n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["Input",r+1,n(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:["type: ",i]}),n(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:["name: ",t.name||"--"]})]})},r)}):e("div",{className:"nlp-details",children:"--"}),n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["Output",e(U,{className:"nlp-details ",fontWeight:"regular",fontSize:12,children:w?.returnType||"--"})]})]})})]})})},Ym=o(({chipOptionList:t,selectedChips:r,optionZIndex:i=0,inputRef:o,ChipsAccordionWidth:s},d)=>{const[f,h]=c([]),[C,p]=c(!1),[m,A]=c({left:0,top:0}),[g,v]=c("down"),y=a(null);w(d,()=>y.current);const E=So(y,C);l(()=>{K(t)||h(t)},[t]);const b=a(null),M=()=>{b.current};l(()=>{M()},[f]),u(()=>{const e=()=>{if(!o?.current)return;const{positionX:e,positionY:t,width:n,fromBottom:r}=E(o);v(r<160?"up":"down"),A({left:e+n,top:t})};e();const t=new ResizeObserver(()=>e());return o?.current&&t.observe(o.current),window.addEventListener("scroll",e,!0),()=>{o?.current&&t.unobserve(o.current),t.disconnect(),window.removeEventListener("scroll",e,!0)}},[E,o]);return l(()=>{const e=()=>{M()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),L(n("div",{className:"ff-chips-accordion",style:{left:m.left,top:m.top,zIndex:i+100,transform:"up"===g?"translateY(calc(-100% + 33px))":"none",width:s,position:"absolute"},ref:y,children:[e("div",{ref:b,className:"ff-chips-row "+(C?"expanded":""),style:{maxHeight:C?"280px":"20px"},children:e("div",{className:"chips-container "+(C?"chips-container-scroll":""),children:f?.map(({name:t,isSelected:n},i)=>e("div",{className:"chip "+(n?"selected-chip":""),onClick:()=>(e=>{const t=f.map((t,n)=>n===e?{...t,isSelected:!t.isSelected}:t);if(h(t),r){const e=t.filter(e=>e.isSelected);r(e)}})(i),children:e(U,{as:"div",className:"chip-text",children:t,fontSize:10,lineHeight:"15px"})},i))})}),e("div",{className:"ff-arrow-icon-container",children:e("div",{className:"ff-icon-wrapper "+(C?"expanded":""),role:"button","aria-expanded":C,children:e(q,{name:"down"===g?"arrows_down_icon":"arrows_top_icon",height:8,width:8,onClick:()=>{p(e=>!e),C&&document.querySelector(".ff-chips-row")?.scrollTo({top:0})}})})})]}),document.body)}),Jm=(e,t)=>{switch(t.type){case"FOCUS_INPUT":return{...e,isInputFocused:!0,isIconClick:!0,showOptions:!0};case"BLUR_INPUT":return{...e,isInputFocused:!1,option:t.payload.option,isIconClick:!1,showOptions:!1,dropdownPosition:{positionX:0,positionY:0,width:0,fromBottom:0}};case"UPDATE_DROPDOWN_POSITION":const{positionX:n,positionY:r,width:i,fromBottom:o}=t.payload||{};return{...e,dropdownPosition:{positionX:n,positionY:r,width:i,fromBottom:o}};case"UPDATE_OPTION":return{...e,option:t.payload};case"SHOW_ERROR":return{...e,isInputFocused:!0,isIconClick:!1,showOptions:!1,option:t.payload.option,dropdownPosition:{positionX:0,positionY:0,width:0,fromBottom:0}};default:return e}},$m=({label:t="",leftIcon:r,rightIcon:i,rightIconColor:o,showLabel:s=!0,onHelpIconClick:d=()=>{},aiIconClick:f=()=>{},webServiceClick:h=()=>{},accessibilityClick:C=()=>{},containerWidth:p="",optionsList:m=[],selectedOption:A={displayName:"",projectId:"",nlpType:"",platform:""},onChange:v=()=>{},errorMsg:y="",className:w="",optionZIndex:E=100,disabled:b=!1,borderRadius:M=!0,showBorder:x=!0,required:H=!1,value:V="",onSelect:k=()=>{},chipOptionList:S,selectedChips:Z,loadMoreOptions:O=()=>{},isWebservice:z=!0,isAccessibility:N=!1,closeInputOnOutsideClick:T=()=>{},tooltipText:D="Help",ChipsAccordionWidth:F="27.8%",dropDownMessage:R=""})=>{const P={isInputFocused:!1,isIconClick:!1,showOptions:!1,option:K(A)&&"string"==typeof A?.displayName?A.displayName:"",dropdownPosition:{positionX:0,positionY:0,width:0,fromBottom:0}},[B,j]=g(Jm,P),[_,W]=c(A),[X,Q]=c({}),G=a(!1);l(()=>{const e="string"==typeof A.displayName?A.displayName:String(A.displayName??"");e!==_.displayName&&W({...A,displayName:e})},[A]),l(()=>{V&&ae("FOCUS_INPUT")},[V]);const Y=a(null),J=a(null),$=a(null),{isInputFocused:ee,isIconClick:te,showOptions:ne,dropdownPosition:re,option:ie}=B,oe=So(Y,ne),ae=e=>{b||j("SHOW_ERROR"===e||"BLUR_INPUT"===e?{type:e,payload:{option:"string"==typeof A.displayName?A.displayName:String(A.displayName??"")}}:{type:e})},le=()=>{if(!ne||!Y?.current||b)return;const{positionX:e,positionY:t,width:n,fromBottom:r}=oe(Y);j({type:"UPDATE_DROPDOWN_POSITION",payload:{positionX:e,positionY:t,width:n,fromBottom:r}})},se=e=>{const t=window.innerWidth-document.body.clientWidth;document.body.style.paddingRight=e?"":`${t}px`,document.body.style.overflow=e?"":"hidden"};u(()=>{if(b)return;ne&&se(!ne),le();const e=()=>le();return window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{se(!0),window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}},[ne]),l(()=>{y&&ae("SHOW_ERROR")},[]),l(()=>{ae("FOCUS_INPUT")},[]);const ce=!ee&&Boolean(ie);return l(()=>{const e=J.current;if(!e)return;let t=e.parentElement;for(;t&&t!==document.body;){const e=getComputedStyle(t);if(["scroll","auto"].includes(e.overflowY))break;t=t.parentElement}if(!t)return;const n=t.style.overflow,r=ne||S;return t.style.overflow=r?"hidden":n||"auto",()=>{t.style.overflow=n||"auto"}},[ne,S]),n("section",{className:"main-section",children:[n("div",{className:I(`ff-nlp-input-wrapper ${w}`),children:[n("div",{className:"ff-nlp-input",children:[e("input",{type:"text",className:I("ff-nlp-input-container",{"ff-nlp-input-container--default":!ee,"ff-nlp-input-container--active":ce,"ff-nlp-input-container--no-label":!s,"ff-nlp-input-container--error":y&&!ee&&!Boolean(ie),"ff-nlp-input-container--border-radius":!M,"ff-nlp-input-container--disable":b,"ff-nlp-input-container--no-border":!x}),style:{zIndex:E,paddingLeft:"32px"},onFocus:()=>ae("FOCUS_INPUT"),onChange:e=>{b||v(e)},value:V,disabled:b,autoComplete:"off",spellCheck:"false",ref:J,autoFocus:!0}),n("div",{className:"ff-nlp-icon-container",children:[e(q,{name:r||"ai_search",className:"ff-nlp-help_icon",width:16,height:16,onClick:f}),e(U,{className:"icon-label",fontSize:10,children:"Search With Ai"})]}),s&&n("div",{className:I("ff-nlp-input-label","ff-nlp-input-label--default",{"ff-nlp-input-label--active":V||Boolean(ie),"ff-nlp-input-label--error":y}),children:[H&&e(U,{color:"var(--$error-light)",className:"ff-nlp-input-label--required",children:"*"}),t]}),n("div",{className:"help-icon-container",onMouseDown:()=>G.current=!0,style:{zIndex:E},children:[e("span",{className:I("ff-nlp-input-arrow",{"ff-nlp-input-arrow--down":!te,"ff-nlp-input-arrow--no-label":!s}),onMouseEnter:e=>{const t=e.target.getBoundingClientRect();Q({top:t.top+window.scrollY-20+"px",left:`${t.left+window.scrollX+.5*t.width}px`,visibility:"visible",opacity:1,transitionDelay:"0s"})},onMouseLeave:()=>Q(e=>({...e,visibility:"hidden",opacity:0})),children:e(q,{name:i||"",height:16,width:16,onClick:d,color:o})}),L(e(U,{className:"help-icon-label",fontSize:10,style:X,children:D}),document.body)]}),e("fieldset",{className:I("ff-nlp-input-fieldset",{"ff-nlp-input-fieldset--no-label":!s,"ff-nlp-input-fieldset--default":!ee,"ff-nlp-input-fieldset--active":ee,"ff-nlp-input-fieldset--option":ce,"ff-nlp-input-fieldset--error":y,"ff-nlp-input-fieldset--border-radius":!M,"ff-nlp-input-fieldset--no-border":!x})})]}),y&&e(U,{className:"ff-nlp-input-wrapper-error-text",fontSize:8,color:"var(--error-light)",children:y}),e("div",{ref:Y,children:ne&&L(e(Km,{onSelectBlur:()=>{b||(G.current?G.current=!1:y?ae("SHOW_ERROR"):(ae("BLUR_INPUT"),T()))},onSelectOptionSelector:e=>{k(e)},dropdownPosition:re,options:m,optionZIndex:E,inputRef:J,webServiceClick:h,accessibilityClick:C,containerWidth:p,loadMoreOptions:O,chipRef:$,isWebservice:z,isAccessibility:N,dropDownMessage:R}),document.body)})]}),e("div",{className:"chips-accordion-content",children:S&&S.length>0&&e(Ym,{chipOptionList:S,selectedChips:Z,optionZIndex:E,ref:$,inputRef:J,ChipsAccordionWidth:F})})]})},eA=({items:t,onButtonClick:r,selectedValue:i=null,onChange:o,className:a=""})=>{const[s,d]=c(i);l(()=>{i!==s&&d(i)},[i,s]);return n("div",{className:I("ff-icon-radio-group",a),children:[t.map(t=>e("div",{className:I("ff-icon-radio-button",{selected:s===t.iconName,disabled:t.disabled}),onClick:()=>(e=>{if(e.disabled)return;const t=e.iconName;d(t),o&&o(t),r(e)})(t),children:e(Y,{title:t.iconLabel,children:e("div",{className:I("icon-container",{selected:s===t.iconName}),children:e(q,{name:t.iconName,hoverEffect:!1,color:s===t.iconName?"var(--drawer-footer-bg)":"var(--brand-color)"})})})},t.iconName)),e("div",{className:"line-connector"})]})},tA=({width:t="100%",options:r=[],runCount:i=0,className:o="",contentReverse:a=!1,onClick:l=()=>{},modalId:s="",scriptType:c="",readOnly:d=!1,isMissing:u=!1})=>{const f={local:"local",browserstack:"browserstack_icon",saucelabs:"sause_lab_icon",lambdatest:"lambda_icon",fireflink:"fireflink_platform_logo",mac:"mac_icon",mac_icon:"mac_icon",android:"android_icon",linux:"linux","google chrome":"chrome_icon","mozilla firefox":"fire_fox","microsoft edge":"edge","internet explorer":"internet_explorer",safari:"safari_icon",opera:"opera",windows:"windows",edge:"edge",microsoftedge:"edge",firefox:"fire_fox",chrome:"chrome_icon",explorer:"internet_explorer",ios:"mac_icon",comet:"comet_icon"},h="manual"===c.toLowerCase();return console.warn("Options list",r),n("div",{id:s,style:{width:t},className:I("ff-machine-input-field-wrapper",o,{"cursor-event-none":1!==i&&"Automation"==c}),onClick:()=>{d||l()},children:[!h&&n(U,{as:"span",color:"var(--ff-machine-input-field-text-color)",fontSize:8,textAlign:"center",className:"ff-machine-input-label",children:["Run ",i]}),e("div",{className:I("ff-machine-input-field",{"ff-machine-input-field-reverse":a,"ff-machine-input-field-missing":u}),children:r.map(({label:t,type:r,version:i,available:o})=>n("div",{className:I("ff-machine-icon-text-wrapper",{"ff-machine-icon-text-wrapper-reverse":a,show_border:!1===o}),children:[e(q,{name:f[r?.toLowerCase()]||"",className:"ff-machine-icon"}),e(Y,{title:t,children:e(U,{className:I("ff-machine-text",{"ff-machine-text-reverse":a}),color:"var(--ff-machine-input-field-text-color)",children:Hn(t,10)?xn(t,10):t})}),h&&!K(i)&&e(Y,{title:i,children:n(U,{className:I("ff-machine-text",{"ff-machine-text-reverse":a}),color:"var(--ff-machine-input-field-text-color)",children:[" -"," ",Hn(i??"",10)?xn(i??"",10):i]})})]},r))})]})};tA.displayName="MachineInputField";const nA=({datSetToolTip:{globalVariableSetName:r="",peVariableSetName:i="",testDataSetName:o=""}})=>{const a={"Project Environment Set":i,"Global Variable Set":r,"Test Data Set":o};return e(t,{children:Object.entries(a).map(([t,r],i)=>e("div",{className:"ff-dataSetList-container",children:n("div",{children:[e(U,{as:"div",fontSize:10,lineHeight:"15px",color:"var(--details-page-value-color)",className:"ff-dataSetList-items",children:t}),e(U,{as:"div",lineHeight:"18px",color:"var(--base-bg-color)",children:r})]})},i))})},rA=e=>"object"==typeof e&&0===Object.keys(e).length,iA=s(null),oA=({machineInstances:r,rowIndex:i,machineColumnCount:o,nextRowMachineInstance:a,previousRowMachineInstance:l,onAddBrowser:s,onDeleteBrowser:c,onAddRunBrowser:u,onUpdateDataSetList:f,onUpdateAddBrowserInstance:h,addInstanceLabel:C="",scriptType:p="",projectType:m="",readOnly:A,maxRunCount:g})=>{const v=i%2==0,y=K(r[o-1]),w=d(iA),{testDataSetMap:E={},globalVariableMap:b={},projectVariableMap:M={}}=w||{},L=(e,t)=>e&&t&&"machineInstanceId"in e&&"machineInstanceId"in t&&e.machineInstanceId===t.machineInstanceId?"dashed":"solid",x=e=>r?.length-1!==e&&o>1,H=(e="",t)=>{const{executionEnv:n,browserName:r,browserVersion:i,machineInfo:{osVersion:o,iconName:a,osName:l,hostName:s},deviceInfo:c,fireCloudProjectName:d=""}=t,u=[{label:"FireFlink Device Farm"===n?d:n,type:((e="")=>"local"===e?.toLowerCase()?"local":e?.toLowerCase()?.includes("browserstack")?"Browserstack":e?.toLowerCase()?.includes("lambdatest")?"LambdaTest":e?.toLowerCase()?.includes("saucelabs")?"SauceLabs":e?.toLowerCase()?.includes("fireflink device farm")?"fireflink":"")(n)}];"manual"===p?.toLowerCase()&&u.push({label:s||"",type:"local"===n?.toLowerCase()?"local":""});const f=[{label:o||"",type:a||l},{label:i,type:r}],h=c?.reduce((e,t)=>(t&&e?.push({label:t?.name,type:"manual"===p?.toLowerCase()?"android":t?.platform,version:"manual"===p?.toLowerCase()?t?.version:"",available:"boolean"==typeof t?.available?t?.available:""}),e),[]);switch(e.toLowerCase()){case"web":case"web service":return[...u,...f];case"web & mobile":case"ms dynamics":case"salesforce":return[...u,...f,...h];case"mobile":return[...u,...h];default:return[]}},V="manual"!==p?.toLowerCase(),k=e=>!K(e)||(rA(e)||void 0!==a);return n("div",{className:I({"ff-connecting-branch-grid":v,"ff-connecting-branch-grid-reverse":!v}),style:{gridTemplateColumns:1===o?"24px minmax(min-content, auto) 24px":`24px minmax(min-content, auto) repeat(${o-1}, 40px minmax(min-content, auto)) 24px`},children:[n("div",{className:"ff-connecting-branch-start-wrapper",children:[e("div",{className:I({"ff-connecting-branch-arrow":v,"ff-connecting-branch-arrow-reverse":!v})}),e("div",{className:I({"ff-connecting-branch-container":v,"ff-connecting-branch-container-reverse":!v}),style:{border:`1px ${L(r[0],l)} var(--ff-connecting-branch-color)`,borderTop:"none",borderLeft:`${!v&&"none"}`,borderRight:`${v&&"none"}`}})]}),r?.map((i,o)=>{const{runCount:a=("runCount"in i?i.runCount:0),numberOfRuns:l=0,machineInstanceId:d="",peVariableSetId:y="",globalVariableSetId:w="",testDataSetId:S="",testDataSetName:Z="",peVariableSetName:O="",globalVariableSetName:z=""}=i;return n(t,{children:[K(i)?!A&&e("div",{className:"ff-connecting-branch-browser-button",children:e(W,{id:`ff-sequential-branch-add-${d}`,variant:"tertiary",label:C,iconName:"plus_icon",iconPosition:v?"left":"right",onClick:()=>{A||s(`ff-sequential-branch-add-${d}`)}})}):n("div",{children:[n("div",{className:"ff-connecting-branch-input-point-wrapper",children:[k(r[o+1])&&e("div",{className:I({"ff-connecting-branch-point":v,"ff-connecting-branch-point-reverse":!v})}),e(tA,{runCount:a,options:H(m,i),contentReverse:!v,modalId:`${d}-runCount-${a-1}`,onClick:()=>1==a||"Automation"!==p?h(`${d}-runCount-0`,i):null,scriptType:p,readOnly:A},mi())]}),n("div",{className:I({"ff-connecting-branch-datalist":v,"ff-connecting-branch-datalist-reverse":!v}),children:[V&&n(t,{children:[e("div",{id:`ff-sequential-branch-dataset-${d}-${a}`,className:"ff-dataset-list-branch",onClick:()=>{A||f(`ff-sequential-branch-dataset-${d}-${a}`,{peVariableSetId:y,globalVariableSetId:w,testDataSetId:S,testDataSetName:Z,globalVariableSetName:z,peVariableSetName:O},!0,l,d)},children:n(Y,{placement:"bottom",title:e(t,{children:e(nA,{datSetToolTip:{peVariableSetName:M[y]||"",globalVariableSetName:b[w]||"",testDataSetName:E[S]||""}})}),style:{display:"flex",alignItems:"center"},children:[e(q,{name:"datalist_icon",className:"ff-connecting-icon",hoverEffect:!0}),e(U,{className:"ff-connecting-text",color:"var(--ff-connecting-branch-color)",children:"Data Set List"})]})}),!A&&e(t,{children:e(Y,{placement:"bottom",title:l>=g?`Maximum ${g} runs are allowed.`:"",children:n("div",{className:"ff-environment-run-container",onClick:l>=g?void 0:()=>u(d),children:[e(q,{name:"plus_icon",className:"ff-connecting-run-icon",color:"var(--ff-connecting-branch-color)",hoverEffect:!0,disabled:l>=g}),e(U,{className:"ff-connecting-run-text",color:"var(--ff-connecting-branch-color)",style:{opacity:l>=g?.5:1},children:"Run"})]})})})]}),!A&&e(Y,{title:"Delete",children:e(q,{name:"delete",className:"ff-connecting-delete-icon",onClick:()=>c(d,a),color:"var(--ff-connecting-branch-delete-color)",hoverEffect:!0})})]})]}),x(o)&&e("div",{className:"ff-connecting-branch-middle-arrow",style:{borderTop:`1px ${L(i,r[o+1])} var(--ff-connecting-branch-color)`},children:e("div",{className:I({"ff-connecting-branch-arrow":v,"ff-connecting-branch-arrow-reverse":!v})})})]},mi())}),(A?!y&&!K(a):!y)&&e("div",{className:I({"ff-connecting-branch-end-arrow":v,"ff-connecting-branch-end-arrow-reverse":!v}),style:{border:`1px ${L(r[o-1],a)} var(--ff-connecting-branch-color)`,borderBottom:"none",borderLeft:`${v&&"none"}`,borderRight:`${!v&&"none"}`}})]})},aA=({machineBranchInstances:n,machineColumnCount:r,machineColumnWidth:i,onAddBrowser:o,onDeleteBrowser:a,onAddRunBrowser:s,onUpdateDataSetList:d,onUpdateAddBrowserInstance:u,addInstanceLabel:f="",scriptType:h="",projectType:C="Web",readOnly:p=!1,maxRunCount:m})=>{const[A,g]=c(n);l(()=>{g(n)},[n]);const v=((e,t)=>{const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n})(A,r);return e("div",{className:"ff-connecting-branch-grid-wrapper",children:v.map((n,l)=>e(t,{children:e(oA,{machineInstances:n,rowIndex:l,machineColumnCount:r,machineColumnWidth:i,onAddBrowser:o,onDeleteBrowser:a,onAddRunBrowser:s,nextRowMachineInstance:v[l+1]?.[0],previousRowMachineInstance:v[l-1]?.[r-1],onUpdateDataSetList:d,onUpdateAddBrowserInstance:u,addInstanceLabel:f,scriptType:h,projectType:C,readOnly:p,maxRunCount:m})},mi()))})},lA=({machineInstances:r=[],machineColumnWidth:i=180,machineColumnCount:o=1,selectedMachine:s={},machineOptionsList:d=[],onHandleSelect:u=()=>{},onAddBrowserInstance:f=()=>{},onAddRunBrowserInstance:h=()=>{},onDeleteBrowserInstance:C=()=>{},onUpdateDataSetList:p=()=>{},onDeleteMachineInstance:m=()=>{},dataSetValues:A={testDataSetId:"",globalVariableSetId:"",peVariableSetId:"",globalVariableSetName:"",peVariableSetName:"",testDataSetName:""},onUpdateAddBrowserInstance:g=()=>{},addInstanceLabel:v="Environment",placeholder:y="Choose Machine",scriptType:w="Automation",projectType:E="Web",readOnly:b=!1,zIndex:M=99999,maxRunCount:L=35,environmentVariableMaps:x,isRequired:H=!1,showIcon:V=!1})=>{const[k,S]=c({}),Z=a(null),O=Math.max(o,1),z=Math.max(i,180),[N,T]=c([]),D=K(r);let F=K(s.value?.clientId);"Manual"===w&&(F=K(s.value));l(()=>{S(s)},[s]),l(()=>{T(b?r:[...r,{}])},[r]);const R="manual"!==w.toLowerCase(),P=(B=A,j="Id",Object.fromEntries(Object.entries(B).filter(([e])=>!e.includes(j))));var B,j;const _=b&&!D||!b&&D||!b&&!D;return e(iA.Provider,{value:x,children:n("div",{className:"ff-sequential-connecting-branch-wrapper",children:[n("div",{className:"ff-connecting-select-branch-wrapper",children:[n("div",{className:"ff-select-branch-wrapper",children:[e(Zo,{onChange:u,optionsList:d,label:y,required:H,showLabel:!0,className:"ff-sequential-select-branch",width:"240px",selectedOption:k,valueAccessor:"name",optionsRequired:!b,disableInput:b,optionZIndex:M,showIcon:V}),!F&&n("div",{className:I({"ff-select-branch-arrow":D,"ff-select-branch-arrow-down":!D}),children:[_&&e("div",{className:"ff-select-branch-point"}),n("div",{className:"ff-select-branch-arrow",children:[!b&&e("div",{className:"ff-branch-arrow-wrapper",children:D&&e("div",{className:"ff-branch-arrow"})}),D&&!b&&e(t,{children:e(W,{variant:"tertiary",label:"Manual"===w?"Machine":"Environment",iconName:"plus_icon",iconPosition:"left",size:"small",className:"branch-button",ref:Z,onClick:()=>f("ff-sequential-branch-button"),id:"ff-sequential-branch-button"})})]})]})]}),!F&&n("div",{className:"ff-select-scope-datalist",children:[e("div",{className:"ff-scope-wrapper",children:e(U,{as:"span",color:((e="")=>e.toLowerCase().includes("inactive")?"var(--ff-machine-inactive-status-color)":e.toLowerCase().includes("running")?"var(--ff-machine-running-status-color)":e.toLowerCase().includes("active")?"var(--ff-machine-active-status-color)":"var(--ff-machine-active-status-color))")(s.value?.status),className:"ff-scope-text",children:s.value?.status})}),n("div",{className:"ff-datalist-wrapper",children:[R&&e("div",{id:"ff-sequential-machine-datalist",onClick:()=>{b||p("ff-sequential-machine-datalist",A)},children:n(Y,{placement:"bottom",title:e("div",{children:e(nA,{datSetToolTip:P})}),style:{display:"flex",alignItems:"center"},children:[e(q,{name:"datalist_icon",className:"ff-dataset-icon",hoverEffect:!0}),e(U,{as:"span",color:"var(--ff-connecting-branch-color)",className:"ff-datalist-text",children:"Data Set List"})]})}),!b&&e(Y,{title:"Delete",placement:"bottom",children:e(q,{name:"delete",className:"ff-run-delete-icon",color:"var(--ff-connecting-branch-delete-color)",onClick:m,hoverEffect:!0})})]})]})]}),e("div",{className:"ff-sequential-branches-wrapper",children:!D&&e(aA,{machineBranchInstances:N,machineColumnCount:O,machineColumnWidth:z,onAddBrowser:f,onDeleteBrowser:C,onAddRunBrowser:h,onUpdateDataSetList:p,onUpdateAddBrowserInstance:g,addInstanceLabel:v,scriptType:w,projectType:E,readOnly:b,maxRunCount:L})})]})})},sA=({label:t,selectedFiles:r,onFilesChange:i,disabled:o=!1,buttonDisplayType:l="attachment",iconName:s="plus_icon",maxFileSizeMB:d,maxFiles:u,buttonLabel:f="Select Files",showSelectedFiles:h=!0,buttonVariant:C="primary",deleteButton:p=!0,multiple:m=!0,addAttachmentButton:A=!0,isInfoIconRequired:g=!0,onFileListClick:v,types:y=[],attachmentInfoTooltip:w="",selectedFileMessage:E="This file is already selected",required:b=!1,errorMessage:M,truncateMaxLimit:L=1/0,onClickAttachmentButton:x=()=>{}})=>{const H=a(null),[V,k]=c(""),S={image:["image/jpeg","image/png","image/svg+xml"],video:["video/mp4","video/mpeg","video/quicktime"],audio:["audio/mpeg","audio/wav","audio/ogg"],document:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],archive:["application/zip","application/x-rar-compressed","application/x-7z-compressed"],spreadsheet:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],excel:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],dat:[".dat","application/octet-stream"],trg:[".trg","application/octet-stream"]},Z=y.flatMap(e=>S[e]||[]).join(","),O=()=>{x(),k(""),H.current?.click()};return n("div",{children:[g&&n("div",{className:"ff-label-icon",children:[e(U,{fontWeight:"semi-bold",lineHeight:"18px",as:"span",required:b,children:t}),e(Y,{title:w||(()=>{if(0===y.length)return"Any files are allowed.";const t=y.flatMap(e=>S[e]||[]).map(e=>e.split("/")[1]),r=t.pop();return n("span",{children:[t.join(", ")," and ",r," files are allowed.",e("br",{}),"Max size: ",d," MB"]})})(),placement:"bottom-start",children:e(q,{name:"info",hoverEffect:!0})})]}),(!h||0===r.length)&&("attachment"===l?e(W,{variant:C,label:f,size:"medium",onClick:O,disabled:o}):"icon"===l?e(kp,{label:f,iconName:s,onClick:O,isDisable:o}):null),e("input",{type:"file",ref:H,className:"ff-input-field",onChange:()=>{if(k(""),H.current?.files){const e=Array.from(H.current.files);if(e.length>5)return k("Maximum file(s) can be uploaded: 5"),void(H.current.value="");const t=e.filter(e=>!r.some(t=>t.name===e.name));if(0===t.length)return k(E),void(H.current.value="");if("number"==typeof u&&r.length+t.length>u)return k(`You can only select up to ${u} files.`),void(H.current.value="");if("number"==typeof d){const e=1024*d*1024;if(t.filter(t=>t.size>e).length>0)return k(`Maximum file(s) size allowed: ${d} MB.`),void(H.current.value="")}i([...r,...t],t,"ADD"),H.current.value=""}},multiple:m,accept:Z,required:b}),V&&e(wi,{isOpen:!!V,variant:"info",toastTitle:"Info",toastMessage:V,zIndex:1e7}),h&&r.map((t,o)=>n("div",{className:"ff-attachment-files",onClick:v,children:[e(U,{color:"var(--brand-color)",children:e(Oi,{title:t.name,width:L})}),p&&e(Y,{title:"Delete",children:e(q,{name:"delete",hoverEffect:!0,color:"var(--ff-delete-button-attachment)",variant:"danger",onClick:()=>(e=>{const t=[...r],n=t.splice(e,1);i(t,n,"DELETE")})(o)})}),o===r.length-1&&A&&e(Y,{title:""+("number"==typeof u&&r.length>=u?`Maximum files can be uploaded: ${u}`:"Add File"),children:e(q,{name:"add_file",hoverEffect:!0,onClick:O,disabled:"number"==typeof u&&!(r.length<u)})})]},t.name)),b&&e(U,{children:M,fontSize:10,className:"error-text"})]})},cA=({selected:t="text",firstButton:r="File",secondButton:i="File",handleClick:o})=>n("div",{className:"toggle-container",children:[e("button",{className:"toggle-button "+(t===r?"active":""),onClick:()=>o(r),children:r}),e("button",{className:"toggle-button "+(t===i?"active":""),onClick:()=>o(i),children:i})]}),dA=({variant:t="small",iconName:n,iconColor:r="var(--avatar-icon-color)",customAvatarSize:i,customIconSize:o,backgroundColor:a,label:l,labelFontSize:s})=>{const c=l?.slice(0,2);return e("div",{className:`ff-avatar ff-avatar--${t}`,style:{height:`${i}px`,width:`${i}px`,backgroundColor:a},children:l?e("span",{className:"ff-avatar-label",style:{fontSize:s||"14px",color:r},children:c}):e(q,{name:n,height:o,width:o,color:r})})},uA=({logo:t,overlay:r=!1})=>e("div",{className:`overlay-loader ${r&&"overlay"}`,children:n("div",{className:"loader-container ",children:[t&&e(t,{}),e("div",{className:"line_loader"})]})}),fA=({contentHeader:t,data:r,maxHeight:i=""})=>{const o=`scrollable-${(e=>{const t=parseInt(e);if(isNaN(t))return"default";const n=100*Math.round(t/100);return Math.min(Math.max(100,n),1e3)})(i)}`;return n("div",{className:"ff-content-card-container",children:[e("div",{className:"ff-content-card-nav",children:e(U,{as:"div",fontWeight:"semi-bold",lineHeight:"35px",children:t})}),e("div",{className:`ff-content-card-body scrollable ${o}`,children:Object.entries(r).map(([t,r],i)=>n("div",{className:"ff-content-card-row",children:[n(U,{fontWeight:"semi-bold",children:[t,":"]}),e(U,{className:"ff-content-card-value",children:r})]},i+t))})]})},hA=new Set(["auto","auto-start","auto-end","top","top-start","top-end","bottom","bottom-start","bottom-end","right","right-start","right-end","left","left-start","left-end"]),CA=e=>{const t=document.createElement("div"),n=e.getAttribute("data-tooltip-id");if(n){const e=document.getElementById(n);if(e){let n=e.innerHTML.replace(/<!--[\s\S]*?-->/g,"").trim();return'""'!==n&&"''"!==n&&"&quot;&quot;"!==n||(n=""),""===n||/^<([a-zA-Z0-9-]+)[^>]*>\s*<\/\1>$/i.test(n)?"":(t.innerHTML=e.innerHTML,t)}}const r=e.getAttribute("data-tooltip")||"";if(!r.trim())return"";const i=r.replace(/\\n/g," ").replace(/\n/g," ").replace(/\s+/g," ").trim();if(!i)return"";const o=i.trim().startsWith("<")&&i.trim().endsWith(">"),a=/<(?:[a-z][\s\S]*>|\/[a-z0-9]+>)|&[#a-zA-Z0-9]+;/i.test(i);return e.hasAttribute("data-tooltip-allowhtml")?o?t.innerHTML=i:(t.style.wordBreak="break-word",a?t.innerHTML=i:t.textContent=i):(t.style.wordBreak="break-word",t.textContent=i),t},pA=()=>(l(()=>{const e=e=>{const t=e.target;t instanceof Element&&t.closest("[data-tippy-root]")||pn({duration:0})};window.addEventListener("scroll",e,!0);const t=An(document.body,{target:"[data-tooltip], [data-tooltip-id]",arrow:!1,placement:"bottom",theme:"ff-global-tooltip",appendTo:document.body,allowHTML:!0,popperOptions:{modifiers:[{name:"preventOverflow",options:{altAxis:!0,padding:8}},{name:"flip",options:{padding:8,fallbackPlacements:["top","right","left"]}}]},content:e=>CA(e),onShow(e){const{reference:t}=e,n=CA(t);if(""===n)return!1;const r=e.reference.hasAttribute("data-tooltip-interactive"),i=e.reference.getAttribute("data-tooltip-placement"),o=i?.trim().toLowerCase(),a=o&&hA.has(o)?o:"bottom";e.setProps({interactive:r,placement:a,content:n})},onMount(e){if(!e.reference.hasAttribute("data-tooltip-interactive")){const t=e.popper.querySelector(".tippy-box");t&&t.scrollHeight>t.clientHeight&&e.setProps({interactive:!0})}}});return()=>{window.removeEventListener("scroll",e,!0),Array.isArray(t)?t.forEach(e=>e.destroy()):t.destroy()}},[]),null),mA="Principle",AA="Guidelines",gA="Weightage in %",vA=e=>null==e||"boolean"==typeof e?"":"string"==typeof e||"number"==typeof e?String(e):Array.isArray(e)?e.map(vA).filter(Boolean).join(" "):i.isValidElement(e)?vA(e.props.children):"",yA=({title:t="Success Criteria Weightage",totalWeightage:r,maxWeightage:i=100,principleColumnLabel:o=mA,guidelinesColumnLabel:a=AA,weightageColumnLabel:l=gA,columnLabels:s,groups:d=[],onWeightageChange:u=()=>{},renderWeightageCell:f,weightageInputWidth:h="12%",onReset:C=()=>{},showResetIcon:p=!0,disabled:m=!1,minValue:A=0,maxValue:g=100,disableUpwardIncreaseOnMax:v=!0,isAccordion:y=!0,defaultExpanded:w=!1,className:E="",style:M})=>{const L=b().replace(/:/g,""),[x,H]=c(w),V=`${L}-weightage-title`,k=`${L}-weightage-content`,S=d.reduce((e,t)=>e+t.guidelines.length,0);let Z=2;const O=d.map(e=>{const t=Z;return Z+=e.guidelines.length,t}),z={principle:s?.principle??o,guidelines:s?.guidelines??a,weightage:s?.weightage??l},N=vA(z.weightage)||gA,T=i??g,D=r??d.reduce((e,t)=>e+t.guidelines.reduce((e,t)=>e+(t.value||0),0),0),F=Math.max(0,T-D),R=(e,t,n)=>{u(e,t,n)},P=!y||x,B=({groupIndex:t,rowIndex:n,row:r,minValue:i,maxValue:o,disabled:a,inputWidth:l,inputProps:s})=>e("div",{className:"ff-weightage-input",style:{width:l},children:e(Hi,{type:"number",noBorder:!0,value:r.value,minValue:i,maxValue:o,disabled:a,error:r.error,helperText:r.helperText,placeholder:"",variant:"primary",isLabelRequired:!1,disableAfterMaxValueReached:!0,size:"small",className:"ff-weightage-input-field",onChange:e=>((e,t,n,r,i,o)=>{const a=o.target.value,l=""===a?0:Number(a);let s=!1,c="";(l<r||l>i)&&(s=!0,c=`Value must be between ${r} and ${i}`),R(e,t,{...n,value:l,error:s,helperText:c})})(t,n,r,i,o,e),setUpdatedNumberValue:e=>R(t,n,{...r,value:e}),...s})}),j=(t,n,r)=>e("div",{className:t,role:"columnheader","aria-colindex":r,children:e(U,{fontWeight:"semi-bold",children:e(Xs,{children:n})})}),_=(t,r,i)=>{const o=t.key??t.principle;return e("div",{className:"ff-weightage-group",role:"rowgroup","aria-label":t.principle,children:t.guidelines.map((a,l)=>((t,r,i,o,a,l)=>{const s=o.key??`${i}-${o.label}`,c=o.maxValue??T,d=Math.min(c,100),u=v?Math.min(d,(o.value||0)+F):d,C=Math.min(o.minValue??A,u),p=m||!!o.disabled||!P,g=`${L}-weightage-row-${r}-${a}`,y=o.error&&o.helperText?`${g}-error`:void 0,w={group:t,row:o,groupIndex:r,rowIndex:a,rowKey:s,minValue:C,maxValue:u,disabled:p,inputWidth:h,inputProps:{id:`${g}-input`,name:s,"aria-label":`${N} for ${o.label} in ${t.principle}`,"aria-describedby":y,"aria-errormessage":y,"aria-invalid":o.error||void 0,onWheel:e=>{e.currentTarget.blur()}},onChange:e=>R(r,a,e)};return n("div",{className:"ff-weightage-row",role:"row","aria-rowindex":l,children:[0===a&&e("div",{className:"ff-weightage-principle",role:"rowheader","aria-colindex":1,"aria-rowspan":t.guidelines.length,style:{gridRow:`span ${t.guidelines.length}`},children:e(U,{fontWeight:"medium",children:e(Xs,{children:t.principle})})}),e("div",{className:"ff-weightage-guideline",role:"cell","aria-colindex":2,children:e(U,{children:e(Xs,{className:"auto-truncate",children:o.label})})}),e("div",{className:"ff-weightage-value",role:"cell","aria-colindex":3,children:(E=w,f?f(E):B(E))})]},s);var E})(t,r,o,a,l,i+l))},o)};return n("div",{className:I("ff-weightage-table",E),style:M,children:[e(pA,{}),n("div",{className:"ff-weightage-head",children:[e("div",{className:"ff-weightage-title",id:V,children:e(U,{fontWeight:"semi-bold",children:e(Xs,{children:t})})}),n("span",{className:"ff-weightage-total",children:[e("span",{className:"ff-weightage-total-value","aria-live":"polite","aria-label":`Total weightage ${D}`,children:e(U,{fontWeight:"semi-bold",children:n(Xs,{children:["Total Weightage : ",D]})})}),p&&e("button",{type:"button",className:"ff-weightage-icon-button",onClick:C,"aria-label":"Reset weightage values to default","data-tooltip":"Reset to default value",children:e(q,{name:"reset_default_value",withPadding:!1})}),y&&e("button",{type:"button",className:"ff-weightage-icon-button",onClick:()=>{H(e=>!e)},"aria-label":x?"Collapse weightage table":"Expand weightage table","aria-expanded":P,"aria-controls":k,"data-tooltip":x?"Collapse":"Expand",children:e(q,{name:x?"arrow_up":"arrow_down",withPadding:!1})})]})]}),e("div",{className:I("ff-weightage-content",{"ff-weightage-content--expanded":P}),id:k,"aria-hidden":!P,...P?{}:{inert:""},children:e("div",{className:"ff-weightage-content-inner",children:n("div",{className:"ff-weightage-grid",role:"table","aria-labelledby":V,"aria-colcount":3,"aria-rowcount":S+1,children:[n("div",{className:"ff-weightage-row ff-weightage-row-head",role:"row","aria-rowindex":1,children:[j("ff-weightage-principle",z.principle,1),j("ff-weightage-guideline",z.guidelines,2),j("ff-weightage-value",z.weightage,3)]}),d.map((e,t)=>_(e,t,O[t]??2))]})})})]})},wA=({label:t,placeholder:r,text:i,showText:o=!0,highlightText:s,customError:d,confirmIcon:u,customErrorCondition:f,cancelIcon:h,variant:C="textField",onInputChange:p,dropdownData:m=[],className:A,height:g,isOpen:v=!1,confirmAction:y,onClick:w,tooltip:E,onDoubleClick:b,disableEditing:M=!1})=>{const[L,x]=c(v??!1),[H,V]=c(i??""),[k,S]=c(m[0]?.value??""),[Z,O]=c(""),[z,N]=c(!0),[I,T]=c(!1),D=!(!Z||!L),F=a(null),R=a(null),[P,B]=c(null),j=X("Escape");l(()=>()=>{P&&clearTimeout(P)},[P]);const _=()=>{let e="";0===H.length||0===H.trim().length?e="Please type any text.":H.length<3?e="Please enter at least 3 characters.":f&&(e=d??"Invalid input."),e?O(e):(x(!1),O(""),y&&y(H,k)),u?.onClick?.()},W=()=>{V(i??""),S(m[0]?.value??""),x(!1),O(""),T(!1),h?.onClick?.()},Q=e=>{const t=e.target.value;V(t),N(!1),0===t.length||0===t.trim().length?O("Input is required"):t.length<3?O("Input cannot be less than 3 characters"):t.length>250?O("Input cannot be more than 250 characters"):$n.test(t)?O("Space is not allowed at starting and at the end"):O(f?d??"Invalid input.":""),T(t!==i),p&&p(t)},G=e=>{if(F.current&&!F.current.contains(e.target)&&R.current!==e.target){const e=((e,t)=>e===t?"No changes were made.":e?e.length<3?"Please enter at least 3 characters.":"":"Text is required")(H,i??"");e&&L?O(e):(x(!1),O(""))}};return l(()=>(document.addEventListener("click",G),()=>{document.removeEventListener("click",G)}),[H]),j(W),Zn([{key:"Enter",action:()=>{_()}}],F),n("div",{className:"ff-label-edit-text-field",ref:F,children:[L?n("div",{className:"ff-label-text-field",children:["textFieldWithDropdown"===C?n("div",{className:"ff-label-text-field-with-dropdown "+(L?"open":""),style:{height:g},children:[e(Hi,{name:"input",type:"text",label:t||"",disabled:!1,error:D,placeholder:r||"",value:H,onChange:Q,className:`${A} \n \n ${I?"modified":""}`}),e(Zo,{label:"",optionsList:m,selectedOption:{value:k,label:k},onChange:e=>S(e.value)})]}):e("div",{className:"ff-label-text-field-without-dropdown",children:e(Hi,{name:"input",type:"text",label:t||"",disabled:!1,error:D,placeholder:r||"",value:H,onChange:Q,className:`${A} \n \n ${I?"modified":""}`})}),n("div",{className:"ff-icon-container",children:[u&&e(Y,{title:"Confirm",placement:"bottom",children:e(q,{color:"var(--label-edit-confirm-icon)",height:20,width:20,name:u.name,disabled:z,className:""+(z?"disabled-confirm-icon":"confirm-icon"),onClick:_})}),h&&e(Y,{title:"Cancel",placement:"bottom",children:e(q,{color:"var(--label-edit-cancel-icon)",height:12,width:20,name:h.name,className:"cancel-icon",onClick:W,ref:R})})]})]}):e(Y,{title:E?.tooltipTitle?E?.tooltipTitle:"",placement:"bottom",children:o&&e("span",{className:"display-text",onDoubleClick:()=>{M||(P&&(clearTimeout(P),B(null)),b&&b(),x(!0),O(""))},role:"button",onClick:()=>{if(M)return;P&&(clearTimeout(P),B(null));const e=window.setTimeout(()=>{w&&w(),B(null)},1e3);B(e)},children:e(yn,{text:H,highlight:s})})}),Z&&L&&e(U,{as:"p",fontSize:8,className:"error-text",children:Z})]})},EA=e=>e?e.charAt(0)?.toUpperCase()+e?.slice(1)?.toLowerCase():"",bA=({label:t,text:r,highlightText:i,customError:o,customErrorCondition:l=!1,confirmIcon:s,cancelIcon:d,editIcon:u,dropdownData:f=[],isOpen:h=!1,confirmAction:C,onClick:p,nameTooltipTitle:m})=>{const[A,g]=c(h??!1),[v,y]=c(r),[w,E]=c(!0),[b,M]=c(f[0]?.value??""),[L,x]=c(""),[H,V]=c(!1),k=!(!L||!A),S=a(null),Z=a(null),O=()=>{const e=((e,t,n,r)=>e===t?"No changes were made.":e?e.length<3?"Please enter at least 3 characters.":r?n??"":"":"Text is required")(v,r,o,l);e&&A?x(e):(g(!1),x(""),C&&C(v,b))},z=()=>{y(r),M(f[0]?.value??""),g(!1),x(""),V(!1)};function N(e){"Enter"===e&&O(),"Escape"===e&&z()}return Zn([{key:"Enter",action:()=>N("Enter")},{key:"Escape",action:()=>N("Escape")}],S),n("div",{className:"ff-label-edit-text-field",ref:S,children:[n("div",A?{className:"ff-label-text-field",children:[e("div",{className:"ff-label-text-field-without-dropdown",children:e(Hi,{name:"input",label:t||"",disabled:!1,error:k,placeholder:"Enter your name",value:v,onChange:e=>{y(e.target.value),V(!0),x(""),E(!1)},className:"\n \n "+(H?"modified":""),type:"text"})}),n("div",{className:"ff-icon-container",children:[s&&e(Y,{title:"confirm",placement:"bottom",children:e(q,{color:s?.color??"var(--default-confirm-icon-color)",height:s?.height??20,disabled:w,width:s?.width??20,name:s?.name??"default-confirm-icon",className:`${s?.className??"default-confirm-class"} ${w?"disabled-confirm-icon":"confirm-icon"}`,onClick:O})}),d&&e(Y,{title:"cancel",placement:"bottom",children:e(q,{color:d?.color??"var(--label-edit-cancel-icon)",height:d?.height??12,width:d?.width??20,name:d?.name??"default-cancel-icon",className:d?.className??"cancel-icon",onClick:z,ref:Z})})]})]}:{className:"display-text-container",children:[m?e(Y,{title:m,children:e("span",{className:"display-text",onClick:p,children:e(yn,{text:v,highlight:i})})}):e("span",{className:"display-text",onClick:p,children:e(yn,{text:v,highlight:i})}),e(Y,{title:EA(u?.name??"Edit"),children:e(q,{color:u?.color??"var(--label-edit-cancel-icon)",height:u?.height??20,width:u?.width??20,name:u?.name??"edit",className:u?.className??"edit-icon",onClick:()=>{g(!0),x("")}})})]}),L&&A&&e(U,{as:"p",fontSize:8,className:"error-text",children:L})]})},MA="SET_DATA",LA="SET_CREATE_FORMULA_PARSER",xA="SELECT_ENTIRE_ROW",HA="SELECT_ENTIRE_COLUMN",VA="SELECT_ENTIRE_WORKSHEET",kA="SET_SELECTION",SA="SELECT",ZA="ACTIVATE",OA="SET_CELL_DATA",zA="SET_CELL_DIMENSIONS",NA="COPY",IA="CUT",TA="PASTE",DA="EDIT",FA="VIEW",RA="BLUR",PA="KEY_PRESS",BA="KEY_DOWN",jA="DRAG_START",_A="DRAG_END",qA="COMMIT",UA="BOLD",WA="ITALIC",XA="UNDERLINE_TYPE",QA="FONT_FAMILY",GA="FONT_SIZE",KA="TEXT_ALIGN",YA="BORDER_TYPE",JA="COLOR",$A="BACKGROUND_COLOR",eg="FORMATE_PAINTER",tg="ADD_ROW_TOP",ng="ADD_ROW_BOTTOM",rg="ADD_COLUMN_LEFT",ig="ADD_COLUMN_RIGHT",og="DELETE_ROW",ag="DELETE_COLUMN",lg="SET_ROW_HEIGHT",sg="SET_COLUMN_WIDTH",cg="SET_COLUMN_POSITION",dg="SET_AUTO_FILL",ug="UPDATE_COLUMN_DIMENSIONS",fg="SET_EDITABLE",hg="ON_MOUSE_UP";function Cg(e){return{type:hg,payload:{point:e}}}function pg(e){return{type:fg,payload:{editable:e}}}function mg(e,t){return{type:lg,payload:{row:e,height:t}}}function Ag(e,t){return{type:cg,payload:{column:e,width:t}}}function gg(e){return{type:UA,payload:{data:e}}}function vg(e){return{type:WA,payload:{data:e}}}function yg(e,t,n){return{type:YA,payload:{data:e,value:t,color:n}}}function wg(e){return{type:XA,payload:{data:e}}}function Eg(e,t){return{type:GA,payload:{data:e,value:t}}}function bg(e,t){return{type:QA,payload:{data:e,value:t}}}function Mg(e,t){return{type:KA,payload:{data:e,value:t}}}function Lg(e,t){return{type:JA,payload:{data:e,value:t}}}function xg(e,t){return{type:$A,payload:{data:e,value:t}}}function Hg(e){return{type:eg,payload:{data:e}}}function Vg(e){return{type:tg,row:e}}function kg(e){return{type:ng,row:e}}function Sg(e,t){return{type:rg,columnWidth:e,column:t}}function Zg(e,t){return{type:ig,columnWidth:e,column:t}}function Og(e){return{type:og,row:e}}function zg(e){return{type:ag,column:e}}function Ng(e){return{type:PA,payload:{event:e}}}function Ig(e){return{type:MA,payload:{data:e}}}function Tg(e){return{type:LA,payload:{createFormulaParser:e}}}function Dg(e){return{type:kA,payload:{selection:e}}}function Fg(e){return{type:ZA,payload:{point:e}}}function Rg(e,t){return{type:OA,payload:{active:e,data:t}}}function Pg(e,t){return{type:zA,payload:{point:e,dimensions:t}}}function Bg(e){return{type:TA,payload:{data:e}}}function jg(e){return{type:BA,payload:{event:e}}}function _g(){return{type:jA}}function qg(){return{type:_A}}function Ug(){return{type:NA}}function Wg(){return{type:IA}}function Xg(){return{type:DA}}function Qg(){return{type:RA}}function Gg(e,t){const n=t[e.row];if(void 0!==n)return n[e.column]}function Kg(e,t,n){const r=[...n],i=[...n[0]??[]];i.length<=e.column&&(i.length=e.column+1),r[0]=i;const o=[...n[e.row]??[]];return o[e.column]=t,r[e.row]=o,r}function Yg(e,t,n){let r=n[0];r||(r=[],n[0]=r);let i=n[e.row];i||(i=[],n[e.row]=i),r.length<=e.column&&(r.length=e.column+1),i[e.column]=t}const Jg={value:"",inputType:{type:"text"},readOnly:!1,style:{color:"#000000",backgroundColor:"#ffffff",borderColor:"#c9c9c9",textDecoration:"normal",borderRight:"1px solid var(--excel-header-border)",borderLeft:"1px solid var(--excel-header-border)",borderTop:"1px solid var(--excel-header-border)",borderBottom:"1px solid var(--excel-header-border)",fontSize:""+($g=9,1.33*$g+"px"),fontWeight:"normal",fontStyle:"normal",fontFamily:"Poppins",textAlign:"left"}};var $g;function ev(e,t){if(!nv(e,t))return t;const n=[...t],r=t[e.row];if(r){const t=[...r];t[e.column]=Jg,n[e.row]=t}return n}function*tv(e){for(const[t,n]of e.entries())for(const[e,r]of n.entries()){const n={row:t,column:e};yield[n,r]}}function nv(e,t){const n=t[0];return!!n&&(e.row>=0&&e.column>=0&&Number.isInteger(e.row)&&Number.isInteger(e.column)&&e.column<n.length&&e.row<t.length)}function rv(e){return{columns:ov(e),rows:iv(e)}}function iv(e){return e.length}function ov(e){const t=e[0];return t?t.length:0}function av(e){const t=rv(e);return{row:t.rows-1,column:t.columns-1}}class lv{start;end;constructor(e,t){this.start={row:Math.min(e.row,t.row),column:Math.min(e.column,t.column)},this.end={row:Math.max(e.row,t.row),column:Math.max(e.column,t.column)}}*[Symbol.iterator](){for(let e=this.start.row;e<=this.end.row;e++)for(let t=this.start.column;t<=this.end.column;t++)yield{row:e,column:t}}size(){return(this.end.row+1-this.start.row)*(this.end.column+1-this.start.column)}has(e){return e.row>=this.start.row&&e.column>=this.start.column&&e.row<=this.end.row&&e.column<=this.end.column}mask(e){return new lv({row:e.start.row>this.start.row?e.start.row:this.start.row,column:e.start.column>this.start.column?e.start.column:this.start.column},{row:e.end.row<this.end.row?e.end.row:this.end.row,column:e.end.column<this.end.column?e.end.column:this.end.column})}equals(e){return this.start.row===e.start.row&&this.start.column===e.start.column&&this.end.row===e.end.row&&this.end.column===e.end.column}}const sv={row:0,column:0};class cv{}class dv extends cv{toRange(e){return null}normalizeTo(e){return this}hasEntireRow(){return!1}hasEntireColumn(){return!1}size(){return 0}has(){return!1}equals(e){return e instanceof dv}}class uv extends cv{range;constructor(e){super(),this.range=e}toRange(e){return this.range}normalizeTo(e){const t=Av(e);return new uv(this.range.mask(t))}hasEntireRow(){return!1}hasEntireColumn(){return!1}size(e){const t=this.toRange(e);return t?t.size():0}has(e,t){const n=this.toRange(e);return null!==n&&n.has(t)}equals(e){return e instanceof uv&&this.range.equals(e.range)}}class fv extends cv{}class hv extends fv{toRange(e){return Av(e)}normalizeTo(){return this}hasEntireColumn(){return!0}hasEntireRow(){return!0}size(e){return ov(e)*iv(e)}has(){return!0}equals(e){return e instanceof hv}}class Cv extends fv{start;end;constructor(e,t){if(!gv(e))throw new vv("start");if(!gv(t))throw new vv("end");super(),this.start=Math.min(e,t),this.end=Math.max(e,t)}equals(e){return e instanceof Cv&&this.constructor===e.constructor&&this.start===e.start&&this.end===e.end}}class pv extends Cv{toRange(e){const t=av(e);return new lv({row:this.start,column:0},{row:this.end,column:t.column})}normalizeTo(e){const t=iv(e);return new pv(Math.max(this.start,0),Math.min(this.end,t-1))}hasEntireRow(e){return e>=this.start&&e<=this.end}hasEntireColumn(){return!1}size(e){return(this.end-this.start+1)*ov(e)}has(e,t){return t.row>=this.start&&t.row<=this.end}}class mv extends Cv{toRange(e){const t=av(e);return new lv({row:0,column:this.start},{row:t.row,column:this.end})}normalizeTo(e){const t=ov(e);return new mv(Math.max(this.start,0),Math.min(this.end,t-1))}hasEntireRow(){return!1}hasEntireColumn(e){return e>=this.start&&e<=this.end}size(e){return(this.end-this.start+1)*iv(e)}has(e,t){return t.column>=this.start&&t.column<=this.end}}function Av(e){const t=av(e);return new lv(sv,t)}function gv(e){return Number.isInteger(e)&&e>=0}class vv extends Error{constructor(e){super(`${e} is not a valid index. It must be 0 or a positive integer`)}}const yv="text/plain";function wv(e,t=0,n=1){const r=[];if(-1===Math.sign(e-t)){for(let i=t;i>e;i-=n)r.push(i);return r}for(let i=t;i<e;i+=n)r.push(i);return r}function Ev(e,t){return Boolean(e&&(r=e,(n=t).column===r.column&&n.row===r.row));var n,r}function bv(e){return{width:e.offsetWidth,height:e.offsetHeight,left:e.offsetLeft,top:e.offsetTop}}function Mv(e){return Object.keys(e).map(e=>Number(e)).sort((e,t)=>e-t)}function Lv(e,t,n){const r={},i=Mv(e);let o=0,a=!1;for(let l=0;l<i.length;l++){if(l===t){const e=r[l-1],t=e?e.left+e.width:0;r[l]={left:t,width:n},o=n,a=!0}const s=i[l];if(void 0===s)continue;const c=e[s];if(!c)continue;const d=a?l+1:l,u=a?c.left+o:c.left;r[d]={...c,left:u}}if(!a){const e=i.length>0?i[i.length-1]:void 0,o=void 0!==e?r[e]:void 0,a=o?o.left+o.width:0;r[t]={left:a,width:n}}return r}function xv(e,t,n){const r={},i=Mv(e);let o=0,a=!1;for(let l=0;l<i.length;l++){if(l===t){const e=r[l-1],t=e?e.top+e.height:0;r[l]={top:t,height:n},o=n,a=!0}const s=i[l];if(void 0===s)continue;const c=e[s];if(!c)continue;const d=a?l+1:l,u=a?c.top+o:c.top;r[d]={...c,top:u}}if(!a){const e=i.length>0?i[i.length-1]:void 0,o=void 0!==e?r[e]:void 0,a=o?o.top+o.height:0;r[t]={top:a,height:n}}return r}function Hv(e,t){const n={},r=Mv(e);let i=0;for(let o=0,a=0;o<r.length;o++){if(r[o]===t)continue;const l=r[o];if(void 0===l)continue;const s=e[l];s&&(n[a]={top:0===i?s.top:i,height:s.height},"number"==typeof n[a]?.top&&(i=(n[a]?.top??0)+s.height),a++)}return n}function Vv(e,t){const n={},r=Mv(e);let i=0;for(let o=0,a=0;o<r.length;o++){if(r[o]===t)continue;const l=r[o];if(void 0===l)continue;const s=e[l];s&&(n[a]={left:0===i?s.left:i,width:s.width},"number"==typeof n[a]?.left&&(i=(n[a]?.left??0)+s.width),a++)}return n}function kv(e,t,n){const r=100;let i=32;for(let n=0;n<e.row;n++)i+=(t?.[n]?t?.[n]?.height:32)||32;const o=(t?.[e.row]?t?.[e.row]?.height:32)||32;let a=60;for(let t=0;t<e.column;t++)a+=(n?.[t]?n?.[t]?.width:r)||r;return{top:i,height:o,left:a,width:(n?.[e.column]?n?.[e.column]?.width:r)||r}}function Sv(e,t,n){const r=kv(n.start,e,t);let i=kv(n.end,e,t);return void 0===i&&(i=function(e,t,n){const r=100;let i=4032;for(let n=0;n<e.row;n++)i+=(t?.[n]?t?.[n]?.height:32)||32;const o=(t?.[e.row]?t?.[e.row]?.height:32)||32;let a=60;for(let t=0;t<e.column;t++)a+=(n?.[t]?n?.[t]?.width:r)||r;return{top:i,height:o,left:a,width:(n?.[e.column]?n?.[e.column]?.width:r)||r}}(n.end,e,t)),r&&i&&{width:i.left+i.width-r.left,height:i.top+i.height-r.top,top:r.top+1,left:r.left+1}}function Zv(e,t,n,r){const i=r.toRange(n);return i?Sv(e,t,i):void 0}function Ov(e){return function(e,t){const n=[];for(const[r,i]of tv(t))Yg(r,e(i,r),n);return n}(e=>e?.value||"",e).map(e=>e.map(e=>{const t=String(e).replace(/"/g,'""');return si.test(t)?`"${t}"`:t}).join("\t")).join("\n")}function zv(e,t){return null!==e&&"view"===t&&Nv(e)}function Nv(e){return e.matches(":focus-within")}function Iv(e){return"string"==typeof e&&e.includes("\n")}const Tv=e=>`${1.33*e}px`,Dv=e=>parseFloat(e.replace("px",""))/1.33,Fv={value:"",inputType:{type:"text"},readOnly:!1,style:{color:"#000000",backgroundColor:"#ffffff",borderColor:"#c9c9c9",textDecoration:"normal",borderRight:"1px solid var(--excel-header-border)",borderLeft:"1px solid var(--excel-header-border)",borderTop:"1px solid var(--excel-header-border)",borderBottom:"1px solid var(--excel-header-border)",fontSize:`${Tv(9)}`,fontWeight:"normal",fontStyle:"normal",fontFamily:"Poppins",textAlign:"left"}},Rv=[{label:"Times New Roman",value:"Times New Roman"},{label:"Arial",value:"Arial"},{label:"fantasy",value:"fantasy"},{label:"cursive",value:"cursive"},{label:"Poppins",value:"Poppins"},{label:"Courier New",value:"Courier New"},{label:"Verdana",value:"Verdana"},{label:"Tahoma",value:"Tahoma"},{label:"Trebuchet MS",value:"Trebuchet MS"},{label:"Comic Sans MS",value:"Comic Sans MS"},{label:"Impact",value:"Impact"},{label:"Arial Black",value:"Arial Black"},{label:"Lucida Console",value:"Lucida Console"},{label:"Lucida Sans Unicode",value:"Lucida Sans Unicode"},{label:"Courier",value:"Courier"},{label:"Arial Rounded MT Bold",value:"Arial Rounded MT Bold"},{label:"Georgia",value:"Georgia"},{label:"sans-serif",value:"sans-serif"},{label:"serif",value:"serif"},{label:"monospace",value:"monospace"}],Pv=[5,6,8,9,10,12,14,16,18,20,22,24,26,28,32,36,40,48,56,72],Bv=e=>["dropDown","text"].includes(e?.inputType?.type??"text")&&!e?.readOnly;function jv(e){return{rowCount:e?.length??0,columnCount:e?.[0]?.length??0}}function _v(e){return"string"==typeof e&&e.startsWith("=")&&e.length>1}function qv(e){return e}function Uv(e){return`${e.row},${e.column}`}function Wv(e){const[t,n]=e.split(",");return{row:Number(t),column:Number(n)}}class Xv{set;constructor(e){this.set=e}static from(e){const t=new Set;for(const n of e)t.add(Uv(n));return new Xv(t)}has(e){return this.set.has(Uv(e))}get size(){return this.set.size}add(e){const t=new Set(this.set);return t.add(Uv(e)),new Xv(t)}delete(e){const t=new Set(this.set);return t.delete(Uv(e))?new Xv(t):this}difference(e){let t=this;for(const n of e)t=t.delete(n);return t}union(e){let t=this;for(const n of e)t=t.add(n);return t}*[Symbol.iterator](){for(const e of this.set)yield Wv(e)}}class Qv{forwards;constructor(e=new Map){this.forwards=e}static from(e){const t=new Map;for(const[n,r]of e)t.set(Uv(n),r);return new Qv(t)}set(e,t){const n=new Qv(new Map(this.forwards));return 0===t.size?(n.forwards.delete(Uv(e)),n):(n.forwards.set(Uv(e),t),n)}get(e){return this.forwards.get(Uv(e))||Xv.from([])}getBackwards(e){let t=Xv.from([]);for(const[n,r]of this.forwards)r.has(e)&&(t=t.add(Wv(n)));return t}getBackwardsRecursive(e,t=Xv.from([])){let n=this.getBackwards(e),r=t;for(const e of n)r.has(e)||(r=r.add(e),n=n.union(this.getBackwardsRecursive(e,r)));return n}hasCircularDependency(e){let t=Xv.from([]);const n=[e];for(;n.length>0;){const e=n.pop();if(!e)continue;if(t.has(e))return!0;t=t.add(e);const r=this.get(e);if(r)for(const e of r)n.push(e)}return!1}*[Symbol.iterator](){const e=new Set;for(const[t,n]of this.forwards){const r=Wv(t);e.add(t),yield[r,n];for(const t of n){const n=Uv(t);e.has(n)||this.forwards.has(n)||(e.add(n),yield[t,Xv.from([])])}}}*traverseBFSBackwards(){let e=Xv.from([]);const t=[];for(const[n,r]of this)0===r.size&&(e=e.add(n),t.push(n));for(;t.length>0;){const n=t.shift();if(!n)continue;yield n;const r=this.getBackwards(n);if(0!==r.size)for(const n of r)e.has(n)||0!==this.get(n).difference(e).size||(t.push(n),e=e.add(n))}}}class Gv{data;evaluatedData;referenceGraph;createFormulaParser;constructor(e,t,n,r){this.createFormulaParser=e,this.data=t,this.referenceGraph=n||function(){const e=[];return Qv.from(e)}(),this.evaluatedData=r||function(e,t){let n=e;for(const r of t.traverseBFSBackwards()){const t=Gg(r,e);if(t&&_v(t.value)){const e=Yv();n=Kg(r,{...t,value:e},n)}}return n}(t,this.referenceGraph)}}function Kv(e,t,n){const r=Kg(t,n,e.data),i=(_v(n.value),e.referenceGraph),o=function(e,t,n,r,i){if(n.hasCircularDependency(r)){let o=Xv.from([r]),a=Kg(r,{...i,value:"TODO"},e);for(const e of n.getBackwardsRecursive(r)){if(o.has(e))break;o=o.add(e);const n=Gg(e,t);n&&(a=Kg(e,{...n,value:"TODO"},a))}return a}let o=e;const a=_v(i.value)?"TODO":i.value,l={...i,value:a};o=Kg(r,l,o);for(const e of n.getBackwardsRecursive(r)){const n=Gg(e,t);if(!n)continue;const r=_v(n.value)?Yv():n.value;o=Kg(e,{...n,value:r},o)}return o}(e.evaluatedData,r,i,t,n);return new Gv(e.createFormulaParser,r,i,o)}function Yv(){return"TODO"}function Jv(e){if(6!==e.length)return!1;for(let t=1;t<e.length;t++)if(!"0123456789ABCDEFabcdef".includes(e[t]))return!1;return!0}function $v(e){return my(e)||!e.editable?e:{...e,mode:"edit"}}const ey=e=>(e=>e&&!e.readOnly)(e)&&"file"!==e?.inputType?.type?{...e,value:"",style:e?.style}:e,ty=e=>{if(e)return{...e,value:(e.value||"")+"\n",style:e.style}};function ny(e){if(!e.active)return e;const t=e.selected.toRange(e.model.data),n=[];let r=e.model.data;for(const i of t||[]){const t=Gg(i,e.model.data),o=ey(t);n.push({prevCell:t||null,nextCell:o||null}),r=Kg(i,o,r)}return{...e,model:new Gv(qv,r),...ay(n)}}function ry(e){if(!e.active)return e;const t=e.selected.toRange(e.model.data),n=[];let r=e.model.data;for(const i of t||[]){const t=Gg(i,e.model.data),o=ty(t);n.push({prevCell:t||null,nextCell:o||null}),r=Kg(i,o,r)}return{...e,mode:"edit",model:new Gv(qv,r),...ay(n)}}function iy(e){return{...e,active:null,copied:null,formattedStyle:{open:!1,style:void 0},selected:new dv}}function oy(e){return{...e,mode:"view"}}function ay(e){return{lastCommit:e}}const ly=(e,t)=>n=>{if(!n.active)return;const r=rv(n.model.data),i=n.active.column+t>=r.columns,o={row:n.active.row+e+(i?1:0),column:(n.active.column+t)%r.columns};return nv(o,n.model.data)?{...n,active:o,selected:new uv(new lv(o,o)),mode:"view"}:{...n,mode:"view"}},sy={ArrowUp:ly(-1,0),ArrowDown:ly(1,0),ArrowLeft:ly(0,-1),ArrowRight:ly(0,1),Tab:ly(0,1),Enter:$v,Backspace:function(e){if(!e.active)return e;if("view"===e.mode){return ny(e)}{const t=[];let n=e.model.data;const r=Gg(e.active,e.model.data),i=ey(r);return t.push({prevCell:r||null,nextCell:i||null}),n=Kg(e.active,i,n),{...e,mode:"edit",model:new Gv(qv,n),...ay(t)}}},Delete:ny,Escape:iy},cy={Escape:oy,Tab:sy.Tab,Enter:sy.ArrowDown,Delete:ny},dy={Tab:ly(0,-1)};var uy;!function(e){e.Left="Left",e.Right="Right",e.Top="Top",e.Bottom="Bottom"}(uy||(uy={}));const fy={ArrowUp:e=>({...e,selected:Ay(e.selected,e.active,e.model.data,uy.Top)}),ArrowDown:e=>({...e,selected:Ay(e.selected,e.active,e.model.data,uy.Bottom)}),ArrowLeft:e=>({...e,selected:Ay(e.selected,e.active,e.model.data,uy.Left)}),ArrowRight:e=>({...e,selected:Ay(e.selected,e.active,e.model.data,uy.Right)}),Tab:ly(0,-1)},hy={},Cy={};function py(e,t){const{key:n}=t;let r;if("edit"===e.mode)if(t.shiftKey&&"Enter"===n)r=sy;else{if(t.altKey&&"Enter"===n)return ry;r=t.shiftKey?dy:cy}else r=t.shiftKey&&t.metaKey?hy:t.shiftKey?fy:t.metaKey?Cy:sy;return r[n]}function my(e){const t=function(e){const t=e.active&&Gg(e.active,e.model.data);return t||null}(e);return Boolean(t?.readOnly)}function Ay(e,t,n,r){if(!t)return e;if(e instanceof uv){const i=function(e,t,n,r){const i=r===uy.Left||r===uy.Right?"column":"row",o=r===uy.Left||r===uy.Top?"start":"end",a="start"===o?-1:1,l=e.range.has({...t,[i]:t[i]+-1*a}),s=l?"start"===o?"end":"start":o,c=new lv(e.range.start,e.range.end);c[s][i]+=a;const d=new uv(c).normalizeTo(n);return d}(e,t,n,r);return i}return e instanceof mv?function(e,t,n,r){if(r===uy.Top||r===uy.Bottom)return e;const i=r===uy.Left?-1:1,o=r===uy.Left?"start":"end",a="start"===o?"end":"start",l={...e};(r===uy.Left?e.end>t.row:e.start<t.row)?l[a]=e[a]+i:l[o]=e[o]+i;return new mv(Math.max(l.start,0),Math.max(l.end,0)).normalizeTo(n)}(e,t,n,r):e instanceof pv?function(e,t,n,r){if(r===uy.Left||r===uy.Right)return e;const i=r===uy.Top?-1:1,o=r===uy.Top?"start":"end",a="start"===o?"end":"start",l={...e};(r===uy.Top?e.end>t.row:e.start<t.row)?l[a]=e[a]+i:l[o]=e[o]+i;return new pv(Math.max(l.start,0),Math.max(l.end,0)).normalizeTo(n)}(e,t,n,r):e}const gy=(e,t={},n)=>{const{selectedRow:r,selectedColumn:i,model:o,columnDimensions:a}=e,{column:l,columnWidth:s=100}=t,c=l??i;if(K(c))return e;const d="LEFT"===n?c:c+1,u=o.data.map(e=>{const t=[...e],n=e[c];return t.splice(d,0,(e=>{if("object"!=typeof e||null===e)return e;const{contextDisable:t,...n}=e;return{...n,value:"",readOnly:!1,style:{...e.style,borderBottom:"",borderLeft:"",borderRight:"",borderTop:""}}})(n)),t}),f=new Gv(o.createFormulaParser,u),h=r??0;return{...e,model:f,selectedRow:h,selectedColumn:d,active:{row:h,column:d},selected:new mv(d,d),columnDimensions:Lv(a,d,s)}},vy=(e,t={},n)=>{const{selectedRow:r,selectedColumn:i,model:o,rowDimensions:a}=e,{row:l}=t,s=l??r;if(K(s))return e;const c="TOP"===n?s:s+1,d=[...o.data],u=((e,t)=>e?e?.map(e=>"object"==typeof e&&null!==e?{...e,value:"",readOnly:!1,contextDisable:void 0,style:{...e.style,borderBottom:"",borderLeft:"",borderRight:"",borderTop:""}}:e):Array(t||0).fill(Fv))(o.data[s]||[],d[0]?.length);d.splice(c,0,u??[]);const f=new Gv(o.createFormulaParser,d),h=i??0;return{...e,model:f,selectedRow:c,selectedColumn:h,active:{row:c,column:h},selected:new pv(c,c),rowDimensions:xv(a,c,32)}},yy={active:null,mode:"view",rowDimensions:{},columnDimensions:{},lastChanged:null,hasPasted:!1,cut:!1,autoFill:{open:!1,cellValue:{value:"",style:{}}},dragging:!1,model:new Gv(qv,[]),selected:new dv,copied:null,lastCommit:null,selectedColumn:null,selectedRow:null,formattedStyle:{open:!1,style:void 0},editable:!1,ctrl:!0};function wy(e,t){switch(t.type){case ug:{const{minimumColumnWidth:n}=t.payload,r={...e.columnDimensions};return Object.keys(r).forEach(e=>{const t=parseInt(e);(r[t]?.width||0)!==n&&(r[t]={left:r[t]?.left||0,width:n})}),{...e,columnDimensions:r}}case fg:{const{editable:n}=t.payload;return{...e,editable:n}}case dg:{const{autofill:n}=t.payload,r=e.active;let i=Fv;return r&&(i=Gg({row:r.row,column:r.column},e.model.data)||i),{...e,autoFill:{open:n,cellValue:i}}}case tg:return vy(e,t,"TOP");case ng:return vy(e,t,"BOTTOM");case rg:return gy(e,t,"LEFT");case ig:return gy(e,t,"RIGHT");case og:{let{selectedRow:n,selectedColumn:r,model:i,rowDimensions:o,copied:a}=e;const{row:l}=t;if(K(n))return e;const s=l??n;let c=[...i.data];c.splice(s,1);const d=new Gv(i.createFormulaParser,c);let u=s>0?s-1:0;const f=null!==r?r:0,h=c.length>0?{row:u,column:f}:null,C=c.length>0?new pv(u,u):new dv;let p=a;return a&&a.start.row<=s&&a.end.row>=s&&(p=null),{...e,model:d,selectedRow:u,selectedColumn:f,selected:C,active:h,copied:p,rowDimensions:Hv(o,s)}}case ag:{const{selectedRow:n,selectedColumn:r,model:i,columnDimensions:o,copied:a}=e,{column:l}=t;if(K(l??r))return e;const s=l??r,c=i.data.map(e=>e.filter((e,t)=>t!==s)),d=new Gv(i.createFormulaParser,c),u=null!==n?n:0,f=s>0?s-1:0,h=c.length>0?{row:u,column:f}:null,C=c.length>0?new mv(f,f):new dv;let p=a;return a&&a.start.column<=s&&a.end.column>=s&&(p=null),{...e,model:d,selectedRow:u,selectedColumn:f,selected:C,active:h,copied:p,columnDimensions:Vv(o,s)}}case UA:{const t=e.selected.toRange(e.model.data),n=function(e,t,n){if(!t)return e;const{start:r,end:i}=t;let o=e,a=!1;for(let e=r.row;e<=i.row;e++){for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);if(r&&n&&!r.readOnly&&"bold"===r.style?.fontWeight){a=!0;break}}if(a)break}for(let e=r.row;e<=i.row;e++)for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);r&&n&&(r.readOnly||(o=Kg({row:e,column:t},{...r,style:{...r.style,fontWeight:a?"normal":"bold"}},o)))}return o}(e.model.data,t,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,n)}}case WA:{const t=e.selected.toRange(e.model.data),n=function(e,t,n){if(!t)return e;const{start:r,end:i}=t;let o=e,a=!1;for(let e=r.row;e<=i.row;e++){for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);if(r&&n&&!r.readOnly&&"italic"===r.style?.fontStyle){a=!0;break}}if(a)break}for(let e=r.row;e<=i.row;e++)for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);r&&n&&(r.readOnly||(o=Kg({row:e,column:t},{...r,style:{...r.style,fontStyle:a?"normal":"italic"}},o)))}return o}(e.model.data,t,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,n)}}case YA:{const{value:n,color:r}=t.payload,i=e.selected.toRange(e.model.data),o=function(e,t,n,r,i){if(!t)return e;let o=e;const{start:a,end:l}=t,s=(e,t)=>Gg({row:e,column:t},o),c=(e,t,n)=>{o=Kg({row:e,column:t},n,o)};for(let e=a.row;e<=l.row;e++)for(let t=a.column;t<=l.column;t++){const o=s(e,t);if(!o||!i||o.readOnly)continue;const a={...o,style:{...o.style}},l=s(e-1,t),d=s(e+1,t),u=s(e,t-1),f=s(e,t+1),h=`2px solid ${r}`,C="1px solid var(--excel-header-border)",p=e=>{switch(e){case"borderTop":l&&l.style?.borderBottom===h?a.style.borderTop="none":a.style.borderTop=h;break;case"borderBottom":d&&d.style?.borderTop===h?a.style.borderBottom="none":a.style.borderBottom=h;break;case"borderLeft":u&&u.style?.borderRight===h?a.style.borderLeft="none":a.style.borderLeft=h;break;case"borderRight":f&&f.style?.borderLeft===h?a.style.borderRight="none":a.style.borderRight=h}};switch(n){case"border-all-sides":p("borderTop"),p("borderBottom"),p("borderLeft"),p("borderRight");break;case"border-none":if(a.style={...a.style,borderRight:C,borderLeft:C,borderTop:C,borderBottom:C},l){const n={...l,style:{...l.style}};"none"===n.style.borderBottom&&(n.style.borderBottom=h,c(e-1,t,n))}if(d){const n={...d,style:{...d.style}};"none"===n.style.borderTop&&(n.style.borderTop=h,c(e+1,t,n))}if(u){const n={...u,style:{...u.style}};"none"===n.style.borderRight&&(n.style.borderRight=h,c(e,t-1,n))}if(f){const n={...f,style:{...f.style}};"none"===n.style.borderLeft&&(n.style.borderLeft=h,c(e,t+1,n))}break;case"border-right":p("borderRight");break;case"border-left":p("borderLeft");break;case"border-top":p("borderTop");break;case"border-bottom":p("borderBottom")}c(e,t,a)}return o}(e.model.data,i,n,r,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,o)}}case XA:{const t=e.selected.toRange(e.model.data),n=function(e,t,n){if(!t)return e;const{start:r,end:i}=t;let o=e,a=!1;for(let e=r.row;e<=i.row;e++){for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);if(r&&n&&!r.readOnly&&"underline"===r.style?.textDecoration){a=!0;break}}if(a)break}for(let e=r.row;e<=i.row;e++)for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);r&&n&&(r.readOnly||(o=Kg({row:e,column:t},{...r,style:{...r.style,textDecoration:a?"none":"underline"}},o)))}return o}(e.model.data,t,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,n)}}case GA:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;const i=Number(n);if(isNaN(i))return e;const o=Tv(i),{start:a,end:l}=t;let s=e;for(let e=a.row;e<=l.row;e++)for(let t=a.column;t<=l.column;t++){const n=Gg({row:e,column:t},s);n&&r&&(n.readOnly||(s=Kg({row:e,column:t},{...n,style:{...n.style,fontSize:o}},s)))}return s}(e.model.data,r,n,e.editable),o=new Gv(e.model.createFormulaParser,i);let a={...e.rowDimensions};if(e.active&&"edit"!==e.mode){const t=e.active.row,n=i[t];if(n){let e=32;n.forEach(t=>{if(!t)return;const n=t.style?.fontSize?parseInt(t.style.fontSize.toString().replace("px","")):9,r=Math.max(1.2*n,18),i=(["file","dropDown"].includes(t?.inputType?.type??"")?0:String(t.value).split(" ").length)+(String(t.value).split("\n").length-1);e=Math.max(e,r*i)}),a[t]={...a[t]||{top:0,height:32},height:e}}}else if(r)for(let e=r.start.row;e<=r.end.row;e++){const t=i[e];if(!t)continue;let n=32;t.forEach(e=>{if(!e)return;const t=e.style?.fontSize?parseInt(e.style.fontSize.toString().replace("px","")):9,r=Math.max(1.2*t,18),i=(["file","dropDown"].includes(e?.inputType?.type??"")?0:String(e.value).split(" ").length)+(String(e.value).split("\n").length-1);n=Math.max(n,r*i)}),a[e]={...a[e]||{top:0,height:32},height:n}}return{...e,model:o,rowDimensions:a}}case QA:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;const{start:i,end:o}=t;let a=e;for(let e=i.row;e<=o.row;e++)for(let t=i.column;t<=o.column;t++){const i=Gg({row:e,column:t},a);i&&r&&(i.readOnly||(a=Kg({row:e,column:t},{...i,style:{...i.style,fontFamily:n}},a)))}return a}(e.model.data,r,n,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,i)}}case KA:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;const{start:i,end:o}=t;let a=e;for(let e=i.row;e<=o.row;e++)for(let t=i.column;t<=o.column;t++){const i=Gg({row:e,column:t},a);i&&r&&(i.readOnly||(a=Kg({row:e,column:t},{...i,style:{...i.style,textAlign:n}},a)))}return a}(e.model.data,r,n,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,i)}}case JA:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;const{start:i,end:o}=t;let a=e;const l=Jv(n)?`#${n}`:n;for(let e=i.row;e<=o.row;e++)for(let t=i.column;t<=o.column;t++){const n=Gg({row:e,column:t},a);n&&r&&(n.readOnly||(a=Kg({row:e,column:t},{...n,style:{...n.style,color:l}},a)))}return a}(e.model.data,r,n,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,i)}}case $A:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;if(t){const{start:i,end:o}=t;let a=e;const l=Jv(n)?`#${n}`:n;for(let e=i.row;e<=o.row;e++)for(let t=i.column;t<=o.column;t++){const n=Gg({row:e,column:t},a);n&&r&&(n.readOnly||(a=Kg({row:e,column:t},{...n,style:{...n.style,backgroundColor:l}},a)))}return a}return e}(e.model.data,r,n,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,i)}}case eg:{if(!e.editable)return e;const t=function(e,t){if(!t)return;const{row:n,column:r}=t,i=Gg({row:n,column:r},{...e});return i&&i.style?i.style:void 0}(e.model.data,e.active),n=e.selected.toRange(e.model.data);return e.formattedStyle.open?{...e,selected:new dv,active:e.copied?.start||null,copied:null,formattedStyle:{open:!1,style:void 0}}:{...e,selected:new dv,active:null,copied:n,formattedStyle:{open:!0,style:t}}}case MA:{const{data:n}=t.payload,r=e.active&&nv(e.active,n)?e.active:null,i=e.selected.normalizeTo(n);return{...e,model:new Gv(e.model.createFormulaParser,n),active:r,selected:i}}case LA:{const{createFormulaParser:n}=t.payload;return{...e,model:new Gv(n,e.model.data)}}case xA:{const{row:n,extend:r}=t.payload,{active:i}=e,o=new pv(r&&i?i.row:n,n),a=r&&i?i:{...sv,row:n};return{...e,selected:o,active:a,mode:"view",selectedColumn:null,selectedRow:n}}case HA:{const{column:n,extend:r}=t.payload,{active:i}=e,o=new mv(r&&i?i.column:n,n),a=r&&i?i:{...sv,column:n};return{...e,selected:o,active:a,mode:"view",selectedColumn:n,selectedRow:null}}case VA:return{...e,selected:new hv,active:sv,mode:"view"};case kA:{const{selection:n}=t.payload,r=n.toRange(e.model.data),i=e.active&&n.has(e.model.data,e.active)?e.active:r?.start;return{...e,selected:n,active:i||null,mode:"view"}}case SA:{const{point:n}=t.payload;return e.active&&!Ev(e.active,n)?{...e,selected:new uv(new lv(n,e.active)),mode:"view"}:e}case ZA:{const{point:n}=t.payload;return{...e,selected:new uv(new lv(n,n)),active:n,mode:Ev(e.active,n)&&e.editable?"edit":"view"}}case OA:{const{active:n,data:r}=t.payload;return my(e)||!e.editable?e:{...e,model:Kv(e.model,n,r),lastChanged:n}}case zA:{const{point:n,dimensions:r}=t.payload,i=e.rowDimensions[n.row],o=e.columnDimensions[n.column];return i&&o&&i.top===r.top&&i.height===r.height&&o.left===r.left&&o.width===r.width?e:{...e,rowDimensions:{...e.rowDimensions,[n.row]:{top:r.top,height:r.height}},columnDimensions:{...e.columnDimensions,[n.column]:{left:r.left,width:r.width}}}}case NA:case IA:{const n=e.selected.toRange(e.model.data);return{...e,copied:n,cut:t.type===IA,hasPasted:!1}}case TA:{const{data:n}=t.payload,{active:r}=e;if(!r||!e.editable)return e;const i=function(e,t,n="\t",r=/\r\n|\n|\r/){return e.replace(/"([^"]*?)"/g,(e,t)=>t.replace(/\n/g,"\\n")).split(r).map(e=>e.split(n).map(e=>e.replace(/\\n/g,"\n")).map(t))}(n,e=>({value:e})),o=rv(i),a=e.selected.toRange(e.model.data);let l=null;e.cut&&e.copied&&(l=new lv(r,{row:r.row+o.rows-1,column:r.column+o.columns-1}));const s=e=>!!l&&(e.row>=l.start.row&&e.row<=l.end.row&&e.column>=l.start.column&&e.column<=l.end.column);if(a&&1===o.rows&&1===o.columns){const t=Gg({row:0,column:0},i);let n=e.model.data;if(e.cut&&e.copied)for(const t of e.copied)s(t)||(n=ev(t,n));const r=[];for(const i of a||[]){const o=Gg(i,e.model.data)||null,a={...o,value:t?.value};r.push({prevCell:o||Fv,nextCell:Fv}),Bv(o)&&(n=Kg(i,a,n))}return{...e,model:new Gv(qv,n),copied:null,cut:!1,hasPasted:!0,mode:"view",lastCommit:r}}const c={rows:r.row+o.rows,columns:r.column+o.columns},d=function(e,t){const{rows:n,columns:r}=rv(e);if(n>=t.rows&&r>=t.columns)return e;const i={rows:t.rows>n?t.rows:n,columns:t.columns>r?t.columns:r};let o=[...e];if(i.columns>r){const e=i.columns-r;o=o.map(t=>[...t,...Array(e).fill(Jg)])}if(i.rows>n){const e=i.rows-n,t=Array(i.columns).fill(Jg);o=[...o,...Array(e).fill(t)]}return o}(e.model.data,c);let u={data:d,commit:[]};for(const[t,n]of tv(i)){let i=u.commit||[];const o={row:t.row+r.row,column:t.column+r.column};let a=u.data;if(e.cut&&e.copied){const r={row:t.row+e.copied.start.row,column:t.column+e.copied.start.column};s(r)||(a=ev(r,u.data)),i=[...i,{prevCell:n||null,nextCell:null}]}nv(o,d)||(u={data:a,commit:i});const l=Gg(o,a)||null;i=[...i,{prevCell:l,nextCell:n||null}],Bv(l)&&(u.data=Kg(o,{...l,value:n?.value??""},a),u.commit=i)}return{...e,model:new Gv(qv,u.data),selected:new uv(new lv(r,{row:r.row+o.rows-1,column:r.column+o.columns-1})),copied:null,cut:!1,hasPasted:!0,mode:"view",lastCommit:u.commit}}case DA:return $v(e);case FA:return oy(e);case"CLEAR":return ny(e);case RA:return iy(e);case PA:{const{event:n}=t.payload;if(my(e)||n.metaKey||!e.editable)return e;if("view"===e.mode&&e.active){const t=e.selected.toRange(e.model.data);return 1===t?.size()?$v(ny(e)):$v(e)}return e}case BA:{const{event:n}=t.payload;if(n.ctrlKey)return{...e,ctrl:!e.ctrl};if(my(e)||n.metaKey||!e.editable)return e;const r=py(e,n);return r?{...e,...r(e,n)}:e}case lg:{const{row:n,height:r}=t.payload,i=e.rowDimensions[n]||{top:0};let o=e.model.data;if(o[n]){const e=o?.[n]?.length;for(let t=0;t<e;t++){const e={row:n,column:t},i=Gg(e,o)||Fv;o=Kg(e,{...i,style:{...i.style,height:r}},o)}}const a=new Gv(e.model.createFormulaParser,o);return{...e,rowDimensions:{...e.rowDimensions,[n]:{top:i.top,height:r}},model:a}}case sg:{const{column:n,width:r}=t.payload,i=e.columnDimensions[n]||{left:0};if(!e.model.data)return{...e,columnDimensions:{...e.columnDimensions,[n]:{left:i.left,width:r}}};let o=e.model.data??[];for(let e=0;e<o.length;e++)if(o[e]&&o?.[e]?.length>n){const t={row:e,column:n},i=Gg(t,o)??Fv;o=Kg(t,{...i,style:{...i.style??{},width:r}},o)}const a=new Gv(e.model.createFormulaParser,o);return{...e,columnDimensions:{...e.columnDimensions,[n]:{left:i.left,width:r}},model:a}}case cg:{const{column:n,width:r}=t.payload,i=e.columnDimensions[n]||{left:0};return{...e,columnDimensions:{...e.columnDimensions,[n]:{left:i.left,width:r}}}}case jA:return{...e,dragging:!0};case hg:{const{point:n}=t.payload;let r=e.model.data;return!e.dragging&&e.formattedStyle.open&&(r=function(e,t,n){if(!n||!t.open)return e;let r=e;const i=Gg(n,r);i&&!i.readOnly&&(r=Kg(n,{...i,style:t.style},r));return r}(e.model.data,e.formattedStyle,e.active)),{...e,copied:null,model:new Gv(e.model.createFormulaParser,r),formattedStyle:{open:!1,style:void 0},active:n}}case _A:{const t=e.selected.toRange(e.model.data),n=e.active;let r=e.model.data;if(e.formattedStyle.open&&(r=function(e,t,n){if(!t||!n.open)return e;const{start:r,end:i}=t;let o=e;for(let e=r.row;e<=i.row;e++)for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);r&&(r.readOnly||(o=Kg({row:e,column:t},{...r,style:n.style},o)))}return o}(e.model.data,t,e.formattedStyle)),e.autoFill.open&&e.editable&&t){r=function(e,t,n,r,i){if(!t)return e;const{start:o,end:a}=t,l=o.row-a.row,s=o.column-a.column;let c={row:0,column:0},d={row:0,column:0};Math.abs(l)>Math.abs(s)?(c={row:Math.min(o.row,a.row),column:r?.column??o.column},d={row:Math.max(o.row,a.row),column:r?.column??o.column}):(c={row:r?.row??o.row,column:Math.min(o.column,a.column)},d={row:r?.row??o.row,column:Math.max(o.column,a.column)});let u=e;const f=String(n.value??""),h=[...f.matchAll(/(-?\d+)/g)],C=["dropDown"].includes(n?.inputType?.type||"");for(let e=c.row;e<=d.row;e++)for(let t=c.column;t<=d.column;t++){const o=Gg({row:e,column:t},u);if(!o||o.readOnly)continue;const a=["file","dropDown"].includes(o?.inputType?.type||""),d=["file"].includes(o?.inputType?.type||"");if(!C&&a)continue;if(C&&d)continue;let p=f;if(!i&&h.length>0){let n=0;n=Math.abs(l)>Math.abs(s)?e-(r?.row??c.row):t-(r?.column??c.column);let i=0;p=p.replace(/(-?\d+)/g,()=>{const e=h[i++];return e?(parseInt(e?.[1]??"",10)+n).toString():""})}u=Kg({row:e,column:t},{...o,style:n.style,value:p,inputType:n.inputType},u)}return u}(e.model.data,t,e.autoFill.cellValue,n,e.ctrl);let{start:i,end:o}=t;const a=i.row-o.row,l=i.column-o.column;let s={row:0,column:0},c={row:0,column:0};return Math.abs(a)>Math.abs(l)?(s={row:Math.min(i.row,o.row),column:n?.column??0},c={row:Math.max(i.row,o.row),column:n?.column??0}):(s={row:n?.row??0,column:Math.min(i.column,o.column)},c={row:n?.row??0,column:Math.max(i.column,o.column)}),{...e,dragging:!1,autoFill:{open:!1,cellValue:{value:"",style:{}}},formattedStyle:{open:!1,style:void 0},model:new Gv(e.model.createFormulaParser,r),selected:new uv(new lv(s,c))}}return{...e,dragging:!1,autoFill:{open:!1,cellValue:{value:"",style:{}}},formattedStyle:{open:!1,style:void 0},model:new Gv(e.model.createFormulaParser,r)}}case qA:{const{changes:n}=t.payload;return{...e,...ay(n)}}default:throw new Error("Unknown action")}}var Ey,by={exports:{}},My={};var Ly,xy,Hy={};
27
+ */function Fm(){return Nm||(Nm=1,"production"===process.env.NODE_ENV?Zm.exports=function(){if(Sm)return Om;Sm=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,p=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,A=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case s:case c:case r:case o:case i:case u:return e;default:switch(e=e&&e.$$typeof){case l:case d:case C:case h:case a:return e;default:return f}}case n:return f}}}function y(e){return v(e)===c}return Om.AsyncMode=s,Om.ConcurrentMode=c,Om.ContextConsumer=l,Om.ContextProvider=a,Om.Element=t,Om.ForwardRef=d,Om.Fragment=r,Om.Lazy=C,Om.Memo=h,Om.Portal=n,Om.Profiler=o,Om.StrictMode=i,Om.Suspense=u,Om.isAsyncMode=function(e){return y(e)||v(e)===s},Om.isConcurrentMode=y,Om.isContextConsumer=function(e){return v(e)===l},Om.isContextProvider=function(e){return v(e)===a},Om.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Om.isForwardRef=function(e){return v(e)===d},Om.isFragment=function(e){return v(e)===r},Om.isLazy=function(e){return v(e)===C},Om.isMemo=function(e){return v(e)===h},Om.isPortal=function(e){return v(e)===n},Om.isProfiler=function(e){return v(e)===o},Om.isStrictMode=function(e){return v(e)===i},Om.isSuspense=function(e){return v(e)===u},Om.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===o||e===i||e===u||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===h||e.$$typeof===a||e.$$typeof===l||e.$$typeof===d||e.$$typeof===m||e.$$typeof===A||e.$$typeof===g||e.$$typeof===p)},Om.typeOf=v,Om}():Zm.exports=(zm||(zm=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,p=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,A=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var p=e.type;switch(p){case s:case c:case r:case o:case i:case u:return p;default:var m=p&&p.$$typeof;switch(m){case l:case d:case C:case h:case a:return m;default:return f}}case n:return f}}}var y=s,w=c,E=l,b=a,M=t,L=d,x=r,H=C,V=h,k=n,S=o,Z=i,O=u,z=!1;function N(e){return v(e)===c}Dm.AsyncMode=y,Dm.ConcurrentMode=w,Dm.ContextConsumer=E,Dm.ContextProvider=b,Dm.Element=M,Dm.ForwardRef=L,Dm.Fragment=x,Dm.Lazy=H,Dm.Memo=V,Dm.Portal=k,Dm.Profiler=S,Dm.StrictMode=Z,Dm.Suspense=O,Dm.isAsyncMode=function(e){return z||(z=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),N(e)||v(e)===s},Dm.isConcurrentMode=N,Dm.isContextConsumer=function(e){return v(e)===l},Dm.isContextProvider=function(e){return v(e)===a},Dm.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Dm.isForwardRef=function(e){return v(e)===d},Dm.isFragment=function(e){return v(e)===r},Dm.isLazy=function(e){return v(e)===C},Dm.isMemo=function(e){return v(e)===h},Dm.isPortal=function(e){return v(e)===n},Dm.isProfiler=function(e){return v(e)===o},Dm.isStrictMode=function(e){return v(e)===i},Dm.isSuspense=function(e){return v(e)===u},Dm.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===o||e===i||e===u||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===h||e.$$typeof===a||e.$$typeof===l||e.$$typeof===d||e.$$typeof===m||e.$$typeof===A||e.$$typeof===g||e.$$typeof===p)},Dm.typeOf=v}()),Dm)),Zm.exports}var Rm=function(){if(Tm)return Im;Tm=1;var e=Fm(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function o(n){return e.isMemo(n)?r:i[n.$$typeof]||t}i[e.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[e.Memo]=r;var a=Object.defineProperty,l=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,c=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,u=Object.prototype;return Im=function e(t,r,i){if("string"!=typeof r){if(u){var f=d(r);f&&f!==u&&e(t,f,i)}var h=l(r);s&&(h=h.concat(s(r)));for(var C=o(t),p=o(r),m=0;m<h.length;++m){var A=h[m];if(!(n[A]||i&&i[A]||p&&p[A]||C&&C[A])){var g=c(r,A);try{a(t,A,g)}catch(e){}}}}return t},Im}(),Pm=S(Rm);function Bm(){return Bm=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bm.apply(this,arguments)}var jm={},_m=0;var qm="onloadcallback";function Um(){return"undefined"!=typeof window&&window.recaptchaOptions||{}}var Wm=function(e,t){return t=t||{},function(n){var r=n.displayName||n.name||"Component",i=function(r){var i,o;function a(e,t){var n;return(n=r.call(this,e,t)||this).state={},n.__scriptURL="",n}o=r,(i=a).prototype=Object.create(o.prototype),i.prototype.constructor=i,i.__proto__=o;var l=a.prototype;return l.asyncScriptLoaderGetScriptLoaderID=function(){return this.__scriptLoaderID||(this.__scriptLoaderID="async-script-loader-"+_m++),this.__scriptLoaderID},l.setupScriptURL=function(){return this.__scriptURL="function"==typeof e?e():e,this.__scriptURL},l.asyncScriptLoaderHandleLoad=function(e){var t=this;this.setState(e,function(){return t.props.asyncScriptOnLoad&&t.props.asyncScriptOnLoad(t.state)})},l.asyncScriptLoaderTriggerOnScriptLoaded=function(){var e=jm[this.__scriptURL];if(!e||!e.loaded)throw new Error("Script is not loaded.");for(var n in e.observers)e.observers[n](e);delete window[t.callbackName]},l.componentDidMount=function(){var e=this,n=this.setupScriptURL(),r=this.asyncScriptLoaderGetScriptLoaderID(),i=t,o=i.globalName,a=i.callbackName,l=i.scriptId;if(o&&void 0!==window[o]&&(jm[n]={loaded:!0,observers:{}}),jm[n]){var s=jm[n];return s&&(s.loaded||s.errored)?void this.asyncScriptLoaderHandleLoad(s):void(s.observers[r]=function(t){return e.asyncScriptLoaderHandleLoad(t)})}var c={};c[r]=function(t){return e.asyncScriptLoaderHandleLoad(t)},jm[n]={loaded:!1,observers:c};var d=document.createElement("script");for(var u in d.src=n,d.async=!0,t.attributes)d.setAttribute(u,t.attributes[u]);l&&(d.id=l);var f=function(e){if(jm[n]){var t=jm[n].observers;for(var r in t)e(t[r])&&delete t[r]}};a&&"undefined"!=typeof window&&(window[a]=function(){return e.asyncScriptLoaderTriggerOnScriptLoaded()}),d.onload=function(){var e=jm[n];e&&(e.loaded=!0,f(function(t){return!a&&(t(e),!0)}))},d.onerror=function(){var e=jm[n];e&&(e.errored=!0,f(function(t){return t(e),!0}))},document.body.appendChild(d)},l.componentWillUnmount=function(){var e=this.__scriptURL;if(!0===t.removeOnUnmount)for(var n=document.getElementsByTagName("script"),r=0;r<n.length;r+=1)n[r].src.indexOf(e)>-1&&n[r].parentNode&&n[r].parentNode.removeChild(n[r]);var i=jm[e];i&&(delete i.observers[this.asyncScriptLoaderGetScriptLoaderID()],!0===t.removeOnUnmount&&delete jm[e])},l.render=function(){var e=t.globalName,r=this.props;r.asyncScriptOnLoad;var i=r.forwardedRef,o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(r,["asyncScriptOnLoad","forwardedRef"]);return e&&"undefined"!=typeof window&&(o[e]=void 0!==window[e]?window[e]:void 0),o.ref=i,p(n,o)},a}(E),a=o(function(e,t){return p(i,Bm({},e,{forwardedRef:t}))});return a.displayName="AsyncScriptLoader("+r+")",a.propTypes={asyncScriptOnLoad:Mm.func},Pm(a,n)}}(function(){var e=Um(),t=e.useRecaptchaNet?"recaptcha.net":"www.google.com";return e.enterprise?"https://"+t+"/recaptcha/enterprise.js?onload="+qm+"&render=explicit":"https://"+t+"/recaptcha/api.js?onload="+qm+"&render=explicit"},{callbackName:qm,globalName:"grecaptcha",attributes:Um().nonce?{nonce:Um().nonce}:{}})(km);const Xm=Wm,Qm=o(({onVerify:t,className:r="",error:i,sitekey:o,...a},l)=>{const[s,d]=c(null),u=i||s;return n("div",{className:I("ff-recaptcha-wrapper",r),children:[e(Xm,{ref:l,sitekey:o,onChange:e=>{e?(d(null),t(e)):d("Please complete the CAPTCHA")},...a}),u&&e("div",{className:"ff-recaptcha-error",children:e(U,{fontSize:12,children:u})})]})}),Gm={margin:6,optionHeight:32,selectInputHeight:38,dropDownWrapperPadding:0},Km=({onSelectBlur:r,onSelectOptionSelector:i,dropdownPosition:o,options:s=[],optionZIndex:u=100,inputRef:f,webServiceClick:h=()=>{},accessibilityClick:C=()=>{},containerWidth:p,loadMoreOptions:m,chipRef:A,isWebservice:g=!0,isAccessibility:v=!1,dropDownMessage:y=""})=>{const[w,E]=c(null),[b,M]=c(""),L=d(Q),x=L?.currentTheme,H=a(null),[V,k]=c(-1);J(H,r,[f,A]);const{positionX:S,positionY:Z,width:O,fromBottom:z}=o,{margin:N,optionHeight:T,selectInputHeight:D,dropDownWrapperPadding:F}=Gm,R=e=>{let t="",n="";return"NLP"===e?(t="NLP",n="ff-nlp"):"STEP_GROUP"===e?(t="SG",n="ff-sg"):"PROGRAM_ELEMENTS"===e?(t="PE",n="ff-pe"):"WORKBENCH_REQUEST"===e?(t="WS",n="ff-ws"):(t="--",n="nlp-default"),{label:t,className:n}},P=({platform:n,nlpType:r})=>"NLP"===r?e(q,"Web"===n?{name:"web_icon",height:10,width:10}:"Android"===n?{name:"android_icon",height:10,width:10}:"iOS"===n?{name:"ios_icon",height:10,width:10,color:"var(--dotted-border-color)"}:"Generic"===n?{name:"mobile_icon",height:10,width:10}:{name:"common_nlp",height:10,width:10}):"WORKBENCH_REQUEST"===r&&"Webservice"===n?e(q,{name:"web_service_icon",height:8,width:8}):e(t,{});Sn(["ff-nlp-dropdown-pagination"],{root:document.getElementById("ff-nlp-dropdown-options-wrapper"),rootMargin:"0px",threshold:.1,onIntersect:(e,t)=>{e.isIntersecting&&m&&m()}}),l(()=>{if(V>=0&&V<s.length){const e=s[V];E(e),M("show")}else V>=s.length&&(E(null),M(""),k(-1));const e=e=>{if(s.length)switch(e.key){case"ArrowDown":e.preventDefault(),k(e=>e<s.length-1?e+1:0);break;case"ArrowUp":e.preventDefault(),k(e=>e>0?e-1:s.length-1);break;case"Enter":V>=0&&s[V]&&i(s[V])}};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[s,V]),l(()=>{if(V<0)return;const e=document.getElementById(`ff-nlp-option-${V}`);e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})},[V]),l(()=>{if(!s?.length)return;const e=H.current;if(!e)return;const t=t=>{e.contains(t.target)||(t.stopPropagation(),t.preventDefault())};return document.body.addEventListener("wheel",t,{passive:!1}),document.body.addEventListener("touchmove",t,{passive:!1}),()=>{document.body.removeEventListener("wheel",t),document.body.removeEventListener("touchmove",t)}},[s]);const B=e=>e?.searchName||e?.displayName||e?.desc||e?.name||e?.nlpName||"---";return e("div",{className:"ff-nlp-dropdown-wrapper",children:n("div",{ref:H,style:{...(()=>{let e;return e=K(s)||s.length>0?5*T+2*F:s.length*T+2*F,z>e+N+80?{left:S,top:Z,width:O,zIndex:u}:{zIndex:u,left:S,width:O,top:Z-D-92-e-N}})(),width:p},className:I("ff-nlp-options-wrapper",x),onMouseLeave:()=>M("hide"),children:[n("div",{className:"ff-nlp-options-wrapper-main",children:[e("div",{className:"ff-nlp-options-primary-wrapper",id:"ff-nlp-dropdown-options-wrapper",children:K(s)?e(U,{textAlign:"center",lineHeight:"32px",as:"p",color:"var(--ff-nlp-text-color)",className:"ff-nlp-no-option",children:K(y)?"No Results Found":y}):n(t,{children:[s.map((t,r)=>e("div",{onMouseEnter:()=>{E(t),M("show")},id:`ff-nlp-option-${r}`,children:e("div",{onMouseEnter:()=>k(r),onClick:()=>i(t),onKeyDown:e=>{"Enter"===e.key&&i(t)},children:n(U,{as:"div",lineHeight:"30px",fontSize:12,className:I("ff-nlp-option",x,{"ff-nlp-option--selected":V===r}),children:[e(Y,{title:t.platform,children:e("span",{children:e(U,{className:`nlp-categories ${R(t.nlpType).className}`,fontWeight:"regular",fontSize:8,lineHeight:"32px",children:R(t.nlpType).label})})}),e("span",{children:P(t)}),B(t)]})})},`ff-nlp-option-${r}`)),e("div",{id:"ff-nlp-dropdown-pagination"})]})}),n("div",{className:I("show"===b?"ff-nlp-web-service-div":"ff-nlp-primary-web-service-div",{"ff-nlp-web-service-div--gap":v}),children:[g&&e(kp,{iconName:"plus_user_icon",label:"Web Service",onClick:()=>{r(),h()}}),v&&e(kp,{iconName:"plus_user_icon",label:"Accessibility",onClick:()=>{r(),C()}})]})]}),e("div",{className:"show"===b?"ff-nlp-data-show":"ff-nlp-data-hide",children:n("div",{className:"ff-nlp-data-side-menu",children:[w?.videoSrc&&n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:10,children:["Video",e("div",{className:"nlp-details ",children:e("video",{src:w.videoSrc,controls:!0,className:"nlp-video-player",width:"100%",children:"Your browser does not support the video tag."})})]}),n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["STEP_GROUP"===w?.nlpType?"Step Group Details":"NLP Details",e(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:B(w)})]}),n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["Description",e(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:w?.description||"--"})]}),"STEP_GROUP"===w?.nlpType&&e(t,{children:n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["Path",e(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:w?.path?w?.path:"---"})]})}),e(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:"Inputs"}),w?.stepInputs?.length?w.stepInputs.map((t,r)=>{const i=t.type?t?.type?.split(".")?.pop():"--";return e("div",{children:n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["Input",r+1,n(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:["type: ",i]}),n(U,{className:"nlp-details",fontWeight:"regular",fontSize:12,children:["name: ",t.name||"--"]})]})},r)}):e("div",{className:"nlp-details",children:"--"}),n(U,{className:"nlp-details-header",fontWeight:"semi-bold",fontSize:12,children:["Output",e(U,{className:"nlp-details ",fontWeight:"regular",fontSize:12,children:w?.returnType||"--"})]})]})})]})})},Ym=o(({chipOptionList:t,selectedChips:r,optionZIndex:i=0,inputRef:o,ChipsAccordionWidth:s},d)=>{const[f,h]=c([]),[C,p]=c(!1),[m,A]=c({left:0,top:0}),[g,v]=c("down"),y=a(null);w(d,()=>y.current);const E=So(y,C);l(()=>{K(t)||h(t)},[t]);const b=a(null),M=()=>{b.current};l(()=>{M()},[f]),u(()=>{const e=()=>{if(!o?.current)return;const{positionX:e,positionY:t,width:n,fromBottom:r}=E(o);v(r<160?"up":"down"),A({left:e+n,top:t})};e();const t=new ResizeObserver(()=>e());return o?.current&&t.observe(o.current),window.addEventListener("scroll",e,!0),()=>{o?.current&&t.unobserve(o.current),t.disconnect(),window.removeEventListener("scroll",e,!0)}},[E,o]);return l(()=>{const e=()=>{M()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),L(n("div",{className:"ff-chips-accordion",style:{left:m.left,top:m.top,zIndex:i+100,transform:"up"===g?"translateY(calc(-100% + 33px))":"none",width:s,position:"absolute"},ref:y,children:[e("div",{ref:b,className:"ff-chips-row "+(C?"expanded":""),style:{maxHeight:C?"280px":"20px"},children:e("div",{className:"chips-container "+(C?"chips-container-scroll":""),children:f?.map(({name:t,isSelected:n},i)=>e("div",{className:"chip "+(n?"selected-chip":""),onClick:()=>(e=>{const t=f.map((t,n)=>n===e?{...t,isSelected:!t.isSelected}:t);if(h(t),r){const e=t.filter(e=>e.isSelected);r(e)}})(i),children:e(U,{as:"div",className:"chip-text",children:t,fontSize:10,lineHeight:"15px"})},i))})}),e("div",{className:"ff-arrow-icon-container",children:e("div",{className:"ff-icon-wrapper "+(C?"expanded":""),role:"button","aria-expanded":C,children:e(q,{name:"down"===g?"arrows_down_icon":"arrows_top_icon",height:8,width:8,onClick:()=>{p(e=>!e),C&&document.querySelector(".ff-chips-row")?.scrollTo({top:0})}})})})]}),document.body)}),Jm=(e,t)=>{switch(t.type){case"FOCUS_INPUT":return{...e,isInputFocused:!0,isIconClick:!0,showOptions:!0};case"BLUR_INPUT":return{...e,isInputFocused:!1,option:t.payload.option,isIconClick:!1,showOptions:!1,dropdownPosition:{positionX:0,positionY:0,width:0,fromBottom:0}};case"UPDATE_DROPDOWN_POSITION":const{positionX:n,positionY:r,width:i,fromBottom:o}=t.payload||{};return{...e,dropdownPosition:{positionX:n,positionY:r,width:i,fromBottom:o}};case"UPDATE_OPTION":return{...e,option:t.payload};case"SHOW_ERROR":return{...e,isInputFocused:!0,isIconClick:!1,showOptions:!1,option:t.payload.option,dropdownPosition:{positionX:0,positionY:0,width:0,fromBottom:0}};default:return e}},$m=({label:t="",leftIcon:r,rightIcon:i,rightIconColor:o,showLabel:s=!0,onHelpIconClick:d=()=>{},aiIconClick:f=()=>{},webServiceClick:h=()=>{},accessibilityClick:C=()=>{},containerWidth:p="",optionsList:m=[],selectedOption:A={displayName:"",projectId:"",nlpType:"",platform:""},onChange:v=()=>{},errorMsg:y="",className:w="",optionZIndex:E=100,disabled:b=!1,borderRadius:M=!0,showBorder:x=!0,required:H=!1,value:V="",onSelect:k=()=>{},chipOptionList:S,selectedChips:Z,loadMoreOptions:O=()=>{},isWebservice:z=!0,isAccessibility:N=!1,closeInputOnOutsideClick:T=()=>{},tooltipText:D="Help",ChipsAccordionWidth:F="27.8%",dropDownMessage:R=""})=>{const P={isInputFocused:!1,isIconClick:!1,showOptions:!1,option:K(A)&&"string"==typeof A?.displayName?A.displayName:"",dropdownPosition:{positionX:0,positionY:0,width:0,fromBottom:0}},[B,j]=g(Jm,P),[_,W]=c(A),[X,Q]=c({}),G=a(!1);l(()=>{const e="string"==typeof A.displayName?A.displayName:String(A.displayName??"");e!==_.displayName&&W({...A,displayName:e})},[A]),l(()=>{V&&ae("FOCUS_INPUT")},[V]);const Y=a(null),J=a(null),$=a(null),{isInputFocused:ee,isIconClick:te,showOptions:ne,dropdownPosition:re,option:ie}=B,oe=So(Y,ne),ae=e=>{b||j("SHOW_ERROR"===e||"BLUR_INPUT"===e?{type:e,payload:{option:"string"==typeof A.displayName?A.displayName:String(A.displayName??"")}}:{type:e})},le=()=>{if(!ne||!Y?.current||b)return;const{positionX:e,positionY:t,width:n,fromBottom:r}=oe(Y);j({type:"UPDATE_DROPDOWN_POSITION",payload:{positionX:e,positionY:t,width:n,fromBottom:r}})},se=e=>{const t=window.innerWidth-document.body.clientWidth;document.body.style.paddingRight=e?"":`${t}px`,document.body.style.overflow=e?"":"hidden"};u(()=>{if(b)return;ne&&se(!ne),le();const e=()=>le();return window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{se(!0),window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}},[ne]),l(()=>{y&&ae("SHOW_ERROR")},[]),l(()=>{ae("FOCUS_INPUT")},[]);const ce=!ee&&Boolean(ie);return l(()=>{const e=J.current;if(!e)return;let t=e.parentElement;for(;t&&t!==document.body;){const e=getComputedStyle(t);if(["scroll","auto"].includes(e.overflowY))break;t=t.parentElement}if(!t)return;const n=t.style.overflow,r=ne||S;return t.style.overflow=r?"hidden":n||"auto",()=>{t.style.overflow=n||"auto"}},[ne,S]),n("section",{className:"main-section",children:[n("div",{className:I(`ff-nlp-input-wrapper ${w}`),children:[n("div",{className:"ff-nlp-input",children:[e("input",{type:"text",className:I("ff-nlp-input-container",{"ff-nlp-input-container--default":!ee,"ff-nlp-input-container--active":ce,"ff-nlp-input-container--no-label":!s,"ff-nlp-input-container--error":y&&!ee&&!Boolean(ie),"ff-nlp-input-container--border-radius":!M,"ff-nlp-input-container--disable":b,"ff-nlp-input-container--no-border":!x}),style:{zIndex:E,paddingLeft:"32px"},onFocus:()=>ae("FOCUS_INPUT"),onChange:e=>{b||v(e)},value:V,disabled:b,autoComplete:"off",spellCheck:"false",ref:J,autoFocus:!0}),n("div",{className:"ff-nlp-icon-container",children:[e(q,{name:r||"ai_search",className:"ff-nlp-help_icon",width:16,height:16,onClick:f}),e(U,{className:"icon-label",fontSize:10,children:"Search With Ai"})]}),s&&n("div",{className:I("ff-nlp-input-label","ff-nlp-input-label--default",{"ff-nlp-input-label--active":V||Boolean(ie),"ff-nlp-input-label--error":y}),children:[H&&e(U,{color:"var(--$error-light)",className:"ff-nlp-input-label--required",children:"*"}),t]}),n("div",{className:"help-icon-container",onMouseDown:()=>G.current=!0,style:{zIndex:E},children:[e("span",{className:I("ff-nlp-input-arrow",{"ff-nlp-input-arrow--down":!te,"ff-nlp-input-arrow--no-label":!s}),onMouseEnter:e=>{const t=e.target.getBoundingClientRect();Q({top:t.top+window.scrollY-20+"px",left:`${t.left+window.scrollX+.5*t.width}px`,visibility:"visible",opacity:1,transitionDelay:"0s"})},onMouseLeave:()=>Q(e=>({...e,visibility:"hidden",opacity:0})),children:e(q,{name:i||"",height:16,width:16,onClick:d,color:o})}),L(e(U,{className:"help-icon-label",fontSize:10,style:X,children:D}),document.body)]}),e("fieldset",{className:I("ff-nlp-input-fieldset",{"ff-nlp-input-fieldset--no-label":!s,"ff-nlp-input-fieldset--default":!ee,"ff-nlp-input-fieldset--active":ee,"ff-nlp-input-fieldset--option":ce,"ff-nlp-input-fieldset--error":y,"ff-nlp-input-fieldset--border-radius":!M,"ff-nlp-input-fieldset--no-border":!x})})]}),y&&e(U,{className:"ff-nlp-input-wrapper-error-text",fontSize:8,color:"var(--error-light)",children:y}),e("div",{ref:Y,children:ne&&L(e(Km,{onSelectBlur:()=>{b||(G.current?G.current=!1:y?ae("SHOW_ERROR"):(ae("BLUR_INPUT"),T()))},onSelectOptionSelector:e=>{k(e)},dropdownPosition:re,options:m,optionZIndex:E,inputRef:J,webServiceClick:h,accessibilityClick:C,containerWidth:p,loadMoreOptions:O,chipRef:$,isWebservice:z,isAccessibility:N,dropDownMessage:R}),document.body)})]}),e("div",{className:"chips-accordion-content",children:S&&S.length>0&&e(Ym,{chipOptionList:S,selectedChips:Z,optionZIndex:E,ref:$,inputRef:J,ChipsAccordionWidth:F})})]})},eA=({items:t,onButtonClick:r,selectedValue:i=null,onChange:o,className:a=""})=>{const[s,d]=c(i);l(()=>{i!==s&&d(i)},[i,s]);return n("div",{className:I("ff-icon-radio-group",a),children:[t.map(t=>e("div",{className:I("ff-icon-radio-button",{selected:s===t.iconName,disabled:t.disabled}),onClick:()=>(e=>{if(e.disabled)return;const t=e.iconName;d(t),o&&o(t),r(e)})(t),children:e(Y,{title:t.iconLabel,children:e("div",{className:I("icon-container",{selected:s===t.iconName}),children:e(q,{name:t.iconName,hoverEffect:!1,color:s===t.iconName?"var(--drawer-footer-bg)":"var(--brand-color)"})})})},t.iconName)),e("div",{className:"line-connector"})]})},tA=({width:t="100%",options:r=[],runCount:i=0,className:o="",contentReverse:a=!1,onClick:l=()=>{},modalId:s="",scriptType:c="",readOnly:d=!1,isMissing:u=!1})=>{const f={local:"local",browserstack:"browserstack_icon",saucelabs:"sause_lab_icon",lambdatest:"lambda_icon",fireflink:"fireflink_platform_logo",mac:"mac_icon",mac_icon:"mac_icon",android:"android_icon",linux:"linux","google chrome":"chrome_icon","mozilla firefox":"fire_fox","microsoft edge":"edge","internet explorer":"internet_explorer",safari:"safari_icon",opera:"opera",windows:"windows",edge:"edge",microsoftedge:"edge",firefox:"fire_fox",chrome:"chrome_icon",explorer:"internet_explorer",ios:"mac_icon",comet:"comet_icon"},h="manual"===c.toLowerCase();return console.warn("Options list",r),n("div",{id:s,style:{width:t},className:I("ff-machine-input-field-wrapper",o,{"cursor-event-none":1!==i&&"Automation"==c}),onClick:()=>{d||l()},children:[!h&&n(U,{as:"span",color:"var(--ff-machine-input-field-text-color)",fontSize:8,textAlign:"center",className:"ff-machine-input-label",children:["Run ",i]}),e("div",{className:I("ff-machine-input-field",{"ff-machine-input-field-reverse":a,"ff-machine-input-field-missing":u}),children:r.map(({label:t,type:r,version:i,available:o})=>n("div",{className:I("ff-machine-icon-text-wrapper",{"ff-machine-icon-text-wrapper-reverse":a,show_border:!1===o}),children:[e(q,{name:f[r?.toLowerCase()]||"",className:"ff-machine-icon"}),e(Y,{title:t,children:e(U,{className:I("ff-machine-text",{"ff-machine-text-reverse":a}),color:"var(--ff-machine-input-field-text-color)",children:Hn(t,10)?xn(t,10):t})}),h&&!K(i)&&e(Y,{title:i,children:n(U,{className:I("ff-machine-text",{"ff-machine-text-reverse":a}),color:"var(--ff-machine-input-field-text-color)",children:[" -"," ",Hn(i??"",10)?xn(i??"",10):i]})})]},r))})]})};tA.displayName="MachineInputField";const nA=({datSetToolTip:{globalVariableSetName:r="",peVariableSetName:i="",testDataSetName:o=""}})=>{const a={"Project Environment Set":i,"Global Variable Set":r,"Test Data Set":o};return e(t,{children:Object.entries(a).map(([t,r],i)=>e("div",{className:"ff-dataSetList-container",children:n("div",{children:[e(U,{as:"div",fontSize:10,lineHeight:"15px",color:"var(--details-page-value-color)",className:"ff-dataSetList-items",children:t}),e(U,{as:"div",lineHeight:"18px",color:"var(--base-bg-color)",children:r})]})},i))})},rA=e=>"object"==typeof e&&0===Object.keys(e).length,iA=s(null),oA=({machineInstances:r,rowIndex:i,machineColumnCount:o,nextRowMachineInstance:a,previousRowMachineInstance:l,onAddBrowser:s,onDeleteBrowser:c,onAddRunBrowser:u,onUpdateDataSetList:f,onUpdateAddBrowserInstance:h,addInstanceLabel:C="",scriptType:p="",projectType:m="",readOnly:A,maxRunCount:g})=>{const v=i%2==0,y=K(r[o-1]),w=d(iA),{testDataSetMap:E={},globalVariableMap:b={},projectVariableMap:M={}}=w||{},L=(e,t)=>e&&t&&"machineInstanceId"in e&&"machineInstanceId"in t&&e.machineInstanceId===t.machineInstanceId?"dashed":"solid",x=e=>r?.length-1!==e&&o>1,H=(e="",t)=>{const{executionEnv:n,browserName:r,browserVersion:i,machineInfo:{osVersion:o,iconName:a,osName:l,hostName:s},deviceInfo:c,fireCloudProjectName:d=""}=t,u=[{label:"FireFlink Device Farm"===n?d:n,type:((e="")=>"local"===e?.toLowerCase()?"local":e?.toLowerCase()?.includes("browserstack")?"Browserstack":e?.toLowerCase()?.includes("lambdatest")?"LambdaTest":e?.toLowerCase()?.includes("saucelabs")?"SauceLabs":e?.toLowerCase()?.includes("fireflink device farm")?"fireflink":"")(n)}];"manual"===p?.toLowerCase()&&u.push({label:s||"",type:"local"===n?.toLowerCase()?"local":""});const f=[{label:o||"",type:a||l},{label:i,type:r}],h=c?.reduce((e,t)=>(t&&e?.push({label:t?.name,type:"manual"===p?.toLowerCase()?"android":t?.platform,version:"manual"===p?.toLowerCase()?t?.version:"",available:"boolean"==typeof t?.available?t?.available:""}),e),[]);switch(e.toLowerCase()){case"web":case"web service":return[...u,...f];case"web & mobile":case"ms dynamics":case"salesforce":return[...u,...f,...h];case"mobile":return[...u,...h];default:return[]}},V="manual"!==p?.toLowerCase(),k=e=>!K(e)||(rA(e)||void 0!==a);return n("div",{className:I({"ff-connecting-branch-grid":v,"ff-connecting-branch-grid-reverse":!v}),style:{gridTemplateColumns:1===o?"24px minmax(min-content, auto) 24px":`24px minmax(min-content, auto) repeat(${o-1}, 40px minmax(min-content, auto)) 24px`},children:[n("div",{className:"ff-connecting-branch-start-wrapper",children:[e("div",{className:I({"ff-connecting-branch-arrow":v,"ff-connecting-branch-arrow-reverse":!v})}),e("div",{className:I({"ff-connecting-branch-container":v,"ff-connecting-branch-container-reverse":!v}),style:{border:`1px ${L(r[0],l)} var(--ff-connecting-branch-color)`,borderTop:"none",borderLeft:`${!v&&"none"}`,borderRight:`${v&&"none"}`}})]}),r?.map((i,o)=>{const{runCount:a=("runCount"in i?i.runCount:0),numberOfRuns:l=0,machineInstanceId:d="",peVariableSetId:y="",globalVariableSetId:w="",testDataSetId:S="",testDataSetName:Z="",peVariableSetName:O="",globalVariableSetName:z=""}=i;return n(t,{children:[K(i)?!A&&e("div",{className:"ff-connecting-branch-browser-button",children:e(W,{id:`ff-sequential-branch-add-${d}`,variant:"tertiary",label:C,iconName:"plus_icon",iconPosition:v?"left":"right",onClick:()=>{A||s(`ff-sequential-branch-add-${d}`)}})}):n("div",{children:[n("div",{className:"ff-connecting-branch-input-point-wrapper",children:[k(r[o+1])&&e("div",{className:I({"ff-connecting-branch-point":v,"ff-connecting-branch-point-reverse":!v})}),e(tA,{runCount:a,options:H(m,i),contentReverse:!v,modalId:`${d}-runCount-${a-1}`,onClick:()=>1==a||"Automation"!==p?h(`${d}-runCount-0`,i):null,scriptType:p,readOnly:A},mi())]}),n("div",{className:I({"ff-connecting-branch-datalist":v,"ff-connecting-branch-datalist-reverse":!v}),children:[V&&n(t,{children:[e("div",{id:`ff-sequential-branch-dataset-${d}-${a}`,className:"ff-dataset-list-branch",onClick:()=>{A||f(`ff-sequential-branch-dataset-${d}-${a}`,{peVariableSetId:y,globalVariableSetId:w,testDataSetId:S,testDataSetName:Z,globalVariableSetName:z,peVariableSetName:O},!0,l,d)},children:n(Y,{placement:"bottom",title:e(t,{children:e(nA,{datSetToolTip:{peVariableSetName:M[y]||"",globalVariableSetName:b[w]||"",testDataSetName:E[S]||""}})}),style:{display:"flex",alignItems:"center"},children:[e(q,{name:"datalist_icon",className:"ff-connecting-icon",hoverEffect:!0}),e(U,{className:"ff-connecting-text",color:"var(--ff-connecting-branch-color)",children:"Data Set List"})]})}),!A&&e(t,{children:e(Y,{placement:"bottom",title:l>=g?`Maximum ${g} runs are allowed.`:"",children:n("div",{className:"ff-environment-run-container",onClick:l>=g?void 0:()=>u(d),children:[e(q,{name:"plus_icon",className:"ff-connecting-run-icon",color:"var(--ff-connecting-branch-color)",hoverEffect:!0,disabled:l>=g}),e(U,{className:"ff-connecting-run-text",color:"var(--ff-connecting-branch-color)",style:{opacity:l>=g?.5:1},children:"Run"})]})})})]}),!A&&e(Y,{title:"Delete",children:e(q,{name:"delete",className:"ff-connecting-delete-icon",onClick:()=>c(d,a),color:"var(--ff-connecting-branch-delete-color)",hoverEffect:!0})})]})]}),x(o)&&e("div",{className:"ff-connecting-branch-middle-arrow",style:{borderTop:`1px ${L(i,r[o+1])} var(--ff-connecting-branch-color)`},children:e("div",{className:I({"ff-connecting-branch-arrow":v,"ff-connecting-branch-arrow-reverse":!v})})})]},mi())}),(A?!y&&!K(a):!y)&&e("div",{className:I({"ff-connecting-branch-end-arrow":v,"ff-connecting-branch-end-arrow-reverse":!v}),style:{border:`1px ${L(r[o-1],a)} var(--ff-connecting-branch-color)`,borderBottom:"none",borderLeft:`${v&&"none"}`,borderRight:`${!v&&"none"}`}})]})},aA=({machineBranchInstances:n,machineColumnCount:r,machineColumnWidth:i,onAddBrowser:o,onDeleteBrowser:a,onAddRunBrowser:s,onUpdateDataSetList:d,onUpdateAddBrowserInstance:u,addInstanceLabel:f="",scriptType:h="",projectType:C="Web",readOnly:p=!1,maxRunCount:m})=>{const[A,g]=c(n);l(()=>{g(n)},[n]);const v=((e,t)=>{const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n})(A,r);return e("div",{className:"ff-connecting-branch-grid-wrapper",children:v.map((n,l)=>e(t,{children:e(oA,{machineInstances:n,rowIndex:l,machineColumnCount:r,machineColumnWidth:i,onAddBrowser:o,onDeleteBrowser:a,onAddRunBrowser:s,nextRowMachineInstance:v[l+1]?.[0],previousRowMachineInstance:v[l-1]?.[r-1],onUpdateDataSetList:d,onUpdateAddBrowserInstance:u,addInstanceLabel:f,scriptType:h,projectType:C,readOnly:p,maxRunCount:m})},mi()))})},lA=({machineInstances:r=[],machineColumnWidth:i=180,machineColumnCount:o=1,selectedMachine:s={},machineOptionsList:d=[],onHandleSelect:u=()=>{},onAddBrowserInstance:f=()=>{},onAddRunBrowserInstance:h=()=>{},onDeleteBrowserInstance:C=()=>{},onUpdateDataSetList:p=()=>{},onDeleteMachineInstance:m=()=>{},dataSetValues:A={testDataSetId:"",globalVariableSetId:"",peVariableSetId:"",globalVariableSetName:"",peVariableSetName:"",testDataSetName:""},onUpdateAddBrowserInstance:g=()=>{},addInstanceLabel:v="Environment",placeholder:y="Choose Machine",scriptType:w="Automation",projectType:E="Web",readOnly:b=!1,zIndex:M=99999,maxRunCount:L=35,environmentVariableMaps:x,isRequired:H=!1,showIcon:V=!1})=>{const[k,S]=c({}),Z=a(null),O=Math.max(o,1),z=Math.max(i,180),[N,T]=c([]),D=K(r);let F=K(s.value?.clientId);"Manual"===w&&(F=K(s.value));l(()=>{S(s)},[s]),l(()=>{T(b?r:[...r,{}])},[r]);const R="manual"!==w.toLowerCase(),P=(B=A,j="Id",Object.fromEntries(Object.entries(B).filter(([e])=>!e.includes(j))));var B,j;const _=b&&!D||!b&&D||!b&&!D;return e(iA.Provider,{value:x,children:n("div",{className:"ff-sequential-connecting-branch-wrapper",children:[n("div",{className:"ff-connecting-select-branch-wrapper",children:[n("div",{className:"ff-select-branch-wrapper",children:[e(Zo,{onChange:u,optionsList:d,label:y,required:H,showLabel:!0,className:"ff-sequential-select-branch",width:"240px",selectedOption:k,valueAccessor:"name",optionsRequired:!b,disableInput:b,optionZIndex:M,showIcon:V}),!F&&n("div",{className:I({"ff-select-branch-arrow":D,"ff-select-branch-arrow-down":!D}),children:[_&&e("div",{className:"ff-select-branch-point"}),n("div",{className:"ff-select-branch-arrow",children:[!b&&e("div",{className:"ff-branch-arrow-wrapper",children:D&&e("div",{className:"ff-branch-arrow"})}),D&&!b&&e(t,{children:e(W,{variant:"tertiary",label:"Manual"===w?"Machine":"Environment",iconName:"plus_icon",iconPosition:"left",size:"small",className:"branch-button",ref:Z,onClick:()=>f("ff-sequential-branch-button"),id:"ff-sequential-branch-button"})})]})]})]}),!F&&n("div",{className:"ff-select-scope-datalist",children:[e("div",{className:"ff-scope-wrapper",children:e(U,{as:"span",color:((e="")=>e.toLowerCase().includes("inactive")?"var(--ff-machine-inactive-status-color)":e.toLowerCase().includes("running")?"var(--ff-machine-running-status-color)":e.toLowerCase().includes("active")?"var(--ff-machine-active-status-color)":"var(--ff-machine-active-status-color))")(s.value?.status),className:"ff-scope-text",children:s.value?.status})}),n("div",{className:"ff-datalist-wrapper",children:[R&&e("div",{id:"ff-sequential-machine-datalist",onClick:()=>{b||p("ff-sequential-machine-datalist",A)},children:n(Y,{placement:"bottom",title:e("div",{children:e(nA,{datSetToolTip:P})}),style:{display:"flex",alignItems:"center"},children:[e(q,{name:"datalist_icon",className:"ff-dataset-icon",hoverEffect:!0}),e(U,{as:"span",color:"var(--ff-connecting-branch-color)",className:"ff-datalist-text",children:"Data Set List"})]})}),!b&&e(Y,{title:"Delete",placement:"bottom",children:e(q,{name:"delete",className:"ff-run-delete-icon",color:"var(--ff-connecting-branch-delete-color)",onClick:m,hoverEffect:!0})})]})]})]}),e("div",{className:"ff-sequential-branches-wrapper",children:!D&&e(aA,{machineBranchInstances:N,machineColumnCount:O,machineColumnWidth:z,onAddBrowser:f,onDeleteBrowser:C,onAddRunBrowser:h,onUpdateDataSetList:p,onUpdateAddBrowserInstance:g,addInstanceLabel:v,scriptType:w,projectType:E,readOnly:b,maxRunCount:L})})]})})},sA=({label:t,selectedFiles:r,onFilesChange:i,disabled:o=!1,buttonDisplayType:l="attachment",iconName:s="plus_icon",maxFileSizeMB:d,maxFiles:u,buttonLabel:f="Select Files",showSelectedFiles:h=!0,buttonVariant:C="primary",deleteButton:p=!0,multiple:m=!0,addAttachmentButton:A=!0,isInfoIconRequired:g=!0,onFileListClick:v,types:y=[],attachmentInfoTooltip:w="",selectedFileMessage:E="This file is already selected",required:b=!1,errorMessage:M,truncateMaxLimit:L=1/0,onClickAttachmentButton:x=()=>{}})=>{const H=a(null),[V,k]=c(""),S={image:["image/jpeg","image/png","image/svg+xml"],video:["video/mp4","video/mpeg","video/quicktime"],audio:["audio/mpeg","audio/wav","audio/ogg"],document:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],archive:["application/zip","application/x-rar-compressed","application/x-7z-compressed"],spreadsheet:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],excel:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],dat:[".dat","application/octet-stream"],trg:[".trg","application/octet-stream"]},Z=y.flatMap(e=>S[e]||[]).join(","),O=()=>{x(),k(""),H.current?.click()};return n("div",{children:[g&&n("div",{className:"ff-label-icon",children:[e(U,{fontWeight:"semi-bold",lineHeight:"18px",as:"span",required:b,children:t}),e(Y,{title:w||(()=>{if(0===y.length)return"Any files are allowed.";const t=y.flatMap(e=>S[e]||[]).map(e=>e.split("/")[1]),r=t.pop();return n("span",{children:[t.join(", ")," and ",r," files are allowed.",e("br",{}),"Max size: ",d," MB"]})})(),placement:"bottom-start",children:e(q,{name:"info",hoverEffect:!0})})]}),(!h||0===r.length)&&("attachment"===l?e(W,{variant:C,label:f,size:"medium",onClick:O,disabled:o}):"icon"===l?e(kp,{label:f,iconName:s,onClick:O,isDisable:o}):null),e("input",{type:"file",ref:H,className:"ff-input-field",onChange:()=>{if(k(""),H.current?.files){const e=Array.from(H.current.files);if(e.length>5)return k("Maximum file(s) can be uploaded: 5"),void(H.current.value="");const t=e.filter(e=>!r.some(t=>t.name===e.name));if(0===t.length)return k(E),void(H.current.value="");if("number"==typeof u&&r.length+t.length>u)return k(`You can only select up to ${u} files.`),void(H.current.value="");if("number"==typeof d){const e=1024*d*1024;if(t.filter(t=>t.size>e).length>0)return k(`Maximum file(s) size allowed: ${d} MB.`),void(H.current.value="")}i([...r,...t],t,"ADD"),H.current.value=""}},multiple:m,accept:Z,required:b}),V&&e(wi,{isOpen:!!V,variant:"info",toastTitle:"Info",toastMessage:V,zIndex:1e7}),h&&r.map((t,o)=>n("div",{className:"ff-attachment-files",onClick:v,children:[e(U,{color:"var(--brand-color)",children:e(Oi,{title:t.name,width:L})}),p&&e(Y,{title:"Delete",children:e(q,{name:"delete",hoverEffect:!0,color:"var(--ff-delete-button-attachment)",variant:"danger",onClick:()=>(e=>{const t=[...r],n=t.splice(e,1);i(t,n,"DELETE")})(o)})}),o===r.length-1&&A&&e(Y,{title:""+("number"==typeof u&&r.length>=u?`Maximum files can be uploaded: ${u}`:"Add File"),children:e(q,{name:"add_file",hoverEffect:!0,onClick:O,disabled:"number"==typeof u&&!(r.length<u)})})]},t.name)),b&&e(U,{children:M,fontSize:10,className:"error-text"})]})},cA=({selected:t="text",firstButton:r="File",secondButton:i="File",handleClick:o})=>n("div",{className:"toggle-container",children:[e("button",{className:"toggle-button "+(t===r?"active":""),onClick:()=>o(r),children:r}),e("button",{className:"toggle-button "+(t===i?"active":""),onClick:()=>o(i),children:i})]}),dA=({variant:t="small",iconName:n,iconColor:r="var(--avatar-icon-color)",customAvatarSize:i,customIconSize:o,backgroundColor:a,label:l,labelFontSize:s})=>{const c=l?.slice(0,2);return e("div",{className:`ff-avatar ff-avatar--${t}`,style:{height:`${i}px`,width:`${i}px`,backgroundColor:a},children:l?e("span",{className:"ff-avatar-label",style:{fontSize:s||"14px",color:r},children:c}):e(q,{name:n,height:o,width:o,color:r})})},uA=({logo:t,overlay:r=!1})=>e("div",{className:`overlay-loader ${r&&"overlay"}`,children:n("div",{className:"loader-container ",children:[t&&e(t,{}),e("div",{className:"line_loader"})]})}),fA=({contentHeader:t,data:r,maxHeight:i=""})=>{const o=`scrollable-${(e=>{const t=parseInt(e);if(isNaN(t))return"default";const n=100*Math.round(t/100);return Math.min(Math.max(100,n),1e3)})(i)}`;return n("div",{className:"ff-content-card-container",children:[e("div",{className:"ff-content-card-nav",children:e(U,{as:"div",fontWeight:"semi-bold",lineHeight:"35px",children:t})}),e("div",{className:`ff-content-card-body scrollable ${o}`,children:Object.entries(r).map(([t,r],i)=>n("div",{className:"ff-content-card-row",children:[n(U,{fontWeight:"semi-bold",children:[t,":"]}),e(U,{className:"ff-content-card-value",children:r})]},i+t))})]})},hA=new Set(["auto","auto-start","auto-end","top","top-start","top-end","bottom","bottom-start","bottom-end","right","right-start","right-end","left","left-start","left-end"]),CA=e=>{const t=document.createElement("div"),n=e.getAttribute("data-tooltip-id");if(n){const e=document.getElementById(n);if(e){let n=e.innerHTML.replace(/<!--[\s\S]*?-->/g,"").trim();return'""'!==n&&"''"!==n&&"&quot;&quot;"!==n||(n=""),""===n||/^<([a-zA-Z0-9-]+)[^>]*>\s*<\/\1>$/i.test(n)?"":(t.innerHTML=e.innerHTML,t)}}const r=e.getAttribute("data-tooltip")||"";if(!r.trim())return"";const i=r.replace(/\\n/g," ").replace(/\n/g," ").replace(/\s+/g," ").trim();if(!i)return"";const o=i.trim().startsWith("<")&&i.trim().endsWith(">"),a=/<(?:[a-z][\s\S]*>|\/[a-z0-9]+>)|&[#a-zA-Z0-9]+;/i.test(i);return e.hasAttribute("data-tooltip-allowhtml")?o?t.innerHTML=i:(t.style.wordBreak="break-word",a?t.innerHTML=i:t.textContent=i):(t.style.wordBreak="break-word",t.textContent=i),t},pA=()=>(l(()=>{const e=e=>{const t=e.target;t instanceof Element&&t.closest("[data-tippy-root]")||pn({duration:0})};window.addEventListener("scroll",e,!0);const t=An(document.body,{target:"[data-tooltip], [data-tooltip-id]",arrow:!1,placement:"bottom",theme:"ff-global-tooltip",appendTo:document.body,allowHTML:!0,popperOptions:{modifiers:[{name:"preventOverflow",options:{altAxis:!0,padding:8}},{name:"flip",options:{padding:8,fallbackPlacements:["top","right","left"]}}]},content:e=>CA(e),onShow(e){const{reference:t}=e;if(!document.body.contains(t))return!1;const n=CA(t);if(""===n)return!1;const r=e.reference.hasAttribute("data-tooltip-interactive"),i=e.reference.getAttribute("data-tooltip-placement"),o=i?.trim().toLowerCase(),a=o&&hA.has(o)?o:"bottom";e.setProps({interactive:r,placement:a,content:n})},onCreate(e){const t=new MutationObserver(()=>{if(e.state.isVisible){const t=CA(e.reference);""===t?e.hide():e.setContent(t)}});t.observe(e.reference,{attributes:!0,attributeFilter:["data-tooltip","data-tooltip-id"]}),e._attrObserver=t;const n=e.reference.parentElement;if(n){const t=new MutationObserver(()=>{document.body.contains(e.reference)||(e.hide(),e.destroy())});t.observe(n,{childList:!0}),e._domObserver=t}},onDestroy(e){e._attrObserver?.disconnect(),e._domObserver?.disconnect()},onMount(e){if(!e.reference.hasAttribute("data-tooltip-interactive")){const t=e.popper.querySelector(".tippy-box");t&&t.scrollHeight>t.clientHeight&&e.setProps({interactive:!0})}}});return()=>{window.removeEventListener("scroll",e,!0),Array.isArray(t)?t.forEach(e=>e.destroy()):t.destroy()}},[]),null),mA="Principle",AA="Guidelines",gA="Weightage in %",vA=e=>null==e||"boolean"==typeof e?"":"string"==typeof e||"number"==typeof e?String(e):Array.isArray(e)?e.map(vA).filter(Boolean).join(" "):i.isValidElement(e)?vA(e.props.children):"",yA=({title:t="Success Criteria Weightage",totalWeightage:r,maxWeightage:i=100,principleColumnLabel:o=mA,guidelinesColumnLabel:a=AA,weightageColumnLabel:l=gA,columnLabels:s,groups:d=[],onWeightageChange:u=()=>{},renderWeightageCell:f,weightageInputWidth:h="12%",onReset:C=()=>{},showResetIcon:p=!0,disabled:m=!1,minValue:A=0,maxValue:g=100,disableUpwardIncreaseOnMax:v=!0,isAccordion:y=!0,defaultExpanded:w=!1,className:E="",style:M})=>{const L=b().replace(/:/g,""),[x,H]=c(w),V=`${L}-weightage-title`,k=`${L}-weightage-content`,S=d.reduce((e,t)=>e+t.guidelines.length,0);let Z=2;const O=d.map(e=>{const t=Z;return Z+=e.guidelines.length,t}),z={principle:s?.principle??o,guidelines:s?.guidelines??a,weightage:s?.weightage??l},N=vA(z.weightage)||gA,T=i??g,D=r??d.reduce((e,t)=>e+t.guidelines.reduce((e,t)=>e+(t.value||0),0),0),F=Math.max(0,T-D),R=(e,t,n)=>{u(e,t,n)},P=!y||x,B=({groupIndex:t,rowIndex:n,row:r,minValue:i,maxValue:o,disabled:a,inputWidth:l,inputProps:s})=>e("div",{className:"ff-weightage-input",style:{width:l},children:e(Hi,{type:"number",noBorder:!0,value:r.value,minValue:i,maxValue:o,disabled:a,error:r.error,helperText:r.helperText,placeholder:"",variant:"primary",isLabelRequired:!1,disableAfterMaxValueReached:!0,size:"small",className:"ff-weightage-input-field",onChange:e=>((e,t,n,r,i,o)=>{const a=o.target.value,l=""===a?0:Number(a);let s=!1,c="";(l<r||l>i)&&(s=!0,c=`Value must be between ${r} and ${i}`),R(e,t,{...n,value:l,error:s,helperText:c})})(t,n,r,i,o,e),setUpdatedNumberValue:e=>R(t,n,{...r,value:e}),...s})}),j=(t,n,r)=>e("div",{className:t,role:"columnheader","aria-colindex":r,children:e(U,{fontWeight:"semi-bold",children:e(Xs,{children:n})})}),_=(t,r,i)=>{const o=t.key??t.principle;return e("div",{className:"ff-weightage-group",role:"rowgroup","aria-label":t.principle,children:t.guidelines.map((a,l)=>((t,r,i,o,a,l)=>{const s=o.key??`${i}-${o.label}`,c=o.maxValue??T,d=Math.min(c,100),u=v?Math.min(d,(o.value||0)+F):d,C=Math.min(o.minValue??A,u),p=m||!!o.disabled||!P,g=`${L}-weightage-row-${r}-${a}`,y=o.error&&o.helperText?`${g}-error`:void 0,w={group:t,row:o,groupIndex:r,rowIndex:a,rowKey:s,minValue:C,maxValue:u,disabled:p,inputWidth:h,inputProps:{id:`${g}-input`,name:s,"aria-label":`${N} for ${o.label} in ${t.principle}`,"aria-describedby":y,"aria-errormessage":y,"aria-invalid":o.error||void 0,onWheel:e=>{e.currentTarget.blur()}},onChange:e=>R(r,a,e)};return n("div",{className:"ff-weightage-row",role:"row","aria-rowindex":l,children:[0===a&&e("div",{className:"ff-weightage-principle",role:"rowheader","aria-colindex":1,"aria-rowspan":t.guidelines.length,style:{gridRow:`span ${t.guidelines.length}`},children:e(U,{fontWeight:"medium",children:e(Xs,{children:t.principle})})}),e("div",{className:"ff-weightage-guideline",role:"cell","aria-colindex":2,children:e(U,{children:e(Xs,{className:"auto-truncate",children:o.label})})}),e("div",{className:"ff-weightage-value",role:"cell","aria-colindex":3,children:(E=w,f?f(E):B(E))})]},s);var E})(t,r,o,a,l,i+l))},o)};return n("div",{className:I("ff-weightage-table",E),style:M,children:[e(pA,{}),n("div",{className:"ff-weightage-head",children:[e("div",{className:"ff-weightage-title",id:V,children:e(U,{fontWeight:"semi-bold",children:e(Xs,{children:t})})}),n("span",{className:"ff-weightage-total",children:[e("span",{className:"ff-weightage-total-value","aria-live":"polite","aria-label":`Total weightage ${D}`,children:e(U,{fontWeight:"semi-bold",children:n(Xs,{children:["Total Weightage : ",D]})})}),p&&e("button",{type:"button",className:"ff-weightage-icon-button",onClick:C,"aria-label":"Reset weightage values to default","data-tooltip":"Reset to default value",children:e(q,{name:"reset_default_value",withPadding:!1})}),y&&e("button",{type:"button",className:"ff-weightage-icon-button",onClick:()=>{H(e=>!e)},"aria-label":x?"Collapse weightage table":"Expand weightage table","aria-expanded":P,"aria-controls":k,"data-tooltip":x?"Collapse":"Expand",children:e(q,{name:x?"arrow_up":"arrow_down",withPadding:!1})})]})]}),e("div",{className:I("ff-weightage-content",{"ff-weightage-content--expanded":P}),id:k,"aria-hidden":!P,...P?{}:{inert:""},children:e("div",{className:"ff-weightage-content-inner",children:n("div",{className:"ff-weightage-grid",role:"table","aria-labelledby":V,"aria-colcount":3,"aria-rowcount":S+1,children:[n("div",{className:"ff-weightage-row ff-weightage-row-head",role:"row","aria-rowindex":1,children:[j("ff-weightage-principle",z.principle,1),j("ff-weightage-guideline",z.guidelines,2),j("ff-weightage-value",z.weightage,3)]}),d.map((e,t)=>_(e,t,O[t]??2))]})})})]})},wA=({label:t,placeholder:r,text:i,showText:o=!0,highlightText:s,customError:d,confirmIcon:u,customErrorCondition:f,cancelIcon:h,variant:C="textField",onInputChange:p,dropdownData:m=[],className:A,height:g,isOpen:v=!1,confirmAction:y,onClick:w,tooltip:E,onDoubleClick:b,disableEditing:M=!1})=>{const[L,x]=c(v??!1),[H,V]=c(i??""),[k,S]=c(m[0]?.value??""),[Z,O]=c(""),[z,N]=c(!0),[I,T]=c(!1),D=!(!Z||!L),F=a(null),R=a(null),[P,B]=c(null),j=X("Escape");l(()=>()=>{P&&clearTimeout(P)},[P]);const _=()=>{let e="";0===H.length||0===H.trim().length?e="Please type any text.":H.length<3?e="Please enter at least 3 characters.":f&&(e=d??"Invalid input."),e?O(e):(x(!1),O(""),y&&y(H,k)),u?.onClick?.()},W=()=>{V(i??""),S(m[0]?.value??""),x(!1),O(""),T(!1),h?.onClick?.()},Q=e=>{const t=e.target.value;V(t),N(!1),0===t.length||0===t.trim().length?O("Input is required"):t.length<3?O("Input cannot be less than 3 characters"):t.length>250?O("Input cannot be more than 250 characters"):$n.test(t)?O("Space is not allowed at starting and at the end"):O(f?d??"Invalid input.":""),T(t!==i),p&&p(t)},G=e=>{if(F.current&&!F.current.contains(e.target)&&R.current!==e.target){const e=((e,t)=>e===t?"No changes were made.":e?e.length<3?"Please enter at least 3 characters.":"":"Text is required")(H,i??"");e&&L?O(e):(x(!1),O(""))}};return l(()=>(document.addEventListener("click",G),()=>{document.removeEventListener("click",G)}),[H]),j(W),Zn([{key:"Enter",action:()=>{_()}}],F),n("div",{className:"ff-label-edit-text-field",ref:F,children:[L?n("div",{className:"ff-label-text-field",children:["textFieldWithDropdown"===C?n("div",{className:"ff-label-text-field-with-dropdown "+(L?"open":""),style:{height:g},children:[e(Hi,{name:"input",type:"text",label:t||"",disabled:!1,error:D,placeholder:r||"",value:H,onChange:Q,className:`${A} \n \n ${I?"modified":""}`}),e(Zo,{label:"",optionsList:m,selectedOption:{value:k,label:k},onChange:e=>S(e.value)})]}):e("div",{className:"ff-label-text-field-without-dropdown",children:e(Hi,{name:"input",type:"text",label:t||"",disabled:!1,error:D,placeholder:r||"",value:H,onChange:Q,className:`${A} \n \n ${I?"modified":""}`})}),n("div",{className:"ff-icon-container",children:[u&&e(Y,{title:"Confirm",placement:"bottom",children:e(q,{color:"var(--label-edit-confirm-icon)",height:20,width:20,name:u.name,disabled:z,className:""+(z?"disabled-confirm-icon":"confirm-icon"),onClick:_})}),h&&e(Y,{title:"Cancel",placement:"bottom",children:e(q,{color:"var(--label-edit-cancel-icon)",height:12,width:20,name:h.name,className:"cancel-icon",onClick:W,ref:R})})]})]}):e(Y,{title:E?.tooltipTitle?E?.tooltipTitle:"",placement:"bottom",children:o&&e("span",{className:"display-text",onDoubleClick:()=>{M||(P&&(clearTimeout(P),B(null)),b&&b(),x(!0),O(""))},role:"button",onClick:()=>{if(M)return;P&&(clearTimeout(P),B(null));const e=window.setTimeout(()=>{w&&w(),B(null)},1e3);B(e)},children:e(yn,{text:H,highlight:s})})}),Z&&L&&e(U,{as:"p",fontSize:8,className:"error-text",children:Z})]})},EA=e=>e?e.charAt(0)?.toUpperCase()+e?.slice(1)?.toLowerCase():"",bA=({label:t,text:r,highlightText:i,customError:o,customErrorCondition:l=!1,confirmIcon:s,cancelIcon:d,editIcon:u,dropdownData:f=[],isOpen:h=!1,confirmAction:C,onClick:p,nameTooltipTitle:m})=>{const[A,g]=c(h??!1),[v,y]=c(r),[w,E]=c(!0),[b,M]=c(f[0]?.value??""),[L,x]=c(""),[H,V]=c(!1),k=!(!L||!A),S=a(null),Z=a(null),O=()=>{const e=((e,t,n,r)=>e===t?"No changes were made.":e?e.length<3?"Please enter at least 3 characters.":r?n??"":"":"Text is required")(v,r,o,l);e&&A?x(e):(g(!1),x(""),C&&C(v,b))},z=()=>{y(r),M(f[0]?.value??""),g(!1),x(""),V(!1)};function N(e){"Enter"===e&&O(),"Escape"===e&&z()}return Zn([{key:"Enter",action:()=>N("Enter")},{key:"Escape",action:()=>N("Escape")}],S),n("div",{className:"ff-label-edit-text-field",ref:S,children:[n("div",A?{className:"ff-label-text-field",children:[e("div",{className:"ff-label-text-field-without-dropdown",children:e(Hi,{name:"input",label:t||"",disabled:!1,error:k,placeholder:"Enter your name",value:v,onChange:e=>{y(e.target.value),V(!0),x(""),E(!1)},className:"\n \n "+(H?"modified":""),type:"text"})}),n("div",{className:"ff-icon-container",children:[s&&e(Y,{title:"confirm",placement:"bottom",children:e(q,{color:s?.color??"var(--default-confirm-icon-color)",height:s?.height??20,disabled:w,width:s?.width??20,name:s?.name??"default-confirm-icon",className:`${s?.className??"default-confirm-class"} ${w?"disabled-confirm-icon":"confirm-icon"}`,onClick:O})}),d&&e(Y,{title:"cancel",placement:"bottom",children:e(q,{color:d?.color??"var(--label-edit-cancel-icon)",height:d?.height??12,width:d?.width??20,name:d?.name??"default-cancel-icon",className:d?.className??"cancel-icon",onClick:z,ref:Z})})]})]}:{className:"display-text-container",children:[m?e(Y,{title:m,children:e("span",{className:"display-text",onClick:p,children:e(yn,{text:v,highlight:i})})}):e("span",{className:"display-text",onClick:p,children:e(yn,{text:v,highlight:i})}),e(Y,{title:EA(u?.name??"Edit"),children:e(q,{color:u?.color??"var(--label-edit-cancel-icon)",height:u?.height??20,width:u?.width??20,name:u?.name??"edit",className:u?.className??"edit-icon",onClick:()=>{g(!0),x("")}})})]}),L&&A&&e(U,{as:"p",fontSize:8,className:"error-text",children:L})]})},MA="SET_DATA",LA="SET_CREATE_FORMULA_PARSER",xA="SELECT_ENTIRE_ROW",HA="SELECT_ENTIRE_COLUMN",VA="SELECT_ENTIRE_WORKSHEET",kA="SET_SELECTION",SA="SELECT",ZA="ACTIVATE",OA="SET_CELL_DATA",zA="SET_CELL_DIMENSIONS",NA="COPY",IA="CUT",TA="PASTE",DA="EDIT",FA="VIEW",RA="BLUR",PA="KEY_PRESS",BA="KEY_DOWN",jA="DRAG_START",_A="DRAG_END",qA="COMMIT",UA="BOLD",WA="ITALIC",XA="UNDERLINE_TYPE",QA="FONT_FAMILY",GA="FONT_SIZE",KA="TEXT_ALIGN",YA="BORDER_TYPE",JA="COLOR",$A="BACKGROUND_COLOR",eg="FORMATE_PAINTER",tg="ADD_ROW_TOP",ng="ADD_ROW_BOTTOM",rg="ADD_COLUMN_LEFT",ig="ADD_COLUMN_RIGHT",og="DELETE_ROW",ag="DELETE_COLUMN",lg="SET_ROW_HEIGHT",sg="SET_COLUMN_WIDTH",cg="SET_COLUMN_POSITION",dg="SET_AUTO_FILL",ug="UPDATE_COLUMN_DIMENSIONS",fg="SET_EDITABLE",hg="ON_MOUSE_UP";function Cg(e){return{type:hg,payload:{point:e}}}function pg(e){return{type:fg,payload:{editable:e}}}function mg(e,t){return{type:lg,payload:{row:e,height:t}}}function Ag(e,t){return{type:cg,payload:{column:e,width:t}}}function gg(e){return{type:UA,payload:{data:e}}}function vg(e){return{type:WA,payload:{data:e}}}function yg(e,t,n){return{type:YA,payload:{data:e,value:t,color:n}}}function wg(e){return{type:XA,payload:{data:e}}}function Eg(e,t){return{type:GA,payload:{data:e,value:t}}}function bg(e,t){return{type:QA,payload:{data:e,value:t}}}function Mg(e,t){return{type:KA,payload:{data:e,value:t}}}function Lg(e,t){return{type:JA,payload:{data:e,value:t}}}function xg(e,t){return{type:$A,payload:{data:e,value:t}}}function Hg(e){return{type:eg,payload:{data:e}}}function Vg(e){return{type:tg,row:e}}function kg(e){return{type:ng,row:e}}function Sg(e,t){return{type:rg,columnWidth:e,column:t}}function Zg(e,t){return{type:ig,columnWidth:e,column:t}}function Og(e){return{type:og,row:e}}function zg(e){return{type:ag,column:e}}function Ng(e){return{type:PA,payload:{event:e}}}function Ig(e){return{type:MA,payload:{data:e}}}function Tg(e){return{type:LA,payload:{createFormulaParser:e}}}function Dg(e){return{type:kA,payload:{selection:e}}}function Fg(e){return{type:ZA,payload:{point:e}}}function Rg(e,t){return{type:OA,payload:{active:e,data:t}}}function Pg(e,t){return{type:zA,payload:{point:e,dimensions:t}}}function Bg(e){return{type:TA,payload:{data:e}}}function jg(e){return{type:BA,payload:{event:e}}}function _g(){return{type:jA}}function qg(){return{type:_A}}function Ug(){return{type:NA}}function Wg(){return{type:IA}}function Xg(){return{type:DA}}function Qg(){return{type:RA}}function Gg(e,t){const n=t[e.row];if(void 0!==n)return n[e.column]}function Kg(e,t,n){const r=[...n],i=[...n[0]??[]];i.length<=e.column&&(i.length=e.column+1),r[0]=i;const o=[...n[e.row]??[]];return o[e.column]=t,r[e.row]=o,r}function Yg(e,t,n){let r=n[0];r||(r=[],n[0]=r);let i=n[e.row];i||(i=[],n[e.row]=i),r.length<=e.column&&(r.length=e.column+1),i[e.column]=t}const Jg={value:"",inputType:{type:"text"},readOnly:!1,style:{color:"#000000",backgroundColor:"#ffffff",borderColor:"#c9c9c9",textDecoration:"normal",borderRight:"1px solid var(--excel-header-border)",borderLeft:"1px solid var(--excel-header-border)",borderTop:"1px solid var(--excel-header-border)",borderBottom:"1px solid var(--excel-header-border)",fontSize:""+($g=9,1.33*$g+"px"),fontWeight:"normal",fontStyle:"normal",fontFamily:"Poppins",textAlign:"left"}};var $g;function ev(e,t){if(!nv(e,t))return t;const n=[...t],r=t[e.row];if(r){const t=[...r];t[e.column]=Jg,n[e.row]=t}return n}function*tv(e){for(const[t,n]of e.entries())for(const[e,r]of n.entries()){const n={row:t,column:e};yield[n,r]}}function nv(e,t){const n=t[0];return!!n&&(e.row>=0&&e.column>=0&&Number.isInteger(e.row)&&Number.isInteger(e.column)&&e.column<n.length&&e.row<t.length)}function rv(e){return{columns:ov(e),rows:iv(e)}}function iv(e){return e.length}function ov(e){const t=e[0];return t?t.length:0}function av(e){const t=rv(e);return{row:t.rows-1,column:t.columns-1}}class lv{start;end;constructor(e,t){this.start={row:Math.min(e.row,t.row),column:Math.min(e.column,t.column)},this.end={row:Math.max(e.row,t.row),column:Math.max(e.column,t.column)}}*[Symbol.iterator](){for(let e=this.start.row;e<=this.end.row;e++)for(let t=this.start.column;t<=this.end.column;t++)yield{row:e,column:t}}size(){return(this.end.row+1-this.start.row)*(this.end.column+1-this.start.column)}has(e){return e.row>=this.start.row&&e.column>=this.start.column&&e.row<=this.end.row&&e.column<=this.end.column}mask(e){return new lv({row:e.start.row>this.start.row?e.start.row:this.start.row,column:e.start.column>this.start.column?e.start.column:this.start.column},{row:e.end.row<this.end.row?e.end.row:this.end.row,column:e.end.column<this.end.column?e.end.column:this.end.column})}equals(e){return this.start.row===e.start.row&&this.start.column===e.start.column&&this.end.row===e.end.row&&this.end.column===e.end.column}}const sv={row:0,column:0};class cv{}class dv extends cv{toRange(e){return null}normalizeTo(e){return this}hasEntireRow(){return!1}hasEntireColumn(){return!1}size(){return 0}has(){return!1}equals(e){return e instanceof dv}}class uv extends cv{range;constructor(e){super(),this.range=e}toRange(e){return this.range}normalizeTo(e){const t=Av(e);return new uv(this.range.mask(t))}hasEntireRow(){return!1}hasEntireColumn(){return!1}size(e){const t=this.toRange(e);return t?t.size():0}has(e,t){const n=this.toRange(e);return null!==n&&n.has(t)}equals(e){return e instanceof uv&&this.range.equals(e.range)}}class fv extends cv{}class hv extends fv{toRange(e){return Av(e)}normalizeTo(){return this}hasEntireColumn(){return!0}hasEntireRow(){return!0}size(e){return ov(e)*iv(e)}has(){return!0}equals(e){return e instanceof hv}}class Cv extends fv{start;end;constructor(e,t){if(!gv(e))throw new vv("start");if(!gv(t))throw new vv("end");super(),this.start=Math.min(e,t),this.end=Math.max(e,t)}equals(e){return e instanceof Cv&&this.constructor===e.constructor&&this.start===e.start&&this.end===e.end}}class pv extends Cv{toRange(e){const t=av(e);return new lv({row:this.start,column:0},{row:this.end,column:t.column})}normalizeTo(e){const t=iv(e);return new pv(Math.max(this.start,0),Math.min(this.end,t-1))}hasEntireRow(e){return e>=this.start&&e<=this.end}hasEntireColumn(){return!1}size(e){return(this.end-this.start+1)*ov(e)}has(e,t){return t.row>=this.start&&t.row<=this.end}}class mv extends Cv{toRange(e){const t=av(e);return new lv({row:0,column:this.start},{row:t.row,column:this.end})}normalizeTo(e){const t=ov(e);return new mv(Math.max(this.start,0),Math.min(this.end,t-1))}hasEntireRow(){return!1}hasEntireColumn(e){return e>=this.start&&e<=this.end}size(e){return(this.end-this.start+1)*iv(e)}has(e,t){return t.column>=this.start&&t.column<=this.end}}function Av(e){const t=av(e);return new lv(sv,t)}function gv(e){return Number.isInteger(e)&&e>=0}class vv extends Error{constructor(e){super(`${e} is not a valid index. It must be 0 or a positive integer`)}}const yv="text/plain";function wv(e,t=0,n=1){const r=[];if(-1===Math.sign(e-t)){for(let i=t;i>e;i-=n)r.push(i);return r}for(let i=t;i<e;i+=n)r.push(i);return r}function Ev(e,t){return Boolean(e&&(r=e,(n=t).column===r.column&&n.row===r.row));var n,r}function bv(e){return{width:e.offsetWidth,height:e.offsetHeight,left:e.offsetLeft,top:e.offsetTop}}function Mv(e){return Object.keys(e).map(e=>Number(e)).sort((e,t)=>e-t)}function Lv(e,t,n){const r={},i=Mv(e);let o=0,a=!1;for(let l=0;l<i.length;l++){if(l===t){const e=r[l-1],t=e?e.left+e.width:0;r[l]={left:t,width:n},o=n,a=!0}const s=i[l];if(void 0===s)continue;const c=e[s];if(!c)continue;const d=a?l+1:l,u=a?c.left+o:c.left;r[d]={...c,left:u}}if(!a){const e=i.length>0?i[i.length-1]:void 0,o=void 0!==e?r[e]:void 0,a=o?o.left+o.width:0;r[t]={left:a,width:n}}return r}function xv(e,t,n){const r={},i=Mv(e);let o=0,a=!1;for(let l=0;l<i.length;l++){if(l===t){const e=r[l-1],t=e?e.top+e.height:0;r[l]={top:t,height:n},o=n,a=!0}const s=i[l];if(void 0===s)continue;const c=e[s];if(!c)continue;const d=a?l+1:l,u=a?c.top+o:c.top;r[d]={...c,top:u}}if(!a){const e=i.length>0?i[i.length-1]:void 0,o=void 0!==e?r[e]:void 0,a=o?o.top+o.height:0;r[t]={top:a,height:n}}return r}function Hv(e,t){const n={},r=Mv(e);let i=0;for(let o=0,a=0;o<r.length;o++){if(r[o]===t)continue;const l=r[o];if(void 0===l)continue;const s=e[l];s&&(n[a]={top:0===i?s.top:i,height:s.height},"number"==typeof n[a]?.top&&(i=(n[a]?.top??0)+s.height),a++)}return n}function Vv(e,t){const n={},r=Mv(e);let i=0;for(let o=0,a=0;o<r.length;o++){if(r[o]===t)continue;const l=r[o];if(void 0===l)continue;const s=e[l];s&&(n[a]={left:0===i?s.left:i,width:s.width},"number"==typeof n[a]?.left&&(i=(n[a]?.left??0)+s.width),a++)}return n}function kv(e,t,n){const r=100;let i=32;for(let n=0;n<e.row;n++)i+=(t?.[n]?t?.[n]?.height:32)||32;const o=(t?.[e.row]?t?.[e.row]?.height:32)||32;let a=60;for(let t=0;t<e.column;t++)a+=(n?.[t]?n?.[t]?.width:r)||r;return{top:i,height:o,left:a,width:(n?.[e.column]?n?.[e.column]?.width:r)||r}}function Sv(e,t,n){const r=kv(n.start,e,t);let i=kv(n.end,e,t);return void 0===i&&(i=function(e,t,n){const r=100;let i=4032;for(let n=0;n<e.row;n++)i+=(t?.[n]?t?.[n]?.height:32)||32;const o=(t?.[e.row]?t?.[e.row]?.height:32)||32;let a=60;for(let t=0;t<e.column;t++)a+=(n?.[t]?n?.[t]?.width:r)||r;return{top:i,height:o,left:a,width:(n?.[e.column]?n?.[e.column]?.width:r)||r}}(n.end,e,t)),r&&i&&{width:i.left+i.width-r.left,height:i.top+i.height-r.top,top:r.top+1,left:r.left+1}}function Zv(e,t,n,r){const i=r.toRange(n);return i?Sv(e,t,i):void 0}function Ov(e){return function(e,t){const n=[];for(const[r,i]of tv(t))Yg(r,e(i,r),n);return n}(e=>e?.value||"",e).map(e=>e.map(e=>{const t=String(e).replace(/"/g,'""');return si.test(t)?`"${t}"`:t}).join("\t")).join("\n")}function zv(e,t){return null!==e&&"view"===t&&Nv(e)}function Nv(e){return e.matches(":focus-within")}function Iv(e){return"string"==typeof e&&e.includes("\n")}const Tv=e=>`${1.33*e}px`,Dv=e=>parseFloat(e.replace("px",""))/1.33,Fv={value:"",inputType:{type:"text"},readOnly:!1,style:{color:"#000000",backgroundColor:"#ffffff",borderColor:"#c9c9c9",textDecoration:"normal",borderRight:"1px solid var(--excel-header-border)",borderLeft:"1px solid var(--excel-header-border)",borderTop:"1px solid var(--excel-header-border)",borderBottom:"1px solid var(--excel-header-border)",fontSize:`${Tv(9)}`,fontWeight:"normal",fontStyle:"normal",fontFamily:"Poppins",textAlign:"left"}},Rv=[{label:"Times New Roman",value:"Times New Roman"},{label:"Arial",value:"Arial"},{label:"fantasy",value:"fantasy"},{label:"cursive",value:"cursive"},{label:"Poppins",value:"Poppins"},{label:"Courier New",value:"Courier New"},{label:"Verdana",value:"Verdana"},{label:"Tahoma",value:"Tahoma"},{label:"Trebuchet MS",value:"Trebuchet MS"},{label:"Comic Sans MS",value:"Comic Sans MS"},{label:"Impact",value:"Impact"},{label:"Arial Black",value:"Arial Black"},{label:"Lucida Console",value:"Lucida Console"},{label:"Lucida Sans Unicode",value:"Lucida Sans Unicode"},{label:"Courier",value:"Courier"},{label:"Arial Rounded MT Bold",value:"Arial Rounded MT Bold"},{label:"Georgia",value:"Georgia"},{label:"sans-serif",value:"sans-serif"},{label:"serif",value:"serif"},{label:"monospace",value:"monospace"}],Pv=[5,6,8,9,10,12,14,16,18,20,22,24,26,28,32,36,40,48,56,72],Bv=e=>["dropDown","text"].includes(e?.inputType?.type??"text")&&!e?.readOnly;function jv(e){return{rowCount:e?.length??0,columnCount:e?.[0]?.length??0}}function _v(e){return"string"==typeof e&&e.startsWith("=")&&e.length>1}function qv(e){return e}function Uv(e){return`${e.row},${e.column}`}function Wv(e){const[t,n]=e.split(",");return{row:Number(t),column:Number(n)}}class Xv{set;constructor(e){this.set=e}static from(e){const t=new Set;for(const n of e)t.add(Uv(n));return new Xv(t)}has(e){return this.set.has(Uv(e))}get size(){return this.set.size}add(e){const t=new Set(this.set);return t.add(Uv(e)),new Xv(t)}delete(e){const t=new Set(this.set);return t.delete(Uv(e))?new Xv(t):this}difference(e){let t=this;for(const n of e)t=t.delete(n);return t}union(e){let t=this;for(const n of e)t=t.add(n);return t}*[Symbol.iterator](){for(const e of this.set)yield Wv(e)}}class Qv{forwards;constructor(e=new Map){this.forwards=e}static from(e){const t=new Map;for(const[n,r]of e)t.set(Uv(n),r);return new Qv(t)}set(e,t){const n=new Qv(new Map(this.forwards));return 0===t.size?(n.forwards.delete(Uv(e)),n):(n.forwards.set(Uv(e),t),n)}get(e){return this.forwards.get(Uv(e))||Xv.from([])}getBackwards(e){let t=Xv.from([]);for(const[n,r]of this.forwards)r.has(e)&&(t=t.add(Wv(n)));return t}getBackwardsRecursive(e,t=Xv.from([])){let n=this.getBackwards(e),r=t;for(const e of n)r.has(e)||(r=r.add(e),n=n.union(this.getBackwardsRecursive(e,r)));return n}hasCircularDependency(e){let t=Xv.from([]);const n=[e];for(;n.length>0;){const e=n.pop();if(!e)continue;if(t.has(e))return!0;t=t.add(e);const r=this.get(e);if(r)for(const e of r)n.push(e)}return!1}*[Symbol.iterator](){const e=new Set;for(const[t,n]of this.forwards){const r=Wv(t);e.add(t),yield[r,n];for(const t of n){const n=Uv(t);e.has(n)||this.forwards.has(n)||(e.add(n),yield[t,Xv.from([])])}}}*traverseBFSBackwards(){let e=Xv.from([]);const t=[];for(const[n,r]of this)0===r.size&&(e=e.add(n),t.push(n));for(;t.length>0;){const n=t.shift();if(!n)continue;yield n;const r=this.getBackwards(n);if(0!==r.size)for(const n of r)e.has(n)||0!==this.get(n).difference(e).size||(t.push(n),e=e.add(n))}}}class Gv{data;evaluatedData;referenceGraph;createFormulaParser;constructor(e,t,n,r){this.createFormulaParser=e,this.data=t,this.referenceGraph=n||function(){const e=[];return Qv.from(e)}(),this.evaluatedData=r||function(e,t){let n=e;for(const r of t.traverseBFSBackwards()){const t=Gg(r,e);if(t&&_v(t.value)){const e=Yv();n=Kg(r,{...t,value:e},n)}}return n}(t,this.referenceGraph)}}function Kv(e,t,n){const r=Kg(t,n,e.data),i=(_v(n.value),e.referenceGraph),o=function(e,t,n,r,i){if(n.hasCircularDependency(r)){let o=Xv.from([r]),a=Kg(r,{...i,value:"TODO"},e);for(const e of n.getBackwardsRecursive(r)){if(o.has(e))break;o=o.add(e);const n=Gg(e,t);n&&(a=Kg(e,{...n,value:"TODO"},a))}return a}let o=e;const a=_v(i.value)?"TODO":i.value,l={...i,value:a};o=Kg(r,l,o);for(const e of n.getBackwardsRecursive(r)){const n=Gg(e,t);if(!n)continue;const r=_v(n.value)?Yv():n.value;o=Kg(e,{...n,value:r},o)}return o}(e.evaluatedData,r,i,t,n);return new Gv(e.createFormulaParser,r,i,o)}function Yv(){return"TODO"}function Jv(e){if(6!==e.length)return!1;for(let t=1;t<e.length;t++)if(!"0123456789ABCDEFabcdef".includes(e[t]))return!1;return!0}function $v(e){return my(e)||!e.editable?e:{...e,mode:"edit"}}const ey=e=>(e=>e&&!e.readOnly)(e)&&"file"!==e?.inputType?.type?{...e,value:"",style:e?.style}:e,ty=e=>{if(e)return{...e,value:(e.value||"")+"\n",style:e.style}};function ny(e){if(!e.active)return e;const t=e.selected.toRange(e.model.data),n=[];let r=e.model.data;for(const i of t||[]){const t=Gg(i,e.model.data),o=ey(t);n.push({prevCell:t||null,nextCell:o||null}),r=Kg(i,o,r)}return{...e,model:new Gv(qv,r),...ay(n)}}function ry(e){if(!e.active)return e;const t=e.selected.toRange(e.model.data),n=[];let r=e.model.data;for(const i of t||[]){const t=Gg(i,e.model.data),o=ty(t);n.push({prevCell:t||null,nextCell:o||null}),r=Kg(i,o,r)}return{...e,mode:"edit",model:new Gv(qv,r),...ay(n)}}function iy(e){return{...e,active:null,copied:null,formattedStyle:{open:!1,style:void 0},selected:new dv}}function oy(e){return{...e,mode:"view"}}function ay(e){return{lastCommit:e}}const ly=(e,t)=>n=>{if(!n.active)return;const r=rv(n.model.data),i=n.active.column+t>=r.columns,o={row:n.active.row+e+(i?1:0),column:(n.active.column+t)%r.columns};return nv(o,n.model.data)?{...n,active:o,selected:new uv(new lv(o,o)),mode:"view"}:{...n,mode:"view"}},sy={ArrowUp:ly(-1,0),ArrowDown:ly(1,0),ArrowLeft:ly(0,-1),ArrowRight:ly(0,1),Tab:ly(0,1),Enter:$v,Backspace:function(e){if(!e.active)return e;if("view"===e.mode){return ny(e)}{const t=[];let n=e.model.data;const r=Gg(e.active,e.model.data),i=ey(r);return t.push({prevCell:r||null,nextCell:i||null}),n=Kg(e.active,i,n),{...e,mode:"edit",model:new Gv(qv,n),...ay(t)}}},Delete:ny,Escape:iy},cy={Escape:oy,Tab:sy.Tab,Enter:sy.ArrowDown,Delete:ny},dy={Tab:ly(0,-1)};var uy;!function(e){e.Left="Left",e.Right="Right",e.Top="Top",e.Bottom="Bottom"}(uy||(uy={}));const fy={ArrowUp:e=>({...e,selected:Ay(e.selected,e.active,e.model.data,uy.Top)}),ArrowDown:e=>({...e,selected:Ay(e.selected,e.active,e.model.data,uy.Bottom)}),ArrowLeft:e=>({...e,selected:Ay(e.selected,e.active,e.model.data,uy.Left)}),ArrowRight:e=>({...e,selected:Ay(e.selected,e.active,e.model.data,uy.Right)}),Tab:ly(0,-1)},hy={},Cy={};function py(e,t){const{key:n}=t;let r;if("edit"===e.mode)if(t.shiftKey&&"Enter"===n)r=sy;else{if(t.altKey&&"Enter"===n)return ry;r=t.shiftKey?dy:cy}else r=t.shiftKey&&t.metaKey?hy:t.shiftKey?fy:t.metaKey?Cy:sy;return r[n]}function my(e){const t=function(e){const t=e.active&&Gg(e.active,e.model.data);return t||null}(e);return Boolean(t?.readOnly)}function Ay(e,t,n,r){if(!t)return e;if(e instanceof uv){const i=function(e,t,n,r){const i=r===uy.Left||r===uy.Right?"column":"row",o=r===uy.Left||r===uy.Top?"start":"end",a="start"===o?-1:1,l=e.range.has({...t,[i]:t[i]+-1*a}),s=l?"start"===o?"end":"start":o,c=new lv(e.range.start,e.range.end);c[s][i]+=a;const d=new uv(c).normalizeTo(n);return d}(e,t,n,r);return i}return e instanceof mv?function(e,t,n,r){if(r===uy.Top||r===uy.Bottom)return e;const i=r===uy.Left?-1:1,o=r===uy.Left?"start":"end",a="start"===o?"end":"start",l={...e};(r===uy.Left?e.end>t.row:e.start<t.row)?l[a]=e[a]+i:l[o]=e[o]+i;return new mv(Math.max(l.start,0),Math.max(l.end,0)).normalizeTo(n)}(e,t,n,r):e instanceof pv?function(e,t,n,r){if(r===uy.Left||r===uy.Right)return e;const i=r===uy.Top?-1:1,o=r===uy.Top?"start":"end",a="start"===o?"end":"start",l={...e};(r===uy.Top?e.end>t.row:e.start<t.row)?l[a]=e[a]+i:l[o]=e[o]+i;return new pv(Math.max(l.start,0),Math.max(l.end,0)).normalizeTo(n)}(e,t,n,r):e}const gy=(e,t={},n)=>{const{selectedRow:r,selectedColumn:i,model:o,columnDimensions:a}=e,{column:l,columnWidth:s=100}=t,c=l??i;if(K(c))return e;const d="LEFT"===n?c:c+1,u=o.data.map(e=>{const t=[...e],n=e[c];return t.splice(d,0,(e=>{if("object"!=typeof e||null===e)return e;const{contextDisable:t,...n}=e;return{...n,value:"",readOnly:!1,style:{...e.style,borderBottom:"",borderLeft:"",borderRight:"",borderTop:""}}})(n)),t}),f=new Gv(o.createFormulaParser,u),h=r??0;return{...e,model:f,selectedRow:h,selectedColumn:d,active:{row:h,column:d},selected:new mv(d,d),columnDimensions:Lv(a,d,s)}},vy=(e,t={},n)=>{const{selectedRow:r,selectedColumn:i,model:o,rowDimensions:a}=e,{row:l}=t,s=l??r;if(K(s))return e;const c="TOP"===n?s:s+1,d=[...o.data],u=((e,t)=>e?e?.map(e=>"object"==typeof e&&null!==e?{...e,value:"",readOnly:!1,contextDisable:void 0,style:{...e.style,borderBottom:"",borderLeft:"",borderRight:"",borderTop:""}}:e):Array(t||0).fill(Fv))(o.data[s]||[],d[0]?.length);d.splice(c,0,u??[]);const f=new Gv(o.createFormulaParser,d),h=i??0;return{...e,model:f,selectedRow:c,selectedColumn:h,active:{row:c,column:h},selected:new pv(c,c),rowDimensions:xv(a,c,32)}},yy={active:null,mode:"view",rowDimensions:{},columnDimensions:{},lastChanged:null,hasPasted:!1,cut:!1,autoFill:{open:!1,cellValue:{value:"",style:{}}},dragging:!1,model:new Gv(qv,[]),selected:new dv,copied:null,lastCommit:null,selectedColumn:null,selectedRow:null,formattedStyle:{open:!1,style:void 0},editable:!1,ctrl:!0};function wy(e,t){switch(t.type){case ug:{const{minimumColumnWidth:n}=t.payload,r={...e.columnDimensions};return Object.keys(r).forEach(e=>{const t=parseInt(e);(r[t]?.width||0)!==n&&(r[t]={left:r[t]?.left||0,width:n})}),{...e,columnDimensions:r}}case fg:{const{editable:n}=t.payload;return{...e,editable:n}}case dg:{const{autofill:n}=t.payload,r=e.active;let i=Fv;return r&&(i=Gg({row:r.row,column:r.column},e.model.data)||i),{...e,autoFill:{open:n,cellValue:i}}}case tg:return vy(e,t,"TOP");case ng:return vy(e,t,"BOTTOM");case rg:return gy(e,t,"LEFT");case ig:return gy(e,t,"RIGHT");case og:{let{selectedRow:n,selectedColumn:r,model:i,rowDimensions:o,copied:a}=e;const{row:l}=t;if(K(n))return e;const s=l??n;let c=[...i.data];c.splice(s,1);const d=new Gv(i.createFormulaParser,c);let u=s>0?s-1:0;const f=null!==r?r:0,h=c.length>0?{row:u,column:f}:null,C=c.length>0?new pv(u,u):new dv;let p=a;return a&&a.start.row<=s&&a.end.row>=s&&(p=null),{...e,model:d,selectedRow:u,selectedColumn:f,selected:C,active:h,copied:p,rowDimensions:Hv(o,s)}}case ag:{const{selectedRow:n,selectedColumn:r,model:i,columnDimensions:o,copied:a}=e,{column:l}=t;if(K(l??r))return e;const s=l??r,c=i.data.map(e=>e.filter((e,t)=>t!==s)),d=new Gv(i.createFormulaParser,c),u=null!==n?n:0,f=s>0?s-1:0,h=c.length>0?{row:u,column:f}:null,C=c.length>0?new mv(f,f):new dv;let p=a;return a&&a.start.column<=s&&a.end.column>=s&&(p=null),{...e,model:d,selectedRow:u,selectedColumn:f,selected:C,active:h,copied:p,columnDimensions:Vv(o,s)}}case UA:{const t=e.selected.toRange(e.model.data),n=function(e,t,n){if(!t)return e;const{start:r,end:i}=t;let o=e,a=!1;for(let e=r.row;e<=i.row;e++){for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);if(r&&n&&!r.readOnly&&"bold"===r.style?.fontWeight){a=!0;break}}if(a)break}for(let e=r.row;e<=i.row;e++)for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);r&&n&&(r.readOnly||(o=Kg({row:e,column:t},{...r,style:{...r.style,fontWeight:a?"normal":"bold"}},o)))}return o}(e.model.data,t,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,n)}}case WA:{const t=e.selected.toRange(e.model.data),n=function(e,t,n){if(!t)return e;const{start:r,end:i}=t;let o=e,a=!1;for(let e=r.row;e<=i.row;e++){for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);if(r&&n&&!r.readOnly&&"italic"===r.style?.fontStyle){a=!0;break}}if(a)break}for(let e=r.row;e<=i.row;e++)for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);r&&n&&(r.readOnly||(o=Kg({row:e,column:t},{...r,style:{...r.style,fontStyle:a?"normal":"italic"}},o)))}return o}(e.model.data,t,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,n)}}case YA:{const{value:n,color:r}=t.payload,i=e.selected.toRange(e.model.data),o=function(e,t,n,r,i){if(!t)return e;let o=e;const{start:a,end:l}=t,s=(e,t)=>Gg({row:e,column:t},o),c=(e,t,n)=>{o=Kg({row:e,column:t},n,o)};for(let e=a.row;e<=l.row;e++)for(let t=a.column;t<=l.column;t++){const o=s(e,t);if(!o||!i||o.readOnly)continue;const a={...o,style:{...o.style}},l=s(e-1,t),d=s(e+1,t),u=s(e,t-1),f=s(e,t+1),h=`2px solid ${r}`,C="1px solid var(--excel-header-border)",p=e=>{switch(e){case"borderTop":l&&l.style?.borderBottom===h?a.style.borderTop="none":a.style.borderTop=h;break;case"borderBottom":d&&d.style?.borderTop===h?a.style.borderBottom="none":a.style.borderBottom=h;break;case"borderLeft":u&&u.style?.borderRight===h?a.style.borderLeft="none":a.style.borderLeft=h;break;case"borderRight":f&&f.style?.borderLeft===h?a.style.borderRight="none":a.style.borderRight=h}};switch(n){case"border-all-sides":p("borderTop"),p("borderBottom"),p("borderLeft"),p("borderRight");break;case"border-none":if(a.style={...a.style,borderRight:C,borderLeft:C,borderTop:C,borderBottom:C},l){const n={...l,style:{...l.style}};"none"===n.style.borderBottom&&(n.style.borderBottom=h,c(e-1,t,n))}if(d){const n={...d,style:{...d.style}};"none"===n.style.borderTop&&(n.style.borderTop=h,c(e+1,t,n))}if(u){const n={...u,style:{...u.style}};"none"===n.style.borderRight&&(n.style.borderRight=h,c(e,t-1,n))}if(f){const n={...f,style:{...f.style}};"none"===n.style.borderLeft&&(n.style.borderLeft=h,c(e,t+1,n))}break;case"border-right":p("borderRight");break;case"border-left":p("borderLeft");break;case"border-top":p("borderTop");break;case"border-bottom":p("borderBottom")}c(e,t,a)}return o}(e.model.data,i,n,r,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,o)}}case XA:{const t=e.selected.toRange(e.model.data),n=function(e,t,n){if(!t)return e;const{start:r,end:i}=t;let o=e,a=!1;for(let e=r.row;e<=i.row;e++){for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);if(r&&n&&!r.readOnly&&"underline"===r.style?.textDecoration){a=!0;break}}if(a)break}for(let e=r.row;e<=i.row;e++)for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);r&&n&&(r.readOnly||(o=Kg({row:e,column:t},{...r,style:{...r.style,textDecoration:a?"none":"underline"}},o)))}return o}(e.model.data,t,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,n)}}case GA:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;const i=Number(n);if(isNaN(i))return e;const o=Tv(i),{start:a,end:l}=t;let s=e;for(let e=a.row;e<=l.row;e++)for(let t=a.column;t<=l.column;t++){const n=Gg({row:e,column:t},s);n&&r&&(n.readOnly||(s=Kg({row:e,column:t},{...n,style:{...n.style,fontSize:o}},s)))}return s}(e.model.data,r,n,e.editable),o=new Gv(e.model.createFormulaParser,i);let a={...e.rowDimensions};if(e.active&&"edit"!==e.mode){const t=e.active.row,n=i[t];if(n){let e=32;n.forEach(t=>{if(!t)return;const n=t.style?.fontSize?parseInt(t.style.fontSize.toString().replace("px","")):9,r=Math.max(1.2*n,18),i=(["file","dropDown"].includes(t?.inputType?.type??"")?0:String(t.value).split(" ").length)+(String(t.value).split("\n").length-1);e=Math.max(e,r*i)}),a[t]={...a[t]||{top:0,height:32},height:e}}}else if(r)for(let e=r.start.row;e<=r.end.row;e++){const t=i[e];if(!t)continue;let n=32;t.forEach(e=>{if(!e)return;const t=e.style?.fontSize?parseInt(e.style.fontSize.toString().replace("px","")):9,r=Math.max(1.2*t,18),i=(["file","dropDown"].includes(e?.inputType?.type??"")?0:String(e.value).split(" ").length)+(String(e.value).split("\n").length-1);n=Math.max(n,r*i)}),a[e]={...a[e]||{top:0,height:32},height:n}}return{...e,model:o,rowDimensions:a}}case QA:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;const{start:i,end:o}=t;let a=e;for(let e=i.row;e<=o.row;e++)for(let t=i.column;t<=o.column;t++){const i=Gg({row:e,column:t},a);i&&r&&(i.readOnly||(a=Kg({row:e,column:t},{...i,style:{...i.style,fontFamily:n}},a)))}return a}(e.model.data,r,n,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,i)}}case KA:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;const{start:i,end:o}=t;let a=e;for(let e=i.row;e<=o.row;e++)for(let t=i.column;t<=o.column;t++){const i=Gg({row:e,column:t},a);i&&r&&(i.readOnly||(a=Kg({row:e,column:t},{...i,style:{...i.style,textAlign:n}},a)))}return a}(e.model.data,r,n,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,i)}}case JA:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;const{start:i,end:o}=t;let a=e;const l=Jv(n)?`#${n}`:n;for(let e=i.row;e<=o.row;e++)for(let t=i.column;t<=o.column;t++){const n=Gg({row:e,column:t},a);n&&r&&(n.readOnly||(a=Kg({row:e,column:t},{...n,style:{...n.style,color:l}},a)))}return a}(e.model.data,r,n,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,i)}}case $A:{const{value:n}=t.payload,r=e.selected.toRange(e.model.data),i=function(e,t,n,r){if(!t)return e;if(t){const{start:i,end:o}=t;let a=e;const l=Jv(n)?`#${n}`:n;for(let e=i.row;e<=o.row;e++)for(let t=i.column;t<=o.column;t++){const n=Gg({row:e,column:t},a);n&&r&&(n.readOnly||(a=Kg({row:e,column:t},{...n,style:{...n.style,backgroundColor:l}},a)))}return a}return e}(e.model.data,r,n,e.editable);return{...e,model:new Gv(e.model.createFormulaParser,i)}}case eg:{if(!e.editable)return e;const t=function(e,t){if(!t)return;const{row:n,column:r}=t,i=Gg({row:n,column:r},{...e});return i&&i.style?i.style:void 0}(e.model.data,e.active),n=e.selected.toRange(e.model.data);return e.formattedStyle.open?{...e,selected:new dv,active:e.copied?.start||null,copied:null,formattedStyle:{open:!1,style:void 0}}:{...e,selected:new dv,active:null,copied:n,formattedStyle:{open:!0,style:t}}}case MA:{const{data:n}=t.payload,r=e.active&&nv(e.active,n)?e.active:null,i=e.selected.normalizeTo(n);return{...e,model:new Gv(e.model.createFormulaParser,n),active:r,selected:i}}case LA:{const{createFormulaParser:n}=t.payload;return{...e,model:new Gv(n,e.model.data)}}case xA:{const{row:n,extend:r}=t.payload,{active:i}=e,o=new pv(r&&i?i.row:n,n),a=r&&i?i:{...sv,row:n};return{...e,selected:o,active:a,mode:"view",selectedColumn:null,selectedRow:n}}case HA:{const{column:n,extend:r}=t.payload,{active:i}=e,o=new mv(r&&i?i.column:n,n),a=r&&i?i:{...sv,column:n};return{...e,selected:o,active:a,mode:"view",selectedColumn:n,selectedRow:null}}case VA:return{...e,selected:new hv,active:sv,mode:"view"};case kA:{const{selection:n}=t.payload,r=n.toRange(e.model.data),i=e.active&&n.has(e.model.data,e.active)?e.active:r?.start;return{...e,selected:n,active:i||null,mode:"view"}}case SA:{const{point:n}=t.payload;return e.active&&!Ev(e.active,n)?{...e,selected:new uv(new lv(n,e.active)),mode:"view"}:e}case ZA:{const{point:n}=t.payload;return{...e,selected:new uv(new lv(n,n)),active:n,mode:Ev(e.active,n)&&e.editable?"edit":"view"}}case OA:{const{active:n,data:r}=t.payload;return my(e)||!e.editable?e:{...e,model:Kv(e.model,n,r),lastChanged:n}}case zA:{const{point:n,dimensions:r}=t.payload,i=e.rowDimensions[n.row],o=e.columnDimensions[n.column];return i&&o&&i.top===r.top&&i.height===r.height&&o.left===r.left&&o.width===r.width?e:{...e,rowDimensions:{...e.rowDimensions,[n.row]:{top:r.top,height:r.height}},columnDimensions:{...e.columnDimensions,[n.column]:{left:r.left,width:r.width}}}}case NA:case IA:{const n=e.selected.toRange(e.model.data);return{...e,copied:n,cut:t.type===IA,hasPasted:!1}}case TA:{const{data:n}=t.payload,{active:r}=e;if(!r||!e.editable)return e;const i=function(e,t,n="\t",r=/\r\n|\n|\r/){return e.replace(/"([^"]*?)"/g,(e,t)=>t.replace(/\n/g,"\\n")).split(r).map(e=>e.split(n).map(e=>e.replace(/\\n/g,"\n")).map(t))}(n,e=>({value:e})),o=rv(i),a=e.selected.toRange(e.model.data);let l=null;e.cut&&e.copied&&(l=new lv(r,{row:r.row+o.rows-1,column:r.column+o.columns-1}));const s=e=>!!l&&(e.row>=l.start.row&&e.row<=l.end.row&&e.column>=l.start.column&&e.column<=l.end.column);if(a&&1===o.rows&&1===o.columns){const t=Gg({row:0,column:0},i);let n=e.model.data;if(e.cut&&e.copied)for(const t of e.copied)s(t)||(n=ev(t,n));const r=[];for(const i of a||[]){const o=Gg(i,e.model.data)||null,a={...o,value:t?.value};r.push({prevCell:o||Fv,nextCell:Fv}),Bv(o)&&(n=Kg(i,a,n))}return{...e,model:new Gv(qv,n),copied:null,cut:!1,hasPasted:!0,mode:"view",lastCommit:r}}const c={rows:r.row+o.rows,columns:r.column+o.columns},d=function(e,t){const{rows:n,columns:r}=rv(e);if(n>=t.rows&&r>=t.columns)return e;const i={rows:t.rows>n?t.rows:n,columns:t.columns>r?t.columns:r};let o=[...e];if(i.columns>r){const e=i.columns-r;o=o.map(t=>[...t,...Array(e).fill(Jg)])}if(i.rows>n){const e=i.rows-n,t=Array(i.columns).fill(Jg);o=[...o,...Array(e).fill(t)]}return o}(e.model.data,c);let u={data:d,commit:[]};for(const[t,n]of tv(i)){let i=u.commit||[];const o={row:t.row+r.row,column:t.column+r.column};let a=u.data;if(e.cut&&e.copied){const r={row:t.row+e.copied.start.row,column:t.column+e.copied.start.column};s(r)||(a=ev(r,u.data)),i=[...i,{prevCell:n||null,nextCell:null}]}nv(o,d)||(u={data:a,commit:i});const l=Gg(o,a)||null;i=[...i,{prevCell:l,nextCell:n||null}],Bv(l)&&(u.data=Kg(o,{...l,value:n?.value??""},a),u.commit=i)}return{...e,model:new Gv(qv,u.data),selected:new uv(new lv(r,{row:r.row+o.rows-1,column:r.column+o.columns-1})),copied:null,cut:!1,hasPasted:!0,mode:"view",lastCommit:u.commit}}case DA:return $v(e);case FA:return oy(e);case"CLEAR":return ny(e);case RA:return iy(e);case PA:{const{event:n}=t.payload;if(my(e)||n.metaKey||!e.editable)return e;if("view"===e.mode&&e.active){const t=e.selected.toRange(e.model.data);return 1===t?.size()?$v(ny(e)):$v(e)}return e}case BA:{const{event:n}=t.payload;if(n.ctrlKey)return{...e,ctrl:!e.ctrl};if(my(e)||n.metaKey||!e.editable)return e;const r=py(e,n);return r?{...e,...r(e,n)}:e}case lg:{const{row:n,height:r}=t.payload,i=e.rowDimensions[n]||{top:0};let o=e.model.data;if(o[n]){const e=o?.[n]?.length;for(let t=0;t<e;t++){const e={row:n,column:t},i=Gg(e,o)||Fv;o=Kg(e,{...i,style:{...i.style,height:r}},o)}}const a=new Gv(e.model.createFormulaParser,o);return{...e,rowDimensions:{...e.rowDimensions,[n]:{top:i.top,height:r}},model:a}}case sg:{const{column:n,width:r}=t.payload,i=e.columnDimensions[n]||{left:0};if(!e.model.data)return{...e,columnDimensions:{...e.columnDimensions,[n]:{left:i.left,width:r}}};let o=e.model.data??[];for(let e=0;e<o.length;e++)if(o[e]&&o?.[e]?.length>n){const t={row:e,column:n},i=Gg(t,o)??Fv;o=Kg(t,{...i,style:{...i.style??{},width:r}},o)}const a=new Gv(e.model.createFormulaParser,o);return{...e,columnDimensions:{...e.columnDimensions,[n]:{left:i.left,width:r}},model:a}}case cg:{const{column:n,width:r}=t.payload,i=e.columnDimensions[n]||{left:0};return{...e,columnDimensions:{...e.columnDimensions,[n]:{left:i.left,width:r}}}}case jA:return{...e,dragging:!0};case hg:{const{point:n}=t.payload;let r=e.model.data;return!e.dragging&&e.formattedStyle.open&&(r=function(e,t,n){if(!n||!t.open)return e;let r=e;const i=Gg(n,r);i&&!i.readOnly&&(r=Kg(n,{...i,style:t.style},r));return r}(e.model.data,e.formattedStyle,e.active)),{...e,copied:null,model:new Gv(e.model.createFormulaParser,r),formattedStyle:{open:!1,style:void 0},active:n}}case _A:{const t=e.selected.toRange(e.model.data),n=e.active;let r=e.model.data;if(e.formattedStyle.open&&(r=function(e,t,n){if(!t||!n.open)return e;const{start:r,end:i}=t;let o=e;for(let e=r.row;e<=i.row;e++)for(let t=r.column;t<=i.column;t++){const r=Gg({row:e,column:t},o);r&&(r.readOnly||(o=Kg({row:e,column:t},{...r,style:n.style},o)))}return o}(e.model.data,t,e.formattedStyle)),e.autoFill.open&&e.editable&&t){r=function(e,t,n,r,i){if(!t)return e;const{start:o,end:a}=t,l=o.row-a.row,s=o.column-a.column;let c={row:0,column:0},d={row:0,column:0};Math.abs(l)>Math.abs(s)?(c={row:Math.min(o.row,a.row),column:r?.column??o.column},d={row:Math.max(o.row,a.row),column:r?.column??o.column}):(c={row:r?.row??o.row,column:Math.min(o.column,a.column)},d={row:r?.row??o.row,column:Math.max(o.column,a.column)});let u=e;const f=String(n.value??""),h=[...f.matchAll(/(-?\d+)/g)],C=["dropDown"].includes(n?.inputType?.type||"");for(let e=c.row;e<=d.row;e++)for(let t=c.column;t<=d.column;t++){const o=Gg({row:e,column:t},u);if(!o||o.readOnly)continue;const a=["file","dropDown"].includes(o?.inputType?.type||""),d=["file"].includes(o?.inputType?.type||"");if(!C&&a)continue;if(C&&d)continue;let p=f;if(!i&&h.length>0){let n=0;n=Math.abs(l)>Math.abs(s)?e-(r?.row??c.row):t-(r?.column??c.column);let i=0;p=p.replace(/(-?\d+)/g,()=>{const e=h[i++];return e?(parseInt(e?.[1]??"",10)+n).toString():""})}u=Kg({row:e,column:t},{...o,style:n.style,value:p,inputType:n.inputType},u)}return u}(e.model.data,t,e.autoFill.cellValue,n,e.ctrl);let{start:i,end:o}=t;const a=i.row-o.row,l=i.column-o.column;let s={row:0,column:0},c={row:0,column:0};return Math.abs(a)>Math.abs(l)?(s={row:Math.min(i.row,o.row),column:n?.column??0},c={row:Math.max(i.row,o.row),column:n?.column??0}):(s={row:n?.row??0,column:Math.min(i.column,o.column)},c={row:n?.row??0,column:Math.max(i.column,o.column)}),{...e,dragging:!1,autoFill:{open:!1,cellValue:{value:"",style:{}}},formattedStyle:{open:!1,style:void 0},model:new Gv(e.model.createFormulaParser,r),selected:new uv(new lv(s,c))}}return{...e,dragging:!1,autoFill:{open:!1,cellValue:{value:"",style:{}}},formattedStyle:{open:!1,style:void 0},model:new Gv(e.model.createFormulaParser,r)}}case qA:{const{changes:n}=t.payload;return{...e,...ay(n)}}default:throw new Error("Unknown action")}}var Ey,by={exports:{}},My={};var Ly,xy,Hy={};
28
28
  /**
29
29
  * @license React
30
30
  * scheduler.development.js
@@ -33,7 +33,7 @@ object-assign
33
33
  *
34
34
  * This source code is licensed under the MIT license found in the
35
35
  * LICENSE file in the root directory of this source tree.
36
- */var Vy,ky=(xy||(xy=1,"production"===process.env.NODE_ENV?by.exports=(Ey||(Ey=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(0>i(s,n))c<o&&0>i(d,s)?(e[r]=d,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<o&&0>i(d,n)))break e;e[r]=d,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,C=!1,p=!1,m=!1,A="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(s,i)}i=n(c)}}function w(e){if(p=!1,y(e),!C)if(null!==n(s))C=!0,b||(b=!0,E());else{var t=n(c);null!==t&&Z(w,t.startTime-e)}}var E,b=!1,M=-1,L=5,x=-1;function H(){return!(!m&&e.unstable_now()-x<L)}function V(){if(m=!1,b){var t=e.unstable_now();x=t;var i=!0;try{e:{C=!1,p&&(p=!1,g(M),M=-1),h=!0;var o=f;try{t:{for(y(t),u=n(s);null!==u&&!(u.expirationTime>t&&H());){var a=u.callback;if("function"==typeof a){u.callback=null,f=u.priorityLevel;var l=a(u.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof l){u.callback=l,y(t),i=!0;break t}u===n(s)&&r(s),y(t)}else r(s);u=n(s)}if(null!==u)i=!0;else{var d=n(c);null!==d&&Z(w,d.startTime-t),i=!1}}break e}finally{u=null,f=o,h=!1}i=void 0}}finally{i?E():b=!1}}}if("function"==typeof v)E=function(){v(V)};else if("undefined"!=typeof MessageChannel){var k=new MessageChannel,S=k.port2;k.port1.onmessage=V,E=function(){S.postMessage(null)}}else E=function(){A(V,0)};function Z(t,n){M=A(function(){t(e.unstable_now())},n)}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_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){m=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:d++,callback:i,priorityLevel:r,startTime:o,expirationTime:l=o+l,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(s)&&r===n(c)&&(p?(g(M),M=-1):p=!0,Z(w,o-a))):(r.sortIndex=l,t(s,r),C||h||(C=!0,b||(b=!0,E()))),r},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(My)),My):by.exports=(Ly||(Ly=1,Vy=Hy,"production"!==process.env.NODE_ENV&&function(){function e(){if(y=!1,M){var e=Vy.unstable_now();H=e;var t=!0;try{e:{g=!1,v&&(v=!1,E(L),L=-1),A=!0;var i=m;try{t:{for(o(e),p=n(f);null!==p&&!(p.expirationTime>e&&l());){var c=p.callback;if("function"==typeof c){p.callback=null,m=p.priorityLevel;var d=c(p.expirationTime<=e);if(e=Vy.unstable_now(),"function"==typeof d){p.callback=d,o(e),t=!0;break t}p===n(f)&&r(f),o(e)}else r(f);p=n(f)}if(null!==p)t=!0;else{var u=n(h);null!==u&&s(a,u.startTime-e),t=!1}}break e}finally{p=null,m=i,A=!1}t=void 0}}finally{t?V():M=!1}}}function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(0>i(s,n))c<o&&0>i(d,s)?(e[r]=d,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<o&&0>i(d,n)))break e;e[r]=d,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}function o(e){for(var i=n(h);null!==i;){if(null===i.callback)r(h);else{if(!(i.startTime<=e))break;r(h),i.sortIndex=i.expirationTime,t(f,i)}i=n(h)}}function a(e){if(v=!1,o(e),!g)if(null!==n(f))g=!0,M||(M=!0,V());else{var t=n(h);null!==t&&s(a,t.startTime-e)}}function l(){return!(!y&&Vy.unstable_now()-H<x)}function s(e,t){L=w(function(){e(Vy.unstable_now())},t)}if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),Vy.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var c=performance;Vy.unstable_now=function(){return c.now()}}else{var d=Date,u=d.now();Vy.unstable_now=function(){return d.now()-u}}var f=[],h=[],C=1,p=null,m=3,A=!1,g=!1,v=!1,y=!1,w="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null,M=!1,L=-1,x=5,H=-1;if("function"==typeof b)var V=function(){b(e)};else if("undefined"!=typeof MessageChannel){var k=new MessageChannel,S=k.port2;k.port1.onmessage=e,V=function(){S.postMessage(null)}}else V=function(){w(e,0)};Vy.unstable_IdlePriority=5,Vy.unstable_ImmediatePriority=1,Vy.unstable_LowPriority=4,Vy.unstable_NormalPriority=3,Vy.unstable_Profiling=null,Vy.unstable_UserBlockingPriority=2,Vy.unstable_cancelCallback=function(e){e.callback=null},Vy.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x=0<e?Math.floor(1e3/e):5},Vy.unstable_getCurrentPriorityLevel=function(){return m},Vy.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},Vy.unstable_requestPaint=function(){y=!0},Vy.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},Vy.unstable_scheduleCallback=function(e,r,i){var o=Vy.unstable_now();switch(i="object"==typeof i&&null!==i&&"number"==typeof(i=i.delay)&&0<i?o+i:o,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return e={id:C++,callback:r,priorityLevel:e,startTime:i,expirationTime:l=i+l,sortIndex:-1},i>o?(e.sortIndex=i,t(h,e),null===n(f)&&e===n(h)&&(v?(E(L),L=-1):v=!0,s(a,i-o))):(e.sortIndex=l,t(f,e),g||A||(g=!0,M||(M=!0,V()))),e},Vy.unstable_shouldYield=l,Vy.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Hy)),by.exports);const Sy=Symbol(),Zy=Symbol(),Oy="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?l:u,zy=ky.unstable_runWithPriority?e=>{try{ky.unstable_runWithPriority(ky.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e();function Ny(e,t){const n=d(e)[Sy];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]=g((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(),Oy(()=>(o.add(s),()=>{o.delete(s)}),[o]),l[1]}const Iy=function(e){const t=s({[Sy]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[Zy]=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={[Sy]:{v:r,n:i,l:e,u:t}}}return Oy(()=>{r.current=e,i.current+=1,zy(()=>{s.current[Sy].l.forEach(t=>{t({n:i.current,v:e})})})},[e]),p(n,{value:s.current},t)}),delete t.Consumer,t}([yy,()=>{}]),Ty=({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})},Dy=t=>e("tr",{...t}),Fy=t=>e("tr",{className:"ff-spreadsheet-row-header",...t});function Ry(){return Ny(Iy,([,e])=>e)}function Py(e){return Ny(Iy,([t])=>e(t))}const By=({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:I("corner-header",{"ff-spreadsheet-header--selected":t}),children:e(q,{variant:t?"dark":"light",color:t?"var(--hover-color)":"var(--text-color)",name:"excel_corner_menu"})})})},jy=t=>function(n){const i=Ry(),o=r.useCallback(()=>i({type:VA}),[i]),a=Py(e=>e.selected instanceof hv);return e(t,{...n,selected:a,onSelect:o})},_y=t=>function(n){const i=Ry(),o=r.useCallback((e,t)=>i(function(e,t){return{type:HA,payload:{column:e,extend:t}}}(e,t)),[i]),a=Py(e=>e.selected.hasEntireColumn(n.column)),l=Py(e=>e.selectedColumn??void 0),s=Py(e=>e.active?Gg(e.active,e.model.data):void 0);return e(t,{...n,cell:s,selected:a,selectedColumn:l,onSelect:o,scrollToColumn:n.scrollToColumn})},qy=_y(({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:A,contextMenu:g,onAddColumn:v,onDeleteColumn:y,setVisibleRange:w,scrollToColumn:E})=>{const b=Ry(),M=Py(e=>e.model.data),L=Py(e=>e.columnDimensions[t]?.width??p),x=Py(e=>e.model.data),{columnCount:H}=jv(x),V=e=>{w(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return C&&E(C),n})},k=h(()=>[{label:"Add Column Left",value:"Add Column Left",iconName:"plus_icon",action:()=>{V("increment"),c(p),v?.(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:()=>{V("increment"),d(p),v?.(C??t,!1)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Right"]??!1,disable:H>=m},...A?[]:[{label:"Delete Column",value:"Delete Column",iconName:"delete",action:()=>{V("decrement"),s(),y?.(C??t)},disableTooltip:"",visible:f?.contextDisable?.["Delete Column"]??!1,disable:!1}]],[C,t,M]),S=r.useCallback((e,n)=>{const r=n?t-1:t,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientX,l=Number(L),s=e=>{const t=e.clientX-o,n=Math.max(p,l+t);b(function(e,t){return{type:sg,payload:{column:e,width:t}}}(i,n))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),b(qg())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),b(_g())},[t,L]),Z=r.useCallback(e=>b(Fg(e)),[b]),O=r.useCallback(e=>{a(t,e.shiftKey)},[a,t]),z=r.useCallback(e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"column",options:k})},[t,C,u,k]);return r.useEffect(()=>{void 0!==C&&"column"===g?.contextType&&l(e=>({open:e.open,contextType:"column",options:k}))},[t,C,u,k,"column"===g?.contextType]),n("th",{className:I("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{width:`${L}px`,minWidth:"100px"},onClick:O,onContextMenu:z,tabIndex:0,children:[e(U,{fontWeight:"medium",children:i??Uy(t)}),e("div",{className:"drag-column-selector drag-column-left",onMouseDown:e=>S(e,!1),onDoubleClick:()=>b(Ag(t,L)),onClick:()=>Z({row:-1,column:t})}),e("div",{className:"drag-column-selector drag-column-right",onMouseDown:e=>S(e,!0),onDoubleClick:()=>b(Ag(t,L)),onClick:()=>Z({row:-1,column:t})})]},t)});function Uy(e){let t="",n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}const Wy=({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:A,scrollToRow:g})=>{const v=Ry(),y=Py(e=>e.rowDimensions[t]?.height||32),w=Py(e=>e.model.data),{rowCount:E}=jv(w),b=e=>{A(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return f&&g(f),n})},M=r.useMemo(()=>[{label:"Add Row Top",value:"Add Row Top",iconName:"plus_icon",action:()=>{b("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:()=>{b("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:()=>{b("decrement"),d()},disableTooltip:"",visible:h?.contextDisable?.["Delete Row"]??!1,disable:!1}]],[f,t]),L=r.useCallback((e,n)=>{const r=n?t:t-1,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientY,l=y,s=e=>{const t=e.clientY-o,n=Math.max(32,l+t);v(mg(i,n))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),v(qg())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c)},[y,t]),x=r.useCallback(e=>v(Fg(e)),[v]),H=r.useCallback(e=>{a(t,e.shiftKey)},[t]),V=r.useCallback(e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"row",options:M})},[t,u,M,f]);return r.useEffect(()=>{void 0!==f&&"row"===m?.contextType&&l(e=>({open:e.open,contextType:"row",options:M}))},[t,u,M,f,"row"===m?.contextType]),n("th",{className:I("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{height:`${y}px`,minHeight:"32px"},onClick:H,onContextMenu:V,tabIndex:0,children:[e(U,{fontWeight:"medium",children:void 0!==i?i:t+1}),e("div",{className:"drag-row-selector drag-row-down",onMouseDown:e=>L(e,!0),onDoubleClick:()=>v(mg(t,y)),onClick:()=>x({row:t,column:-1})}),e("div",{className:"drag-row-selector drag-row-up",onMouseDown:e=>L(e,!1),onDoubleClick:()=>v(mg(t,y)),onClick:()=>x({row:t,column:-1})})]})},Xy=t=>function(n){const i=Ry(),o=Py(e=>e.selected.hasEntireRow(n.row)),a=Py(e=>e.active?Gg(e.active,e.model.data):void 0),l=Py(e=>e.selectedRow??void 0),s=r.useCallback((e,t)=>i(function(e,t){return{type:xA,payload:{row:e,extend:t}}}(e,t)),[i]);return e(t,{...n,selected:o,cell:a,selectedRow:l,onSelect:s,scrollToRow:n.scrollToRow})},Qy=r.memo(({row:t,column:n,DataViewer:i,active:o,dragging:a,mode:l,data:s,evaluatedData:c,select:d,activate:u,edit:f,editable:h,setCellDimensions:C,setCellData:p})=>{const m=r.useRef(null),A=r.useMemo(()=>({row:t,column:n}),[t,n]),g=r.useCallback(e=>{e.preventDefault(),window.getSelection()?.removeAllRanges(),"view"===l&&(C(A,bv(e.currentTarget)),e.shiftKey?d(A):(u(A),"dropDown"===s?.inputType?.type&&h&&!s?.readOnly&&f()))},[l,C,A,d,u,f,h,s]),v=r.useCallback(e=>{a&&(C(A,bv(e.currentTarget)),d(A))},[C,d,a,A]);return r.useEffect(()=>{const e=m.current;if(!e)return;const t=()=>{a||C(A,bv(e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[C,A,a]),s&&s.DataViewer&&(i=s.DataViewer),e("td",{ref:m,style:{...s?.style,..."dropDown"===s?.inputType?.type&&{fontSize:"12px"},textDecoration:"underline"===s?.style?.textDecoration?s?.style?.textDecoration:"none"},className:I("ff-spreadsheet-cell",s?.className,{"ff-spreadsheet-active-cell":o||a}),onMouseEnter:v,onMouseDown:g,tabIndex:0,children:e(i,{row:t,column:n,cell:s,active:o,evaluatedCell:c,setCellData:p,inputValue:()=>null})})}),Gy=t=>function(n){const{row:i,column:o}=n,a=Ry(),l=r.useMemo(()=>({row:i,column:o}),[i,o]),s=r.useCallback(e=>a(Rg(l,e)),[a,l]),c=r.useCallback(e=>a(function(e){return{type:SA,payload:{point:e}}}(e)),[a]),d=r.useCallback(e=>a(Fg(e)),[a]),u=r.useCallback(()=>a(Xg()),[a]),f=r.useCallback((e,t)=>a(Pg(e,t)),[a]),h=Py(e=>Ev(e.active,l)),C=Py(e=>h?e.mode:"view"),p=Py(e=>e.editable),m=Py(e=>Gg(l,e.model.data)),A=Py(e=>Gg(l,e.model.evaluatedData)),g=Py(e=>e.dragging),v=Py(e=>e.copied?.has(l)||!1);return e(t,{...n,active:h,copied:v,dragging:g,mode:C,evaluatedData:A,data:m,select:c,activate:d,edit:u,editable:p,setCellDimensions:f,setCellData:s})},Ky=({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:Yy(a)}:{className:I("ff-spreadsheet-data-viewer",{"ff-spreadsheet-data-viewer--preserve-breaks":Iv(a)}),children:o||"dropDown"!==r?.inputType?.type?o||"file"!==r?.inputType?.type?!o&&a:e(t,{children:K(r?.value)?n("div",{className:"ff-spreadsheet-data-viewer--without-fileType",children:[e(q,{name:"attachment_icon"})," Attachment"]}):(n=>{if(K(n))return e(t,{});return JSON.parse(n).map(t=>e("div",{className:"ff-spreadsheet-data-viewer--fileType",children:e(Oi,{width:r?.style?.width??100,title:t?.name?.split("*")?.[0]??""})},t.name))})(a)}):n("div",{className:"ff-spreadsheet-data-viewer--dropdownType",children:[a,e(q,{name:"arrow_down",height:8,className:"dropdownType-icon"})]})})};function Yy(e){return e?"TRUE":"FALSE"}const Jy=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=String(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"}})})}),$y=({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(Jy,{ref:i,initialValue:n?.value??"",onChange:o,className:"ff-spreadsheet-cell-textarea",style:{...n?.style,width:"100%",height:"100%",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})})},ew=t=>{const i=r.useRef(null),o=r.useRef(null),a=Ry(),l=r.useCallback((e,t)=>a(Rg(e,t)),[a]),s=r.useCallback(e=>a(Fg(e)),[a]),c=r.useCallback(()=>a(Xg()),[a]),d=r.useCallback(e=>a({type:dg,payload:{autofill:e}}),[a]),u=r.useCallback(e=>a(function(e){return{type:qA,payload:{changes:e}}}(e)),[a]),f=r.useCallback(()=>{a({type:FA})},[a]),h=Py(e=>e.rowDimensions),C=Py(e=>e.active),p=Py(e=>e.mode),m=Py(e=>e.active?Gg(e.active,e.model.data):void 0),A=Py(e=>e.selected),g=Py(e=>A&&Zv(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),v=Py(e=>{let t=C?kv(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}),y=r.useMemo(()=>!C||!v||C.row<t.visibleRowRange.start||C.row>=t.visibleRowRange.end||C.column<t.visibleColRange.start||C.column>=t.visibleColRange.end,[C,v,t.visibleRowRange,t.visibleColRange]),w=r.useRef(void 0),E=r.useRef(null),b=r.useRef(void 0),M=r.useCallback(e=>{C&&l(C,e)},[l,C]),[L,x]=r.useState({value:"",name:""}),[H,V]=r.useState(!1),[k,S]=r.useState(),[Z,O]=r.useState([]),[z,N]=r.useState("var(--ff-select-text-color)");r.useEffect(()=>{m&&C&&t.getActiveCell({value:m.value,active:C});const n=i.current;if(!y&&n&&(n.focus({preventScroll:!0}),"dropDown"===m?.inputType?.type)){x({value:m?.value,name:m?.value}),N(m?.style?.color),V(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,color:t.color}));S(t)}},[i,y,C?.row,C?.column]),r.useEffect(()=>{if("file"===m?.inputType?.type&&m?.value)try{const e=JSON.parse(m.value).map(e=>new File([new Blob],e.name.split("*")[0]??"default"));O(e)}catch(e){console.error("Error parsing cell value for files:",e),O([])}else O([])},[m?.inputType?.type,m?.value]),r.useEffect(()=>{"dropDown"===m?.inputType?.type&&m?.value!==L.value&&x({value:m?.value,name:m?.value})},[m?.value,m?.inputType?.type,L.value]),r.useEffect(()=>{const e=E.current,t=b.current;if(E.current=C,b.current=m,!e||!t)return;const n=C?.row!==e.row||C?.column!==e.column;if(n||"edit"!==p){const e=w.current;t!==e?u([{prevCell:e||null,nextCell:t}]):n||m===t||u([{prevCell:t,nextCell:m||null}]),w.current=m}});const T=m&&m.DataEditor||t.DataEditor,D=m&&m.readOnly,F=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]),R=r.useCallback(e=>{e.preventDefault(),t.setContextMenu({open:t.contextOption?.open??!1,contextType:t.contextOption?.contextType??null,options:t.contextOption?.options||[]})},[t]),P=g?.height!==v?.height||g?.width!==v?.width,B=r.useCallback(e=>{C&&P&&(Pg(C,bv(e.currentTarget)),s(C))},[C,P]),j=t.isAtRight?t.maxWidth-(v?.left-t.scrollPos.left)+100:t.maxWidth,_=t.isAtBottom?t.maxHeight-(v?.top-t.scrollPos.top)+64:t.maxHeight,q=["file","dropDown"].includes(m?.inputType?.type||""),U="dropDown"===m?.inputType?.type;return n("div",{ref:i,className:I("ff-spreadsheet-active-cell",`ff-spreadsheet-active-cell--${p}`,{"ff-spreadsheet-active-cell--hidden":y,"ff-spreadsheet-active-cell--dragging":P&&"text"!==m?.inputType?.type}),onMouseDown:B,style:{...v,backgroundColor:m?.style?.backgroundColor,...q?{display:"flex",alignItems:U?"center":m?.style?.alignContent,justifyContent:U?"flex-start":m?.style?.textAlign}:{},..."edit"===p&&C?{minWidth:Math.min(v?.width,t.maxWidth),minHeight:Math.min(v?.height,t.maxHeight),height:"auto",maxWidth:`${j}px`,maxHeight:`${_}px`,overflow:"auto",..."dropDown"===m?.inputType?.type?{}:{padding:"2px 4px 0px 4px",width:"max-content"}}:{}},onContextMenu:R,onClick:"view"!==p||D?void 0:c,tabIndex:0,children:[e("div",{className:q?"":"active-cell-main",style:U?{width:"100%"}:void 0,children:"dropDown"===m?.inputType?.type?e(Zo,{...m?.inputType?.inputProps,dropDownRef:o,showOptions:{open:!("edit"!==p||!C),toggle:H},selectedOption:L,optionsList:k||[],height:26,showLabel:!1,disabled:!t.editable,showBorder:!1,selectedOptionColor:z,optionZIndex:5e3,onChange:e=>{const t=K(e.color)?m?.style:{...m?.style,color:e.color};x({value:e.value,name:e.label}),N(e.color||"var(--ff-select-text-color)"),M({...m,value:e.value,style:t,inputType:m?.inputType})}}):"file"===m?.inputType?.type?e(sA,{...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:Z,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 cc.info("Cannot upload more than 5 files.");if(t.attachmentAction?.addAttachment&&i.length>0)try{let e=0,r=0,o=0;const l=Z?.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):"";M({...m,value:e,style:m?.style,inputType:m?.inputType}),a(mg(C?.row||0,Math.max(s,h?.[C.row]?.height||s))),O(c.map(e=>new File([new Blob],e.name?.split("*")[0]??"default")))}o>0&&cc.info("No memory available to add the file"),e>0&&cc.success(`${e} file${e>1?"s":""} uploaded successfully`),r>0&&cc.info(`${r} unsupported ${r>1?"files":"file"}. Please check the file formats.`)}catch(e){console.error("Upload operation failed:",e),cc.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),cc.error("Error deleting file")}else console.error(`Cannot delete ${i.name}: Invalid fileId or no match`,{index:n,fileId:o,hasDeleteAttachment:!!t.attachmentAction?.deleteAttachment}),cc.error("Failed to delete file: Invalid file data")}if(r>0){const t=e.length>0?JSON.stringify(e):"";M({...m,value:t,style:m?.style,inputType:m?.inputType}),O(e?.map(e=>new File([new Blob],e.name.split("*")[0]))),cc.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):"";M({...m,value:e,style:m?.style,inputType:m?.inputType}),O(t.map(e=>new File([new Blob],e.name.split("*")[0]))),cc.error("Failed to delete file(s). Invalid file data detected.")}else cc.error("Failed to delete file(s). No valid files removed.")}}catch(e){console.error("Delete operation failed:",e),cc.error("Delete operation failed")}}catch(e){console.error("handleFilesChange error:",e),cc.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:(v?.width??0)-60}):"edit"===p&&C&&t.editable?e(T,{row:C.row,column:C.column,cell:m,onChange:M,exitEditMode:f}):e(Jy,{initialValue:m?.value,onChange:()=>{},className:"ff-spreadsheet-cell-textarea",style:{...m?.style,height:"100%",width:"100%",textDecoration:"underline"===m?.style?.textDecoration?"underline":"none",backgroundColor:P?"#1e161f00":m?.style?.backgroundColor,pointerEvents:"none",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})}),!["file"].includes(m?.inputType?.type??"")&&("edit"===p||C&&e("div",{onMouseDown:F,className:"select_dot"}))]},`${C?.row}-${C?.column}`)},tw=({dimensions:t,dragging:n,hidden:r,variant:i})=>{const o=Py(e=>e.active),a=Py(e=>e.autoFill),l=Py(e=>o?kv(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:I("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}})},nw=({scrollPos:t={top:0,left:0}})=>{const n=Py(e=>e.selected),i=Py(e=>e.dragging),o=Py(e=>e.selected.size(e.model.data)<2),a=Py(e=>n&&Zv(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(tw,{variant:"selected",dimensions:l,dragging:i,hidden:o||!a})},rw=({scrollPos:t={top:0,left:0}})=>{const n=Py(e=>e.copied),i=null===n,o=Py(e=>n&&Sv(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(tw,{variant:"copied",dimensions:a,hidden:i||!o,dragging:!1})},iw=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:I("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:I("ff-excel-color-selector-picker",{"color-selector-disabled":n}),ref:l,onChange:e=>{d(e.target.value),t(e.target.value.replace("#",""))}})})});iw.displayName="ColorBarSelector";const ow=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"}},aw=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"}},lw=e=>Pv.reduce((t,n)=>Math.abs(n-parseFloat(e))<Math.abs(t-parseFloat(e))?n:t);function sw(e,t=100){const{border:n}=e;let r="",i="",o="",a="";return"THIN"!==n.top&&(r="MEDIUM"===n.top?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.right&&(i="MEDIUM"===n.right?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.bottom&&(o="MEDIUM"===n.bottom?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.left&&(a="MEDIUM"===n.left?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),{fontSize:Tv(lw(String(e.size))),fontFamily:(l=e.name,Rv.some(e=>e.label===l)?l:"Poppins"),color:`#${e.color}`,backgroundColor:`#${e.backgroundColor}`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":"normal",borderTop:r,borderRight:i,borderBottom:o,borderLeft:a,textAlign:ow(e.alignment.horizontal),alignContent:ow(e.alignment.vertical),height:e.height??32,width:e.width??t};var l}const cw=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"},dw=(e,t=100)=>({name:e.fontFamily||"Arial",size:Dv(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:cw(e.borderTop?e.borderTop.toString():void 0),right:cw(e.borderRight?e.borderRight.toString():void 0),bottom:cw(e.borderBottom?e.borderBottom.toString():void 0),left:cw(e.borderLeft?e.borderLeft.toString():void 0)},alignment:{horizontal:aw(e.textAlign),vertical:aw(e.alignContent),wrapText:!1},width:e.width||t,height:e.height||32}),uw=({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 A=Py(e=>e.selected instanceof hv),[g,v]=c("disable"===t||!r),y=Py(e=>e.active?Gg(e.active,e.model.data):null),w=Py(e=>e.model.data),E=Py(e=>e.formattedStyle.open),b={...Fv.style,color:"#1e161f",backgroundColor:"#ffffff",borderColor:"#1e161f"},[M,L]=c(y?.style||b),x=a(null);l(()=>{y?.style&&JSON.stringify(y.style)!==JSON.stringify(M)&&L(y?.style||b),A?v(!r):y&&"boolean"==typeof y.readOnly&&v(y.readOnly||"disable"===t||!r||"dropDown"===y?.inputType?.type)},[y,r]);const H=dw(M),[V,k]=c("border-none"),[S,Z]=c({label:"",value:""}),[O,z]=c({label:"",value:""}),[N,I]=c({color:b.color,backgroundColor:b.backgroundColor,borderColor:b.borderColor}),T=[{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"}],D=Pv.map(e=>({label:e,value:e})),F=a(null),R=a(null);l(()=>{let e=setTimeout(()=>{d(w,N.color)},0);return()=>{clearTimeout(e)}},[N.color]),l(()=>{let e=setTimeout(()=>{C(w,N.backgroundColor)},0);return()=>{clearTimeout(e)}},[N.backgroundColor]);return l(()=>{const e=M.fontFamily,t=`${Dv(M.fontSize)}`;Z({label:e??"Times New Roman",value:e??"Times New Roman"}),z({label:t??"11",value:t??"11"})},[M]),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(Zo,{disabled:g,height:24,tooltip:!0,showToolTip:!0,showLabel:!1,optionZIndex:2e3,onChange:e=>{Z({label:e.label,value:e.label}),f(w,e.value)},required:!1,optionsList:Rv,selectedOption:S})}),e("div",{className:"ff-excel-toolbar-font-size",children:e(Zo,{disabled:g,height:24,showLabel:!1,optionZIndex:2e3,required:!1,onChange:e=>{z({label:e.label,value:e.value}),u(w,e.value)},optionsList:D,selectedOption:O})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(Y,{placement:"top",title:"Text Left",children:e(q,{disabled:g,variant:"left"===M.textAlign?"dark":"light",hoverEffect:"left"!==M.textAlign,onClick:()=>h(w,"left"),name:"text_align_left"})}),e(Y,{placement:"top",title:"Text Center",children:e(q,{disabled:g,variant:"center"===M.textAlign?"dark":"light",hoverEffect:"center"!==M.textAlign,onClick:()=>h(w,"center"),name:"text_align_center"})}),e(Y,{placement:"top",title:"Text Right",children:e(q,{disabled:g,variant:"right"===M.textAlign?"dark":"light",hoverEffect:"right"!==M.textAlign,onClick:()=>h(w,"right"),name:"text_align_right"})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-text",children:[e(Y,{placement:"top",title:"Bold",children:e(q,{disabled:g,variant:H.bold?"dark":"light",hoverEffect:!H.bold,onClick:()=>i(w),name:"bold"})}),e(Y,{placement:"top",title:"Italic",children:e(q,{disabled:g,variant:H.italic?"dark":"light",hoverEffect:!H.italic,onClick:()=>o(w),name:"italic"})}),e(Y,{placement:"top",title:"Underline",children:e("div",{className:"ff-excel-toolbar-icon-underline",children:e(q,{disabled:g,variant:"underline"===M.textDecoration?"dark":"light",hoverEffect:"underline"!==M.textDecoration,onClick:()=>s(w),name:"underline"})})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(Y,{placement:"top",title:"Format Painter",children:e(q,{disabled:g,variant:E?"dark":"light",hoverEffect:!E,onClick:()=>{m(w)},name:"formate_painter"})}),e(Y,{placement:"top",title:"Text Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(q,{disabled:g,hoverEffect:!0,width:12,height:10,onClick:()=>{d(w,N.color),F.current?.click()},name:"text_color"}),e(iw,{ref:F,disabled:g,getColorValue:e=>{I(t=>({...t,color:e}))},initialColor:N.color})]})}),e(Y,{placement:"top",title:"Background Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(q,{disabled:g,hoverEffect:!0,width:12,height:10,onClick:()=>{C(w,N.backgroundColor),R.current?.click()},name:"fill_color"}),e(iw,{ref:R,disabled:g,getColorValue:e=>{I(t=>({...t,backgroundColor:e}))},initialColor:N.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(Y,{placement:"top",title:"Border Type",children:e(q,{hoverEffect:!0,disabled:g,onClick:()=>p(w,V,"var(--input-hover-border-color)"),name:(()=>{const e=T.find(e=>e.value===V);return e?e.icon:""})()})}),e("span",{ref:x,children:e(Do,{disabled:g,iconName:"arrow_down",targetRef:x,iconSize:12,zIndex:2e3,options:T,tooltipTitle:"Border Type",tooltipPlacement:"top",onOptionClick:e=>{let t=e.value;p(w,t,"var(--input-hover-border-color)"),k(t)}})})]})})]})},fw=(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},hw=r.forwardRef(function(t,i){const{className:o,columnLabels:a=[],rowLabels:l=[],toolbar:s,editable:c,onKeyDown:d,Table:u=Ty,Row:f=Dy,sheetHeight:h,HeaderRow:C=Fy,DataEditor:p=$y,DataViewer:m=Ky,onSelect:A=()=>{},onActivate:g=()=>{},onEvaluatedDataChange:v=()=>{},contextOption:y,attachmentAction:w,workRef:E,minimumColumnWidth:b,setContextMenu:M,maxRowLimit:L,maxColLimit:x,disableDeleteOption:H,contextMenu:V,getActiveCell:k,onAddColumn:S,onDeleteColumn:Z}=t,O=32,z=b||100,N=r.useRef(!1),T=Py(e=>e.model.data),[D,F]=r.useState(!1),[R,P]=r.useState(0),[B,j]=r.useState(0),[_,q]=r.useState({top:0,left:0}),[U,W]=r.useState(!1),[X,Q]=r.useState(!1),G=r.useMemo(()=>{const e=t.createFormulaParser||qv,n=new Gv(e,t.data);let r={},i={};t.data.forEach((e,t)=>{let n=O;e.forEach(e=>{if(e){const t=parseFloat(String(e.style?.height).replace("px",""))||O;n=Math.max(n,t)}}),r[t]={top:0,height:n}});const o=t.data[0]?t.data[0].length:0;for(let e=0;e<o;e++){let n=z;t.data.forEach(t=>{const r=t[e];if(r){const e=parseFloat(String(r.style?.width).replace("px",""))||z;n=Math.max(n,e)}}),i[e]={left:0,width:n}}return F(e=>!e),{...yy,model:n,selected:t.selected||yy.selected,rowDimensions:r,columnDimensions:i}},[t.createFormulaParser,t.data,t.selected]),K=r.useReducer(wy,G),[Y,J]=K,$=r.useMemo(()=>function(e,t,n){const{columns:r,rows:i}=rv(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,te]=r.useState({start:0,end:Math.min(20,$.rows)}),[ne,re]=r.useState({start:0,end:Math.min(15,$.columns)}),ie=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.rowDimensions[n]?.height||O;return t},[Y.rowDimensions,O]),oe=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.columnDimensions[n]?.width||z;return t},[Y.columnDimensions,z]),ae=r.useRef(!0);r.useEffect(()=>{ae.current?ae.current=!1:J(function(e){return{type:ug,payload:{minimumColumnWidth:e}}}(b))},[b]);const le=ie($.rows),se=oe($.columns),ce=ie(ee.start),de=le-ie(ee.end),ue=oe(ne.start),fe=se-oe(ne.end),he=Y.mode,Ce=r.useRef(null),pe=e=>r.useCallback((...t)=>J(e(...t)),[e]),me=pe(pg),Ae=pe(Wg),ge=pe(Ug),ve=pe(Qg),ye=pe(Bg),we=pe(jg),Ee=pe(Ng),be=pe(_g),Me=pe(qg),Le=pe(Ig),xe=pe(Tg),He=pe(Dg),Ve=pe(gg),ke=pe(vg),Se=pe(wg),Ze=pe(Mg),Oe=pe(Eg),ze=pe(bg),Ne=pe(yg),Ie=pe(Lg),Te=pe(xg),De=pe(Hg),Fe=pe(Cg),Re=pe(Vg),Pe=pe(kg),Be=pe(Sg),je=pe(Zg),_e=pe(Og),qe=pe(zg);r.useImperativeHandle(i,()=>({removeSelect:ve}));const Ue=r.useRef(Y.active);r.useEffect(()=>{if(Y.active!==Ue.current)if(Y.active)g(Y.active);else{const e=E.current;e&&Nv(e)&&document.activeElement&&document.activeElement.blur()}Ue.current=Y.active},[g,Y.active]);const We=r.useRef(Y.model.evaluatedData);r.useEffect(()=>{Y?.model?.evaluatedData!==We?.current&&v(Y?.model?.evaluatedData),We.current=Y.model.evaluatedData},[Y?.model?.evaluatedData,v]);const Xe=r.useRef(Y.selected);r.useEffect(()=>{Y.selected.equals(Xe.current)||t.selected&&Y.selected.equals(t.selected)||A(Y.selected),Xe.current=Y.selected},[Y.selected,A,t.selected]);const Qe=r.useRef(t.selected);r.useEffect(()=>{t.selected&&Qe.current&&!t.selected.equals(Qe.current)&&He(t.selected),Qe.current=t.selected},[t.selected,He]);let Ge=r.useRef();r.useEffect(()=>{me(c),void 0!==Ge.current&&t.data!==Ge.current&&Le(t.data),Ge.current=t.data},[t.data,Le,c]);const Ke=r.useRef(t.createFormulaParser);r.useEffect(()=>{t.createFormulaParser!==Ke.current&&t.createFormulaParser&&xe(t.createFormulaParser),Ke.current=t.createFormulaParser},[t.createFormulaParser,xe]);const Ye=r.useCallback(e=>{const{model:t,selected:n}=Y,{data:r}=t,i=n.toRange(r);if(i){!function(e,t){e.clipboardData?.setData(yv,t)}(e,Ov(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]=Gg({row:o,column:i},n)}return r}(i.start,i.end,r)))}},[Y]),Je=r.useCallback(e=>{zv(Ce.current,he)&&(e.preventDefault(),e.stopPropagation(),Ye(e),Ae())},[he,Ye,Ae]),$e=r.useCallback(e=>{zv(Ce.current,he)&&(e.preventDefault(),e.stopPropagation(),Ye(e),ge())},[he,Ye,ge]),et=r.useCallback(e=>{if(zv(Ce.current,he)&&(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(yv):""}(e);ye(t)}},[he,ye]),tt=r.useCallback(e=>{e.persist();const t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();t&&"b"===n?(e.preventDefault(),Ve(T)):t&&"i"===n?(e.preventDefault(),ke(T)):t&&"u"===n&&(e.preventDefault(),Se(T)),d&&d(e),e.defaultPrevented||(function(e,t){return void 0!==py(e,t)}(Y,e)&&e.nativeEvent.preventDefault(),we(e))},[Y,d,we]),nt=r.useCallback(()=>{Y.formattedStyle.open&&Y.active&&Fe(Y.active)},[Y]),rt=r.useCallback(()=>{Me(),document.removeEventListener("mouseup",rt)},[Me]),it=r.useCallback(e=>{Y.dragging||1!==e.buttons||"view"!==he||(be(),document.addEventListener("mouseup",rt))},[Y,be,rt,he]),ot=r.useMemo(()=>Gy(t.Cell||Qy),[t.Cell,D,c]),at=r.useMemo(()=>jy(t.CornerIndicator||By),[t.CornerIndicator,D]),lt=r.useMemo(()=>Xy(t.RowIndicator||Wy),[t.RowIndicator,D]),st=r.useMemo(()=>_y(t.ColumnIndicator||qy),[t.ColumnIndicator,D]);r.useEffect(()=>(document.addEventListener("cut",Je),document.addEventListener("copy",$e),document.addEventListener("paste",et),()=>{document.removeEventListener("cut",Je),document.removeEventListener("copy",$e),document.removeEventListener("paste",et)}),[Je,$e,et]);const ct=e=>{const t=new ResizeObserver(e=>{const t=e[0];if(t&&Ce.current){const e=t.target;if(e){const{clientWidth:t,clientHeight:n}=e;j(Math.min(Ce.current.clientHeight,n)),P(Math.min(Ce.current.clientWidth,t))}}}),n=e.current;n&&t.observe(n)},dt=r.useCallback(e=>{const t=e.target,{scrollTop:n,clientHeight:r,scrollLeft:i,clientWidth:o}=t;q({top:n,left:i});let a=0;for(;a<$.rows&&ie(a)<n;)a++;let l=a;for(;l<$.rows&&ie(l)<n+r;)l++;a=Math.max(0,a-10),l=Math.min($.rows,l+10),te({start:a,end:l});const s=l===$.rows;W(s);let c=0;for(;c<$.columns&&oe(c)<i;)c++;let d=c;for(;d<$.columns&&oe(d)<i+o;)d++;c=Math.max(0,c-10),d=Math.min($.columns,d+10),re({start:c,end:d});const u=d===$.columns;Q(u),V.open&&M({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},[$.rows,$.columns,ie,oe]),ut=r.useMemo(()=>fw(dt,16),[dt]),ft=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.rowDimensions?.[n]?.height||O;requestAnimationFrame(()=>{Ce.current&&e>=$.rows-1&&Ce?.current?.scrollTo({top:t+O,behavior:"smooth"})})})},ht=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.columnDimensions?.[n]?.width||z;requestAnimationFrame(()=>{Ce.current&&e>=$.columns-1&&Ce.current.scrollTo({left:t+60,behavior:"smooth"})})})};r.useEffect(()=>{N.current||(te({start:0,end:Math.min(20,$.rows)}),re({start:0,end:Math.min(15,$.columns)}))},[$.rows,$.columns,N.current]);const Ct=wv(ee.end,ee.start),pt=wv(ne.end,ne.start),mt=n("colgroup",{children:[e("col",{style:{width:"60px"}},"row-indicator")," ",e("col",{style:{width:`${ue}px`}},"left-spacer")," ",pt.map(t=>e("col",{style:{width:`${Y.columnDimensions[t]?.width||z}px`}},t)),e("col",{style:{width:`${fe}px`}},"right-spacer")," "]}),At=r.useMemo(()=>n(u,{useTableRef:ct,totalWidth:se,children:[mt,n("tbody",{children:[n(C,{children:[e(at,{}),e("div",{className:"spacer left"}),pt.map(n=>e(st,{column:n,minimumColumnWidth:b,setContextMenu:t.setContextMenu,label:n in a?a[n]:void 0,deleteColumn:qe,addColumnLeft:Be,addColumnRight:je,columnContextEnable:t.columnContextEnable,maxColLimit:x,disableDeleteOption:H,contextMenu:V,onAddColumn:S,onDeleteColumn:Z,setVisibleRange:re,scrollToColumn:ht},n)),e("div",{className:"spacer right"})]}),e("tr",{style:{height:`${ce}px`}}),Ct.map(r=>n(f,{row:r,children:[e(lt,{label:r in l?l?.[r]:void 0,row:r,addRowTop:Re,addRowBottom:Pe,deleteRow:_e,setContextMenu:t.setContextMenu,rowContextEnable:t.rowContextEnable,maxRowLimit:L,disableDeleteOption:H,contextMenu:V,setVisibleRange:te,scrollToRow:ft},r),e("div",{className:"spacer left"}),pt.map(t=>e(ot,{row:r,column:t,DataViewer:m},`${r}-${t}`)),e("div",{className:"spacer right"})]},r)),e("tr",{style:{height:`${de}px`}})]})]}),[u,$.rows,$.columns,f,C,at,a,st,l,lt,ot,m,ee,ne,ce,de,ue,fe,Y.rowDimensions,Y.columnDimensions]),gt=r.useMemo(()=>e(ew,{attachmentAction:w,contextOption:y,getActiveCell:k,setContextMenu:t.setContextMenu,DataEditor:p,visibleRowRange:ee,visibleColRange:ne,maxHeight:B-64,maxWidth:R-b,totalHeight:le,totalWidth:se,isAtBottom:U,isAtRight:X,scrollPos:_,editable:c},Y.active?`${Y.active.row}-${Y.active.column}`:"no-active"),[p,ee,ne,Y.active,B,R,le,se,U,X,c]),vt=r.useMemo(()=>n("div",{className:"ff-excel-spreadsheet-container",children:[e("div",{style:{width:`${R}px`},className:I("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),e("div",{style:{height:`${B}px`},className:I("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(uw,{editable:c,toolbar:s,onBold:Ve,onItalic:ke,setUnderlineType:Se,setColor:Ie,setBorderType:Ne,setFontSize:Oe,setFontFamily:ze,setTextAlign:Ze,setBackgroundColor:Te,setFormatePainter:De})}),n("div",{ref:Ce,style:{height:h},className:I("ff-excel-spreadsheet",o),onKeyPress:Ee,onKeyDown:tt,onClick:nt,onMouseMove:it,onScroll:e=>ut(e),children:[At,gt,e(nw,{scrollPos:_}),e(rw,{scrollPos:_})]})]}),[o,Ee,tt,it,At,gt,R]);return e(Iy.Provider,{value:K,children:vt})}),Cw=({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(Y,{title:i?t.disableTooltip:"",children:n("div",{className:"ff-excel-menu-options "+(i?"disabled":""),onClick:()=>{i||t.action()},children:[t.iconName&&e(q,{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(U,{as:"label",children:t.label})]})},t.label)}var r;return null})})},pw=({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:A=()=>Promise.resolve(),onSaveInfoChange:g,attachmentAction:v={addAttachment:()=>Promise.resolve(""),deleteAttachment:()=>Promise.resolve(""),viewAttachment:()=>Promise.resolve()},onSaveDelay:y=3e3,scroller:w=!1,columnContextEnable:E=!0,rowContextEnable:b=!0,sheetBarContextEnable:M=!0,minimumColumnWidth:L=100,disableDeleteOption:x=!1,maxRowLimit:H=1/0,maxColLimit:V=1/0,maxSheetLimit:k=1/0,getActiveCell:S=()=>{}})=>{const Z=a(null),[O,z]=c([]),[N,T]=c(""),[D,F]=i.useState({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",disable:!1,visible:!1}]}),[R,P]=c({name:"defaultSheet",index:0}),[B,j]=c({defaultSheet:[[Fv]]}),[_,W]=c([[Fv]]),[X,Q]=c((A.length,{})),[G,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),K(t.length)||($.current=t[0]||"",P({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:Fv.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:K(e?.style)?Fv.style:sw(e?.style,L),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||Fv);l[n][r]={...t,value:t?.value??"",readOnly:t?.readOnly?t.readOnly:i,inputType:o,contextDisable:t?.contextDisable}})}),n[t]=l,A.length>1){const e=i[0]||[];r[t]=Array.from({length:a},(t,n)=>({newData:"",oldData:e[n]?.value||""}))}}),j(n),A.length>1&&Q(r);const i=Object.keys(n)[0];i&&void 0!==n[i]&&W(n[i])}},[r]),l(()=>{g&&g(N),"File saved"===N&&setTimeout(()=>{T("")},2e3)},[N]),l(()=>{T("Saving..."),re(oe())},[B,$.current]);const re=i.useCallback(Ys(e=>{if(A.length>1){const t={...X};O.forEach((n,r)=>{const i=(e[r].data[0]||[]).map(e=>e?.value||"");t[n]=(t[n]||[]).map((e,t)=>({...e,newData:i[t]||""}))}),Q(t);const n=O.map(e=>({sheetName:e,headers:t[e]||[]}));A(e,n)}else A(e);T("File saved")},y),[A,X,O]),ie=i.useCallback(e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),re(oe()))},[A]);i.useEffect(()=>(document.addEventListener("keydown",ie),()=>{document.removeEventListener("keydown",ie)}),[ie]);const oe=()=>O.map(e=>{const t=B[e]?.map(e=>{const t=e.reduce((e,t,n)=>{const r=""!==String(t?.value??"").trim(),i=t?.style?.width,o=t?.style?.height;return r||(void 0!==i&&i!==L||void 0!==o&&32!==o)?n:e},-1),n=e.map((e,n)=>e&&e.style&&n<=t?{value:e.value,style:dw(e.style,L),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:K(n.length)?[[]]:n}}),[ae,le]=c(null),se=()=>O.length>=k,ce=()=>{if(se())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",O),t=Array.from({length:u},()=>Array.from({length:f},()=>Fv));z(t=>[...t,e]),P({index:O?.length,name:e}),j({...B,[e]:t}),W(t),A.length>1&&Q(t=>({...t,[e]:Array.from({length:f},()=>({newData:"",oldData:""}))})),$.current=e},de=(e=[[Fv]])=>{W(e)},ue=(e,t,n)=>{const r=e.target;if(!r||r?.textContent?.trim()===n?.trim())return void le(null);const i=(r.textContent||"").trim();if(!i)return cc.warning("Sheet name cannot be empty."),r.textContent=R.name,void le(null);if(i.length>50)return cc.warning("The sheet name cannot be greater than 50 characters"),r.textContent=R.name,void le(null);if(O.map(e=>e.toLowerCase()).includes(i.toLowerCase())&&n.trim()?.toLowerCase()!==i?.toLowerCase())return cc.warning("Sheet name already exists"),r.textContent=R.name,void le(null);let o=O;de(B?.[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??[]}}(B,n,i);$.current=i,P(e=>({...e,name:i})),j(a),A.length>1&&Q(e=>{const t={...e},r=t[n];return delete t[n],t[i]=r??[],t}),le(null)};const fe=(e,t)=>{e!==R.name&&t!==R.index&&(P({index:t,name:e}),z(n=>{const r=[...n];return r[t]=e,r}),de(B[e]),$.current=e)},he=i.useCallback((e,t=!1)=>{const n=e.target;(!n.closest(".ff-excel-tab-list")&&!n.closest(".ff-excel-sheet")||t)&&D.open&&(F({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]}),t||(e.preventDefault(),e.stopPropagation()))},[D.open]);i.useEffect(()=>(document.addEventListener("contextmenu",he),document.addEventListener("click",e=>he(e,!0)),()=>{document.removeEventListener("contextmenu",he),document.removeEventListener("click",e=>he(e,!0))}),[he]);const Ce=(e,t,n)=>{e.preventDefault();const r=[{label:"Add Sheet",value:"Add Sheet",iconName:"plus_icon",action:()=>ce(),disableTooltip:"Sheet limit reached",visible:!1,disable:se()},...x?[]:[{label:"Delete Sheet",value:"Delete Sheet",iconName:"delete",action:()=>((e,t)=>{if(O.length>1){let n=O.slice();n.splice(t,1);const r={...B};delete r[e];const i=Math.min(t,n.length-1);z(n),j(r),A.length>1&&Q(t=>{const n={...t};return delete n[e],n});const o=n[i]?n[i]:"";P({index:i,name:o}),de(r?.[o]),$.current=o}else cc.warning("Cannot delete the last sheet.")})(t,n),disableTooltip:"",visible:!1,disable:!1}]];F(e=>({...e,open:!0,contextType:"sheet",options:r}))};l(()=>{ne.current?.removeSelect()},[R.name]);return e(t,{children:O.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-(x?32:65)}):(i+a>l&&(i=l-a-2),i<0&&(i=2),J({x:i+m,y:o+p}))},onClick:e=>{e.stopPropagation(),D.open&&F({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(hw,{ref:ne,editable:C,attachmentAction:v,toolbar:s,sheetHeight:h,setContextMenu:F,contextOption:o,data:_,columnContextEnable:E,rowContextEnable:b,minimumColumnWidth:L,onEvaluatedDataChange:e=>{j(t=>({...t,[$.current]:e}))},workRef:ee,scroller:w,maxRowLimit:H,maxColLimit:V,disableDeleteOption:x,contextMenu:D,getActiveCell:S,onAddColumn:(e,t)=>{A.length>1&&Q(n=>{const r=R.name,i=[...n[r]||[]],o=t?e:e+1;return i.splice(o,0,{newData:"",oldData:""}),{...n,[r]:i}})},onDeleteColumn:e=>{A.length>1&&Q(t=>{const n=R.name,r=[...t[n]||[]];return r.splice(e,1),{...t,[n]:r}})}},R.name)}),"hide"!==d&&n("div",{className:"ff-excel-sheet-bar",children:["show"===d&&n("div",{className:"ff-excel-add-sheet-set",children:[e(Y,{title:se()?"Sheet limit reached":"Add Sheet",placement:"top",children:e(q,{disabled:!C||se(),className:"ff-excel-add-sheet-icon",hoverEffect:!0,onClick:ce,name:"plus_icon",height:20,width:20})}),e(Do,{options:(t=>t.map((t,r)=>({label:n("div",{style:{display:"flex",gap:"8px"},children:[R?.name===t?e(q,{height:16,width:16,name:"tick"}):e("div",{style:{height:"16px",width:"24px"}}),e(Y,{title:Hn(t,20,"count")?t:"",children:e(U,{children:xn(t,20,"count")})})]}),name:r,value:t})))(O),targetRef:Z,onOptionClick:e=>{const{value:t,name:n=""}=e;fe(t,parseInt(n))},dropdownPlacement:"top",iconName:"show_script",tooltipTitle:"All Sheets",tooltipPlacement:"top",dropdownHeight:215,selectedValue:R.name})]}),e("div",{className:"ff-excel-tab-container",children:O.map((t,n)=>e(U,{lineHeight:"16px",children:e("div",{onContextMenu:e=>{fe(t,n),M&&Ce(e,t,n)},className:I("ff-excel-tab-list",{active:t===R.name}),onClick:()=>{fe(t,n)},suppressContentEditableWarning:ae===n,onDoubleClick:e=>{"show"===d&&(le(n),null===ae&&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&&ae===n,onBlur:e=>{ue(e,n,t)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ue(e,n,t))},children:t})},t))})]}),D.open&&e(Cw,{contextMenu:D,position:G,editable:C}),e(sc,{})]})})},mw=({label:t="",isActive:n=!0,onClick:r=()=>{},isFilterChip:i=!1})=>{const o=i?"filter":"module";return e("div",{className:I("ff-module-chip",{"ff-filter-chip":i,[`ff-${o}-chip--active`]:n,[`ff-${o}-chip--hover`]:!n}),onClick:r,children:e(U,{lineHeight:"18px",className:"module-typography",children:t})})},Aw=({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}`},gw=({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}),[A,g]=c(!1),v=a(null);let y=-Math.PI/2;const w=2*(t+r),{backgroundArcPath:E,foregroundArcPath:b}=((e,t,n)=>{const r=t,i=r+Math.max(0,Math.min(e,100))/100*2*Math.PI;return{backgroundArcPath:Aw({x:0,y:0,radius:n,startAngle:0,endAngle:2*Math.PI}),foregroundArcPath:Aw({x:0,y:0,radius:n,startAngle:r,endAngle:i})}})(o,y,t),M=()=>{g(!0)},L=()=>{m({x:0,y:0}),g(!1)},x=e=>{if(v.current){const t=v.current.getBoundingClientRect();m({x:e.clientX-t.left,y:e.clientY-t.top})}};return n("div",{ref:v,className:"ff-icon-radial-chart-container",style:{"--fontSize":`${s}px`},onClick:C,children:[e("svg",{width:w,height:w,viewBox:`0 0 ${w} ${w}`,role:"img",children:n("g",{transform:`translate(${t+r}, ${t+r})`,children:[e("path",{d:E,fill:"none",stroke:f,strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:x}),e("path",{d:b,fill:"none",stroke:u,strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:x}),h&&e("path",{d:b,fill:"none",stroke:"var(--dotted-border-color)",strokeOpacity:"0.4",strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:x}),l?e("foreignObject",{x:"-10",y:"-10",width:"20",height:"20",children:e(q,{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)}%`})]})}),A&&n("div",{className:"ff-icon-radial-chart-tooltip",style:{position:"absolute",left:`${p.x+15}px`,top:p.y-5+"px"},children:[e(U,{children:`${i} : `}),n(U,{children:[o,"%"]})]})]})},vw=({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(Y,{title:"Download File",placement:"bottom",children:e(q,{name:"download_file_icon",height:10,width:10,onClick:a,color:"var(--icons-default-color)"})})}),u&&e("div",{className:"ff-icon-container",children:e(Y,{title:"Delete",placement:"bottom",children:e(q,{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(Y,{title:"Maximize",placement:"bottom",children:e(q,{name:"expand_icon",height:16,width:16,onClick:i})})})]}),e(U,{color:"var(--text-area-default-color)",fontWeight:"medium",className:"ff-media-text",children:c})]})}),yw=({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(q,{name:r,height:20,width:20,hoverEffect:!1})}),!C.includes(i.toLowerCase())&&e(U,{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(U,{fontWeight:"semi-bold",fontSize:"10px",className:"ff-text",lineHeight:"15px",color:"var(--ff-chip-text-color)",children:a}),e(U,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"36px",children:"defect density"===i.toLowerCase()?n(t,{children:[o.toString().padStart(2,"0"),e(U,{fontSize:"15px",fontWeight:"semi-bold",children:"/ Modules"})]}):"quality score"===i.toLowerCase()?`${parseFloat(o.toString()).toFixed(2)}%`:o.toString().padStart(2,"0")})]}:{children:[e(U,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"24px",color:f?"var(--base-bg-color)":"",children:o.toString().padStart(2,"0")}),e(U,{className:"ff-text",lineHeight:"18px",color:f?"var(--base-bg-color)":"var(--ff-chip-text-color)",children:a})]})})]})},ww=({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(Y,{title:i?d(t):"",style:{width:"calc(100% - 32px)"},children:e("span",{ref:r,className:"ff-truncated_text",children:d(t)})}),e(q,{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})]})};function Ew(e){return()=>e}function bw(e){e()}function Mw(e,t){return n=>e(t(n))}function Lw(e,t){return()=>e(t)}function xw(e){return void 0!==e}function Hw(){}function Vw(e,t){return t(e),e}function kw(e,t){return t(e)}function Sw(...e){return e}function Zw(e,t){return e(1,t)}function Ow(e,t){e(0,t)}function zw(e){e(2)}function Nw(e){return e(4)}function Iw(e,t){return Zw(e,function(e,t){return n=>e(t,n)}(t,0))}function Tw(e,t){const n=e(1,e=>{n(),t(e)});return n}function Dw(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Fw(e,t){return e===t}function Rw(e=Fw){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Pw(e){return t=>n=>{e(n)&&t(n)}}function Bw(e){return t=>Mw(t,e)}function jw(e){return t=>()=>{t(e)}}function _w(e,...t){const n=function(...e){return t=>e.reduceRight(kw,t)}(...t);return(t,r)=>{switch(t){case 2:return void zw(e);case 1:return Zw(e,n(r))}}}function qw(e,t){return n=>r=>{n(t=e(t,r))}}function Uw(e){return t=>n=>{e>0?e--:t(n)}}function Ww(e){let t,n=null;return r=>i=>{n=i,!t&&(t=setTimeout(()=>{t=void 0,r(n)},e))}}function Xw(...e){const t=new Array(e.length);let n=0,r=null;const i=2**e.length-1;return e.forEach((e,o)=>{const a=2**o;Zw(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 Qw(e){let t=e;const n=Kw();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function Gw(e,t){return Vw(Qw(t),t=>Iw(e,t))}function Kw(){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 Yw(e){return Vw(Kw(),t=>Iw(e,t))}function Jw(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:$w(),singleton:n}}const $w=()=>Symbol();function eE(...e){const t=Kw(),n=new Array(e.length);let r=0;const i=2**e.length-1;return e.forEach((e,o)=>{const a=2**o;Zw(e,e=>{n[o]=e,r|=a,r===i&&Ow(t,n)})}),function(e,o){switch(e){case 2:return void zw(t);case 1:return r===i&&o(n),Zw(t,o)}}}function tE(e,t=Fw){return _w(e,Rw(t))}function nE(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(bw)}}(...e.map(e=>Zw(e,n)))}}}const rE=0,iE=1,oE=2,aE=3,lE={[rE]:"debug",[aE]:"error",[iE]:"log",[oE]:"warn"},sE=Jw(()=>{const e=Qw(aE);return{log:Qw((t,n,r=iE)=>{r>=((typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL??Nw(e))&&console[lE[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function cE(e,t,n){return dE(e,t,n).callbackRef}function dE(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?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:o,ref:r}}function uE(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},aE),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(;void 0===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}),a?.(s?fE("column-gap",getComputedStyle(n).columnGap,o):fE("row-gap",getComputedStyle(n).rowGap,o)),null!==i&&e(i)},[e,t,o,a,l,r,s]);return dE(d,n,c)}function fE(e,t,n){return"normal"!==t&&!0!==t?.endsWith("px")&&n(`${e} was not resolved to pixel value correctly`,t,oE),"normal"===t?0:parseInt(t??"0",10)}function hE(e,t,n){const r=i.useRef(null),o=i.useCallback(n=>{if(!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}=dE(o,!0,n),s=i.useCallback(()=>{o(l.current)},[o,l]);return i.useEffect(()=>{if(t){t.addEventListener("scroll",s);const e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener("scroll",s),e.unobserve(t)}}const e=l.current?.ownerDocument.defaultView;return e?.addEventListener("scroll",s),e?.addEventListener("resize",s),()=>{e?.removeEventListener("scroll",s),e?.removeEventListener("resize",s)}},[s,t,l]),a}const CE=Jw(()=>{const e=Kw(),t=Kw(),n=Qw(0),r=Kw(),i=Qw(0),o=Kw(),a=Kw(),l=Qw(0),s=Qw(0),c=Qw(0),d=Qw(0),u=Kw(),f=Kw(),h=Qw(!1),C=Qw(!1),p=Qw(!1);return Iw(_w(e,Bw(({scrollTop:e})=>e)),t),Iw(_w(e,Bw(({scrollHeight:e})=>e)),a),Iw(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}),pE={lvl:0};function mE(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 AE(e){return e===pE}function gE(e,t){if(!AE(e))return t===e.k?e.v:t<e.k?gE(e.l,t):gE(e.r,t)}function vE(e,t,n="k"){if(AE(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=vE(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return vE(e.l,t,n)}function yE(e,t,n){return AE(e)?ZE(t,n,1):t===e.k?HE(e,{k:t,v:n}):t<e.k?OE(HE(e,{l:yE(e.l,t,n)})):OE(HE(e,{r:yE(e.r,t,n)}))}function wE(){return pE}function EE(e,t,n){if(AE(e))return[];return function(e){return mE(e,({k:e,v:t})=>({index:e,value:t}))}(LE(e,vE(e,t)[0],n))}function bE(e,t){if(AE(e))return pE;const{k:n,l:r,r:i}=e;if(t===n){if(AE(r))return i;if(AE(i))return r;const[t,n]=SE(r);return xE(HE(e,{k:t,l:VE(r),v:n}))}return xE(HE(e,t<n?{l:bE(r,t)}:{r:bE(i,t)}))}function ME(e){return AE(e)?[]:[...ME(e.l),{k:e.k,v:e.v},...ME(e.r)]}function LE(e,t,n){if(AE(e))return[];const{k:r,l:i,r:o,v:a}=e;let l=[];return r>t&&(l=l.concat(LE(i,t,n))),r>=t&&r<=n&&l.push({k:r,v:a}),r<=n&&(l=l.concat(LE(o,t,n))),l}function xE(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(kE(t))return zE(HE(e,{lvl:n-1}));if(!AE(t)&&!AE(t.r))return HE(t.r,{l:HE(t,{r:t.r.l}),lvl:n,r:HE(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(kE(e))return NE(HE(e,{lvl:n-1}));if(!AE(r)&&!AE(r.l)){const t=r.l,i=kE(t)?r.lvl-1:r.lvl;return HE(t,{l:HE(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:NE(HE(r,{l:t.r,lvl:i}))})}throw new Error("Unexpected empty nodes")}function HE(e,t){return ZE(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 VE(e){return AE(e.r)?e.l:xE(HE(e,{r:VE(e.r)}))}function kE(e){return AE(e)||e.lvl>e.r.lvl}function SE(e){return AE(e.r)?[e.k,e.v]:SE(e.r)}function ZE(e,t,n,r=pE,i=pE){return{k:e,l:r,lvl:n,r:i,v:t}}function OE(e){return NE(zE(e))}function zE(e){const{l:t}=e;return AE(t)||t.lvl!==e.lvl?e:HE(t,{r:HE(e,{l:t.r})})}function NE(e){const{lvl:t,r:n}=e;return AE(n)||AE(n.r)||n.lvl!==t||n.r.lvl!==t?e:HE(n,{l:HE(e,{r:n.l}),lvl:t+1})}function IE(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function TE(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const DE=Jw(()=>({recalcInProgress:Qw(!1)}),[],{singleton:!0});function FE(e,t,n){return e[RE(e,t,n)]}function RE(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 PE(e,t){return Math.round(e.getBoundingClientRect()[t])}function BE(e){return!AE(e.groupOffsetTree)}function jE({index:e},t){return t===e?0:t<e?-1:1}function _E({offset:e},t){return t===e?0:t<e?-1:1}function qE(e,t,n){if(0===t.length)return 0;const{index:r,offset:i,size:o}=FE(t,e,jE),a=e-r,l=o*a+(a-1)*n+i;return l>0?l+n:l}function UE(e,t){if(!BE(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function WE(e,t,n){if(function(e){return typeof e.groupIndex<"u"}(e))return t.groupIndices[e.groupIndex]+1;let r=UE("LAST"===e.index?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function XE(e,t,n,r=0){return r>0&&(t=Math.max(t,FE(e,r,jE).offset)),mE(function(e,t,n,r){const i=RE(e,t,r),o=RE(e,n,r,i);return e.slice(i,o+1)}(e,t,n,_E),YE)}function QE(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,rE);const o=e.sizeTree;let a=o,l=0;if(n.length>0&&AE(o)&&2===t.length){const e=t[0].size,r=t[1].size;a=n.reduce((t,n)=>yE(yE(t,n,e),n+1,r),a)}else[a,l]=function(e,t){let n=AE(e)?0:1/0;for(const r of t){const{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),AE(e)){e=yE(e,0,i);continue}const a=EE(e,o-1,t+1);if(a.some(JE(r)))continue;let l=!1,s=!1;for(const{end:n,start:r,value:o}of a)l?(t>=r||i===o)&&(e=bE(e,r)):(s=o!==i,l=!0),n>t&&t>=r&&o!==i&&(e=yE(e,t+1,o));s&&(e=yE(e,o,i))}return[e,n]}(a,t);if(a===o)return e;const{lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u}=KE(e.offsetTree,l,a,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>yE(e,t,qE(t,u,i)),wE()),lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:a}}function GE(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 KE(e,t,n,r){let i=e,o=0,a=0,l=0,s=0;if(0!==t){s=RE(i,t-1,jE),l=i[s].offset;const e=vE(n,t-1);o=e[0],a=e[1],i.length&&i[s].size===vE(n,t)[1]&&(s-=1),i=i.slice(0,s+1)}else i=[];for(const{start:e,value:s}of EE(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 YE(e){return{index:e.index,value:e}}function JE(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 $E={offsetHeight:"height",offsetWidth:"width"},eb=Jw(([{log:e},{recalcInProgress:t}])=>{const n=Kw(),r=Kw(),i=Gw(r,0),o=Kw(),a=Kw(),l=Qw(0),s=Qw([]),c=Qw(void 0),d=Qw(void 0),u=Qw(void 0),f=Qw(void 0),h=Qw((e,t)=>PE(e,$E[t])),C=Qw(void 0),p=Qw(0),m={groupIndices:[],groupOffsetTree:wE(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:wE()},A=Gw(_w(n,Xw(s,e,p),qw(QE,m),Rw()),m),g=Gw(_w(s,Rw(),qw((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),Bw(({prev:e})=>e)),[]);Iw(_w(s,Pw(e=>e.length>0),Xw(A,p),Bw(([e,t,n])=>{const r=e.reduce((e,r,i)=>yE(e,r,qE(r,t.offsetTree,n)||i),wE());return{...t,groupIndices:e,groupOffsetTree:r}})),A),Iw(_w(r,Xw(A),Pw(([e,{lastIndex:t}])=>e<t),Bw(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),Iw(c,d);const v=Gw(_w(c,Bw(e=>void 0===e)),!0);Iw(_w(d,Pw(e=>void 0!==e&&AE(Nw(A).sizeTree)),Bw(e=>{const t=Nw(u),n=Nw(s).length>0;return void 0!==t&&0!==t?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),Iw(_w(f,Pw(e=>void 0!==e&&e.length>0&&AE(Nw(A).sizeTree)),Bw(e=>{const t=[];let n=e[0],r=0;for(let i=1;i<e.length;i++){const o=e[i];o!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=o,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),Iw(_w(s,Xw(u,d),Pw(([,e,t])=>void 0!==e&&void 0!==t),Bw(([e,t,n])=>{const r=[];for(let i=0;i<e.length;i++){const o=e[i],a=e[i+1];r.push({startIndex:o,endIndex:o,size:t}),void 0!==a&&r.push({startIndex:o+1,endIndex:a-1,size:n})}return r})),n);const y=Yw(_w(n,Xw(A),qw(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:m}),Bw(e=>e.changed)));Zw(_w(l,qw((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),Bw(e=>e.diff)),e=>{const{groupIndices:n}=Nw(A);if(e>0)Ow(t,!0),Ow(o,e+GE(e,n));else if(e<0){const t=Nw(g);t.length>0&&(e-=GE(-e,t)),Ow(a,e)}}),Zw(_w(l,Xw(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},aE)});const w=Yw(o);Iw(_w(o,Xw(A),Bw(([e,t])=>{const n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){const n=gE(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=ME(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 ME(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 E=Yw(_w(a,Xw(A,p),Bw(([e,{offsetTree:t},n])=>qE(-e,t,n))));return Iw(_w(a,Xw(A,p),Bw(([e,t,n])=>{if(t.groupIndices.length>0){if(AE(t.sizeTree))return t;let r=wE();const i=Nw(g);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=ME(t.sizeTree).reduce((t,{k:n,v:r})=>yE(t,Math.max(0,n+e),r),r),o!==-e){r=yE(r,0,gE(t.sizeTree,l));r=yE(r,1,vE(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...KE(t.offsetTree,0,r,n)}}const r=ME(t.sizeTree).reduce((t,{k:n,v:r})=>yE(t,Math.max(0,n+e),r),wE());return{...t,sizeTree:r,...KE(t.offsetTree,0,r,n)}})),A),{beforeUnshiftWith:w,data:C,defaultItemSize:d,firstItemIndex:l,fixedItemSize:c,fixedGroupSize:u,gap:p,groupIndices:s,heightEstimates:f,itemSize:h,listRefresh:y,shiftWith:a,shiftWithOffset:E,sizeRanges:n,sizes:A,statefulTotalCount:i,totalCount:r,trackItemSizes:v,unshiftWith:o}},Sw(sE,DE),{singleton:!0});function tb(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}const nb=Jw(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{const o=Kw(),a=Kw(),l=Yw(_w(o,Bw(tb)));return Iw(_w(l,Bw(e=>e.totalCount)),n),Iw(_w(l,Bw(e=>e.groupIndices)),e),Iw(_w(eE(i,t,r),Pw(([e,t])=>BE(t)),Bw(([e,t,n])=>vE(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),Rw(),Bw(e=>[e])),a),{groupCounts:o,topItemsIndexes:a}},Sw(eb,CE)),rb=Jw(([{log:e}])=>{const t=Qw(!1),n=Yw(_w(t,Pw(e=>e),Rw()));return Zw(t,t=>{t&&Nw(e)("props updated",{},rE)}),{didMount:n,propsReady:t}},Sw(sE),{singleton:!0}),ib=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function ob(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!ib)&&(t.behavior="auto"),void 0===t.offset&&(t.offset=0),t}const ab=Jw(([{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=Kw(),C=Kw(),p=Qw(0);let m=null,A=null,g=null;function v(){null!==m&&(m(),m=null),null!==g&&(g(),g=null),A&&(clearTimeout(A),A=null),Ow(s,!1)}return Iw(_w(h,Xw(n,u,r,p,l,a,f),Xw(e,o,i),Bw(([[e,n,r,i,o,a,l,c],u,f,p])=>{const y=ob(e),{align:w,behavior:E,offset:b}=y,M=i-1,L=WE(y,n,M);let x=qE(L,n.offsetTree,u)+a;"end"===w?(x+=f+vE(n.sizeTree,L)[1]-r+p,L===M&&(x+=l)):"center"===w?x+=(f+vE(n.sizeTree,L)[1]-r+p)/2:x-=o,void 0!==b&&0!==b&&(x+=b);const H=t=>{v(),t?(c("retrying to scroll to",{location:e},rE),Ow(h,e)):(Ow(C,!0),c("list did not change, scroll successful",{},rE))};if(v(),"smooth"===E){let e=!1;g=Zw(t,t=>{e=e||t}),m=Tw(d,()=>{H(e)})}else m=Tw(_w(t,function(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),H);return A=setTimeout(()=>{v()},1200),Ow(s,!0),c("scrolling from index to",{behavior:E,index:L,top:x},rE),{behavior:E,top:x}})),c),{scrollTargetReached:C,scrollToIndex:h,topListHeight:p}},Sw(eb,CE,sE),{singleton:!0});function lb(e,t){0===e?t():requestAnimationFrame(()=>{lb(e-1,t)})}function sb(e,t){const n=t-1;return"number"==typeof e?e:"LAST"===e.index?n:e.index}const cb=Jw(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:a}])=>{const l=Qw(!0),s=Qw(0),c=Qw(!0);return Iw(_w(a,Xw(s),Pw(([e,t])=>0!==t),jw(!1)),l),Iw(_w(a,Xw(s),Pw(([e,t])=>0!==t),jw(!1)),c),Zw(_w(eE(t,a),Xw(l,n,e,c),Pw(([[,e],t,{sizeTree:n},r,i])=>e&&(!AE(n)||xw(r))&&!t&&!i),Xw(s)),([,e])=>{Tw(i,()=>{Ow(c,!0)}),lb(4,()=>{Tw(r,()=>{Ow(l,!0)}),Ow(o,e)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:s,scrolledToInitialItem:l}},Sw(eb,CE,ab,rb),{singleton:!0});function db(e,t){return Math.abs(e-t)<1.01}const ub="up",fb="down",hb={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Cb=Jw(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{const a=Qw(!1),l=Qw(!0),s=Kw(),c=Kw(),d=Qw(4),u=Qw(0),f=Gw(_w(nE(_w(tE(i),Uw(1),jw(!0)),_w(tE(i),Uw(1),jw(!1),Dw(100))),Rw()),!1),h=Gw(_w(nE(_w(n,jw(!0)),_w(n,jw(!1),Dw(200))),Rw()),!1);Iw(_w(eE(tE(i),tE(u)),Bw(([e,t])=>e<=t),Rw()),l),Iw(_w(l,Ww(50)),c);const C=Yw(_w(eE(r,tE(o),tE(t),tE(e),tE(d)),qw((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}},hb),Rw((e,t)=>void 0!==e&&e.atBottom===t.atBottom))),p=Gw(_w(r,qw((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!db(e.scrollHeight,t)){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}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Pw(e=>e.changed),Bw(e=>e.jump)),0);Iw(_w(C,Bw(e=>e.atBottom)),a),Iw(_w(a,Ww(50)),s);const m=Qw(fb);Iw(_w(r,Bw(({scrollTop:e})=>e),Rw(),qw((e,t)=>Nw(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?ub:fb,prevScrollTop:t},{direction:fb,prevScrollTop:0}),Bw(e=>e.direction)),m),Iw(_w(r,Ww(50),jw("none")),m);const A=Qw(0);return Iw(_w(f,Pw(e=>!e),jw(0)),A),Iw(_w(i,Ww(100),Xw(f),Pw(([e,t])=>t),qw(([e,t],[n])=>[t,n],[0,0]),Bw(([e,t])=>t-e)),A),{atBottomState:C,atBottomStateChange:s,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:a,isAtTop:l,isScrolling:f,lastJumpDueToItemResize:p,scrollDirection:m,scrollVelocity:A}},Sw(CE)),pb="top",mb="bottom",Ab="none";function gb(e,t,n){return"number"==typeof e?n===ub&&t===pb||n===fb&&t===mb?e:0:n===ub?t===pb?e.main:e.reverse:t===mb?e.main:e.reverse}function vb(e,t){return"number"==typeof e?e:e[t]??0}const yb=Jw(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const o=Kw(),a=Qw(0),l=Qw(0),s=Qw(0);return{increaseViewportBy:l,listBoundary:o,overscan:s,topListHeight:a,visibleRange:Gw(_w(eE(tE(r),tE(i),tE(n),tE(o,TE),tE(s),tE(a),tE(t),tE(e),tE(l)),Bw(([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=Ab;const C=vb(c,pb),p=vb(c,mb);return r-=s,i+=n+l,(r+=n+l)>e+u-C&&(h=ub),(i-=s)<e-f+t+p&&(h=fb),h!==Ab?[Math.max(d-n-gb(o,pb,h)-C,0),d-f-l+t+gb(o,mb,h)+p]:null}),Pw(e=>null!==e),Rw(TE)),[0,0])}},Sw(CE),{singleton:!0});const wb={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Eb(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:Mb(e,i,o),offsetBottom:h,offsetTop:c,top:f,topItems:Mb(t,i,o),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function bb(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=sb(t,l);return Eb(Array.from({length:l}).map((e,t)=>({data:o[t+s],index:t+s,offset:0,size:0})),[],l,i,n,r)}function Mb(e,t,n){if(0===e.length)return[];if(!BE(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=EE(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}function Lb(e,t){return void 0===e?0:"number"==typeof e?e:e[t]??0}const xb=Jw(([{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=Qw([]),m=Qw(0),A=Kw(),g=Qw(0);Iw(o.topItemsIndexes,p);const v=Gw(_w(eE(h,C,tE(s,TE),tE(i),tE(r),tE(c),d,tE(p),tE(t),tE(n),tE(g),e),Pw(([e,t,,n,,,,,,,,r])=>{const i=void 0!==r&&r.length!==n;return e&&!t&&!i}),Bw(([,,[e,t],n,r,i,o,a,l,s,c,d])=>{const u=r,{offsetTree:f,sizeTree:h}=u,C=Nw(m);if(0===n)return{...wb,totalCount:n};if(0===e&&0===t)return 0===C?{...wb,totalCount:n}:bb(C,i,r,l,s,d||[]);if(AE(h))return C>0?null:Eb(function(e,t,n){if(BE(t)){const r=UE(e,t);return[{index:vE(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}(sb(i,n),u,d),[],n,s,u,l);const p=[];if(a.length>0){const e=a[0],t=a[a.length-1];let n=0;for(const r of EE(h,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++)p.push({data:d?.[e],index:e,offset:n,size:i}),n+=i}}if(!o)return Eb([],p,n,s,u,l);const A=a.length>0?a[a.length-1]+1:0,g=XE(f,e,t,A);if(0===g.length)return null;const v=n-1,y=Vw([],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<A&&(o+=(A-a)*l,a=A);const c=Math.min(r.end,v);for(let e=a;e<=c&&!(o>=t);e++)n.push({data:d?.[e],index:e,offset:o,size:l}),o+=l+s}}),w=Lb(c,pb),E=Lb(c,mb);if(y.length>0&&(w>0||E>0)){const e=y[0],t=y[y.length-1];if(w>0&&e.index>A){const t=Math.min(w,e.index-A),n=[];let r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){const t=EE(h,i,i)[0]?.value??e.size;r-=t+s,n.unshift({data:d?.[i],index:i,offset:r,size:t})}y.unshift(...n)}if(E>0&&t.index<v){const e=Math.min(E,v-t.index);let n=t.offset+t.size+s;for(let r=t.index+1;r<=t.index+e;r++){const e=EE(h,r,r)[0]?.value??t.size;y.push({data:d?.[r],index:r,offset:n,size:e}),n+=e+s}}}return Eb(y,p,n,s,u,l)}),Pw(e=>null!==e),Rw()),wb);Iw(_w(e,Pw(xw),Bw(e=>e?.length)),i),Iw(_w(v,Bw(e=>e.topListHeight)),u),Iw(u,l),Iw(_w(v,Bw(e=>[e.top,e.bottom])),a),Iw(_w(v,Bw(e=>e.items)),A);const y=Yw(_w(v,Pw(({items:e})=>e.length>0),Xw(i,e),Pw(([{items:e},t])=>e[e.length-1].originalIndex===t-1),Bw(([,e,t])=>[e-1,t]),Rw(TE),Bw(([e])=>e))),w=Yw(_w(v,Ww(200),Pw(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),Bw(({items:e})=>e[0].index),Rw())),E=Yw(_w(v,Pw(({items:e})=>e.length>0),Bw(({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}}),Rw(IE)));return{endReached:y,initialItemCount:m,itemsRendered:A,listState:v,minOverscanItemCount:g,rangeChanged:E,startReached:w,topItemsIndexes:p,...f}},Sw(eb,nb,yb,cb,ab,Cb,rb,DE),{singleton:!0}),Hb=Jw(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const o=Kw(),a=Gw(_w(eE(n,e,r,t,i),Bw(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return Iw(tE(a),o),{totalListHeight:a,totalListHeightChanged:o}},Sw(CE,xb),{singleton:!0}),Vb=Jw(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Qw(!1);return{alignToBottom:n,paddingTopAddition:Gw(_w(eE(n,e,t),Pw(([e])=>e),Bw(([,e,t])=>Math.max(0,e-t)),Ww(0),Rw()),0)}},Sw(CE,Hb),{singleton:!0}),kb=Jw(()=>({context:Qw(null)})),Sb=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:a})=>t<a?{...i,align:n??"start",...void 0!==r?{behavior:r}:{}}:e>o?{...i,align:n??"end",...void 0!==r?{behavior:r}:{}}:null,Zb=Jw(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:a,scrollTop:l,viewportHeight:s},{scrollToIndex:c}])=>{const d=Kw();return Iw(_w(d,Xw(t,s,n,o,i,r,l),Xw(e),Bw(([[e,t,n,r,i,o,l,s],c])=>{const{calculateViewLocation:d=Sb,done:u,...f}=e,h=WE(e,t,r-1),C=qE(h,t.offsetTree,c)+i+o,p=d({itemBottom:C+vE(t.sizeTree,h)[1],itemTop:C,locationParams:f,viewportBottom:s+n-l,viewportTop:s+o});return null!==p?u&&Tw(_w(a,Pw(e=>!e),Uw(Nw(a)?1:2)),u):u?.(),p}),Pw(e=>null!==e)),c),{scrollIntoView:d}},Sw(eb,CE,ab,xb,sE),{singleton:!0});function Ob(e){return!1!==e&&("smooth"===e?"smooth":"auto")}const zb=Jw(([{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=Qw(!1),p=Kw();let m=null;function A(e){Ow(a,{align:"end",behavior:e,index:"LAST"})}function g(e){const t=Tw(i,t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&null===m&&(Nw(d)("scrolling to bottom due to increased size",{},rE),A("auto"))});setTimeout(t,100)}Zw(_w(eE(_w(tE(t),Uw(1)),s),Xw(tE(C),o,l,u),Bw(([[e,t],n,r,i,o])=>{let a=t&&i,l="auto";return a&&(l=((e,t)=>"function"==typeof e?Ob(e(t)):t&&Ob(e))(n,r||o),a=a&&!1!==l),{followOutputBehavior:l,shouldFollow:a,totalCount:e}}),Pw(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{null!==m&&(m(),m=null),void 0!==Nw(n)?requestAnimationFrame(()=>{Nw(d)("following output to ",{totalCount:r},rE),A(t)}):m=Tw(e,()=>{Nw(d)("following output to ",{totalCount:r},rE),A(t),m=null})}),Zw(_w(eE(tE(C),t,c),Pw(([e,,t])=>!1!==e&&t),qw(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),Pw(({refreshed:e})=>e),Xw(C,t)),([,e])=>{Nw(l)&&g(!1!==e)}),Zw(p,()=>{g(!1!==Nw(C))}),Zw(eE(tE(C),i),([e,t])=>{!1!==e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&A("auto")});const v=Qw(null),y=Kw();return Iw(nE(_w(tE(r),Bw(e=>e?.length??0)),_w(tE(t))),y),Zw(_w(eE(_w(y,Uw(1)),s),Xw(tE(v),l,u,f),Bw(([[e,t],n,r,i,o])=>t&&r&&n?.({context:o,totalCount:e,scrollingInProgress:i})),Pw(e=>!!e),Ww(0)),t=>{null!==m&&(m(),m=null),void 0!==Nw(n)?requestAnimationFrame(()=>{Nw(d)("scrolling into view",{}),Ow(h,t)}):m=Tw(e,()=>{Nw(d)("scrolling into view",{}),Ow(h,t),m=null})}),{autoscrollToBottom:p,followOutput:C,scrollIntoViewOnChange:v}},Sw(eb,Cb,ab,cb,rb,sE,CE,kb,Zb)),Nb=Jw(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:a},{didMount:l}])=>(Iw(_w(l,Xw(o),Pw(([,e])=>0!==e),Xw(i,r,t,n,e),Bw(([[,e],t,n,r,i,o=[]])=>bb(e,t,n,r,i,o))),a),{}),Sw(eb,cb,xb,rb),{singleton:!0}),Ib=Jw(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Qw(0);return Zw(_w(e,Xw(r),Pw(([,e])=>0!==e),Bw(([,e])=>({top:e}))),e=>{Tw(_w(n,Uw(1),Pw(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{Ow(t,e)})})}),{initialScrollTop:r}},Sw(rb,CE,xb),{singleton:!0}),Tb=Jw(([{scrollVelocity:e}])=>{const t=Qw(!1),n=Kw(),r=Qw(!1);return Iw(_w(e,Xw(r,t,n),Pw(([e,t])=>!1!==t&&void 0!==t),Bw(([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}),Rw()),t),Zw(_w(eE(t,e,n),Xw(r)),([[e,t,n],r])=>{e&&!1!==r&&void 0!==r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},Sw(Cb),{singleton:!0}),Db=Jw(([{scrollContainerState:e,scrollTo:t}])=>{const n=Kw(),r=Kw(),i=Kw(),o=Qw(!1),a=Qw(void 0);return Iw(_w(eE(n,r),Bw(([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n}))),e),Iw(_w(t,Xw(r),Bw(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:a,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},Sw(CE)),Fb=Jw(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:a,windowScrollContainerState:l,windowViewportRect:s}])=>{const c=Kw(),d=Qw(void 0),u=Qw(null),f=Qw(null);return Iw(l,u),Iw(s,f),Zw(_w(c,Xw(t,r,a,u,f,n)),([e,t,n,r,i,o,a])=>{const l=function(e){return ME(e).map(({k:e,v:t},n,r)=>{const i=r[n+1];return{endIndex:void 0!==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})}),Iw(_w(d,Pw(xw),Bw(Rb)),i),Iw(_w(o,Xw(d),Pw(([,e])=>void 0!==e),Rw(),Bw(([,e])=>e.ranges)),e),{getState:c,restoreStateFrom:d}},Sw(eb,CE,cb,rb,Db));function Rb(e){return{align:"start",index:0,offset:e.scrollTop}}const Pb=Jw(([{topItemsIndexes:e}])=>{const t=Qw(0);return Iw(_w(t,Pw(e=>e>=0),Bw(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},Sw(xb));function Bb(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const jb=Bb(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),_b=Jw(([{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=Yw(_w(s,Xw(a),qw(([,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]),Pw(([e])=>0!==e),Xw(r,l,n,i,h,C),Pw(([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===ub),Bw(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},rE),e))));function m(n){n>0?(Ow(t,{behavior:"auto",top:-n}),Ow(e,0)):(Ow(e,0),Ow(t,{behavior:"auto",top:-n}))}return Zw(_w(p,Xw(e,o)),([t,n,r])=>{r&&jb()?Ow(e,n-t):m(-t)}),Zw(_w(eE(Gw(o,!1),e,C),Pw(([e,t,n])=>!e&&!n&&0!==t),Bw(([e,t])=>t),Ww(1)),m),Iw(_w(u,Bw(e=>({top:-e}))),t),Zw(_w(c,Xw(f,d),Bw(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function o(e){return e*(n+i)}if(0===t.length)return o(e);let a=0;const l=gE(r,0);let s=0,c=0;for(;s<e;){s++,a+=l;let n=t.length===c+1?1/0:t[c+1]-t[c]-1;s+n>e&&(a-=l,n=e-s+1),s+=n,a+=o(n),c++}return a})),n=>{Ow(e,n),requestAnimationFrame(()=>{Ow(t,{top:n}),requestAnimationFrame(()=>{Ow(e,0),Ow(C,!1)})})}),{deviation:e}},Sw(CE,Cb,xb,eb,sE,DE)),qb=Jw(([e,t,n,r,i,o,a,l,s,c,d])=>({...e,...t,...n,...r,...i,...o,...a,...l,...s,...c,...d}),Sw(yb,Nb,rb,Tb,Hb,Ib,Vb,Db,Zb,sE,kb)),Ub=Jw(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:o,groupIndices:a,heightEstimates:l,itemSize:s,sizeRanges:c,sizes:d,statefulTotalCount:u,totalCount:f,trackItemSizes:h},{initialItemFinalLocationReached:C,initialTopMostItemIndex:p,scrolledToInitialItem:m},A,g,v,y,{scrollToIndex:w},E,{topItemCount:b},{groupCounts:M},L])=>{const{listState:x,minOverscanItemCount:H,topItemsIndexes:V,rangeChanged:k,...S}=y;return Iw(k,L.scrollSeekRangeChanged),Iw(_w(L.windowViewportRect,Bw(e=>e.visibleHeight)),A.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:o,groupCounts:M,heightEstimates:l,initialItemFinalLocationReached:C,initialTopMostItemIndex:p,scrolledToInitialItem:m,sizeRanges:c,topItemCount:b,topItemsIndexes:V,totalCount:f,...v,groupIndices:a,itemSize:s,listState:x,minOverscanItemCount:H,scrollToIndex:w,statefulTotalCount:u,trackItemSizes:h,rangeChanged:k,...S,...L,...A,sizes:d,...g}},Sw(eb,cb,CE,Fb,zb,xb,ab,_b,Pb,nb,qb));function Wb(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 Xb=typeof document<"u"?i.useLayoutEffect:i.useEffect;function Qb(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){void 0!==e.propsReady&&Ow(e.propsReady,!1);for(const r of o){Ow(e[n.required[r]],t[r])}for(const r of a)if(r in t){Ow(e[n.optional[r]],t[r])}void 0!==e.propsReady&&Ow(e.propsReady,!0)}function u(e){return s.reduce((t,r)=>(t[r]=function(e){let t,n;const r=()=>t?.();return function(i,o){switch(i){case 1:return o?n===o?void 0:(r(),n=o,t=Zw(e,o),t):(r(),Hw);case 2:return r(),void(n=null)}}}(e[n.events[r]]),t),{})}const f=i.forwardRef(function(f,h){const{children:C,...p}=f,[m]=i.useState(()=>Vw(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)})),[A]=i.useState(Lw(u,m));var g;Xb(()=>{for(const e of s)e in p&&Zw(A[e],p[e]);return()=>{Object.values(A).map(zw)}},[p,A,m]),Xb(()=>{d(m,p)}),i.useImperativeHandle(h,Ew((g=m,l.reduce((e,t)=>(e[t]=e=>{Ow(g[n.methods[t]],e)},e),{}))));const v=r;return e(c.Provider,{value:m,children:void 0!==r?e(v,{...Wb([...o,...a,...s],p),children:C}):C})});return{Component:f,useEmitter:(e,t)=>{const n=i.useContext(c)[e];Xb(()=>Zw(n,t),[t,n])},useEmitterValue:i.version.startsWith("18")?e=>{const t=i.useContext(c)[e],n=i.useCallback(e=>Zw(t,e),[t]);return i.useSyncExternalStore(n,()=>Nw(t),()=>Nw(t))}:e=>{const t=i.useContext(c)[e],[n,r]=i.useState(Lw(Nw,t));return Xb(()=>Zw(t,e=>{e!==n&&r(Ew(e))}),[t,n]),n},usePublisher:e=>{const t=i.useContext(c);return i.useCallback(n=>{Ow(t[e],n)},[t,e])}}}const Gb=i.createContext(void 0),Kb=i.createContext(void 0),Yb="-webkit-sticky",Jb="sticky",$b=Bb(()=>{if(typeof document>"u")return Jb;const e=document.createElement("div");return e.style.position=Yb,e.style.position===Yb?Yb:Jb}),eM=typeof document<"u"?i.useLayoutEffect:i.useEffect;function tM(e){return"self"in e}function nM(e,t,n,r=Hw,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)||tM(l)){const e=tM(l)?l:l.defaultView;o=!0===a?e.scrollX:e.scrollY,r=!0===a?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=!0===a?e.innerWidth:e.innerHeight}else o=!0===a?l.scrollLeft:l.scrollTop,r=!0===a?l.scrollWidth:l.scrollHeight,i=!0===a?l.offsetWidth:l.offsetHeight;const d=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};!0===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){!0===a&&(e={...void 0!==e.behavior?{behavior:e.behavior}:{},...void 0!==e.top?{left:e.top}:{}}),l.current.scrollBy(e)},scrollerRef:l,scrollToCallback:function(n){const r=l.current;if(!r||(!0===a?"offsetWidth"in r&&0===r.offsetWidth:"offsetHeight"in r&&0===r.offsetHeight))return;const i="smooth"===n.behavior;let o,d,u;tM(r)?(d=Math.max(PE(r.document.documentElement,!0===a?"width":"height"),!0===a?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),o=!0===a?r.innerWidth:r.innerHeight,u=!0===a?window.scrollX:window.scrollY):(d=r[!0===a?"scrollWidth":"scrollHeight"],o=PE(r,!0===a?"width":"height"),u=r[!0===a?"scrollLeft":"scrollTop"]);const f=d-o;if(n.top=Math.ceil(Math.max(Math.min(f,n.top),0)),db(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,!0===a&&(n={...void 0!==n.behavior?{behavior:n.behavior}:{},left:n.top}),r.scrollTo(n)}}}function rM(e){return e}const iM=Jw(()=>{const e=Qw(e=>`Item ${e}`),t=Qw(e=>`Group ${e}`),n=Qw({}),r=Qw(rM),i=Qw("div"),o=Qw(Hw),a=(e,t=null)=>Gw(_w(n,Bw(t=>t[e]),Rw()),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")}}),oM=Jw(([e,t])=>({...e,...t}),Sw(Ub,iM)),aM=({height:t})=>e("div",{style:{height:t}}),lM={overflowAnchor:"none",position:$b(),zIndex:1},sM={overflowAnchor:"none"},cM={...sM,display:"inline-block",height:"100%"},dM=i.memo(function({showTopList:t=!1}){const n=HM("listState"),r=VM("sizeRanges"),o=HM("useWindowScroll"),a=HM("customScrollParent"),l=VM("windowScrollContainerState"),s=VM("scrollContainerState"),c=a||o?l:s,d=HM("itemContent"),u=HM("context"),f=HM("groupContent"),h=HM("trackItemSizes"),C=HM("itemSize"),m=HM("log"),A=VM("gap"),g=HM("horizontalDirection"),{callbackRef:v}=uE(r,C,h,t?Hw:c,m,A,a,g,HM("skipAnimationFrameInResizeObserver")),[y,w]=i.useState(0);xM("deviation",e=>{y!==e&&w(e)});const E=HM("EmptyPlaceholder"),b=HM("ScrollSeekPlaceholder")??aM,M=HM("ListComponent"),L=HM("ItemComponent"),x=HM("GroupComponent"),H=HM("computeItemKey"),V=HM("isSeeking"),k=HM("groupIndices").length>0,S=HM("alignToBottom"),Z=HM("initialItemFinalLocationReached"),O=t?{}:{boxSizing:"border-box",...g?{display:"inline-block",height:"100%",marginLeft:0!==y?y:S?"auto":0,paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,whiteSpace:"nowrap"}:{marginTop:0!==y?y:S?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...Z?{}:{visibility:"hidden"}};return t||0!==n.totalCount||null==E?e(M,{...pM(M,u),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:v,style:O,children:(t?n.topItems:n.items).map(e=>{const t=e.originalIndex,r=H(t+n.firstItemIndex,e.data,u);return V?p(b,{...pM(b,u),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?p(x,{...pM(x,u),"data-index":t,"data-item-index":e.index,"data-known-size":e.size,key:r,style:lM},f(e.index,u)):p(L,{...pM(L,u),...mM(L,e.data),"data-index":t,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:g?cM:sM},k?d(e.index,e.groupIndex,e.data,u):d(e.index,e.data,u))})}):e(E,{...pM(E,u)})}),uM={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},fM={outline:"none",overflowX:"auto",position:"relative"},hM=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),CM={position:$b(),top:0,width:"100%",zIndex:1};function pM(e,t){if("string"!=typeof e)return{context:t}}function mM(e,t){return{item:"string"==typeof e?void 0:t}}const AM=i.memo(function(){const t=HM("HeaderComponent"),n=VM("headerHeight"),r=HM("HeaderFooterTag"),o=cE(i.useMemo(()=>e=>{n(PE(e,"height"))},[n]),!0,HM("skipAnimationFrameInResizeObserver")),a=HM("context");return null!=t?e(r,{ref:o,children:e(t,{...pM(t,a)})}):null}),gM=i.memo(function(){const t=HM("FooterComponent"),n=VM("footerHeight"),r=HM("HeaderFooterTag"),o=cE(i.useMemo(()=>e=>{n(PE(e,"height"))},[n]),!0,HM("skipAnimationFrameInResizeObserver")),a=HM("context");return null!=t?e(r,{ref:o,children:e(t,{...pM(t,a)})}):null});function vM({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:i,style:o,context:a,...l}){const s=r("scrollContainerState"),c=n("ScrollerComponent"),d=r("smoothScrollTargetReached"),u=n("scrollerRef"),f=n("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:C,scrollToCallback:p}=nM(s,d,c,u,void 0,f);return t("scrollTo",p),t("scrollBy",h),e(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:C,style:{...f?fM:uM,...o},tabIndex:0,...l,...pM(c,a),children:i})})}function yM({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:o,style:a,context:l,...s}){const c=r("windowScrollContainerState"),d=n("ScrollerComponent"),u=r("smoothScrollTargetReached"),f=n("totalListHeight"),h=n("deviation"),C=n("customScrollParent"),p=i.useRef(null),m=n("scrollerRef"),{scrollByCallback:A,scrollerRef:g,scrollToCallback:v}=nM(c,u,d,m,C);return eM(()=>(g.current=C||p.current?.ownerDocument.defaultView,()=>{g.current=null}),[g,C]),t("windowScrollTo",v),t("scrollBy",A),e(d,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...0!==f?{height:f+h}:void 0},...s,...pM(d,l),children:o})})}const wM=({children:t})=>{const n=i.useContext(Gb),r=VM("viewportHeight"),o=VM("fixedItemHeight"),a=HM("alignToBottom"),l=HM("horizontalDirection"),s=cE(i.useMemo(()=>Mw(r,e=>PE(e,l?"width":"height")),[r,l]),!0,HM("skipAnimationFrameInResizeObserver"));return i.useEffect(()=>{n&&(r(n.viewportHeight),o(n.itemHeight))},[n,r,o]),e("div",{"data-viewport-type":"element",ref:s,style:hM(a),children:t})},EM=({children:t})=>{const n=i.useContext(Gb),r=VM("windowViewportRect"),o=VM("fixedItemHeight"),a=HM("customScrollParent"),l=hE(r,a,HM("skipAnimationFrameInResizeObserver")),s=HM("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:hM(s),children:t})},bM=({children:t})=>{const n=HM("TopItemListComponent")??"div",r=HM("headerHeight"),i={...CM,marginTop:`${r}px`},o=HM("context");return e(n,{style:i,...pM(n,o),children:t})},MM=i.memo(function(t){const r=HM("useWindowScroll"),i=HM("topItemsIndexes").length>0,o=HM("customScrollParent"),a=HM("context");return n(o||r?SM:kM,{...t,context:a,children:[i&&e(bM,{children:e(dM,{showTopList:!0})}),n(o||r?EM:wM,{children:[e(AM,{}),e(dM,{}),e(gM,{})]})]})}),{Component:LM,useEmitter:xM,useEmitterValue:HM,usePublisher:VM}=Qb(oM,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",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"}},MM),kM=vM({useEmitter:xM,useEmitterValue:HM,usePublisher:VM}),SM=yM({useEmitter:xM,useEmitterValue:HM,usePublisher:VM}),ZM=LM,OM=Jw(()=>{const e=Qw(e=>n("td",{children:["Item $",e]})),t=Qw(null),r=Qw(e=>n("td",{colSpan:1e3,children:["Group ",e]})),i=Qw(null),o=Qw(null),a=Qw({}),l=Qw(rM),s=Qw(Hw),c=(e,t=null)=>Gw(_w(a,Bw(t=>t[e]),Rw()),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")}});Sw(Ub,OM),$b();const zM={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},NM={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:IM,floor:TM,max:DM,min:FM,round:RM}=Math;function PM(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function BM(e,t){return void 0!==e&&e.width===t.width&&e.height===t.height}function jM(e,t){return void 0!==e&&e.column===t.column&&e.row===t.row}const _M=Jw(([{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:A,windowScrollContainerState:g,windowScrollTo:v,windowViewportRect:y},w])=>{const E=Qw(0),b=Qw(0),M=Qw(zM),L=Qw({height:0,width:0}),x=Qw({height:0,width:0}),H=Kw(),V=Kw(),k=Qw(0),S=Qw(null),Z=Qw({column:0,row:0}),O=Kw(),z=Kw(),N=Qw(!1),I=Qw(0),T=Qw(!0),D=Qw(!1),F=Qw(!1);Zw(_w(C,Xw(I),Pw(([e,t])=>0!==t)),()=>{Ow(T,!1)}),Zw(_w(eE(C,T,x,L,I,D),Pw(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i)),([,,,,e])=>{Ow(D,!0),lb(1,()=>{Ow(H,e)}),Tw(_w(c),()=>{Ow(t,[0,0]),Ow(T,!0)})}),Iw(_w(z,Pw(e=>null!=e&&e.scrollTop>0),jw(0)),b),Zw(_w(C,Xw(z),Pw(([,e])=>null!=e)),([,e])=>{e&&(Ow(L,e.viewport),Ow(x,e.item),Ow(Z,e.gap),e.scrollTop>0&&(Ow(N,!0),Tw(_w(c,Uw(1)),e=>{Ow(N,!1)}),Ow(s,{top:e.scrollTop})))}),Iw(_w(L,Bw(({height:e})=>e)),u),Iw(_w(eE(tE(L,BM),tE(x,BM),tE(Z,(e,t)=>void 0!==e&&e.column===t.column&&e.row===t.row),tE(c)),Bw(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),O),Iw(_w(eE(tE(E),r,tE(Z,jM),tE(x,BM),tE(L,BM),tE(S),tE(b),tE(N),tE(T),tE(I)),Pw(([,,,,,,,e])=>!e),Bw(([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 zM;if(0===h){const t=sb(c,e);return function(e){return{...NM,items:e}}(PM(t,t+Math.max(l-1,0),a))}const p=qM(C,h,d);let m,A;s?0===t&&0===n&&l>0?(m=0,A=l-1):(m=p*TM((t+u)/(f+u)),A=p*IM((n+u)/(f+u))-1,A=FM(e-1,DM(A,p-1)),m=FM(A,DM(0,m))):(m=0,A=-1);const g=PM(m,A,a),{bottom:v,top:y}=UM(o,r,i,g),w=IM(e/p);return{bottom:v,itemHeight:f,items:g,itemWidth:h,offsetBottom:w*f+(w-1)*u-v,offsetTop:y,top:y}})),M),Iw(_w(S,Pw(e=>null!==e),Bw(e=>e.length)),E),Iw(_w(eE(L,x,M,Z),Pw(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),Bw(([e,t,{items:n},r])=>{const{bottom:i,top:o}=UM(e,r,t,n);return[o,i]}),Rw(TE)),t);const R=Qw(!1);Iw(_w(c,Xw(R),Bw(([e,t])=>t||0!==e)),R);const P=Yw(_w(eE(M,E),Pw(([{items:e}])=>e.length>0),Xw(R),Pw(([[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}),Bw(([[,e]])=>e-1),Rw())),B=Yw(_w(tE(M),Pw(({items:e})=>e.length>0&&0===e[0].index),jw(0),Rw())),j=Yw(_w(tE(M),Xw(N),Pw(([{items:e},t])=>e.length>0&&!t),Bw(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),Rw(IE),Ww(0)));Iw(j,h.scrollSeekRangeChanged),Iw(_w(H,Xw(L,x,E,Z),Bw(([e,t,n,r,i])=>{const o=ob(e),{align:a,behavior:l,offset:s}=o;let c=o.index;"LAST"===c&&(c=r-1),c=DM(0,c,FM(r-1,c));let d=WM(t,i,n,c);return"end"===a?d=RM(d-t.height+n.height):"center"===a&&(d=RM(d-t.height/2+n.height/2)),void 0!==s&&0!==s&&(d+=s),{behavior:l,top:d}})),s);const _=Gw(_w(M,Bw(e=>e.offsetBottom+e.bottom)),0);return Iw(_w(y,Bw(e=>({height:e.visibleHeight,width:e.visibleWidth}))),L),{customScrollParent:m,data:S,deviation:k,footerHeight:i,gap:Z,headerHeight:o,increaseViewportBy:e,initialItemCount:b,itemDimensions:x,overscan:n,restoreStateFrom:z,scrollBy:a,scrollContainerState:l,scrollHeight:V,scrollTo:s,scrollToIndex:H,scrollTop:c,smoothScrollTargetReached:d,totalCount:E,useWindowScroll:A,viewportDimensions:L,windowScrollContainerState:g,windowScrollTo:v,windowViewportRect:y,...h,gridState:M,horizontalDirection:F,initialTopMostItemIndex:I,totalListHeight:_,...f,endReached:P,propsReady:p,rangeChanged:j,startReached:B,stateChanged:O,stateRestoreInProgress:N,...w}},Sw(yb,CE,Cb,Tb,rb,Db,sE));function qM(e,t,n){return DM(1,TM((e+n)/(TM(t)+n)))}function UM(e,t,n,r){const{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};const o=WM(e,t,n,r[0].index);return{bottom:WM(e,t,n,r[r.length-1].index)+i,top:o}}function WM(e,t,n,r){const i=qM(e.width,n.width,t.column),o=TM(r/i),a=o*n.height+DM(0,o-1)*t.row;return a>0?a+t.row:a}const XM=Jw(()=>{const e=Qw(e=>`Item ${e}`),t=Qw({}),n=Qw(null),r=Qw("virtuoso-grid-item"),i=Qw("virtuoso-grid-list"),o=Qw(rM),a=Qw("div"),l=Qw(Hw),s=(e,n=null)=>Gw(_w(t,Bw(t=>t[e]),Rw()),n),c=Qw(!1),d=Qw(!1);return Iw(tE(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")}}),QM=Jw(([e,t])=>({...e,...t}),Sw(_M,XM)),GM=i.memo(function(){const t=nL("gridState"),n=nL("listClassName"),r=nL("itemClassName"),o=nL("itemContent"),a=nL("computeItemKey"),l=nL("isSeeking"),s=rL("scrollHeight"),c=nL("ItemComponent"),d=nL("ListComponent"),u=nL("ScrollSeekPlaceholder"),f=nL("context"),h=rL("itemDimensions"),C=rL("gap"),m=nL("log"),A=nL("stateRestoreInProgress"),g=rL("reportReadyState"),v=cE(i.useMemo(()=>e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const n=e.firstChild;if(null!==n){const{height:e,width:t}=n.getBoundingClientRect();h({height:e,width:t})}C({column:aL("column-gap",getComputedStyle(e).columnGap,m),row:aL("row-gap",getComputedStyle(e).rowGap,m)})},[s,h,C,m]),!0,!1);return eM(()=>{t.itemHeight>0&&t.itemWidth>0&&g(!0)},[t]),A?null:e(d,{className:n,ref:v,...pM(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,{...pM(u,f),height:t.itemHeight,index:n.index,width:t.itemWidth},i):p(c,{...pM(c,f),className:r,"data-index":n.index,key:i},o(n.index,n.data,f))})})}),KM=i.memo(function(){const t=nL("HeaderComponent"),n=rL("headerHeight"),r=nL("headerFooterTag"),o=cE(i.useMemo(()=>e=>{n(PE(e,"height"))},[n]),!0,!1),a=nL("context");return null!=t?e(r,{ref:o,children:e(t,{...pM(t,a)})}):null}),YM=i.memo(function(){const t=nL("FooterComponent"),n=rL("footerHeight"),r=nL("headerFooterTag"),o=cE(i.useMemo(()=>e=>{n(PE(e,"height"))},[n]),!0,!1),a=nL("context");return null!=t?e(r,{ref:o,children:e(t,{...pM(t,a)})}):null}),JM=({children:t})=>{const n=i.useContext(Kb),r=rL("itemDimensions"),o=rL("viewportDimensions"),a=cE(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:hM(!1),children:t})},$M=({children:t})=>{const n=i.useContext(Kb),r=rL("windowViewportRect"),o=rL("itemDimensions"),a=nL("customScrollParent"),l=hE(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:hM(!1),children:t})},eL=i.memo(function({...t}){const r=nL("useWindowScroll"),i=nL("customScrollParent"),o=i||r?oL:iL,a=i||r?$M:JM,l=nL("context");return e(o,{...t,...pM(o,l),children:n(a,{children:[e(KM,{}),e(GM,{}),e(YM,{})]})})}),{useEmitter:tL,useEmitterValue:nL,usePublisher:rL}=Qb(QM,{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"}},eL),iL=vM({useEmitter:tL,useEmitterValue:nL,usePublisher:rL}),oL=yM({useEmitter:tL,useEmitterValue:nL,usePublisher:rL});function aL(e,t,n){return"normal"!==t&&!0!==t?.endsWith("px")&&n(`${e} was not resolved to pixel value correctly`,t,oE),"normal"===t?0:parseInt(t??"0",10)}const lL=({optionsList:r=[],onSelectVariable:i,dropdownPosition:o,position:s="relative",width:c,height:d="160px",zIndex:u=9999,highlightedIndex:f})=>{const h={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},C=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":h[e.type||""]||"":"step_group_variable"},p=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;function m(e){if(e.endsWith("px")){const t=parseInt(e.slice(0,-2),10);return isNaN(t)?212:t-66}return 212}const A=a(null);l(()=>{void 0!==f&&f>=0&&requestAnimationFrame(()=>{A.current?.scrollToIndex({index:f,behavior:"auto",align:"center"})})},[f,r]);return e("div",{className:I("ff-variable-dropdown",s),style:o?{top:o.top,left:o.left,width:c,height:d,zIndex:u}:{width:c,height:d,zIndex:u},children:K(r)?e("div",{className:"ff-variable-option ff-variable-option-no-data",children:e(U,{as:"span",fontSize:12,children:"No Option"})}):e(ZM,{totalCount:r.length,ref:A,data:r,itemContent:o=>{const a=r[o];return a?e("div",{className:I("ff-variable-data",{"ff-variable-data--highlighted":f===o}),onMouseDown:()=>i(a),children:c.endsWith("px")?n(t,{children:[e(Y,{title:Hn(p(a),m(c),"pixel")?p(a):"",placement:"bottom",style:{width:`${m(c)}px`},children:e(U,{as:"span",fontSize:12,className:"ff-truncated_text",children:p(a)})}),e(q,{name:C(a),height:24,width:24})]}):e(ww,{option:a})},`${a.id}-${o}`):null},style:{height:d,fontSize:"12px"},overscan:10,fixedItemHeight:32})})},sL=({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:A,chartName:g,shouldCenterSinglePoint:v,xAxisLabelGap:y=16,isLeftOverflow:w=!1})=>{const E=40,b=i-80,M=o-80,[L,x]=c(!1),[H,V]=c({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});l(()=>{const e=()=>{x(!1),V(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+y,gap:y},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(U,{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:M,x2:b,y2:M,stroke:f,strokeWidth:1}),e("text",{x:b/2.1,y:M+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*(b/(l-1)),y:M+15,textAnchor:0===n?"start":n===l-1?"end":"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},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:M-i*M/r,textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:o?.toFixed(1)},`y-${n}`)})]})})})]})}function k(e){if(!isNaN(e))return parseFloat(e);const t=Vr,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 S=r?.[0]?.data?.[0]?.hasOwnProperty("date")&&r?.[0]?.data?.[0]?.hasOwnProperty("totalMemory"),Z="date",O=S?"totalMemory":"value",z=e=>{const t=r?.[0]?.data?.length;if(1===t)return v?b/2:b;const n=r[0].data.findIndex(t=>t[Z]===e);return-1===n?0:n/(t-1)*b},N=Math.max(...r?.flatMap(e=>e?.data?.map(e=>k(e[O]))),5),I=e=>{if("memory"===g){const t=Math.max(...r?.flatMap(e=>e?.data?.map(e=>k(e[O]))));return M-e*M/(t>1024?t:1024)}return M-e*M/(0===N?1024:N)},T=e=>{if(1===e?.length){const t=e?.[0],n=z(t[Z]),r=I(k(t[O]));return`M 0 ${I(0)} L ${n} ${r}`}return e?.reduce((t,n,r)=>{const i=z(n[Z]),o=I(k(n[O]));if(0===r)return`M ${i} ${o}`;const a=e[r-1],l=a?z(a[Z]):0;return`${t} C ${l+(i-l)/2} ${a?I(k(a[O])):0}, ${i-(i-l)/2} ${o}, ${i} ${o}`},"")},D=r[0].data;return n("div",{className:"ff-line-chart-text",style:{width:i+20+y,gap:y},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(U,{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>M)return x(!1),void V({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-z(t[Z]));return r<e.distance?{point:t,distance:r}:e},{point:null,distance:1/0}).point;r&&(o=r[Z],i.hoverValues[t]=((e,t=2)=>{let n="";if("string"==typeof e){const t=e.match(Lr),r=e.match(xr);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:z(r[Z]),y:I(k(r[O]))})}),x(!0),V({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:()=>V({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:M,strokeWidth:2}),e("line",{x1:0,y1:M,x2:b,y2:M,stroke:f,strokeWidth:1}),e("text",{x:b/2.1,y:M+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:T(r.data),fill:"none",stroke:r.color,strokeWidth:a,opacity:(o=r.data,o.every(e=>0===k(e[O]))?.5:1)}),H.dotPositions[i]&&n(t,{children:[e("line",{x1:H.dotPositions[i].x,y1:0,x2:H.dotPositions[i].x,y2:M,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"}),e("circle",{cx:H.dotPositions[i].x,cy:H.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:H.dotPositions[i].y,x2:b,y2:H.dotPositions[i].y,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"})]})]},i):null;var o}),(()=>{if(1===D.length){const t=D?.[0];return e("text",{x:v?b/2:b,y:M+15,textAnchor:v?"middle":"end",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=t[Z]?String(t[Z]):""},String(t[Z]))}if(D.length<7)return D.map(t=>e("text",{x:z(t[Z]),y:M+15,textAnchor:"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=t[Z]?String(t[Z]):""},String(t[Z])));{const t=(i-80-7*9.2)/6;return Array.from({length:7}).map((n,r)=>{const i=Math.floor(r*(D?.length-1)/6),o=D[i];return e("text",{x:r*t,y:M+15,fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=o?.[Z]?String(o?.[Z]):""},String(o?.[Z]))})}})(),(()=>{if("memory"===g){const t=Math.max(N,1024);return Array.from({length:6}).map((n,r)=>{const i=r*t/5,o=i/1024;return e("text",{x:-10,y:I(i),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:o.toFixed(1)},`y-${r}`)})}return Array.from({length:6}).map((t,n)=>{const r=n*N/5;return e("text",{x:-10,y:I(r),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:r.toFixed(0)},`y-${n}`)})})()]})}),L&&H.tooltip.visible&&n("div",{className:"ff-line-chart-tooltip",style:{left:w&&H.tooltip.left/2>i/1.75?H.tooltip.left-180:H.tooltip.left,top:H.tooltip.top},children:[e("div",{className:"ff-line-chart-date",children:H.currentXValue}),Object.entries(H.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))]})]})]})},cL=({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(U,{fontWeight:"semi-bold",lineHeight:"32px",className:"ff-download-client-header-text",children:"Download client"}),e(q,{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(U,{as:"div",color:"var(--download-client-content-text-color)",fontWeight:"semi-bold",textAlign:"center",lineHeight:"26px",children:a}),e(U,{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(q,{name:t,height:36,width:36})},t))})]})]})},dL=({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(U,{color:"var(--license_header_text_color)",fontSize:8,lineHeight:"12px",children:t})}),e("div",{className:"ff_children_container",children:o})]})}),uL=({onSelectVariable:t,dropdownPosition:n,filteredOptions:r=[],position:i="relative",width:o="100%",zIndex:s,truncateTextValue:c=34,highlightedIndex:d})=>{const u=a(null);return l(()=>{u.current?.scrollIntoView({block:"nearest"})},[d]),e("div",{className:I(`ff-variable-dropdown-container ${i}`),style:n?{top:n.top+30,left:n.left-30,width:o,zIndex:s}:{width:o,zIndex:s},children:K(r)?e("div",{className:"ff-variable-option no-data",children:e(U,{as:"div",children:"No Option",fontSize:14})}):r?.map((n,r)=>e("div",{className:I("ff-variable-option",{"ff-variable-option--highlighted":d===r}),onMouseDown:()=>t(n),ref:d===r?u:null,children:e(Y,{title:Hn(n?.name,c,"pixel")?n?.name:"",children:e(U,{children:xn(n?.name,c,"pixel")})})},n?.id))})},fL=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:A=!1,isOnlyHash:g=!1,dataFiles:v=[],showAddVariableIcon:y=!0,helperText:E="",error:b,autoComplete:M="off",required:L=!1,zIndex:x=9999,truncateTextValue:H=34,formProps:V={},getSelectedVariable:k=()=>{},symbol:S="$",type:Z="text",clearIcon:O=!0,inputTitle:z="",onBlur:N,helperTextWidth:T,iconProps:D={isShowIcon:!1,iconName:"",iconToolTipTitle:"",isIconDisable:!1,iconColor:"",onIconClick:()=>{}},...F},R)=>{const[P,B]=c(!1),[j,_]=c(!1),[W,X]=c(0),[Q,G]=c(!1),[J,$]=c(null),[ee,te]=c(0),[ne,re]=c(!1),[ie,oe]=c([]),ae=a(null),le=a(null),[se,ce]=c("auto"),de=D?.isShowIcon;l(()=>{const e=le.current?.querySelector(".ff-input-container");if(!e)return;const t=new ResizeObserver(e=>{for(let t of e){const e=`${t.contentRect.width}px`;ce(e)}});return t.observe(e),()=>{t.disconnect()}},[]),w(R,()=>ae.current),l(()=>{null!==J&&ae.current&&(ae.current.setSelectionRange(J,J),ae.current.focus())},[J]),l(()=>{A&&B(C.startsWith("#"));const e=v?.find(e=>e.name===C),t=o?.find(e=>e?.name===C);if(C.startsWith("#")&&A){const e=C.slice(1).toLowerCase(),t=v.filter(t=>t.name.toLowerCase().includes(e));oe(t),B(!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("#");g?re(!1):r||n||C.includes("$")||C.includes("#")?(re(!1),a&&re(!0)):i&&!C.includes("$")&&re(!0)},[C]);const ue=()=>{ae.current&&te(ae.current.selectionStart||0)},fe=ue,he=ue;l(()=>{ae.current&&te(ae.current.selectionStart||0)},[C]);const Ce=e=>{if(ae.current){const{selectionStart:t,selectionEnd:n}=ae.current,r=`${e.name}`;let o;if(o=A&&"#"===C[0]?e.name+C.slice(n||1):e.name,d){d({target:{value:o}},e),k(e.name)}ae.current.value=o,i?.(e),$((t||0)+r.length),B(!1),_(!0)}};const pe=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(S,t-1),l=e.indexOf(S,t);if(-1!==a&&(g&&"$"===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),j&&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,ee,o),me=()=>o?.filter(e=>e?.name?.toLowerCase()?.includes(pe?.searchString?.toLowerCase())),Ae=C.startsWith("#"),ge=Ae?ie:me();l(()=>{X(0)},[A,pe?.showDropdown]);const ve=Boolean(pe?.showDropdown&&Q),ye=Boolean(P&&A&&Q),we=Boolean((Ae?ye:ve)&&ge.length);return n("div",{className:"ff-add-variable-container",children:[n("div",{className:"ff-add-variable-input",ref:le,children:[e(Y,{title:z,style:{width:"100%"},children:e(Hi,{...F,name:"add_variable",ref:ae,type:Z,className:I("ff-variable-input-container",{"ff-variable-input-container--show-icon":de}),value:C,onKeyDown:e=>{switch(e.key){case"ArrowDown":if(!we)return;e.preventDefault(),e.stopPropagation(),X(e=>e<ge.length-1?e+1:e);break;case"ArrowUp":if(!we)return;e.preventDefault(),e.stopPropagation(),X(e=>e>0?e-1:0);break;case"Enter":{if(!we)return;e.preventDefault(),e.stopPropagation();const t=ge[W];t&&Ce(t);break}case"Escape":if(!we)return;e.preventDefault(),e.stopPropagation(),B(!1),G(!1),X(0)}},onChange:d,onPaste:()=>{re(!0)},variant:"primary",label:t,placeholder:s,onClick:fe,onKeyUp:he,onFocus:()=>G(!0),onBlur:e=>{(e=>{e.relatedTarget&&e.relatedTarget.closest(".dropdown-container")||G(!1)})(e),N?.(e)},autoComplete:M,helperText:E,error:b,required:L,helperTextWidth:T,...V})}),!K(C)&&ne&&y&&e("div",{className:"ff-create-variable-container",onClick:f,children:e(U,{fontWeight:"regular",fontSize:"10px",color:"var(--brand-color)",cursor:"pointer",children:"Create Variable"})}),!K(C)&&!g&&e("div",{className:I("ff-cancel-icon-container",{"ff-cancel-icon-container--show-icon":de}),children:O&&e(Y,{title:"Cancel",style:{zIndex:99999},children:e(q,{onClick:h,name:"close",height:16,width:16,hoverEffect:!0})})}),de&&e("div",{className:"ff-info-icon-container",children:e(Y,{title:de&&!D?.isIconDisable?D?.iconToolTipTitle:"",children:e(q,{name:D?.iconName||"",hoverEffect:!1,height:16,width:16,color:D?.iconColor||"var(--text-area-default-color)",onClick:e=>{D?.onIconClick&&D?.onIconClick(e)},disabled:D?.isIconDisable,cursorType:"pointer"})})})]}),pe?.showDropdown&&Q&&e(lL,{position:"absolute",zIndex:x,truncateTextValue:H,width:se,height:K(me())?"auto":m,optionsList:ge,onSelectVariable:Ce,highlightedIndex:W}),P&&A&&Q&&e(uL,{position:"relative",zIndex:x,truncateTextValue:H,width:se,filteredOptions:ge,onSelectVariable:Ce,highlightedIndex:W})]})}),hL=({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:A,dataFiles:g=[],truncateTextValue:v=34,isEnterKeySubmit:y=!1,showHideValueOption:w=!0})=>{const[E,b]=c(!1),[M,L]=c(""),[x,H]=c(),[V,k]=c(!1),[S,Z]=c(!1),[O,z]=c({name:"",value:"",isChecked:!1});l(()=>{t&&"edit"===m&&z({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":qn.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 I(e){const t=!!e,n=qn.test(e),r=$r.test(e),i=e.length>=3&&e.length<=25;return t&&n&&r&&i}l(()=>{const e=N(s);b(!!e),L(e)},[s]),l(()=>{if("edit"!==m)return;const{name:e,value:t,isChecked:n}=O;Z(s!==e||d!==t||h!==n)},[m,s,d,h,O]);const T=()=>{!V&&I(s)&&(k(!0),p())};l(()=>{if(!y)return;const e=e=>{if("Enter"===e.key){e.preventDefault();!I(s)||V||"edit"===m&&!S||T()}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[y,s,d,h,V,m,S,f]);return e(vn,{zIndex:1350,onClose:i,isOpen:t,title:"create"===m?"Create Variable":"Edit Variable",width:"284px",height:w?"280px":"250px",top:"30%",right:8,isFooterRequired:!0,overlay:!0,footerContent:e(()=>n("div",{className:"ff-create-slider-footer",children:[e(W,{onClick:i,label:"Cancel",variant:"tertiary"}),e(W,{variant:"primary",label:"create"===m?"Create":"Update",type:"submit",onClick:T,disabled:!I(s)||V||"edit"===m&&!S})]}),{}),children:n("div",{className:"ff-create-variable-slider",children:[e("div",{className:"ff-create-variable-slider-input",children:e(Hi,{label:"Variable Name",required:!0,type:"text",name:"variableName",value:s||"",onChange:e=>{k(!1),o(e.target.value)},error:E,helperText:M,onBlur:e=>{const t=e.target.value,n=N(t);b(!!n),L(n)}})}),e(Zo,{label:"Variable Type",required:!0,onChange:e=>{u(e),k(!1)},selectedOption:f,optionsList:r,optionZIndex:99999,valueAccessor:"label",disabled:"edit"===m}),e(fL,{label:"Variable Value",placeholder:"Enter Variable value or select path using #",isHash:!0,isOnlyHash:!0,zIndex:99999,truncateTextValue:v,dataFiles:g,dropdownWidth:"100%",setHashInputValue:H,hashInputValue:x||{},value:d||"",type:h?"password":"text",onChange:(e,t)=>{const n=e.target.value;a(n,t)},showAddVariableIcon:!1}),w&&n("div",{className:"ff-hide-value-content",children:[e(bn,{onChange:e=>C(e.target.checked),name:"hideValue",label:"Hide Value",checked:h,disabled:A}),e(Y,{title:"Once the value is hidden, it cannot be undone",children:e(q,{name:"info",width:12,height:12})})]})]})})},CL=e=>{if(null==e||""===e)return{};return{width:e,flex:`0 0 ${"number"==typeof e?`${e}px`:e}`}},pL=({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="number"==typeof r[0]?.width?Math.max(r[0]?.width-8,0):void 0,m=(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:"--"},A=t=>t.map((t,n)=>e("table",{className:"ff-table-accordion__table",cellSpacing:0,children:e("tbody",{className:"ff-table-accordion__tbody",children:e("tr",{className:"ff-table-accordion__body-row",children:r.map((n,r)=>e("td",{className:"ff-table-accordion__body-cell",style:CL(n.width),children:"column"===o&&0===r?"":e(U,{as:"div",className:"ff-table-accordion__cell-typography",children:n.cell?m(t,n):e(Xs,{placement:"bottom",children:m(t,n)})})},n.accessor+r))},t.id||n)})},`accordion-table-${n}`));return n("div",{style:{height:l},className:I("ff-table-accordion",{"ff-table-accordion--fixed-header":s}),children:[e("table",{cellSpacing:0,className:I("ff-table-accordion__table",{"ff-table-accordion__table--fixed-header":s}),children:e("thead",{children:e("tr",{className:"ff-table-accordion__header-row",children:r.map(t=>e("th",{style:CL(t.width),className:I("ff-table-accordion__header-cell",d&&`ff-table-accordion__header-cell--${d}`),children:e("div",{children:e(U,{fontWeight:"semi-bold",fontSize:12,children:t.header})})},`header-${t.header}`))})})}),"row"===o&&i.map((n,r)=>e(wn,{highlightText:t,headerTitle:"string"==typeof n.title?e("div",{style:{maxWidth:void 0!==p?`${p}px`:"100%"},children:e(Xs,{children:e(yn,{text:n.title,highlight:t})})}):e(Xs,{children:"row.title"}),color:"var(--text-color)",accordionContent:A(n.data),disable:n.disable,disableInfoMessage:n.disableInfoMessage,accordionStateIconName:"arrows_down_icon",AccordionStateIconWidth:u,AccordionStateIconHeight:f,className:"ff-table-accordion__row-accordion"},`accordion-row-${r}`)),"column"===o&&i.map((i,o)=>n("div",{className:"ff-table-accordion__column-group",children:[e("div",{className:"ff-display-flex",children:n("div",{className:`ff-table-accordion__column-header ${i.disable&&"ff-table-accordion__column-header--disabled"}`,style:r[0]?CL(r[0].width):{},children:[e("div",{className:"ff-table-accordion__column-label",children:e(U,{as:"div",children:e(Xs,{children:e(yn,{text:"string"==typeof i.title?i.title:"",highlight:t})})})}),e("div",{className:"ff-table-accordion__column-toggle",onClick:()=>{!i.disable&&(e=>{C(e===h?-1:e)})(o)},children:e(q,{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:A(i.data)})]},`column-accordion-${o}`)),K(i)&&e("div",{className:"ff-table-accordion__empty-state",style:{height:`calc(${l} - 50px)`},children:a})]})},mL=({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,A=s;if(void 0!==r&&void 0!==i){const e=p(i),t=p(r);t>0?(m=e/t*100,A=s||i):(m=0,A="0MB")}else m=t||0;const g=Math.max(0,Math.min(m,100));return n("div",{className:"ff-progress-bar-container "+(A?"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:`${g}%`,backgroundColor:o,height:`${l}px`},children:u&&e(U,{className:"ff-progress-bar-percentage",fontSize:f,color:h,children:`${Math.round(g)}%`})})}),A&&e("div",{className:"ff-progress-bar-label",children:e(U,{fontSize:c,color:d,children:e(Y,{title:Hn(A,10,"count")?A:"",children:xn(A,10,"count")})})})]})},AL=({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:A,isMandatory:g=!1})=>{const v=a(null),[y,w]=c(0);u(()=>{v.current&&w(v.current.getBoundingClientRect().width-10)},[C]);const E=m?.name||i,b=y?xn(E,y,"pixel"):E,M=!!y&&Hn(E,y,"pixel");return e("div",{ref:v,style:{width:C},children:e(Y,{title:M?E:"",children:e(W,{variant:t,label:b,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:A,isMandatory:g})})})},gL=({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(Y,{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(q,{name:o?"automation_testcase":"add_testcase",color:"Automation"===t?"var(--primary-button-text-color)":"var(--description-text)"})})}),e(Y,{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(q,{name:a?"manual_testcase":"add_testcase",color:"Manual"===t?"var(--primary-button-text-color)":"var(--description-text)"})})})]})},vL=({selected:t,handleClick:n,tabList:r})=>e("div",{className:"ff-switch-container",children:r.map(r=>e(Y,{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(q,{name:r.icon,color:t===r.name?"var(--primary-button-text-color)":"var(--description-text)"})})},r.name))}),yL=({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:A="video_preview",isDisabled:g=!1})=>{const[v,y]=c(!1),w=i.useRef(null),E=()=>{y(!0),h&&h(d)},b=()=>{t?.(),y(!1)},M=()=>{C&&C(d)};return l(()=>{m&&y(!0)},[m]),n("div",{children:[!m&&(p?e(q,{name:A,hoverEffect:!0,onClick:E,disabled:g}):e(vw,{mediaSrc:r,mediaType:s,onDownloadClick:M,onDeleteClick:()=>a?.(r),onExpandClick:E,fileName:o,fileId:d,thumbnailMediaSrc:u,isDelete:f})),v&&e(Sp,{isOpen:v,onClose:b,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(Y,{title:"Download File",children:e(q,{name:"download_file_icon",onClick:M,color:"var(--icons-default-color)",className:"header-icons"})}),e(Y,{title:"Expand",children:e(q,{name:"expand",onClick:E,color:"var(--icons-default-color)",className:"header-icons"})}),e(Y,{title:"close",children:e(q,{name:"close",onClick:b,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:w,onCanPlay:()=>{if(w.current){const e=w.current.play();void 0!==e&&e.catch(e=>{console.error("Autoplay failed:",e)})}}})]})})]})},wL=({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,A=s&&"left"===u;return n("div",{className:["ff-mobileskin-wrapper",f?"portrait":"landscape",A?"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(Y,{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(q,{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(Y,{title:r,children:e(q,{...i})})},n)})}),s&&A&&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(Y,{title:r,placement:"bottom",children:e(q,{...i})})},n)})})]})},EL=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:A,onFocus:g,disableInput:v,isAdditionalIcon:y=!1,additionalIconName:w,additionIconToolTip:E,onAdditionalIconClick:b},M)=>{const L=a(null);Zn([{key:"Enter",action:()=>x()}],L);const x=e=>{f&&p?.(f.trim())};return n("div",{className:I("ff-prompt-container",{"icon-left":"left"===c,"icon-right":"left"!==c}),style:{width:`${t}px`,height:`${r}px`,borderRadius:d},ref:L,children:[e(Y,{placement:"top",title:C,children:e(q,{name:s,className:"ff-prompt-icon",height:i,width:o,onClick:p,color:h,disabled:K(f)})}),e("input",{ref:M,className:"ff-prompt-input",type:"text",placeholder:l,autoFocus:u,onChange:m,onFocus:g,onBlur:A,value:f,readOnly:v}),y&&w&&e(Y,{placement:"top",title:E,children:e(q,{name:w,className:"ff-prompt-icon additional-icon",height:i,width:o,onClick:b})})]})}),bL=({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:I("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:I("content",`arrow-${a}`),children:e(U,{children:t})})}),ML=({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:A,modalHeight:g,headerContent:v="Header Content",footerContent:y="Footer Content",iconWidth:w,iconHeight:E,modalHeading:b="Ask Fia",children:M,onClearChat:x})=>{const[H,V]=c(!1),[k,S]=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(q,{className:"ff-dynamic-icon",name:r,onClick:()=>{S(e=>!e),setTimeout(()=>V(e=>!e),10)},height:E,width:w}),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(q,{name:"ask_fia_icon",height:32,width:82})})]}),k&&L(e("div",{className:I("ff-dynamic-modal",{open:H}),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:g,width:A},children:n("div",{className:"ff-dynamic-modal-content",children:[v&&e("div",{className:"ff-dynamic-modal-header",children:n("div",{className:"header-container",children:[n("div",{className:"header-left",children:[e(q,{height:16,width:16,name:"fia_icon"}),e(U,{fontWeight:"medium",children:b})]}),n("div",{className:"header-right",children:[e("span",{className:"action",children:e(Y,{title:"Clear chat",placement:"bottom",children:e(q,{height:16,width:16,name:"delete",color:"var(--tooltip-text-color)",onClick:x})})}),e("span",{className:"action",children:e(Y,{title:"Close",placement:"bottom",children:e(q,{height:16,width:16,name:"close",color:"var(--tooltip-text-color)",onClick:()=>(V(!1),void setTimeout(()=>S(!1),300))})})})]})]})}),e("div",{className:"ff-dynamic-modal-body",children:M}),y&&e("div",{className:"ff-dynamic-modal-footer",children:y})]})}),document.body)]})},LL=o(({iconName:r,hoverTitle:i,iconPosition:{top:o,left:a,bottom:l,right:s},hoverIconPosition:{top:c,left:d,bottom:u,right:f},modalPosition:{top:h,left:C,bottom:p,right:m},modalWidth:A,modalHeight:g,headerContent:v="Header Content",footerContent:y="Footer Content",iconWidth:E,iconHeight:b,children:M,isVisible:x,isOpen:H,onOpen:V,onClose:k,isIconVisible:S},Z)=>(w(Z,()=>({closeModal:k})),n(t,{children:[S&&n("div",{style:{top:void 0!==o?`${o}px`:void 0,left:void 0!==a?`${a}px`:void 0,bottom:void 0!==l?`${l}px`:void 0,right:void 0!==s?`${s}px`:void 0},className:"ff-ai-dynamic-icon-container",children:[e(q,{className:"ff-ai-dynamic-icon",name:r,onClick:V,height:b,width:E}),e("div",{style:{top:void 0!==c?`${c}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-ai-chat-icon-hover",children:e("div",{className:"ai-hover-leaf",children:e(U,{fontWeight:"bold",fontSize:14,color:"var(--chatbot-leaf-text)",children:i})})})]}),x&&L(e("div",{className:I("ff-ai-dynamic-modal",{open:H}),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:g,width:A},children:n("div",{className:"ff-ai-dynamic-modal-content",children:[v&&e("div",{className:"ff-ai-dynamic-modal-header",children:v}),e("div",{className:"ff-ai-dynamic-modal-body",children:M}),y&&e("div",{className:"ff-ai-dynamic-modal-footer",children:y})]})}),document.body)]}))),xL=({variant:t,title:r,tabTitle:i,comment:o,profileShortName:a})=>n("div",{className:"ff-history-card",children:[e("div",{className:I("header",`header--${t}`),children:e(U,{fontWeight:"semi-bold",children:i})}),n("div",{className:"body",children:[e("div",{className:"title",children:n("div",{className:"profile",children:[e(U,{className:I("avatar",`avatar--${t}`),children:a}),e(U,{children:r})]})}),n("div",{className:"comment-container",children:[e(U,{fontWeight:"semi-bold",className:"heading",children:"Comments:"}),e(U,{color:"var(--details-page-value-color)",className:"comment",children:o})]})]})]}),HL=({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:I("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(U,{className:I("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"})]})})})]}),VL=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,...A},g)=>{if(!_[t])return null;const v=a(null);l(()=>{v.current&&(void 0!==C&&v.current.setAttribute("x",String(C)),void 0!==p&&v.current.setAttribute("y",String(p)))},[C,p]);const y={ref:g,onClick:u?void 0:o,style:{height:`${n}px`,width:`${r}px`,cursor:u?"not-allowed":"pointer",opacity:u?.3:1},tabIndex:m,...A};return e("span",{...y,children:e("img",{height:n,width:r,src:i,alt:""})})}),kL=({id:r=0,serialNumber:i,activeId:o,setActiveId:s,children:d,onIconClick:u,numberChildren:f,onContainerClick:h,onNextClick:C,onPreviousClick:p,disabled:m,isEditAccess:A,versionsLength:g,count:v,hiddenActions:y=[]})=>{const[w,E]=c(!1),[b,M]=c(!1),L=a(null),x=Array.isArray(y)?y:y?[y]:[],H=(e,t)=>{e.stopPropagation(),t()};l(()=>{L.current&&(()=>{if(L.current){const e=getComputedStyle(L.current),t=1.2*parseFloat(e.fontSize)*6;L.current.scrollHeight>t&&M(!0)}})()},[]);const V=e=>{e.stopPropagation(),E(!w)};return n("div",{className:`ff-prompt-container-Block ${o===r?"active":"inactive"} `,onClick:()=>{s(r),h()},children:[e(U,{fontSize:8,className:"ff-prompt-number-bg-color",as:"span",children:`Test cases ${i}`}),n(t,{children:[n("div",{className:"ff-prompt-content "+(w?"expanded":""),ref:L,children:[d,w&&n(t,{children:[e("span",{role:"button","aria-label":"toggleExpand",onClick:V,className:"read-less-btn",children:e(U,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read Less"})})," "]})]}),b&&!w&&e("div",{role:"button","aria-label":"toggleExpand",onClick:V,className:"read-more-btn",children:e(U,{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=>!x.includes(e.action)).map((t,n)=>{const r=A&&"delete"===t?.action||"regenerate"===t?.action&&(g??0)>=3||m;return e(Y,{title:t.title,placement:"bottom",children:e(q,{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(q,{disabled:1===v,className:"ff-prompt-icons-style",name:"arrow_left_accordian",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>H(e,p),cursorType:"pointer"}),f,e(q,{disabled:v===g,className:"ff-prompt-icons-style",name:"arrow_right_icon",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>H(e,C),cursorType:"pointer"})]})]})]})},SL=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:A,autoComplete:g="off",autoFocus:v=!1,minValue:y=-1/0,maxValue:w=1/0,transparentBackground:E=!1,size:b="small",isLabelRequired:M=!0,onClick:L,onKeyUp:x,isViewMode:H=!1,...V},k)=>{const S=!K(d);return n("fieldset",{className:I("ff-link-input-fieldset",{"ff-link-input-fieldset--disabled":a}),children:[n("div",{className:I("ff-link-input-container",{"ff-link-input-container--float":S,"ff-link-input-container--disabled":!!a}),children:[M&&n("label",{className:I(`ff-link-input-label-container ff-link-input-label-container--${b}`,{"ff-link-input-label-container--danger":!!u}),htmlFor:i,children:[s&&e("span",{className:"required-asterisk",children:"*"}),e("span",{className:I(`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:k,name:i,value:d,type:t,spellCheck:!1,id:i,className:I(`ff-link-input ff-link-input-${r} default-input ff-link-input--${b}`,{"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":!M},`${C}`),placeholder:c,disabled:H||a,onChange:p,onFocus:A,onBlur:m,autoComplete:g,autoFocus:v,min:y,max:w,onClick:L,onKeyUp:x,...V}),e("div",{className:"input-link-icon",children:l||u||!S?e(q,{name:"link",disabled:!0}):e(Y,{title:"Click here to navigate",children:e("span",{children:e(q,{name:"link",disabled:!1,onClick:()=>{d&&!u&&window.open(d,"_blank")}})})})})]}),f&&u&&e("span",{className:I("ff-link-input-message",{"ff-link-input-message--danger":!!u}),children:f})]})}),ZL=({labelsList:r=[],height:i=""})=>{const o=mi(),a=e("div",{className:"ff-chip-tooltip",children:r.filter((e,t)=>t>0).map((t,n)=>e(U,{as:"div",className:"ff-chip-tooltip-label",children:t},`label-${n}-${t}`))});return e(t,{children:!K(r)&&n("div",{className:"ff-chip-with-count-container",children:[e(U,{as:"div",fontWeight:"medium",className:"ff-chip-label",style:i?{height:i}:void 0,children:e(Xs,{children:r[0]||""})}),r.length>1&&n(t,{children:[n(U,{as:"div",className:"ff-chip-count","data-tooltip-id":`tooltip-${o}`,fontWeight:"medium",children:["+",r.length-1]}),e("div",{id:`tooltip-${o}`,className:"ff-chip-tooltip-template",children:e(U,{as:"div",children:a})})]})]})})};class OL 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 zL=({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:[!K(t)&&e("div",{className:"icon-container",children:e(q,{name:t,width:s,height:c})}),n("div",{className:"typography-label-button",children:[n(U,{fontSize:"12px",fontWeight:"regular",lineHeight:"18px",children:[d+l," :"]}),e(U,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:"Click"}),e(kp,{label:i,onClick:r,iconName:"plus_user_icon",isDisable:a}),e(U,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:o})]})]}),NL=({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:I(`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(q,{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:I(`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(Y,{title:r.label.length>9?r.label:"",children:e(U,{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:I("ff-tab-label",{"ff-tab-label--active":i===r.id})})}),"default"===t&&r.count&&e("span",{className:I("tab-count",{"tab-count--active":i===r.id}),children:r.count})]}),e("div",{className:I("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(q,{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})]})},IL=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(q,{name:"danger"===a?"close":r,color:d[a]||d.default,className:`ff-status-indicator__icon ff-status-indicator__icon--${a}`}),e(U,{as:"div",fontSize:12,className:`ff-status-indicator__label ff-status-indicator__label--${a}`,fontWeight:"medium",lineHeight:"20px",children:t})]})})}),TL=({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))})]})},DL=({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(Sp,{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(U,{fontSize:24,lineHeight:"36px",fontWeight:"semi-bold",children:"OTP Verification"}),e(q,{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(W,{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)`:""]})]})})},FL=({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:A=!0,width:g="800px",height:v="432px",showControls:y=!0,customStyle:w,overlay:E=!0,children:b,showControlDownload:M=!1,showControlExpand:L=!1,isFullscreen:x=!1})=>{const H=a(null),V=a(null),[k,S]=c(0),[Z,O]=c(0),[z,N]=c(!1),[I,T]=c(0);l(()=>{"video"===s&&H.current&&!b&&(i?H.current.play():H.current.pause())},[i,s,b]);const D=C(()=>{if(H.current&&!z){const e=H.current.currentTime/H.current.duration*100;T(e||0),S(H.current.currentTime)}},[z]),F=C(()=>{H.current&&O(H.current.duration)},[]),R=C(()=>{S(0),T(0),o?.()},[o]),P=C(e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`,[]),B=C(e=>{if(H.current){const t=e/100*H.current.duration;H.current.currentTime=t,T(e),S(t)}},[]),j=C(e=>{if(z||!V.current)return;const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B,z]),_=C(e=>{if(!V.current)return;N(!0);const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B]),W=C(e=>{if(!z||!V.current||!H.current)return;const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[z,B]),X=C(()=>{N(!1)},[]);return l(()=>{if(z)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",X),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",X)}},[z,W,X]),t?e(iu,{isOpen:t,onClose:r,isMaximized:!1,showHeader:p,overlay:E,downloadHandler:()=>{},customStyle:w,header:n("div",{className:"ff-header-content",children:[e(q,{width:23,height:23,name:"automatic_locator"}),e(U,{children:e("span",{className:"ff-header-title",children:u})})]}),icons:e(Y,{title:"Close",children:e(q,{name:"close",onClick:r})}),width:g,height:v,zIndex:999,children:n("div",{className:"ff-video-wrapper",children:[b||("video"===s?e("video",{ref:H,src:d,className:"ff-media-video",onTimeUpdate:D,onLoadedMetadata:F,onEnded:R}):e("img",{src:d,alt:"Preview",className:"ff-media-image"})),n("div",{className:"ff-top-right-icons",children:[m&&e(Y,{title:"Download",children:e(q,{name:"download_file",color:"white",onClick:f})}),A&&e(Y,{title:x?"Minimize":"Maximize",children:e(q,{name:x?"collapse_icon":"expand_icon",color:"white",onClick:h})})]}),"video"===s&&y&&!b&&n("div",{className:"ff-media-controls",children:[e("button",{onClick:o,className:"ff-play-pause-btn",children:e(Y,{title:i?"Pause":"Play",children:e(q,{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:P(k)}),e("input",{type:"range",className:"ff-seek-bar",min:0,max:100,value:I,onChange:e=>B(parseFloat(e.target.value)),onClick:j,onMouseDown:_,ref:V}),e("span",{className:"ff-total-time",children:P(Z)})]}),n("div",{className:"ff-control-icons",children:[M&&e(Y,{title:"Download",children:e(q,{name:"download_file",color:"white",onClick:f,cursorType:"pointer"})}),L&&e(Y,{title:x?"Minimize":"Maximize",children:e(q,{name:x?"collapse_icon":"expand_icon",color:"white",onClick:h,cursorType:"pointer"})})]})]})]})}):null},RL=({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:A="top-left"})=>{const g=i&&"secondary"===d?s:l,v=a&&parseInt(a)>0,y=o&&parseInt(o)>0,w=i&&(y||v),{tooltip:E="Download",iconName:b="download_file",disabled:M=!1,onClick:L,className:x=""}=p?.download||{},{tooltip:H="Delete",iconName:V="delete_icon",disabled:k=!1,onClick:S,className:Z=""}=p?.delete||{},O=()=>n("div",{className:"ff-dropdown-header-icons",children:[p?.download&&e(Y,{title:E,children:e(q,{name:b||"",className:`ff-dropdown-icon ff-download-icon ${x}`,onClick:L,width:18,height:20,disabled:M,hoverEffect:!0})}),p?.delete&&e(Y,{title:H,children:e(q,{name:V||"",className:`ff-dropdown-icon ff-delete-icon ${Z}`,onClick:S,width:25,height:25,disabled:k,hoverEffect:!0})})]});return n("div",{className:"ff-resolution-dropdown",style:c?{minWidth:c}:{},children:[e("div",{className:"ff-dropdown-notch "+("bottom-center"===A?"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(Au,{tabsData:m,activeTabId:u,onTabClick:e=>{C&&C(e),"tab-1"===e&&f?f():"tab-2"===e&&h&&h()}}),w&&O()]}):i&&w?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(U,{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(U,{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(U,{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(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]})]}):e(U,{fontSize:16,fontWeight:"semi-bold",children:r})})}),e("ul",{className:"ff-dropdown-list",children:g?.map((t,n)=>e("li",{className:"ff-dropdown-item",children:t},n))})]})},PL=(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:"--"},BL=(t,n=[],r,i,o)=>{let a=n;const l=void 0!==i?!i:r;return K(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))})},jL=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:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:E})=>{const b={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:b,children:[i.isTree&&BL(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?uu:T,{})]})}),n("span",{className:"tree-table-fn-td-content "+(i.isTree&&l.container?"folder":""),children:[!l?.isNewNode&&n(t,{children:[i.isTree&&"checkbox"===c&&!(A&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:"none"===l.selectedStatus?e(Y,{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(bn,{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(bn,{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&&!(A&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:e(uc,{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})})]}),e("div",{className:"tree-table-cell-flex",children:l.isNewNode&&i.isTree?e(du,{onCancel:h,onConfirm:f,value:l.value,label:l?.label,optionsList:l.options,selectedOption:l.selectedOption,withDropdown:"inputWithDropdown"===l.type,handleCustomError:C,inputFieldWidth:g,selectFieldWidth:v,confirmIconTooltip:l.confirmIconTooltip,cancelIconTooltip:l.cancelIconTooltip,isEditable:w,setIsEditable:E,isOnBlurTrue:!1,isDisable:{confirm:y},isTableTree:!0}):n(t,{children:[e("span",{className:"tree-table-fn-td-content-text",children:PL(l,i)}),i.actions&&!l?.isNewNode&&e("div",{className:"table-tree-fn-row-action",children:i.actions(l,r)})]})})]})]})]})});jL.displayName="TableCell";const _L=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,addModuleInputWidth:A,addModuleSelectWidth:g,disableEditLabelConfirmIcon:v,isEditable:y,setIsEditable:w,style:E})=>{const b=a(null);return e("div",{"data-level":t.hierarchy,ref:b,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:E,children:n.map((n,a)=>e(jL,{treeRowRef:b,col:n,colIndex:a,node:t,selected:i,select:o,onCheckBoxChange:c,onToggleExpand:s,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,hideOnDisable:m,addModuleInputWidth:A,addModuleSelectWidth:g,disableEditLabelConfirmIcon:v,isEditable:y,setIsEditable:w,columnMeta:r?.[a]},n.name))})});_L.displayName="TableRow";const qL=({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:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:E})=>e("div",{className:"ff-table-tree-fn-body",style:{height:`${a}px`,position:"relative"},children:t?.map((t,a)=>e(_L,{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:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:E,style:{transform:`translateY(${(o+a)*i}px)`,height:`${i}px`,position:"absolute",top:0,left:0,right:0}},t.key))}),UL=i.memo(({columnsData:t,columnMeta:r,totalWidth:i,rootNode:o,selected:s,onCheckBoxChange:d,selectedNode:u,tableHeaderBgColor:f,hideOnDisable:h,transparentHeader:C,showHeader:p=!0,showRootNodeColumnActions:m})=>{const A=a(null),[g,v]=c(!1);l(()=>{v(!0)},[]);const y=(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:[p&&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:{...y(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:A,children:t.map((t,i)=>e("div",{className:"ff-table-tree-fn-td "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:y(i,t.width),children:n("span",{className:"tree-table-fn-default-content "+(0===i?"ff-table-root-index-0":""),children:[0===i&&"checkbox"===o.select&&!(h&&o.node.isDisabled)&&e(bn,{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(uc,{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("div",{className:"tree-table-cell-flex",children:[e(Xs,{children:"name"===t.accessor?o.node[t.accessor]:PL(o.node,t)}),o.cell&&0===i&&e("span",{className:"table-tree--fn-root-cell",children:o.cell(o.node)}),o.actions&&0===i&&g&&A.current&&e("div",{className:"table-tree-fn-row-action",children:o.actions(o.node,A)}),m&&t.actions&&"name"!==t.accessor&&e("div",{className:"table-tree-fn-row-action",children:t.actions(o.node,A)})]})]})},i))})]})});UL.displayName="TableHead";const WL=32,XL="__root__",QL=(e,t)=>{if(!e?.length)return[];const n=new Map,r=new Map,i=new Map,o=new Map;t&&t.key&&n.set(String(t.key),t),e.forEach(e=>{n.set(String(e.key),e);const t=e.parentId?String(e.parentId):XL;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(String(e.key),t)})});const a=e=>{const t=e.parentId?String(e.parentId):XL,a=r.get(t);if(!a||0===a.length)return!1;if((i.get(String(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(String(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,i=r?t.parentSiblings:(e=>{const t=[];let r=e;for(;r&&(r.parentId&&t.unshift(a(r)),r.parentId);)r=n.get(String(r.parentId));return t})(e),o=r?t.hierarchy:i.length;return{...e,lastChild:!a(e),parentSiblings:i,hierarchy:o,selectedStatus:l(e)}})},GL=o(({treeData:t,columnsData:r,selected:i=[],select:o=null,onChange:s=()=>{},onClick:d=()=>{},onExpand:f=()=>{},loadMore:p=()=>{},tableBorder:m,height:A="calc(100vh - 134px)",newNode:g,onAddConfirm:v=()=>{},onAddCancel:y=()=>{},handleEditFieldError:w,loading:E=!1,rootNode:b,pagination:M=!0,selectedNode:L,tableHeaderBgColor:x="var(--border-color-as-bg)",hideOnDisable:H=!1,freezeColumns:V,addModuleInputWidth:k=150,addModuleSelectWidth:S,onScroll:Z,onScrollEnd:O,disableEditLabelConfirmIcon:z=!1,transparentHeader:N=!1,navigateTreeNode:I=null,handleRemoveNavigateTreeNode:T=()=>{},scrollThreshold:D=128,showHeader:F=!0,resetScroll:R=!1,setResetScroll:P=()=>{},showRootNodeColumnActions:B=!1},j)=>{const[_,q]=c(null),[U,W]=c(null),[X,Q]=c({start:0,end:20}),[G,Y]=c(!1),J=a(null),$=a(null),ee=a(0),te=a(E),ne=a(null),re=a(null),ie=a({lastScrollTop:0}),oe=a([]),ae=a(0),le=a(null),se=a(null),ce=a(null),de=a({key:null,attempts:0}),ue=a(null),fe=(e,t)=>{const n=String(e??t);return n.endsWith("%")?{value:parseFloat(n),unit:"%"}:{value:parseFloat(n)||0,unit:"px"}},he=h(()=>{let e=0,t=0;return r.map((n,r)=>{const{value:i,unit:o}=fe(n.width,400),a=!!V&&r<V,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+(V??0)-r:1}})},[r,V]),Ce=h(()=>{let e=0,t=0;return r.forEach(n=>{const{value:r,unit:i}=fe(n.width,400);"%"===i?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[r]),pe=h(()=>{if(!V)return"0px";let e=0,t=0;return he.slice(0,V).forEach(n=>{const r=parseFloat(n.width)||0;n.width.endsWith("%")?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[he,V]),me=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})),A=d?{label:d,value:d}:void 0,g=new Map;e.forEach(e=>g.set(e.key,e)),n&&g.set(n.key,n);const v=g.get(r);let y;h&&(y=g.get(h));let w=v??("addInside"===i?y:void 0);!w&&"addInside"===i&&C&&(w=g.get(C));const E="addInside"===i&&!w&&e.length>=0;if(!w&&!E)return e;const b=[...e],M=w?e.findIndex(e=>e.key===w.key):-1;let L=null,x=0,H=M+1;switch(i){case"addAbove":{const t=w;if(!t)return e;L=t.parentId,x=t.hierarchy;break}case"addBelow":{const t=w;if(!t)return e;L=y?.parentId??t.parentId,x=y?.hierarchy??t.hierarchy;break}case"addInside":{if(E){L=C??h??r??null,x=p??1,H=b.length;break}const t=y??w;if(!t)return e;L=t.key,x=(t.hierarchy??0)+1;const n=b.findIndex(e=>e.key===r);-1!==n&&(H=n+1);break}}const V={hierarchy:x,parentId:L,sourceId:w?.key??r??h??"new-node",isNewNode:!0,key:"new-node",value:o,error:a,label:l,type:s,options:m,selectedOption:A,confirmIconTooltip:u,cancelIconTooltip:f};switch(i){case"addAbove":b.splice(M,0,V);break;case"addBelow":b.splice(M+1,0,V);break;case"addInside":b.splice(Math.max(0,H),0,V)}return b})(t,g,b?.node),[t,g,b]),Ae=h(()=>QL(me,b?.node),[me,b?.node]),ge=h(()=>Ae.filter(e=>!e.hide),[Ae]),ve=h(()=>{const e=new Map;return Ae.forEach(t=>e.set(t.key,t)),e},[Ae]),ye=h(()=>{const e=new Map;return ge.forEach((t,n)=>e.set(t.key,n)),e},[ge]),we=C(e=>{q(t=>t?e&&t!==e?t:null:t),e&&se.current?.key!==e||(se.current=null),ce.current&&(clearTimeout(ce.current),ce.current=null)},[]);l(()=>{te.current=E},[E]),l(()=>{ne.current=U},[U]);const Ee=C(e=>{ne.current=e,W(e)},[]),be=C(()=>{const e=J.current;if(!e)return;const t=ee.current||0,n=Math.max(0,e.scrollTop-t),r=e.clientHeight-t;let i=Math.floor(n/WL)-6,o=Math.ceil((n+r)/WL)+6;i=Math.max(0,i),o=Math.min(ge.length,o),Q(e=>e.start===i&&e.end===o?e:{start:i,end:o})},[ge.length]),Me=C(()=>{null===re.current&&(re.current=requestAnimationFrame(()=>{re.current=null,be()}))},[be]),Le=C(()=>{const e=J.current;if(!e)return;const n=e.scrollTop,r=n>ie.current.lastScrollTop?"down":"up";if(ie.current.lastScrollTop=n,Me(),Z?.(),le.current?.(),!M||E||ne.current||K(t))return;const i=e.scrollHeight,o=e.clientHeight;"down"===r&&i-(n+o)<D&&!t[t.length-1]?.lastResource&&(Ee("below"),p("below"))},[t,M,E,U,D,Me,Z,p,Ee]);l(()=>{if(E||!M||K(t))return;const e=t[0],n=!e?.lastResource,{totalSubContainerCount:r=0,totalResourceCount:i=0}=b?.node||{},o=r+i,a=ge.length<10&&ge.length<o;n&&a&&(Ee("above"),p("above"))},[E,M,t,ge.length,b,p,Ee]),u(()=>{const e=oe.current,t=ge,n=J.current;if(R&&n)return n.scrollTop=0,ie.current.lastScrollTop=0,void P(!1);if(n&&e.length>0&&t.length>0&&!E){const r=ie.current.lastScrollTop,i=Math.max(0,Math.floor(r/WL));let o=-1,a=-1;for(let t=i;t<e.length;t++){const n=e[t]?.key,r=ye.get(n??"");if(void 0!==r){o=t,a=r;break}}if(-1===o)for(let t=i-1;t>=0;t--){const n=e[t]?.key,r=ye.get(n??"");if(void 0!==r){o=t,a=r;break}}if(-1!==o&&-1!==a){const e=a-o,t=Math.max(0,r+e*WL);n.scrollTop!==t&&(n.scrollTop=t,ie.current.lastScrollTop=n.scrollTop,be())}else if("above"===U)0!==n.scrollTop&&(n.scrollTop=0,ie.current.lastScrollTop=0,be());else{const e=ee.current||0,r=Math.max(0,t.length*WL-(n.clientHeight-e));n.scrollTop>r&&(n.scrollTop=r,ie.current.lastScrollTop=r,be())}U&&Ee(null)}oe.current=t},[E,U,ye,ge,Ee,be,R,P]),l(()=>{const e=J.current;if(!e)return;const n=n=>{n.deltaY>=0||!M||K(t)||te.current||ne.current||e.scrollTop>1||t[0]?.lastResource||(Ee("above"),p("above"))};return e.addEventListener("wheel",n,{passive:!0}),()=>{e.removeEventListener("wheel",n)}},[M,t,p,Ee]),l(()=>{const e=J.current;if(e)return le.current=O?Ys(()=>{O?.()},150):null,e.addEventListener("scroll",Le,{passive:!0}),()=>{e.removeEventListener("scroll",Le),le.current?.cancel()}},[Le,O]),l(()=>{const e=J.current;if(!e)return;const t=e=>{Date.now()<ae.current&&e.stopImmediatePropagation()};return e.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{e.removeEventListener("scroll",t,!0)}},[]),l(()=>{const e=$.current;if(!e)return;const t=new ResizeObserver(()=>{ee.current=e.getBoundingClientRect().height,be()});return t.observe(e),()=>t.disconnect()},[be]),u(()=>{if(!g||!J.current)return;const e=J.current,t=ye.get("new-node");if(void 0===t)return;const n=ee.current||0,r=e.clientHeight-n;if(r<=0)return;const i=t*WL,o=i+WL,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&&(ae.current=Date.now()+300,e.scrollTop=l+n,ie.current.lastScrollTop=e.scrollTop,be());const s=requestAnimationFrame(()=>{Y(!0)});return()=>cancelAnimationFrame(s)},[g,ye,be]),l(()=>{g||Y(!1)},[g]),u(()=>{if(!_||E)return;const e=se.current;if(!e||e.key!==_){const e=requestAnimationFrame(()=>{we(_)});return()=>cancelAnimationFrame(e)}const t=ve.get(e.key);if(!t){const t=requestAnimationFrame(()=>{we(e.key)});return()=>cancelAnimationFrame(t)}if(Boolean(t.expanded)!==e.expanded)return;const n=requestAnimationFrame(()=>{we(e.key)});return()=>cancelAnimationFrame(n)},[ve,_,E,we]),l(()=>{de.current.key!==I&&(de.current={key:I,attempts:0}),!I&&ue.current&&(clearTimeout(ue.current),ue.current=null)},[I]),u(()=>{if(!I||g)return;const e=J.current;if(!e)return;const n=ye.get(I);if(void 0!==n){de.current={key:I,attempts:0};const t=ee.current||0,r=Math.max(WL,e.clientHeight-t),i=n*WL+16,o=Math.max(0,i-r/2)+t;return ae.current=Date.now()+400,e.scrollTo({top:o,behavior:"smooth"}),Me(),ue.current&&clearTimeout(ue.current),void(ue.current=setTimeout(()=>{T?.()},350))}if(E||U)return;const r=de.current;if(r.key!==I&&(r.key=I,r.attempts=0),r.attempts+=1,!(r.attempts>30))return M&&!0!==t[0]?.lastResource?(Ee("above"),void p("above")):void(r.attempts>2&&T?.());T?.()},[I,g,ye,E,U,M,t,p,Me,T,Ee]);const xe=C(e=>{if(_)return;const t=!e?.expanded;q(e.key),se.current={key:e.key,expanded:t},ce.current&&clearTimeout(ce.current);const n=Date.now(),r=()=>{if(se.current?.key!==e.key)return;const t=te.current,i=Date.now()-n>=2e3;!t||i?we(e.key):ce.current=setTimeout(r,1e3)};ce.current=setTimeout(r,1e3),f?.(e)},[_,f,we]),He=C((e,t)=>{_||s?.(e,t)},[s,_]),Ve=C((e,t)=>{_||d?.(e,t)},[d,_]);l(()=>()=>{null!==re.current&&(cancelAnimationFrame(re.current),re.current=null),ce.current&&clearTimeout(ce.current),ue.current&&clearTimeout(ue.current)},[]);const ke=ge.length*WL,Se=ge.slice(X.start,X.end);return e("div",{className:"tree-table-wrapper-container table-tree-fn",children:e("div",{className:"tree-table-fn-wrap",ref:j,children:e("div",{className:"table-fn-scrollable "+(ge.length?"":"table-fn-empty"),ref:J,style:{"--table-height":ge.length?A:"auto","--frozen-column-width":pe,border:m},children:n("div",{className:"tree-table-fn",style:{width:Ce},children:[e("div",{ref:$,style:{position:"sticky",top:0,zIndex:98},children:e(UL,{columnsData:r,columnMeta:he,totalWidth:Ce,rootNode:b,onCheckBoxChange:He,selected:i,selectedNode:L,tableHeaderBgColor:x,hideOnDisable:H,transparentHeader:N,showHeader:F,showRootNodeColumnActions:B})}),e(qL,{flattenedTreeData:Se,columnsData:r,columnMeta:he,totalWidth:Ce,rowHeight:WL,startIndex:X.start,totalHeight:ke,selected:i,select:o,onRowClick:Ve,onToggleExpand:xe,onCheckBoxChange:He,onAddConfirm:v,onAddCancel:y,handleEditFieldError:w,expanding:_,selectedNode:L,hideOnDisable:H,addModuleInputWidth:k,addModuleSelectWidth:S,disableEditLabelConfirmIcon:z,isEditable:g?G:void 0,setIsEditable:g?e=>{Y(Boolean(e))}:void 0})]})})})})});GL.displayName="TableTreeFn";const KL=t=>e(uA,{logo:()=>"FireFlink"===t?.name?e(q,{height:100,width:100,name:"fire_flink_loader_logo"}):e("img",{src:t?.loaderName,width:100,height:100,alt:"loader"})}),YL=({isVisible:t})=>t?n("div",{className:"no_data_message",children:[e(q,{name:"no_content",width:120,height:120}),e(U,{fontSize:"20px",lineHeight:"30px",fontWeight:"semi-bold",children:"No Data Available"})]}):null,JL=({text:t=" No Results Found",iconName:r="no_license_found",fontSize:i="24px",textAlign:o="left",direction:a="column",iconWidth:l=120,iconHeight:s=120,fontWeight:c="semi-bold",marginTop:d="0px"})=>e("article",{className:"no_results_container",children:n("div",{className:`no_results_container__${a}`,style:{marginTop:d},children:[e(q,{name:r,width:l,height:s}),e("div",{children:e(U,{as:"div",fontSize:i,lineHeight:"36px",fontWeight:c,color:"var(--text-color)",textAlign:o,children:t})})]})}),$L=({drawerProps:n,showDrawer:r,children:i,zIndex:o=1200,top:a="56px"})=>r?e(vn,{isOpen:n?.isOpen??!0,...n,zIndex:o,top:a,children:i}):e(t,{children:i});const ex=({children:n,offlineContent:r,hasError:i=!1,onNetworkStatusChange:o,overlayClassName:a,overlayZIndex:s=99998,iconWidth:d=300,iconHeight:u=300})=>{const f=function(){const[e,t]=c(navigator.onLine);return l(()=>{const e=()=>{t(!0)},n=()=>{t(!1)};return window.addEventListener("online",e),window.addEventListener("offline",n),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}},[]),e}();return l(()=>{o&&o(f)},[f,o]),i||!f?e("div",{className:`offlineOverlay ${a??""}`,style:{zIndex:s},children:r||e(q,{name:"offline_404_icon",height:u,width:d})}):e(t,{children:n})},tx=e=>{const t=Number.isFinite(e)&&e>0?e:0,n=Math.floor(t/60),r=Math.floor(t%60);return`${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},nx=[.5,1,1.5,2],rx=({duration:r,currentTime:i,isPlaying:o=!1,onPlayPause:l=()=>{},onSeek:s=()=>{},isMuted:d=!1,onMuteToggle:u=()=>{},menuOptions:f,onMenuOptionClick:h=()=>{},playbackRate:C=1,onPlaybackRateChange:p=()=>{},disabled:m=!1,seekStep:A=5,formatTime:g=tx,className:v="",style:y={}})=>{const w=r>0?i/r*100:0,E=a(null),b=a(null),[M,L]=c(!1),[x,H]=c({top:0,left:0}),[V,k]=c(0),S=a(null),Z=f??[{label:"Captions",value:"captions",icon:"captions"},{label:n("div",{ref:b,className:"playback-menu-option",children:["Playback Speed ",e(xi,{label:`${C.toFixed(1)} x`})]}),value:"playback-speed",icon:"playback",keepMenuOpen:!0}],O=e=>Math.min(Math.max(e,0),r||0);return n("div",{className:`ff-audio-player ${v}`,style:y,"aria-disabled":m,tabIndex:m?-1:0,role:"group","aria-label":"Audio player",onKeyDown:e=>{if(m)return;if("INPUT"!==e.target.tagName)switch(e.key){case" ":case"Spacebar":e.preventDefault(),l();break;case"m":case"M":e.preventDefault(),u();break;case"ArrowRight":e.preventDefault(),s(O(i+A));break;case"ArrowLeft":e.preventDefault(),s(O(i-A))}},children:[e("button",{type:"button",className:"ff-audio-play-btn",onClick:l,disabled:m,"aria-label":o?"Pause":"Play",children:o?n("span",{className:"ff-audio-pause-shape",children:[e("span",{className:"ff-audio-pause-bar"}),e("span",{className:"ff-audio-pause-bar"})]}):e(q,{name:"play",width:8,height:8,cursorType:"pointer",withPadding:!1,className:"ff-audio-play"})}),e(U,{fontSize:8,className:"ff-audio-time",children:g(i)}),n("div",{className:"ff-audio-seek-wrap",children:[e("div",{className:"ff-audio-seek-track"}),e("div",{className:"ff-audio-seek-fill",style:{width:`${w}%`}}),e("input",{type:"range",className:"ff-audio-seek",min:0,max:r||0,step:1,value:i,disabled:m,onChange:e=>{s(Number(e.target.value))},"aria-label":"Seek"})]}),e(U,{fontSize:8,className:"ff-audio-time",children:g(r)}),e(q,{name:"speaker",onClick:m?()=>{}:u,disabled:m,withPadding:!1,className:"ff-audio-speaker-icon"+(d?" ff-audio-speaker-muted":""),cursorType:"pointer"}),e("div",{className:"ff-audio-more-wrap",ref:E,children:e(Do,{iconName:"more",options:Z,onOptionClick:e=>{if("playback-speed"===e.value){const e=b.current?.getBoundingClientRect(),t=b.current?.closest(".ff-option-card"),n=t?.getBoundingClientRect();e&&n&&H({top:n.top,left:e.right+8});const r=nx.indexOf(C);return k(r>=0?r:0),L(!0),void requestAnimationFrame(()=>S.current?.focus())}h(e)},dropdownPlacement:"bottomLeft",displayCard:!0,disabled:m,iconSize:12})}),M&&n(t,{children:[e("div",{className:"ff-audio-speed-overlay",onClick:()=>L(!1)}),e("div",{className:"ff-audio-speed-menu",style:{top:x.top,left:x.left},ref:S,tabIndex:-1,role:"listbox","aria-label":"Playback speed",onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),k(e=>(e+1)%nx.length);break;case"ArrowUp":e.preventDefault(),k(e=>(e-1+nx.length)%nx.length);break;case"Enter":e.preventDefault(),p(nx[V]),L(!1);break;case"Escape":e.preventDefault(),L(!1)}},children:nx.map((t,r)=>{const i=t===C;return e("button",{type:"button",role:"option","aria-selected":i,className:["ff-audio-speed-option",r===V&&"ff-audio-speed-option-highlighted",i&&"ff-audio-speed-option-selected"].filter(Boolean).join(" "),onMouseEnter:()=>k(r),onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation(),p(t),L(!1)},children:n(U,{fontSize:10,children:[t.toFixed(1),"x"]})},t)})})]})]})};function ix(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)}const ox=(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)=>ox(e,o[t]));{const n=new Set(o);return i.every(r=>n.has(r)&&ox(e[r],t[r]))}},ax=(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every((e,n)=>{const r=t[n];return ox(e,r)}));function lx(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function sx(e,t){return e&t}function cx(e,t){return e|t}function dx(e,t){return e^t}function ux(e,t){return e&~t}function fx(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 hx(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var Cx,px="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function mx(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=px.charAt(n>>6)+px.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=px.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=px.charAt(n>>2)+px.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function Ax(e){var t,n="",r=0,i=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var o=px.indexOf(e.charAt(t));o<0||(0==r?(n+=lx(o>>2),i=3&o,r=1):1==r?(n+=lx(i<<2|o>>4),i=15&o,r=2):2==r?(n+=lx(i),n+=lx(o>>2),i=3&o,r=3):(n+=lx(i<<2|o>>4),n+=lx(15&o),r=0))}return 1==r&&(n+=lx(i<<2)),n}var gx,vx=function(e){var t;if(void 0===Cx){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(Cx={},t=0;t<16;++t)Cx[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)Cx[n.charAt(t)]=t;for(t=0;t<8;++t)Cx[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=Cx[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},yx={decode:function(e){var t;if(void 0===gx){var n="= \f\n\r\t \u2028\u2029";for(gx=Object.create(null),t=0;t<64;++t)gx["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(gx["-"]=62,gx._=63,t=0;t<9;++t)gx[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=gx[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=yx.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 yx.decode(e)}},wx=1e13,Ex=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)<wx?t=0:r-=(t=0|r/wx)*wx,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+=wx,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+=(wx+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*wx+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),bx=/^(\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)?)?$/,Mx=/^(\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 Lx(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}var xx,Hx=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?bx:Mx).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 Ex(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+Lx(o,n)}return i+o},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return Lx(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 Ex,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 Ex)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 Lx(r,n);i=new Ex,o=0}}return o>0&&(r+=".incomplete"),r},e}(),Vx=function(){function e(e,t,n,r,i){if(!(r instanceof kx))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 Lx(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return Lx(this.stream.parseStringISO(t,t+n),e);case 30:return Lx(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.substring(t,t+n)},e.decode=function(t){var n;n=t instanceof Hx?t:new Hx(t,0);var r=new Hx(n),i=new kx(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}(),kx=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 Ex;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}(),Sx=[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],Zx=(1<<26)/Sx[Sx.length-1],Ox=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=lx(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+=lx(n));return i?o:"0"},e.prototype.negate=function(){var t=Dx();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)+Ux(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=Dx();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 Nx(t):new Ix(t),this.exp(e,n)},e.prototype.clone=function(){var e=Dx();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=Dx();return this.bitwiseTo(e,sx,t),t},e.prototype.or=function(e){var t=Dx();return this.bitwiseTo(e,cx,t),t},e.prototype.xor=function(e){var t=Dx();return this.bitwiseTo(e,dx,t),t},e.prototype.andNot=function(e){var t=Dx();return this.bitwiseTo(e,ux,t),t},e.prototype.not=function(){for(var e=Dx(),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=Dx();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=Dx();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+fx(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+=hx(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,cx)},e.prototype.clearBit=function(e){return this.changeBit(e,ux)},e.prototype.flipBit=function(e){return this.changeBit(e,dx)},e.prototype.add=function(e){var t=Dx();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=Dx();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=Dx();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=Dx();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=Dx();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=Dx(),n=Dx();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),o=qx(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new Nx(t):t.isEven()?new Tx(t):new Ix(t);var a=[],l=3,s=n-1,c=(1<<n)-1;if(a[1]=r.convert(this),n>1){var d=Dx();for(r.sqrTo(a[1],d);l<=c;)a[l]=Dx(),r.mulTo(d,a[l-2],a[l]),l+=2}var u,f,h=e.t-1,C=!0,p=Dx();for(i=Ux(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=qx(1),a=qx(0),l=qx(0),s=qx(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 zx)},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]<=Sx[Sx.length-1]){for(t=0;t<Sx.length;++t)if(n[0]==Sx[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<Sx.length;){for(var r=Sx[t],i=t+1;i<Sx.length&&r<Zx;)r*=Sx[i++];for(r=n.modInt(r);t<i;)if(r%Sx[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]:_x(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=Dx());var a=Dx(),l=this.s,s=t.s,c=this.DB-Ux(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,A=m-d,g=null==n?Dx():n;for(a.dlShiftTo(A,g),r.compareTo(g)>=0&&(r[r.t++]=1,r.subTo(g,r)),e.ONE.dlShiftTo(d,g),g.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--A>=0;){var v=r[--m]==u?this.DM:Math.floor(r[m]*h+(r[m-1]+p)*C);if((r[m]+=a.am(0,v,r,A,0,d))<v)for(a.dlShiftTo(A,g),r.subTo(g,r);r[m]<--v;)r.subTo(g,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=Dx(),i=Dx(),o=n.convert(this),a=Ux(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=qx(n),i=Dx(),o=Dx(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substring(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=_x(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),cx,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)>Sx.length&&(t=Sx.length);for(var o=Dx(),a=0;a<t;++a){o.fromInt(Sx[Math.floor(Math.random()*Sx.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=Dx();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),cx,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}(),zx=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}(),Nx=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}(),Ix=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=Dx();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Ox.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=Dx();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}(),Tx=function(){function e(e){this.m=e,this.r2=Dx(),this.q3=Dx(),Ox.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=Dx();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 Dx(){return new Ox(null)}function Fx(e,t){return new Ox(e,t)}var Rx="undefined"!=typeof navigator;Rx&&"Microsoft Internet Explorer"==navigator.appName?(Ox.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},xx=30):Rx&&"Netscape"!=navigator.appName?(Ox.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},xx=26):(Ox.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},xx=28),Ox.prototype.DB=xx,Ox.prototype.DM=(1<<xx)-1,Ox.prototype.DV=1<<xx;Ox.prototype.FV=Math.pow(2,52),Ox.prototype.F1=52-xx,Ox.prototype.F2=2*xx-52;var Px,Bx,jx=[];for(Px="0".charCodeAt(0),Bx=0;Bx<=9;++Bx)jx[Px++]=Bx;for(Px="a".charCodeAt(0),Bx=10;Bx<36;++Bx)jx[Px++]=Bx;for(Px="A".charCodeAt(0),Bx=10;Bx<36;++Bx)jx[Px++]=Bx;function _x(e,t){var n=jx[e.charCodeAt(t)];return null==n?-1:n}function qx(e){var t=Dx();return t.fromInt(e),t}function Ux(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}Ox.ZERO=qx(0),Ox.ONE=qx(1);var Wx=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 Xx,Qx,Gx=null;if(null==Gx){Gx=[],Qx=0;var Kx=void 0;if("undefined"!=typeof window&&self.crypto&&self.crypto.getRandomValues){var Yx=new Uint32Array(256);for(self.crypto.getRandomValues(Yx),Kx=0;Kx<Yx.length;++Kx)Gx[Qx++]=255&Yx[Kx]}var Jx=0,$x=function(e){if((Jx=Jx||0)>=256||Qx>=256)self.removeEventListener?self.removeEventListener("mousemove",$x,!1):self.detachEvent&&self.detachEvent("onmousemove",$x);else try{var t=e.x+e.y;Gx[Qx++]=255&t,Jx+=1}catch(e){}};"undefined"!=typeof window&&(self.addEventListener?self.addEventListener("mousemove",$x,!1):self.attachEvent&&self.attachEvent("onmousemove",$x))}function eH(){if(null==Xx){for(Xx=new Wx;Qx<256;){var e=Math.floor(65536*Math.random());Gx[Qx++]=255&e}for(Xx.init(Gx),Qx=0;Qx<Gx.length;++Qx)Gx[Qx]=0;Qx=0}return Xx.next()}var tH=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=eH()},e}();function nH(e){return function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}(function(e,t){var n,r,i,o,a,l,s,c,d,u,f,h,C=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),p=new Array(64);for(e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t,d=0;d<e.length;d+=16){for(n=C[0],r=C[1],i=C[2],o=C[3],a=C[4],l=C[5],s=C[6],c=C[7],u=0;u<64;u++)p[u]=u<16?e[u+d]:hH(hH(hH(uH(p[u-2]),p[u-7]),dH(p[u-15])),p[u-16]),f=hH(hH(hH(hH(c,cH(a)),aH(a,l,s)),fH[u]),p[u]),h=hH(sH(n),lH(n,r,i)),c=s,s=l,l=a,a=hH(o,f),o=i,i=r,r=n,n=hH(f,h);C[0]=hH(n,C[0]),C[1]=hH(r,C[1]),C[2]=hH(i,C[2]),C[3]=hH(o,C[3]),C[4]=hH(a,C[4]),C[5]=hH(l,C[5]),C[6]=hH(s,C[6]),C[7]=hH(c,C[7])}return C}(function(e){for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}(e),8*e.length))}function rH(e){for(var t="0123456789abcdef",n="",r=0;r<e.length;r++){var i=e.charCodeAt(r);n+=t.charAt(i>>>4&15)+t.charAt(15&i)}return n}function iH(e,t){return e>>>t|e<<32-t}function oH(e,t){return e>>>t}function aH(e,t,n){return e&t^~e&n}function lH(e,t,n){return e&t^e&n^t&n}function sH(e){return iH(e,2)^iH(e,13)^iH(e,22)}function cH(e){return iH(e,6)^iH(e,11)^iH(e,25)}function dH(e){return iH(e,7)^iH(e,18)^oH(e,3)}function uH(e){return iH(e,17)^iH(e,19)^oH(e,10)}var fH=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function hH(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function CH(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 tH,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 Ox(n)}function pH(e,t,n){for(var r="",i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return r}function mH(e,t){var n=nH;if(e.length+64+2>t)throw"Message too long for RSA";var r,i="";for(r=0;r<t-e.length-64-2;r+=1)i+="\0";var o=n("")+i+""+e,a=new Array(32);(new tH).nextBytes(a);var l=pH(a,o.length,n),s=[];for(r=0;r<o.length;r+=1)s[r]=o.charCodeAt(r)^l.charCodeAt(r);var c=pH(s,a.length,n),d=[0];for(r=0;r<a.length;r+=1)d[r+1]=a[r]^c.charCodeAt(r);return new Ox(d.concat(s))}var AH=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=Fx(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e,t){void 0===t&&(t=CH);var n=this.n.bitLength()+7>>3,r=t(e,n);if(null==r)return null;var i=this.doPublic(r);if(null==i)return null;for(var o=i.toString(16),a=o.length,l=0;l<2*n-a;l++)o="0"+o;return o},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=Fx(e,16),this.e=parseInt(t,16),this.d=Fx(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=Fx(e,16),this.e=parseInt(t,16),this.d=Fx(n,16),this.p=Fx(r,16),this.q=Fx(i,16),this.dmp1=Fx(o,16),this.dmq1=Fx(a,16),this.coeff=Fx(l,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new tH,r=e>>1;this.e=parseInt(t,16);for(var i=new Ox(t,16);;){for(;this.p=new Ox(e-r,1,n),0!=this.p.subtract(Ox.ONE).gcd(i).compareTo(Ox.ONE)||!this.p.isProbablePrime(10););for(;this.q=new Ox(r,1,n),0!=this.q.subtract(Ox.ONE).gcd(i).compareTo(Ox.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(Ox.ONE),l=this.q.subtract(Ox.ONE),s=a.multiply(l);if(0==s.gcd(i).compareTo(Ox.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=Fx(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 tH,i=e>>1;this.e=parseInt(t,16);var o=new Ox(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(Ox.ONE),r=a.q.subtract(Ox.ONE),i=t.multiply(r);0==i.gcd(o).compareTo(Ox.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=Dx(),a.q.fromNumberAsync(i,1,r,function(){a.q.subtract(Ox.ONE).gcda(o,function(e){0==e.compareTo(Ox.ONE)&&a.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(s,0)})})},c=function(){a.p=Dx(),a.p.fromNumberAsync(e-i,1,r,function(){a.p.subtract(Ox.ONE).gcda(o,function(e){0==e.compareTo(Ox.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=(gH[n]||"")+t(e).toString(),i=this.n.bitLength()/4,o=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 Fx("0001"+r+"00"+e,16)}(r,i);if(null==o)return null;var a=this.doPrivate(o);if(null==a)return null;for(var l=a.toString(16),s=l.length,c=0;c<i-s;c++)l="0"+l;return l},e.prototype.verify=function(e,t,n){var r=Fx(t,16),i=this.doPublic(r);return null==i?null:function(e){for(var t in gH)if(gH.hasOwnProperty(t)){var n=gH[t],r=n.length;if(e.substring(0,r)==n)return e.substring(r)}return e}(i.toString(16).replace(/^1f+00/,""))==n(e).toString()},e}();var gH={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function vH(e,t,n){if(!t||!e)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}
36
+ */var Vy,ky=(xy||(xy=1,"production"===process.env.NODE_ENV?by.exports=(Ey||(Ey=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(0>i(s,n))c<o&&0>i(d,s)?(e[r]=d,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<o&&0>i(d,n)))break e;e[r]=d,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,C=!1,p=!1,m=!1,A="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(s,i)}i=n(c)}}function w(e){if(p=!1,y(e),!C)if(null!==n(s))C=!0,b||(b=!0,E());else{var t=n(c);null!==t&&Z(w,t.startTime-e)}}var E,b=!1,M=-1,L=5,x=-1;function H(){return!(!m&&e.unstable_now()-x<L)}function V(){if(m=!1,b){var t=e.unstable_now();x=t;var i=!0;try{e:{C=!1,p&&(p=!1,g(M),M=-1),h=!0;var o=f;try{t:{for(y(t),u=n(s);null!==u&&!(u.expirationTime>t&&H());){var a=u.callback;if("function"==typeof a){u.callback=null,f=u.priorityLevel;var l=a(u.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof l){u.callback=l,y(t),i=!0;break t}u===n(s)&&r(s),y(t)}else r(s);u=n(s)}if(null!==u)i=!0;else{var d=n(c);null!==d&&Z(w,d.startTime-t),i=!1}}break e}finally{u=null,f=o,h=!1}i=void 0}}finally{i?E():b=!1}}}if("function"==typeof v)E=function(){v(V)};else if("undefined"!=typeof MessageChannel){var k=new MessageChannel,S=k.port2;k.port1.onmessage=V,E=function(){S.postMessage(null)}}else E=function(){A(V,0)};function Z(t,n){M=A(function(){t(e.unstable_now())},n)}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_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){m=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:d++,callback:i,priorityLevel:r,startTime:o,expirationTime:l=o+l,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(s)&&r===n(c)&&(p?(g(M),M=-1):p=!0,Z(w,o-a))):(r.sortIndex=l,t(s,r),C||h||(C=!0,b||(b=!0,E()))),r},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(My)),My):by.exports=(Ly||(Ly=1,Vy=Hy,"production"!==process.env.NODE_ENV&&function(){function e(){if(y=!1,M){var e=Vy.unstable_now();H=e;var t=!0;try{e:{g=!1,v&&(v=!1,E(L),L=-1),A=!0;var i=m;try{t:{for(o(e),p=n(f);null!==p&&!(p.expirationTime>e&&l());){var c=p.callback;if("function"==typeof c){p.callback=null,m=p.priorityLevel;var d=c(p.expirationTime<=e);if(e=Vy.unstable_now(),"function"==typeof d){p.callback=d,o(e),t=!0;break t}p===n(f)&&r(f),o(e)}else r(f);p=n(f)}if(null!==p)t=!0;else{var u=n(h);null!==u&&s(a,u.startTime-e),t=!1}}break e}finally{p=null,m=i,A=!1}t=void 0}}finally{t?V():M=!1}}}function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(0>i(s,n))c<o&&0>i(d,s)?(e[r]=d,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<o&&0>i(d,n)))break e;e[r]=d,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}function o(e){for(var i=n(h);null!==i;){if(null===i.callback)r(h);else{if(!(i.startTime<=e))break;r(h),i.sortIndex=i.expirationTime,t(f,i)}i=n(h)}}function a(e){if(v=!1,o(e),!g)if(null!==n(f))g=!0,M||(M=!0,V());else{var t=n(h);null!==t&&s(a,t.startTime-e)}}function l(){return!(!y&&Vy.unstable_now()-H<x)}function s(e,t){L=w(function(){e(Vy.unstable_now())},t)}if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),Vy.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var c=performance;Vy.unstable_now=function(){return c.now()}}else{var d=Date,u=d.now();Vy.unstable_now=function(){return d.now()-u}}var f=[],h=[],C=1,p=null,m=3,A=!1,g=!1,v=!1,y=!1,w="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null,M=!1,L=-1,x=5,H=-1;if("function"==typeof b)var V=function(){b(e)};else if("undefined"!=typeof MessageChannel){var k=new MessageChannel,S=k.port2;k.port1.onmessage=e,V=function(){S.postMessage(null)}}else V=function(){w(e,0)};Vy.unstable_IdlePriority=5,Vy.unstable_ImmediatePriority=1,Vy.unstable_LowPriority=4,Vy.unstable_NormalPriority=3,Vy.unstable_Profiling=null,Vy.unstable_UserBlockingPriority=2,Vy.unstable_cancelCallback=function(e){e.callback=null},Vy.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x=0<e?Math.floor(1e3/e):5},Vy.unstable_getCurrentPriorityLevel=function(){return m},Vy.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},Vy.unstable_requestPaint=function(){y=!0},Vy.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},Vy.unstable_scheduleCallback=function(e,r,i){var o=Vy.unstable_now();switch(i="object"==typeof i&&null!==i&&"number"==typeof(i=i.delay)&&0<i?o+i:o,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return e={id:C++,callback:r,priorityLevel:e,startTime:i,expirationTime:l=i+l,sortIndex:-1},i>o?(e.sortIndex=i,t(h,e),null===n(f)&&e===n(h)&&(v?(E(L),L=-1):v=!0,s(a,i-o))):(e.sortIndex=l,t(f,e),g||A||(g=!0,M||(M=!0,V()))),e},Vy.unstable_shouldYield=l,Vy.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Hy)),by.exports);const Sy=Symbol(),Zy=Symbol(),Oy="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?l:u,zy=ky.unstable_runWithPriority?e=>{try{ky.unstable_runWithPriority(ky.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e();function Ny(e,t){const n=d(e)[Sy];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]=g((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(),Oy(()=>(o.add(s),()=>{o.delete(s)}),[o]),l[1]}const Iy=function(e){const t=s({[Sy]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[Zy]=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={[Sy]:{v:r,n:i,l:e,u:t}}}return Oy(()=>{r.current=e,i.current+=1,zy(()=>{s.current[Sy].l.forEach(t=>{t({n:i.current,v:e})})})},[e]),p(n,{value:s.current},t)}),delete t.Consumer,t}([yy,()=>{}]),Ty=({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})},Dy=t=>e("tr",{...t}),Fy=t=>e("tr",{className:"ff-spreadsheet-row-header",...t});function Ry(){return Ny(Iy,([,e])=>e)}function Py(e){return Ny(Iy,([t])=>e(t))}const By=({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:I("corner-header",{"ff-spreadsheet-header--selected":t}),children:e(q,{variant:t?"dark":"light",color:t?"var(--hover-color)":"var(--text-color)",name:"excel_corner_menu"})})})},jy=t=>function(n){const i=Ry(),o=r.useCallback(()=>i({type:VA}),[i]),a=Py(e=>e.selected instanceof hv);return e(t,{...n,selected:a,onSelect:o})},_y=t=>function(n){const i=Ry(),o=r.useCallback((e,t)=>i(function(e,t){return{type:HA,payload:{column:e,extend:t}}}(e,t)),[i]),a=Py(e=>e.selected.hasEntireColumn(n.column)),l=Py(e=>e.selectedColumn??void 0),s=Py(e=>e.active?Gg(e.active,e.model.data):void 0);return e(t,{...n,cell:s,selected:a,selectedColumn:l,onSelect:o,scrollToColumn:n.scrollToColumn})},qy=_y(({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:A,contextMenu:g,onAddColumn:v,onDeleteColumn:y,setVisibleRange:w,scrollToColumn:E})=>{const b=Ry(),M=Py(e=>e.model.data),L=Py(e=>e.columnDimensions[t]?.width??p),x=Py(e=>e.model.data),{columnCount:H}=jv(x),V=e=>{w(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return C&&E(C),n})},k=h(()=>[{label:"Add Column Left",value:"Add Column Left",iconName:"plus_icon",action:()=>{V("increment"),c(p),v?.(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:()=>{V("increment"),d(p),v?.(C??t,!1)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Right"]??!1,disable:H>=m},...A?[]:[{label:"Delete Column",value:"Delete Column",iconName:"delete",action:()=>{V("decrement"),s(),y?.(C??t)},disableTooltip:"",visible:f?.contextDisable?.["Delete Column"]??!1,disable:!1}]],[C,t,M]),S=r.useCallback((e,n)=>{const r=n?t-1:t,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientX,l=Number(L),s=e=>{const t=e.clientX-o,n=Math.max(p,l+t);b(function(e,t){return{type:sg,payload:{column:e,width:t}}}(i,n))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),b(qg())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),b(_g())},[t,L]),Z=r.useCallback(e=>b(Fg(e)),[b]),O=r.useCallback(e=>{a(t,e.shiftKey)},[a,t]),z=r.useCallback(e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"column",options:k})},[t,C,u,k]);return r.useEffect(()=>{void 0!==C&&"column"===g?.contextType&&l(e=>({open:e.open,contextType:"column",options:k}))},[t,C,u,k,"column"===g?.contextType]),n("th",{className:I("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{width:`${L}px`,minWidth:"100px"},onClick:O,onContextMenu:z,tabIndex:0,children:[e(U,{fontWeight:"medium",children:i??Uy(t)}),e("div",{className:"drag-column-selector drag-column-left",onMouseDown:e=>S(e,!1),onDoubleClick:()=>b(Ag(t,L)),onClick:()=>Z({row:-1,column:t})}),e("div",{className:"drag-column-selector drag-column-right",onMouseDown:e=>S(e,!0),onDoubleClick:()=>b(Ag(t,L)),onClick:()=>Z({row:-1,column:t})})]},t)});function Uy(e){let t="",n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}const Wy=({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:A,scrollToRow:g})=>{const v=Ry(),y=Py(e=>e.rowDimensions[t]?.height||32),w=Py(e=>e.model.data),{rowCount:E}=jv(w),b=e=>{A(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return f&&g(f),n})},M=r.useMemo(()=>[{label:"Add Row Top",value:"Add Row Top",iconName:"plus_icon",action:()=>{b("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:()=>{b("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:()=>{b("decrement"),d()},disableTooltip:"",visible:h?.contextDisable?.["Delete Row"]??!1,disable:!1}]],[f,t]),L=r.useCallback((e,n)=>{const r=n?t:t-1,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientY,l=y,s=e=>{const t=e.clientY-o,n=Math.max(32,l+t);v(mg(i,n))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),v(qg())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c)},[y,t]),x=r.useCallback(e=>v(Fg(e)),[v]),H=r.useCallback(e=>{a(t,e.shiftKey)},[t]),V=r.useCallback(e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"row",options:M})},[t,u,M,f]);return r.useEffect(()=>{void 0!==f&&"row"===m?.contextType&&l(e=>({open:e.open,contextType:"row",options:M}))},[t,u,M,f,"row"===m?.contextType]),n("th",{className:I("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{height:`${y}px`,minHeight:"32px"},onClick:H,onContextMenu:V,tabIndex:0,children:[e(U,{fontWeight:"medium",children:void 0!==i?i:t+1}),e("div",{className:"drag-row-selector drag-row-down",onMouseDown:e=>L(e,!0),onDoubleClick:()=>v(mg(t,y)),onClick:()=>x({row:t,column:-1})}),e("div",{className:"drag-row-selector drag-row-up",onMouseDown:e=>L(e,!1),onDoubleClick:()=>v(mg(t,y)),onClick:()=>x({row:t,column:-1})})]})},Xy=t=>function(n){const i=Ry(),o=Py(e=>e.selected.hasEntireRow(n.row)),a=Py(e=>e.active?Gg(e.active,e.model.data):void 0),l=Py(e=>e.selectedRow??void 0),s=r.useCallback((e,t)=>i(function(e,t){return{type:xA,payload:{row:e,extend:t}}}(e,t)),[i]);return e(t,{...n,selected:o,cell:a,selectedRow:l,onSelect:s,scrollToRow:n.scrollToRow})},Qy=r.memo(({row:t,column:n,DataViewer:i,active:o,dragging:a,mode:l,data:s,evaluatedData:c,select:d,activate:u,edit:f,editable:h,setCellDimensions:C,setCellData:p})=>{const m=r.useRef(null),A=r.useMemo(()=>({row:t,column:n}),[t,n]),g=r.useCallback(e=>{e.preventDefault(),window.getSelection()?.removeAllRanges(),"view"===l&&(C(A,bv(e.currentTarget)),e.shiftKey?d(A):(u(A),"dropDown"===s?.inputType?.type&&h&&!s?.readOnly&&f()))},[l,C,A,d,u,f,h,s]),v=r.useCallback(e=>{a&&(C(A,bv(e.currentTarget)),d(A))},[C,d,a,A]);return r.useEffect(()=>{const e=m.current;if(!e)return;const t=()=>{a||C(A,bv(e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[C,A,a]),s&&s.DataViewer&&(i=s.DataViewer),e("td",{ref:m,style:{...s?.style,..."dropDown"===s?.inputType?.type&&{fontSize:"12px"},textDecoration:"underline"===s?.style?.textDecoration?s?.style?.textDecoration:"none"},className:I("ff-spreadsheet-cell",s?.className,{"ff-spreadsheet-active-cell":o||a}),onMouseEnter:v,onMouseDown:g,tabIndex:0,children:e(i,{row:t,column:n,cell:s,active:o,evaluatedCell:c,setCellData:p,inputValue:()=>null})})}),Gy=t=>function(n){const{row:i,column:o}=n,a=Ry(),l=r.useMemo(()=>({row:i,column:o}),[i,o]),s=r.useCallback(e=>a(Rg(l,e)),[a,l]),c=r.useCallback(e=>a(function(e){return{type:SA,payload:{point:e}}}(e)),[a]),d=r.useCallback(e=>a(Fg(e)),[a]),u=r.useCallback(()=>a(Xg()),[a]),f=r.useCallback((e,t)=>a(Pg(e,t)),[a]),h=Py(e=>Ev(e.active,l)),C=Py(e=>h?e.mode:"view"),p=Py(e=>e.editable),m=Py(e=>Gg(l,e.model.data)),A=Py(e=>Gg(l,e.model.evaluatedData)),g=Py(e=>e.dragging),v=Py(e=>e.copied?.has(l)||!1);return e(t,{...n,active:h,copied:v,dragging:g,mode:C,evaluatedData:A,data:m,select:c,activate:d,edit:u,editable:p,setCellDimensions:f,setCellData:s})},Ky=({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:Yy(a)}:{className:I("ff-spreadsheet-data-viewer",{"ff-spreadsheet-data-viewer--preserve-breaks":Iv(a)}),children:o||"dropDown"!==r?.inputType?.type?o||"file"!==r?.inputType?.type?!o&&a:e(t,{children:K(r?.value)?n("div",{className:"ff-spreadsheet-data-viewer--without-fileType",children:[e(q,{name:"attachment_icon"})," Attachment"]}):(n=>{if(K(n))return e(t,{});return JSON.parse(n).map(t=>e("div",{className:"ff-spreadsheet-data-viewer--fileType",children:e(Oi,{width:r?.style?.width??100,title:t?.name?.split("*")?.[0]??""})},t.name))})(a)}):n("div",{className:"ff-spreadsheet-data-viewer--dropdownType",children:[a,e(q,{name:"arrow_down",height:8,className:"dropdownType-icon"})]})})};function Yy(e){return e?"TRUE":"FALSE"}const Jy=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=String(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"}})})}),$y=({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(Jy,{ref:i,initialValue:n?.value??"",onChange:o,className:"ff-spreadsheet-cell-textarea",style:{...n?.style,width:"100%",height:"100%",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})})},ew=t=>{const i=r.useRef(null),o=r.useRef(null),a=Ry(),l=r.useCallback((e,t)=>a(Rg(e,t)),[a]),s=r.useCallback(e=>a(Fg(e)),[a]),c=r.useCallback(()=>a(Xg()),[a]),d=r.useCallback(e=>a({type:dg,payload:{autofill:e}}),[a]),u=r.useCallback(e=>a(function(e){return{type:qA,payload:{changes:e}}}(e)),[a]),f=r.useCallback(()=>{a({type:FA})},[a]),h=Py(e=>e.rowDimensions),C=Py(e=>e.active),p=Py(e=>e.mode),m=Py(e=>e.active?Gg(e.active,e.model.data):void 0),A=Py(e=>e.selected),g=Py(e=>A&&Zv(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),v=Py(e=>{let t=C?kv(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}),y=r.useMemo(()=>!C||!v||C.row<t.visibleRowRange.start||C.row>=t.visibleRowRange.end||C.column<t.visibleColRange.start||C.column>=t.visibleColRange.end,[C,v,t.visibleRowRange,t.visibleColRange]),w=r.useRef(void 0),E=r.useRef(null),b=r.useRef(void 0),M=r.useCallback(e=>{C&&l(C,e)},[l,C]),[L,x]=r.useState({value:"",name:""}),[H,V]=r.useState(!1),[k,S]=r.useState(),[Z,O]=r.useState([]),[z,N]=r.useState("var(--ff-select-text-color)");r.useEffect(()=>{m&&C&&t.getActiveCell({value:m.value,active:C});const n=i.current;if(!y&&n&&(n.focus({preventScroll:!0}),"dropDown"===m?.inputType?.type)){x({value:m?.value,name:m?.value}),N(m?.style?.color),V(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,color:t.color}));S(t)}},[i,y,C?.row,C?.column]),r.useEffect(()=>{if("file"===m?.inputType?.type&&m?.value)try{const e=JSON.parse(m.value).map(e=>new File([new Blob],e.name.split("*")[0]??"default"));O(e)}catch(e){console.error("Error parsing cell value for files:",e),O([])}else O([])},[m?.inputType?.type,m?.value]),r.useEffect(()=>{"dropDown"===m?.inputType?.type&&m?.value!==L.value&&x({value:m?.value,name:m?.value})},[m?.value,m?.inputType?.type,L.value]),r.useEffect(()=>{const e=E.current,t=b.current;if(E.current=C,b.current=m,!e||!t)return;const n=C?.row!==e.row||C?.column!==e.column;if(n||"edit"!==p){const e=w.current;t!==e?u([{prevCell:e||null,nextCell:t}]):n||m===t||u([{prevCell:t,nextCell:m||null}]),w.current=m}});const T=m&&m.DataEditor||t.DataEditor,D=m&&m.readOnly,F=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]),R=r.useCallback(e=>{e.preventDefault(),t.setContextMenu({open:t.contextOption?.open??!1,contextType:t.contextOption?.contextType??null,options:t.contextOption?.options||[]})},[t]),P=g?.height!==v?.height||g?.width!==v?.width,B=r.useCallback(e=>{C&&P&&(Pg(C,bv(e.currentTarget)),s(C))},[C,P]),j=t.isAtRight?t.maxWidth-(v?.left-t.scrollPos.left)+100:t.maxWidth,_=t.isAtBottom?t.maxHeight-(v?.top-t.scrollPos.top)+64:t.maxHeight,q=["file","dropDown"].includes(m?.inputType?.type||""),U="dropDown"===m?.inputType?.type;return n("div",{ref:i,className:I("ff-spreadsheet-active-cell",`ff-spreadsheet-active-cell--${p}`,{"ff-spreadsheet-active-cell--hidden":y,"ff-spreadsheet-active-cell--dragging":P&&"text"!==m?.inputType?.type}),onMouseDown:B,style:{...v,backgroundColor:m?.style?.backgroundColor,...q?{display:"flex",alignItems:U?"center":m?.style?.alignContent,justifyContent:U?"flex-start":m?.style?.textAlign}:{},..."edit"===p&&C?{minWidth:Math.min(v?.width,t.maxWidth),minHeight:Math.min(v?.height,t.maxHeight),height:"auto",maxWidth:`${j}px`,maxHeight:`${_}px`,overflow:"auto",..."dropDown"===m?.inputType?.type?{}:{padding:"2px 4px 0px 4px",width:"max-content"}}:{}},onContextMenu:R,onClick:"view"!==p||D?void 0:c,tabIndex:0,children:[e("div",{className:q?"":"active-cell-main",style:U?{width:"100%"}:void 0,children:"dropDown"===m?.inputType?.type?e(Zo,{...m?.inputType?.inputProps,dropDownRef:o,showOptions:{open:!("edit"!==p||!C),toggle:H},selectedOption:L,optionsList:k||[],height:26,showLabel:!1,disabled:!t.editable,showBorder:!1,selectedOptionColor:z,optionZIndex:5e3,onChange:e=>{const t=K(e.color)?m?.style:{...m?.style,color:e.color};x({value:e.value,name:e.label}),N(e.color||"var(--ff-select-text-color)"),M({...m,value:e.value,style:t,inputType:m?.inputType})}}):"file"===m?.inputType?.type?e(sA,{...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:Z,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 cc.info("Cannot upload more than 5 files.");if(t.attachmentAction?.addAttachment&&i.length>0)try{let e=0,r=0,o=0;const l=Z?.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):"";M({...m,value:e,style:m?.style,inputType:m?.inputType}),a(mg(C?.row||0,Math.max(s,h?.[C.row]?.height||s))),O(c.map(e=>new File([new Blob],e.name?.split("*")[0]??"default")))}o>0&&cc.info("No memory available to add the file"),e>0&&cc.success(`${e} file${e>1?"s":""} uploaded successfully`),r>0&&cc.info(`${r} unsupported ${r>1?"files":"file"}. Please check the file formats.`)}catch(e){console.error("Upload operation failed:",e),cc.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),cc.error("Error deleting file")}else console.error(`Cannot delete ${i.name}: Invalid fileId or no match`,{index:n,fileId:o,hasDeleteAttachment:!!t.attachmentAction?.deleteAttachment}),cc.error("Failed to delete file: Invalid file data")}if(r>0){const t=e.length>0?JSON.stringify(e):"";M({...m,value:t,style:m?.style,inputType:m?.inputType}),O(e?.map(e=>new File([new Blob],e.name.split("*")[0]))),cc.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):"";M({...m,value:e,style:m?.style,inputType:m?.inputType}),O(t.map(e=>new File([new Blob],e.name.split("*")[0]))),cc.error("Failed to delete file(s). Invalid file data detected.")}else cc.error("Failed to delete file(s). No valid files removed.")}}catch(e){console.error("Delete operation failed:",e),cc.error("Delete operation failed")}}catch(e){console.error("handleFilesChange error:",e),cc.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:(v?.width??0)-60}):"edit"===p&&C&&t.editable?e(T,{row:C.row,column:C.column,cell:m,onChange:M,exitEditMode:f}):e(Jy,{initialValue:m?.value,onChange:()=>{},className:"ff-spreadsheet-cell-textarea",style:{...m?.style,height:"100%",width:"100%",textDecoration:"underline"===m?.style?.textDecoration?"underline":"none",backgroundColor:P?"#1e161f00":m?.style?.backgroundColor,pointerEvents:"none",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})}),!["file"].includes(m?.inputType?.type??"")&&("edit"===p||C&&e("div",{onMouseDown:F,className:"select_dot"}))]},`${C?.row}-${C?.column}`)},tw=({dimensions:t,dragging:n,hidden:r,variant:i})=>{const o=Py(e=>e.active),a=Py(e=>e.autoFill),l=Py(e=>o?kv(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:I("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}})},nw=({scrollPos:t={top:0,left:0}})=>{const n=Py(e=>e.selected),i=Py(e=>e.dragging),o=Py(e=>e.selected.size(e.model.data)<2),a=Py(e=>n&&Zv(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(tw,{variant:"selected",dimensions:l,dragging:i,hidden:o||!a})},rw=({scrollPos:t={top:0,left:0}})=>{const n=Py(e=>e.copied),i=null===n,o=Py(e=>n&&Sv(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(tw,{variant:"copied",dimensions:a,hidden:i||!o,dragging:!1})},iw=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:I("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:I("ff-excel-color-selector-picker",{"color-selector-disabled":n}),ref:l,onChange:e=>{d(e.target.value),t(e.target.value.replace("#",""))}})})});iw.displayName="ColorBarSelector";const ow=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"}},aw=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"}},lw=e=>Pv.reduce((t,n)=>Math.abs(n-parseFloat(e))<Math.abs(t-parseFloat(e))?n:t);function sw(e,t=100){const{border:n}=e;let r="",i="",o="",a="";return"THIN"!==n.top&&(r="MEDIUM"===n.top?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.right&&(i="MEDIUM"===n.right?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.bottom&&(o="MEDIUM"===n.bottom?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.left&&(a="MEDIUM"===n.left?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),{fontSize:Tv(lw(String(e.size))),fontFamily:(l=e.name,Rv.some(e=>e.label===l)?l:"Poppins"),color:`#${e.color}`,backgroundColor:`#${e.backgroundColor}`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":"normal",borderTop:r,borderRight:i,borderBottom:o,borderLeft:a,textAlign:ow(e.alignment.horizontal),alignContent:ow(e.alignment.vertical),height:e.height??32,width:e.width??t};var l}const cw=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"},dw=(e,t=100)=>({name:e.fontFamily||"Arial",size:Dv(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:cw(e.borderTop?e.borderTop.toString():void 0),right:cw(e.borderRight?e.borderRight.toString():void 0),bottom:cw(e.borderBottom?e.borderBottom.toString():void 0),left:cw(e.borderLeft?e.borderLeft.toString():void 0)},alignment:{horizontal:aw(e.textAlign),vertical:aw(e.alignContent),wrapText:!1},width:e.width||t,height:e.height||32}),uw=({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 A=Py(e=>e.selected instanceof hv),[g,v]=c("disable"===t||!r),y=Py(e=>e.active?Gg(e.active,e.model.data):null),w=Py(e=>e.model.data),E=Py(e=>e.formattedStyle.open),b={...Fv.style,color:"#1e161f",backgroundColor:"#ffffff",borderColor:"#1e161f"},[M,L]=c(y?.style||b),x=a(null);l(()=>{y?.style&&JSON.stringify(y.style)!==JSON.stringify(M)&&L(y?.style||b),A?v(!r):y&&"boolean"==typeof y.readOnly&&v(y.readOnly||"disable"===t||!r||"dropDown"===y?.inputType?.type)},[y,r]);const H=dw(M),[V,k]=c("border-none"),[S,Z]=c({label:"",value:""}),[O,z]=c({label:"",value:""}),[N,I]=c({color:b.color,backgroundColor:b.backgroundColor,borderColor:b.borderColor}),T=[{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"}],D=Pv.map(e=>({label:e,value:e})),F=a(null),R=a(null);l(()=>{let e=setTimeout(()=>{d(w,N.color)},0);return()=>{clearTimeout(e)}},[N.color]),l(()=>{let e=setTimeout(()=>{C(w,N.backgroundColor)},0);return()=>{clearTimeout(e)}},[N.backgroundColor]);return l(()=>{const e=M.fontFamily,t=`${Dv(M.fontSize)}`;Z({label:e??"Times New Roman",value:e??"Times New Roman"}),z({label:t??"11",value:t??"11"})},[M]),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(Zo,{disabled:g,height:24,tooltip:!0,showToolTip:!0,showLabel:!1,optionZIndex:2e3,onChange:e=>{Z({label:e.label,value:e.label}),f(w,e.value)},required:!1,optionsList:Rv,selectedOption:S})}),e("div",{className:"ff-excel-toolbar-font-size",children:e(Zo,{disabled:g,height:24,showLabel:!1,optionZIndex:2e3,required:!1,onChange:e=>{z({label:e.label,value:e.value}),u(w,e.value)},optionsList:D,selectedOption:O})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(Y,{placement:"top",title:"Text Left",children:e(q,{disabled:g,variant:"left"===M.textAlign?"dark":"light",hoverEffect:"left"!==M.textAlign,onClick:()=>h(w,"left"),name:"text_align_left"})}),e(Y,{placement:"top",title:"Text Center",children:e(q,{disabled:g,variant:"center"===M.textAlign?"dark":"light",hoverEffect:"center"!==M.textAlign,onClick:()=>h(w,"center"),name:"text_align_center"})}),e(Y,{placement:"top",title:"Text Right",children:e(q,{disabled:g,variant:"right"===M.textAlign?"dark":"light",hoverEffect:"right"!==M.textAlign,onClick:()=>h(w,"right"),name:"text_align_right"})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-text",children:[e(Y,{placement:"top",title:"Bold",children:e(q,{disabled:g,variant:H.bold?"dark":"light",hoverEffect:!H.bold,onClick:()=>i(w),name:"bold"})}),e(Y,{placement:"top",title:"Italic",children:e(q,{disabled:g,variant:H.italic?"dark":"light",hoverEffect:!H.italic,onClick:()=>o(w),name:"italic"})}),e(Y,{placement:"top",title:"Underline",children:e("div",{className:"ff-excel-toolbar-icon-underline",children:e(q,{disabled:g,variant:"underline"===M.textDecoration?"dark":"light",hoverEffect:"underline"!==M.textDecoration,onClick:()=>s(w),name:"underline"})})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(Y,{placement:"top",title:"Format Painter",children:e(q,{disabled:g,variant:E?"dark":"light",hoverEffect:!E,onClick:()=>{m(w)},name:"formate_painter"})}),e(Y,{placement:"top",title:"Text Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(q,{disabled:g,hoverEffect:!0,width:12,height:10,onClick:()=>{d(w,N.color),F.current?.click()},name:"text_color"}),e(iw,{ref:F,disabled:g,getColorValue:e=>{I(t=>({...t,color:e}))},initialColor:N.color})]})}),e(Y,{placement:"top",title:"Background Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(q,{disabled:g,hoverEffect:!0,width:12,height:10,onClick:()=>{C(w,N.backgroundColor),R.current?.click()},name:"fill_color"}),e(iw,{ref:R,disabled:g,getColorValue:e=>{I(t=>({...t,backgroundColor:e}))},initialColor:N.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(Y,{placement:"top",title:"Border Type",children:e(q,{hoverEffect:!0,disabled:g,onClick:()=>p(w,V,"var(--input-hover-border-color)"),name:(()=>{const e=T.find(e=>e.value===V);return e?e.icon:""})()})}),e("span",{ref:x,children:e(Do,{disabled:g,iconName:"arrow_down",targetRef:x,iconSize:12,zIndex:2e3,options:T,tooltipTitle:"Border Type",tooltipPlacement:"top",onOptionClick:e=>{let t=e.value;p(w,t,"var(--input-hover-border-color)"),k(t)}})})]})})]})},fw=(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},hw=r.forwardRef(function(t,i){const{className:o,columnLabels:a=[],rowLabels:l=[],toolbar:s,editable:c,onKeyDown:d,Table:u=Ty,Row:f=Dy,sheetHeight:h,HeaderRow:C=Fy,DataEditor:p=$y,DataViewer:m=Ky,onSelect:A=()=>{},onActivate:g=()=>{},onEvaluatedDataChange:v=()=>{},contextOption:y,attachmentAction:w,workRef:E,minimumColumnWidth:b,setContextMenu:M,maxRowLimit:L,maxColLimit:x,disableDeleteOption:H,contextMenu:V,getActiveCell:k,onAddColumn:S,onDeleteColumn:Z}=t,O=32,z=b||100,N=r.useRef(!1),T=Py(e=>e.model.data),[D,F]=r.useState(!1),[R,P]=r.useState(0),[B,j]=r.useState(0),[_,q]=r.useState({top:0,left:0}),[U,W]=r.useState(!1),[X,Q]=r.useState(!1),G=r.useMemo(()=>{const e=t.createFormulaParser||qv,n=new Gv(e,t.data);let r={},i={};t.data.forEach((e,t)=>{let n=O;e.forEach(e=>{if(e){const t=parseFloat(String(e.style?.height).replace("px",""))||O;n=Math.max(n,t)}}),r[t]={top:0,height:n}});const o=t.data[0]?t.data[0].length:0;for(let e=0;e<o;e++){let n=z;t.data.forEach(t=>{const r=t[e];if(r){const e=parseFloat(String(r.style?.width).replace("px",""))||z;n=Math.max(n,e)}}),i[e]={left:0,width:n}}return F(e=>!e),{...yy,model:n,selected:t.selected||yy.selected,rowDimensions:r,columnDimensions:i}},[t.createFormulaParser,t.data,t.selected]),K=r.useReducer(wy,G),[Y,J]=K,$=r.useMemo(()=>function(e,t,n){const{columns:r,rows:i}=rv(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,te]=r.useState({start:0,end:Math.min(20,$.rows)}),[ne,re]=r.useState({start:0,end:Math.min(15,$.columns)}),ie=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.rowDimensions[n]?.height||O;return t},[Y.rowDimensions,O]),oe=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.columnDimensions[n]?.width||z;return t},[Y.columnDimensions,z]),ae=r.useRef(!0);r.useEffect(()=>{ae.current?ae.current=!1:J(function(e){return{type:ug,payload:{minimumColumnWidth:e}}}(b))},[b]);const le=ie($.rows),se=oe($.columns),ce=ie(ee.start),de=le-ie(ee.end),ue=oe(ne.start),fe=se-oe(ne.end),he=Y.mode,Ce=r.useRef(null),pe=e=>r.useCallback((...t)=>J(e(...t)),[e]),me=pe(pg),Ae=pe(Wg),ge=pe(Ug),ve=pe(Qg),ye=pe(Bg),we=pe(jg),Ee=pe(Ng),be=pe(_g),Me=pe(qg),Le=pe(Ig),xe=pe(Tg),He=pe(Dg),Ve=pe(gg),ke=pe(vg),Se=pe(wg),Ze=pe(Mg),Oe=pe(Eg),ze=pe(bg),Ne=pe(yg),Ie=pe(Lg),Te=pe(xg),De=pe(Hg),Fe=pe(Cg),Re=pe(Vg),Pe=pe(kg),Be=pe(Sg),je=pe(Zg),_e=pe(Og),qe=pe(zg);r.useImperativeHandle(i,()=>({removeSelect:ve}));const Ue=r.useRef(Y.active);r.useEffect(()=>{if(Y.active!==Ue.current)if(Y.active)g(Y.active);else{const e=E.current;e&&Nv(e)&&document.activeElement&&document.activeElement.blur()}Ue.current=Y.active},[g,Y.active]);const We=r.useRef(Y.model.evaluatedData);r.useEffect(()=>{Y?.model?.evaluatedData!==We?.current&&v(Y?.model?.evaluatedData),We.current=Y.model.evaluatedData},[Y?.model?.evaluatedData,v]);const Xe=r.useRef(Y.selected);r.useEffect(()=>{Y.selected.equals(Xe.current)||t.selected&&Y.selected.equals(t.selected)||A(Y.selected),Xe.current=Y.selected},[Y.selected,A,t.selected]);const Qe=r.useRef(t.selected);r.useEffect(()=>{t.selected&&Qe.current&&!t.selected.equals(Qe.current)&&He(t.selected),Qe.current=t.selected},[t.selected,He]);let Ge=r.useRef();r.useEffect(()=>{me(c),void 0!==Ge.current&&t.data!==Ge.current&&Le(t.data),Ge.current=t.data},[t.data,Le,c]);const Ke=r.useRef(t.createFormulaParser);r.useEffect(()=>{t.createFormulaParser!==Ke.current&&t.createFormulaParser&&xe(t.createFormulaParser),Ke.current=t.createFormulaParser},[t.createFormulaParser,xe]);const Ye=r.useCallback(e=>{const{model:t,selected:n}=Y,{data:r}=t,i=n.toRange(r);if(i){!function(e,t){e.clipboardData?.setData(yv,t)}(e,Ov(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]=Gg({row:o,column:i},n)}return r}(i.start,i.end,r)))}},[Y]),Je=r.useCallback(e=>{zv(Ce.current,he)&&(e.preventDefault(),e.stopPropagation(),Ye(e),Ae())},[he,Ye,Ae]),$e=r.useCallback(e=>{zv(Ce.current,he)&&(e.preventDefault(),e.stopPropagation(),Ye(e),ge())},[he,Ye,ge]),et=r.useCallback(e=>{if(zv(Ce.current,he)&&(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(yv):""}(e);ye(t)}},[he,ye]),tt=r.useCallback(e=>{e.persist();const t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();t&&"b"===n?(e.preventDefault(),Ve(T)):t&&"i"===n?(e.preventDefault(),ke(T)):t&&"u"===n&&(e.preventDefault(),Se(T)),d&&d(e),e.defaultPrevented||(function(e,t){return void 0!==py(e,t)}(Y,e)&&e.nativeEvent.preventDefault(),we(e))},[Y,d,we]),nt=r.useCallback(()=>{Y.formattedStyle.open&&Y.active&&Fe(Y.active)},[Y]),rt=r.useCallback(()=>{Me(),document.removeEventListener("mouseup",rt)},[Me]),it=r.useCallback(e=>{Y.dragging||1!==e.buttons||"view"!==he||(be(),document.addEventListener("mouseup",rt))},[Y,be,rt,he]),ot=r.useMemo(()=>Gy(t.Cell||Qy),[t.Cell,D,c]),at=r.useMemo(()=>jy(t.CornerIndicator||By),[t.CornerIndicator,D]),lt=r.useMemo(()=>Xy(t.RowIndicator||Wy),[t.RowIndicator,D]),st=r.useMemo(()=>_y(t.ColumnIndicator||qy),[t.ColumnIndicator,D]);r.useEffect(()=>(document.addEventListener("cut",Je),document.addEventListener("copy",$e),document.addEventListener("paste",et),()=>{document.removeEventListener("cut",Je),document.removeEventListener("copy",$e),document.removeEventListener("paste",et)}),[Je,$e,et]);const ct=e=>{const t=new ResizeObserver(e=>{const t=e[0];if(t&&Ce.current){const e=t.target;if(e){const{clientWidth:t,clientHeight:n}=e;j(Math.min(Ce.current.clientHeight,n)),P(Math.min(Ce.current.clientWidth,t))}}}),n=e.current;n&&t.observe(n)},dt=r.useCallback(e=>{const t=e.target,{scrollTop:n,clientHeight:r,scrollLeft:i,clientWidth:o}=t;q({top:n,left:i});let a=0;for(;a<$.rows&&ie(a)<n;)a++;let l=a;for(;l<$.rows&&ie(l)<n+r;)l++;a=Math.max(0,a-10),l=Math.min($.rows,l+10),te({start:a,end:l});const s=l===$.rows;W(s);let c=0;for(;c<$.columns&&oe(c)<i;)c++;let d=c;for(;d<$.columns&&oe(d)<i+o;)d++;c=Math.max(0,c-10),d=Math.min($.columns,d+10),re({start:c,end:d});const u=d===$.columns;Q(u),V.open&&M({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},[$.rows,$.columns,ie,oe]),ut=r.useMemo(()=>fw(dt,16),[dt]),ft=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.rowDimensions?.[n]?.height||O;requestAnimationFrame(()=>{Ce.current&&e>=$.rows-1&&Ce?.current?.scrollTo({top:t+O,behavior:"smooth"})})})},ht=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.columnDimensions?.[n]?.width||z;requestAnimationFrame(()=>{Ce.current&&e>=$.columns-1&&Ce.current.scrollTo({left:t+60,behavior:"smooth"})})})};r.useEffect(()=>{N.current||(te({start:0,end:Math.min(20,$.rows)}),re({start:0,end:Math.min(15,$.columns)}))},[$.rows,$.columns,N.current]);const Ct=wv(ee.end,ee.start),pt=wv(ne.end,ne.start),mt=n("colgroup",{children:[e("col",{style:{width:"60px"}},"row-indicator")," ",e("col",{style:{width:`${ue}px`}},"left-spacer")," ",pt.map(t=>e("col",{style:{width:`${Y.columnDimensions[t]?.width||z}px`}},t)),e("col",{style:{width:`${fe}px`}},"right-spacer")," "]}),At=r.useMemo(()=>n(u,{useTableRef:ct,totalWidth:se,children:[mt,n("tbody",{children:[n(C,{children:[e(at,{}),e("div",{className:"spacer left"}),pt.map(n=>e(st,{column:n,minimumColumnWidth:b,setContextMenu:t.setContextMenu,label:n in a?a[n]:void 0,deleteColumn:qe,addColumnLeft:Be,addColumnRight:je,columnContextEnable:t.columnContextEnable,maxColLimit:x,disableDeleteOption:H,contextMenu:V,onAddColumn:S,onDeleteColumn:Z,setVisibleRange:re,scrollToColumn:ht},n)),e("div",{className:"spacer right"})]}),e("tr",{style:{height:`${ce}px`}}),Ct.map(r=>n(f,{row:r,children:[e(lt,{label:r in l?l?.[r]:void 0,row:r,addRowTop:Re,addRowBottom:Pe,deleteRow:_e,setContextMenu:t.setContextMenu,rowContextEnable:t.rowContextEnable,maxRowLimit:L,disableDeleteOption:H,contextMenu:V,setVisibleRange:te,scrollToRow:ft},r),e("div",{className:"spacer left"}),pt.map(t=>e(ot,{row:r,column:t,DataViewer:m},`${r}-${t}`)),e("div",{className:"spacer right"})]},r)),e("tr",{style:{height:`${de}px`}})]})]}),[u,$.rows,$.columns,f,C,at,a,st,l,lt,ot,m,ee,ne,ce,de,ue,fe,Y.rowDimensions,Y.columnDimensions]),gt=r.useMemo(()=>e(ew,{attachmentAction:w,contextOption:y,getActiveCell:k,setContextMenu:t.setContextMenu,DataEditor:p,visibleRowRange:ee,visibleColRange:ne,maxHeight:B-64,maxWidth:R-b,totalHeight:le,totalWidth:se,isAtBottom:U,isAtRight:X,scrollPos:_,editable:c},Y.active?`${Y.active.row}-${Y.active.column}`:"no-active"),[p,ee,ne,Y.active,B,R,le,se,U,X,c]),vt=r.useMemo(()=>n("div",{className:"ff-excel-spreadsheet-container",children:[e("div",{style:{width:`${R}px`},className:I("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),e("div",{style:{height:`${B}px`},className:I("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(uw,{editable:c,toolbar:s,onBold:Ve,onItalic:ke,setUnderlineType:Se,setColor:Ie,setBorderType:Ne,setFontSize:Oe,setFontFamily:ze,setTextAlign:Ze,setBackgroundColor:Te,setFormatePainter:De})}),n("div",{ref:Ce,style:{height:h},className:I("ff-excel-spreadsheet",o),onKeyPress:Ee,onKeyDown:tt,onClick:nt,onMouseMove:it,onScroll:e=>ut(e),children:[At,gt,e(nw,{scrollPos:_}),e(rw,{scrollPos:_})]})]}),[o,Ee,tt,it,At,gt,R]);return e(Iy.Provider,{value:K,children:vt})}),Cw=({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(Y,{title:i?t.disableTooltip:"",children:n("div",{className:"ff-excel-menu-options "+(i?"disabled":""),onClick:()=>{i||t.action()},children:[t.iconName&&e(q,{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(U,{as:"label",children:t.label})]})},t.label)}var r;return null})})},pw=({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:A=()=>Promise.resolve(),onSaveInfoChange:g,attachmentAction:v={addAttachment:()=>Promise.resolve(""),deleteAttachment:()=>Promise.resolve(""),viewAttachment:()=>Promise.resolve()},onSaveDelay:y=3e3,scroller:w=!1,columnContextEnable:E=!0,rowContextEnable:b=!0,sheetBarContextEnable:M=!0,minimumColumnWidth:L=100,disableDeleteOption:x=!1,maxRowLimit:H=1/0,maxColLimit:V=1/0,maxSheetLimit:k=1/0,getActiveCell:S=()=>{}})=>{const Z=a(null),[O,z]=c([]),[N,T]=c(""),[D,F]=i.useState({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",disable:!1,visible:!1}]}),[R,P]=c({name:"defaultSheet",index:0}),[B,j]=c({defaultSheet:[[Fv]]}),[_,W]=c([[Fv]]),[X,Q]=c((A.length,{})),[G,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),K(t.length)||($.current=t[0]||"",P({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:Fv.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:K(e?.style)?Fv.style:sw(e?.style,L),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||Fv);l[n][r]={...t,value:t?.value??"",readOnly:t?.readOnly?t.readOnly:i,inputType:o,contextDisable:t?.contextDisable}})}),n[t]=l,A.length>1){const e=i[0]||[];r[t]=Array.from({length:a},(t,n)=>({newData:"",oldData:e[n]?.value||""}))}}),j(n),A.length>1&&Q(r);const i=Object.keys(n)[0];i&&void 0!==n[i]&&W(n[i])}},[r]),l(()=>{g&&g(N),"File saved"===N&&setTimeout(()=>{T("")},2e3)},[N]),l(()=>{T("Saving..."),re(oe())},[B,$.current]);const re=i.useCallback(Ys(e=>{if(A.length>1){const t={...X};O.forEach((n,r)=>{const i=(e[r].data[0]||[]).map(e=>e?.value||"");t[n]=(t[n]||[]).map((e,t)=>({...e,newData:i[t]||""}))}),Q(t);const n=O.map(e=>({sheetName:e,headers:t[e]||[]}));A(e,n)}else A(e);T("File saved")},y),[A,X,O]),ie=i.useCallback(e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),re(oe()))},[A]);i.useEffect(()=>(document.addEventListener("keydown",ie),()=>{document.removeEventListener("keydown",ie)}),[ie]);const oe=()=>O.map(e=>{const t=B[e]?.map(e=>{const t=e.reduce((e,t,n)=>{const r=""!==String(t?.value??"").trim(),i=t?.style?.width,o=t?.style?.height;return r||(void 0!==i&&i!==L||void 0!==o&&32!==o)?n:e},-1),n=e.map((e,n)=>e&&e.style&&n<=t?{value:e.value,style:dw(e.style,L),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:K(n.length)?[[]]:n}}),[ae,le]=c(null),se=()=>O.length>=k,ce=()=>{if(se())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",O),t=Array.from({length:u},()=>Array.from({length:f},()=>Fv));z(t=>[...t,e]),P({index:O?.length,name:e}),j({...B,[e]:t}),W(t),A.length>1&&Q(t=>({...t,[e]:Array.from({length:f},()=>({newData:"",oldData:""}))})),$.current=e},de=(e=[[Fv]])=>{W(e)},ue=(e,t,n)=>{const r=e.target;if(!r||r?.textContent?.trim()===n?.trim())return void le(null);const i=(r.textContent||"").trim();if(!i)return cc.warning("Sheet name cannot be empty."),r.textContent=R.name,void le(null);if(i.length>50)return cc.warning("The sheet name cannot be greater than 50 characters"),r.textContent=R.name,void le(null);if(O.map(e=>e.toLowerCase()).includes(i.toLowerCase())&&n.trim()?.toLowerCase()!==i?.toLowerCase())return cc.warning("Sheet name already exists"),r.textContent=R.name,void le(null);let o=O;de(B?.[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??[]}}(B,n,i);$.current=i,P(e=>({...e,name:i})),j(a),A.length>1&&Q(e=>{const t={...e},r=t[n];return delete t[n],t[i]=r??[],t}),le(null)};const fe=(e,t)=>{e!==R.name&&t!==R.index&&(P({index:t,name:e}),z(n=>{const r=[...n];return r[t]=e,r}),de(B[e]),$.current=e)},he=i.useCallback((e,t=!1)=>{const n=e.target;(!n.closest(".ff-excel-tab-list")&&!n.closest(".ff-excel-sheet")||t)&&D.open&&(F({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]}),t||(e.preventDefault(),e.stopPropagation()))},[D.open]);i.useEffect(()=>(document.addEventListener("contextmenu",he),document.addEventListener("click",e=>he(e,!0)),()=>{document.removeEventListener("contextmenu",he),document.removeEventListener("click",e=>he(e,!0))}),[he]);const Ce=(e,t,n)=>{e.preventDefault();const r=[{label:"Add Sheet",value:"Add Sheet",iconName:"plus_icon",action:()=>ce(),disableTooltip:"Sheet limit reached",visible:!1,disable:se()},...x?[]:[{label:"Delete Sheet",value:"Delete Sheet",iconName:"delete",action:()=>((e,t)=>{if(O.length>1){let n=O.slice();n.splice(t,1);const r={...B};delete r[e];const i=Math.min(t,n.length-1);z(n),j(r),A.length>1&&Q(t=>{const n={...t};return delete n[e],n});const o=n[i]?n[i]:"";P({index:i,name:o}),de(r?.[o]),$.current=o}else cc.warning("Cannot delete the last sheet.")})(t,n),disableTooltip:"",visible:!1,disable:!1}]];F(e=>({...e,open:!0,contextType:"sheet",options:r}))};l(()=>{ne.current?.removeSelect()},[R.name]);return e(t,{children:O.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-(x?32:65)}):(i+a>l&&(i=l-a-2),i<0&&(i=2),J({x:i+m,y:o+p}))},onClick:e=>{e.stopPropagation(),D.open&&F({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(hw,{ref:ne,editable:C,attachmentAction:v,toolbar:s,sheetHeight:h,setContextMenu:F,contextOption:o,data:_,columnContextEnable:E,rowContextEnable:b,minimumColumnWidth:L,onEvaluatedDataChange:e=>{j(t=>({...t,[$.current]:e}))},workRef:ee,scroller:w,maxRowLimit:H,maxColLimit:V,disableDeleteOption:x,contextMenu:D,getActiveCell:S,onAddColumn:(e,t)=>{A.length>1&&Q(n=>{const r=R.name,i=[...n[r]||[]],o=t?e:e+1;return i.splice(o,0,{newData:"",oldData:""}),{...n,[r]:i}})},onDeleteColumn:e=>{A.length>1&&Q(t=>{const n=R.name,r=[...t[n]||[]];return r.splice(e,1),{...t,[n]:r}})}},R.name)}),"hide"!==d&&n("div",{className:"ff-excel-sheet-bar",children:["show"===d&&n("div",{className:"ff-excel-add-sheet-set",children:[e(Y,{title:se()?"Sheet limit reached":"Add Sheet",placement:"top",children:e(q,{disabled:!C||se(),className:"ff-excel-add-sheet-icon",hoverEffect:!0,onClick:ce,name:"plus_icon",height:20,width:20})}),e(Do,{options:(t=>t.map((t,r)=>({label:n("div",{style:{display:"flex",gap:"8px"},children:[R?.name===t?e(q,{height:16,width:16,name:"tick"}):e("div",{style:{height:"16px",width:"24px"}}),e(Y,{title:Hn(t,20,"count")?t:"",children:e(U,{children:xn(t,20,"count")})})]}),name:r,value:t})))(O),targetRef:Z,onOptionClick:e=>{const{value:t,name:n=""}=e;fe(t,parseInt(n))},dropdownPlacement:"top",iconName:"show_script",tooltipTitle:"All Sheets",tooltipPlacement:"top",dropdownHeight:215,selectedValue:R.name})]}),e("div",{className:"ff-excel-tab-container",children:O.map((t,n)=>e(U,{lineHeight:"16px",children:e("div",{onContextMenu:e=>{fe(t,n),M&&Ce(e,t,n)},className:I("ff-excel-tab-list",{active:t===R.name}),onClick:()=>{fe(t,n)},suppressContentEditableWarning:ae===n,onDoubleClick:e=>{"show"===d&&(le(n),null===ae&&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&&ae===n,onBlur:e=>{ue(e,n,t)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ue(e,n,t))},children:t})},t))})]}),D.open&&e(Cw,{contextMenu:D,position:G,editable:C}),e(sc,{})]})})},mw=({label:t="",isActive:n=!0,onClick:r=()=>{},isFilterChip:i=!1})=>{const o=i?"filter":"module";return e("div",{className:I("ff-module-chip",{"ff-filter-chip":i,[`ff-${o}-chip--active`]:n,[`ff-${o}-chip--hover`]:!n}),onClick:r,children:e(U,{lineHeight:"18px",className:"module-typography",children:t})})},Aw=({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}`},gw=({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}),[A,g]=c(!1),v=a(null);let y=-Math.PI/2;const w=2*(t+r),{backgroundArcPath:E,foregroundArcPath:b}=((e,t,n)=>{const r=t,i=r+Math.max(0,Math.min(e,100))/100*2*Math.PI;return{backgroundArcPath:Aw({x:0,y:0,radius:n,startAngle:0,endAngle:2*Math.PI}),foregroundArcPath:Aw({x:0,y:0,radius:n,startAngle:r,endAngle:i})}})(o,y,t),M=()=>{g(!0)},L=()=>{m({x:0,y:0}),g(!1)},x=e=>{if(v.current){const t=v.current.getBoundingClientRect();m({x:e.clientX-t.left,y:e.clientY-t.top})}};return n("div",{ref:v,className:"ff-icon-radial-chart-container",style:{"--fontSize":`${s}px`},onClick:C,children:[e("svg",{width:w,height:w,viewBox:`0 0 ${w} ${w}`,role:"img",children:n("g",{transform:`translate(${t+r}, ${t+r})`,children:[e("path",{d:E,fill:"none",stroke:f,strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:x}),e("path",{d:b,fill:"none",stroke:u,strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:x}),h&&e("path",{d:b,fill:"none",stroke:"var(--dotted-border-color)",strokeOpacity:"0.4",strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:x}),l?e("foreignObject",{x:"-10",y:"-10",width:"20",height:"20",children:e(q,{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)}%`})]})}),A&&n("div",{className:"ff-icon-radial-chart-tooltip",style:{position:"absolute",left:`${p.x+15}px`,top:p.y-5+"px"},children:[e(U,{children:`${i} : `}),n(U,{children:[o,"%"]})]})]})},vw=({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(Y,{title:"Download File",placement:"bottom",children:e(q,{name:"download_file_icon",height:10,width:10,onClick:a,color:"var(--icons-default-color)"})})}),u&&e("div",{className:"ff-icon-container",children:e(Y,{title:"Delete",placement:"bottom",children:e(q,{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(Y,{title:"Maximize",placement:"bottom",children:e(q,{name:"expand_icon",height:16,width:16,onClick:i})})})]}),e(U,{color:"var(--text-area-default-color)",fontWeight:"medium",className:"ff-media-text",children:c})]})}),yw=({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(q,{name:r,height:20,width:20,hoverEffect:!1})}),!C.includes(i.toLowerCase())&&e(U,{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(U,{fontWeight:"semi-bold",fontSize:"10px",className:"ff-text",lineHeight:"15px",color:"var(--ff-chip-text-color)",children:a}),e(U,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"36px",children:"defect density"===i.toLowerCase()?n(t,{children:[o.toString().padStart(2,"0"),e(U,{fontSize:"15px",fontWeight:"semi-bold",children:"/ Modules"})]}):"quality score"===i.toLowerCase()?`${parseFloat(o.toString()).toFixed(2)}%`:o.toString().padStart(2,"0")})]}:{children:[e(U,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"24px",color:f?"var(--base-bg-color)":"",children:o.toString().padStart(2,"0")}),e(U,{className:"ff-text",lineHeight:"18px",color:f?"var(--base-bg-color)":"var(--ff-chip-text-color)",children:a})]})})]})},ww=({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(Y,{title:i?d(t):"",style:{width:"calc(100% - 32px)"},children:e("span",{ref:r,className:"ff-truncated_text",children:d(t)})}),e(q,{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})]})};function Ew(e){return()=>e}function bw(e){e()}function Mw(e,t){return n=>e(t(n))}function Lw(e,t){return()=>e(t)}function xw(e){return void 0!==e}function Hw(){}function Vw(e,t){return t(e),e}function kw(e,t){return t(e)}function Sw(...e){return e}function Zw(e,t){return e(1,t)}function Ow(e,t){e(0,t)}function zw(e){e(2)}function Nw(e){return e(4)}function Iw(e,t){return Zw(e,function(e,t){return n=>e(t,n)}(t,0))}function Tw(e,t){const n=e(1,e=>{n(),t(e)});return n}function Dw(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Fw(e,t){return e===t}function Rw(e=Fw){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Pw(e){return t=>n=>{e(n)&&t(n)}}function Bw(e){return t=>Mw(t,e)}function jw(e){return t=>()=>{t(e)}}function _w(e,...t){const n=function(...e){return t=>e.reduceRight(kw,t)}(...t);return(t,r)=>{switch(t){case 2:return void zw(e);case 1:return Zw(e,n(r))}}}function qw(e,t){return n=>r=>{n(t=e(t,r))}}function Uw(e){return t=>n=>{e>0?e--:t(n)}}function Ww(e){let t,n=null;return r=>i=>{n=i,!t&&(t=setTimeout(()=>{t=void 0,r(n)},e))}}function Xw(...e){const t=new Array(e.length);let n=0,r=null;const i=2**e.length-1;return e.forEach((e,o)=>{const a=2**o;Zw(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 Qw(e){let t=e;const n=Kw();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function Gw(e,t){return Vw(Qw(t),t=>Iw(e,t))}function Kw(){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 Yw(e){return Vw(Kw(),t=>Iw(e,t))}function Jw(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:$w(),singleton:n}}const $w=()=>Symbol();function eE(...e){const t=Kw(),n=new Array(e.length);let r=0;const i=2**e.length-1;return e.forEach((e,o)=>{const a=2**o;Zw(e,e=>{n[o]=e,r|=a,r===i&&Ow(t,n)})}),function(e,o){switch(e){case 2:return void zw(t);case 1:return r===i&&o(n),Zw(t,o)}}}function tE(e,t=Fw){return _w(e,Rw(t))}function nE(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(bw)}}(...e.map(e=>Zw(e,n)))}}}const rE=0,iE=1,oE=2,aE=3,lE={[rE]:"debug",[aE]:"error",[iE]:"log",[oE]:"warn"},sE=Jw(()=>{const e=Qw(aE);return{log:Qw((t,n,r=iE)=>{r>=((typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL??Nw(e))&&console[lE[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function cE(e,t,n){return dE(e,t,n).callbackRef}function dE(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?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:o,ref:r}}function uE(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},aE),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(;void 0===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}),a?.(s?fE("column-gap",getComputedStyle(n).columnGap,o):fE("row-gap",getComputedStyle(n).rowGap,o)),null!==i&&e(i)},[e,t,o,a,l,r,s]);return dE(d,n,c)}function fE(e,t,n){return"normal"!==t&&!0!==t?.endsWith("px")&&n(`${e} was not resolved to pixel value correctly`,t,oE),"normal"===t?0:parseInt(t??"0",10)}function hE(e,t,n){const r=i.useRef(null),o=i.useCallback(n=>{if(!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}=dE(o,!0,n),s=i.useCallback(()=>{o(l.current)},[o,l]);return i.useEffect(()=>{if(t){t.addEventListener("scroll",s);const e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener("scroll",s),e.unobserve(t)}}const e=l.current?.ownerDocument.defaultView;return e?.addEventListener("scroll",s),e?.addEventListener("resize",s),()=>{e?.removeEventListener("scroll",s),e?.removeEventListener("resize",s)}},[s,t,l]),a}const CE=Jw(()=>{const e=Kw(),t=Kw(),n=Qw(0),r=Kw(),i=Qw(0),o=Kw(),a=Kw(),l=Qw(0),s=Qw(0),c=Qw(0),d=Qw(0),u=Kw(),f=Kw(),h=Qw(!1),C=Qw(!1),p=Qw(!1);return Iw(_w(e,Bw(({scrollTop:e})=>e)),t),Iw(_w(e,Bw(({scrollHeight:e})=>e)),a),Iw(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}),pE={lvl:0};function mE(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 AE(e){return e===pE}function gE(e,t){if(!AE(e))return t===e.k?e.v:t<e.k?gE(e.l,t):gE(e.r,t)}function vE(e,t,n="k"){if(AE(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=vE(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return vE(e.l,t,n)}function yE(e,t,n){return AE(e)?ZE(t,n,1):t===e.k?HE(e,{k:t,v:n}):t<e.k?OE(HE(e,{l:yE(e.l,t,n)})):OE(HE(e,{r:yE(e.r,t,n)}))}function wE(){return pE}function EE(e,t,n){if(AE(e))return[];return function(e){return mE(e,({k:e,v:t})=>({index:e,value:t}))}(LE(e,vE(e,t)[0],n))}function bE(e,t){if(AE(e))return pE;const{k:n,l:r,r:i}=e;if(t===n){if(AE(r))return i;if(AE(i))return r;const[t,n]=SE(r);return xE(HE(e,{k:t,l:VE(r),v:n}))}return xE(HE(e,t<n?{l:bE(r,t)}:{r:bE(i,t)}))}function ME(e){return AE(e)?[]:[...ME(e.l),{k:e.k,v:e.v},...ME(e.r)]}function LE(e,t,n){if(AE(e))return[];const{k:r,l:i,r:o,v:a}=e;let l=[];return r>t&&(l=l.concat(LE(i,t,n))),r>=t&&r<=n&&l.push({k:r,v:a}),r<=n&&(l=l.concat(LE(o,t,n))),l}function xE(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(kE(t))return zE(HE(e,{lvl:n-1}));if(!AE(t)&&!AE(t.r))return HE(t.r,{l:HE(t,{r:t.r.l}),lvl:n,r:HE(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(kE(e))return NE(HE(e,{lvl:n-1}));if(!AE(r)&&!AE(r.l)){const t=r.l,i=kE(t)?r.lvl-1:r.lvl;return HE(t,{l:HE(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:NE(HE(r,{l:t.r,lvl:i}))})}throw new Error("Unexpected empty nodes")}function HE(e,t){return ZE(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 VE(e){return AE(e.r)?e.l:xE(HE(e,{r:VE(e.r)}))}function kE(e){return AE(e)||e.lvl>e.r.lvl}function SE(e){return AE(e.r)?[e.k,e.v]:SE(e.r)}function ZE(e,t,n,r=pE,i=pE){return{k:e,l:r,lvl:n,r:i,v:t}}function OE(e){return NE(zE(e))}function zE(e){const{l:t}=e;return AE(t)||t.lvl!==e.lvl?e:HE(t,{r:HE(e,{l:t.r})})}function NE(e){const{lvl:t,r:n}=e;return AE(n)||AE(n.r)||n.lvl!==t||n.r.lvl!==t?e:HE(n,{l:HE(e,{r:n.l}),lvl:t+1})}function IE(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function TE(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const DE=Jw(()=>({recalcInProgress:Qw(!1)}),[],{singleton:!0});function FE(e,t,n){return e[RE(e,t,n)]}function RE(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 PE(e,t){return Math.round(e.getBoundingClientRect()[t])}function BE(e){return!AE(e.groupOffsetTree)}function jE({index:e},t){return t===e?0:t<e?-1:1}function _E({offset:e},t){return t===e?0:t<e?-1:1}function qE(e,t,n){if(0===t.length)return 0;const{index:r,offset:i,size:o}=FE(t,e,jE),a=e-r,l=o*a+(a-1)*n+i;return l>0?l+n:l}function UE(e,t){if(!BE(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function WE(e,t,n){if(function(e){return typeof e.groupIndex<"u"}(e))return t.groupIndices[e.groupIndex]+1;let r=UE("LAST"===e.index?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function XE(e,t,n,r=0){return r>0&&(t=Math.max(t,FE(e,r,jE).offset)),mE(function(e,t,n,r){const i=RE(e,t,r),o=RE(e,n,r,i);return e.slice(i,o+1)}(e,t,n,_E),YE)}function QE(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,rE);const o=e.sizeTree;let a=o,l=0;if(n.length>0&&AE(o)&&2===t.length){const e=t[0].size,r=t[1].size;a=n.reduce((t,n)=>yE(yE(t,n,e),n+1,r),a)}else[a,l]=function(e,t){let n=AE(e)?0:1/0;for(const r of t){const{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),AE(e)){e=yE(e,0,i);continue}const a=EE(e,o-1,t+1);if(a.some(JE(r)))continue;let l=!1,s=!1;for(const{end:n,start:r,value:o}of a)l?(t>=r||i===o)&&(e=bE(e,r)):(s=o!==i,l=!0),n>t&&t>=r&&o!==i&&(e=yE(e,t+1,o));s&&(e=yE(e,o,i))}return[e,n]}(a,t);if(a===o)return e;const{lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u}=KE(e.offsetTree,l,a,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>yE(e,t,qE(t,u,i)),wE()),lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:a}}function GE(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 KE(e,t,n,r){let i=e,o=0,a=0,l=0,s=0;if(0!==t){s=RE(i,t-1,jE),l=i[s].offset;const e=vE(n,t-1);o=e[0],a=e[1],i.length&&i[s].size===vE(n,t)[1]&&(s-=1),i=i.slice(0,s+1)}else i=[];for(const{start:e,value:s}of EE(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 YE(e){return{index:e.index,value:e}}function JE(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 $E={offsetHeight:"height",offsetWidth:"width"},eb=Jw(([{log:e},{recalcInProgress:t}])=>{const n=Kw(),r=Kw(),i=Gw(r,0),o=Kw(),a=Kw(),l=Qw(0),s=Qw([]),c=Qw(void 0),d=Qw(void 0),u=Qw(void 0),f=Qw(void 0),h=Qw((e,t)=>PE(e,$E[t])),C=Qw(void 0),p=Qw(0),m={groupIndices:[],groupOffsetTree:wE(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:wE()},A=Gw(_w(n,Xw(s,e,p),qw(QE,m),Rw()),m),g=Gw(_w(s,Rw(),qw((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),Bw(({prev:e})=>e)),[]);Iw(_w(s,Pw(e=>e.length>0),Xw(A,p),Bw(([e,t,n])=>{const r=e.reduce((e,r,i)=>yE(e,r,qE(r,t.offsetTree,n)||i),wE());return{...t,groupIndices:e,groupOffsetTree:r}})),A),Iw(_w(r,Xw(A),Pw(([e,{lastIndex:t}])=>e<t),Bw(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),Iw(c,d);const v=Gw(_w(c,Bw(e=>void 0===e)),!0);Iw(_w(d,Pw(e=>void 0!==e&&AE(Nw(A).sizeTree)),Bw(e=>{const t=Nw(u),n=Nw(s).length>0;return void 0!==t&&0!==t?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),Iw(_w(f,Pw(e=>void 0!==e&&e.length>0&&AE(Nw(A).sizeTree)),Bw(e=>{const t=[];let n=e[0],r=0;for(let i=1;i<e.length;i++){const o=e[i];o!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=o,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),Iw(_w(s,Xw(u,d),Pw(([,e,t])=>void 0!==e&&void 0!==t),Bw(([e,t,n])=>{const r=[];for(let i=0;i<e.length;i++){const o=e[i],a=e[i+1];r.push({startIndex:o,endIndex:o,size:t}),void 0!==a&&r.push({startIndex:o+1,endIndex:a-1,size:n})}return r})),n);const y=Yw(_w(n,Xw(A),qw(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:m}),Bw(e=>e.changed)));Zw(_w(l,qw((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),Bw(e=>e.diff)),e=>{const{groupIndices:n}=Nw(A);if(e>0)Ow(t,!0),Ow(o,e+GE(e,n));else if(e<0){const t=Nw(g);t.length>0&&(e-=GE(-e,t)),Ow(a,e)}}),Zw(_w(l,Xw(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},aE)});const w=Yw(o);Iw(_w(o,Xw(A),Bw(([e,t])=>{const n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){const n=gE(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=ME(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 ME(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 E=Yw(_w(a,Xw(A,p),Bw(([e,{offsetTree:t},n])=>qE(-e,t,n))));return Iw(_w(a,Xw(A,p),Bw(([e,t,n])=>{if(t.groupIndices.length>0){if(AE(t.sizeTree))return t;let r=wE();const i=Nw(g);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=ME(t.sizeTree).reduce((t,{k:n,v:r})=>yE(t,Math.max(0,n+e),r),r),o!==-e){r=yE(r,0,gE(t.sizeTree,l));r=yE(r,1,vE(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...KE(t.offsetTree,0,r,n)}}const r=ME(t.sizeTree).reduce((t,{k:n,v:r})=>yE(t,Math.max(0,n+e),r),wE());return{...t,sizeTree:r,...KE(t.offsetTree,0,r,n)}})),A),{beforeUnshiftWith:w,data:C,defaultItemSize:d,firstItemIndex:l,fixedItemSize:c,fixedGroupSize:u,gap:p,groupIndices:s,heightEstimates:f,itemSize:h,listRefresh:y,shiftWith:a,shiftWithOffset:E,sizeRanges:n,sizes:A,statefulTotalCount:i,totalCount:r,trackItemSizes:v,unshiftWith:o}},Sw(sE,DE),{singleton:!0});function tb(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}const nb=Jw(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{const o=Kw(),a=Kw(),l=Yw(_w(o,Bw(tb)));return Iw(_w(l,Bw(e=>e.totalCount)),n),Iw(_w(l,Bw(e=>e.groupIndices)),e),Iw(_w(eE(i,t,r),Pw(([e,t])=>BE(t)),Bw(([e,t,n])=>vE(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),Rw(),Bw(e=>[e])),a),{groupCounts:o,topItemsIndexes:a}},Sw(eb,CE)),rb=Jw(([{log:e}])=>{const t=Qw(!1),n=Yw(_w(t,Pw(e=>e),Rw()));return Zw(t,t=>{t&&Nw(e)("props updated",{},rE)}),{didMount:n,propsReady:t}},Sw(sE),{singleton:!0}),ib=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function ob(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!ib)&&(t.behavior="auto"),void 0===t.offset&&(t.offset=0),t}const ab=Jw(([{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=Kw(),C=Kw(),p=Qw(0);let m=null,A=null,g=null;function v(){null!==m&&(m(),m=null),null!==g&&(g(),g=null),A&&(clearTimeout(A),A=null),Ow(s,!1)}return Iw(_w(h,Xw(n,u,r,p,l,a,f),Xw(e,o,i),Bw(([[e,n,r,i,o,a,l,c],u,f,p])=>{const y=ob(e),{align:w,behavior:E,offset:b}=y,M=i-1,L=WE(y,n,M);let x=qE(L,n.offsetTree,u)+a;"end"===w?(x+=f+vE(n.sizeTree,L)[1]-r+p,L===M&&(x+=l)):"center"===w?x+=(f+vE(n.sizeTree,L)[1]-r+p)/2:x-=o,void 0!==b&&0!==b&&(x+=b);const H=t=>{v(),t?(c("retrying to scroll to",{location:e},rE),Ow(h,e)):(Ow(C,!0),c("list did not change, scroll successful",{},rE))};if(v(),"smooth"===E){let e=!1;g=Zw(t,t=>{e=e||t}),m=Tw(d,()=>{H(e)})}else m=Tw(_w(t,function(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),H);return A=setTimeout(()=>{v()},1200),Ow(s,!0),c("scrolling from index to",{behavior:E,index:L,top:x},rE),{behavior:E,top:x}})),c),{scrollTargetReached:C,scrollToIndex:h,topListHeight:p}},Sw(eb,CE,sE),{singleton:!0});function lb(e,t){0===e?t():requestAnimationFrame(()=>{lb(e-1,t)})}function sb(e,t){const n=t-1;return"number"==typeof e?e:"LAST"===e.index?n:e.index}const cb=Jw(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:a}])=>{const l=Qw(!0),s=Qw(0),c=Qw(!0);return Iw(_w(a,Xw(s),Pw(([e,t])=>0!==t),jw(!1)),l),Iw(_w(a,Xw(s),Pw(([e,t])=>0!==t),jw(!1)),c),Zw(_w(eE(t,a),Xw(l,n,e,c),Pw(([[,e],t,{sizeTree:n},r,i])=>e&&(!AE(n)||xw(r))&&!t&&!i),Xw(s)),([,e])=>{Tw(i,()=>{Ow(c,!0)}),lb(4,()=>{Tw(r,()=>{Ow(l,!0)}),Ow(o,e)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:s,scrolledToInitialItem:l}},Sw(eb,CE,ab,rb),{singleton:!0});function db(e,t){return Math.abs(e-t)<1.01}const ub="up",fb="down",hb={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Cb=Jw(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{const a=Qw(!1),l=Qw(!0),s=Kw(),c=Kw(),d=Qw(4),u=Qw(0),f=Gw(_w(nE(_w(tE(i),Uw(1),jw(!0)),_w(tE(i),Uw(1),jw(!1),Dw(100))),Rw()),!1),h=Gw(_w(nE(_w(n,jw(!0)),_w(n,jw(!1),Dw(200))),Rw()),!1);Iw(_w(eE(tE(i),tE(u)),Bw(([e,t])=>e<=t),Rw()),l),Iw(_w(l,Ww(50)),c);const C=Yw(_w(eE(r,tE(o),tE(t),tE(e),tE(d)),qw((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}},hb),Rw((e,t)=>void 0!==e&&e.atBottom===t.atBottom))),p=Gw(_w(r,qw((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!db(e.scrollHeight,t)){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}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Pw(e=>e.changed),Bw(e=>e.jump)),0);Iw(_w(C,Bw(e=>e.atBottom)),a),Iw(_w(a,Ww(50)),s);const m=Qw(fb);Iw(_w(r,Bw(({scrollTop:e})=>e),Rw(),qw((e,t)=>Nw(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?ub:fb,prevScrollTop:t},{direction:fb,prevScrollTop:0}),Bw(e=>e.direction)),m),Iw(_w(r,Ww(50),jw("none")),m);const A=Qw(0);return Iw(_w(f,Pw(e=>!e),jw(0)),A),Iw(_w(i,Ww(100),Xw(f),Pw(([e,t])=>t),qw(([e,t],[n])=>[t,n],[0,0]),Bw(([e,t])=>t-e)),A),{atBottomState:C,atBottomStateChange:s,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:a,isAtTop:l,isScrolling:f,lastJumpDueToItemResize:p,scrollDirection:m,scrollVelocity:A}},Sw(CE)),pb="top",mb="bottom",Ab="none";function gb(e,t,n){return"number"==typeof e?n===ub&&t===pb||n===fb&&t===mb?e:0:n===ub?t===pb?e.main:e.reverse:t===mb?e.main:e.reverse}function vb(e,t){return"number"==typeof e?e:e[t]??0}const yb=Jw(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const o=Kw(),a=Qw(0),l=Qw(0),s=Qw(0);return{increaseViewportBy:l,listBoundary:o,overscan:s,topListHeight:a,visibleRange:Gw(_w(eE(tE(r),tE(i),tE(n),tE(o,TE),tE(s),tE(a),tE(t),tE(e),tE(l)),Bw(([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=Ab;const C=vb(c,pb),p=vb(c,mb);return r-=s,i+=n+l,(r+=n+l)>e+u-C&&(h=ub),(i-=s)<e-f+t+p&&(h=fb),h!==Ab?[Math.max(d-n-gb(o,pb,h)-C,0),d-f-l+t+gb(o,mb,h)+p]:null}),Pw(e=>null!==e),Rw(TE)),[0,0])}},Sw(CE),{singleton:!0});const wb={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Eb(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:Mb(e,i,o),offsetBottom:h,offsetTop:c,top:f,topItems:Mb(t,i,o),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function bb(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=sb(t,l);return Eb(Array.from({length:l}).map((e,t)=>({data:o[t+s],index:t+s,offset:0,size:0})),[],l,i,n,r)}function Mb(e,t,n){if(0===e.length)return[];if(!BE(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=EE(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}function Lb(e,t){return void 0===e?0:"number"==typeof e?e:e[t]??0}const xb=Jw(([{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=Qw([]),m=Qw(0),A=Kw(),g=Qw(0);Iw(o.topItemsIndexes,p);const v=Gw(_w(eE(h,C,tE(s,TE),tE(i),tE(r),tE(c),d,tE(p),tE(t),tE(n),tE(g),e),Pw(([e,t,,n,,,,,,,,r])=>{const i=void 0!==r&&r.length!==n;return e&&!t&&!i}),Bw(([,,[e,t],n,r,i,o,a,l,s,c,d])=>{const u=r,{offsetTree:f,sizeTree:h}=u,C=Nw(m);if(0===n)return{...wb,totalCount:n};if(0===e&&0===t)return 0===C?{...wb,totalCount:n}:bb(C,i,r,l,s,d||[]);if(AE(h))return C>0?null:Eb(function(e,t,n){if(BE(t)){const r=UE(e,t);return[{index:vE(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}(sb(i,n),u,d),[],n,s,u,l);const p=[];if(a.length>0){const e=a[0],t=a[a.length-1];let n=0;for(const r of EE(h,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++)p.push({data:d?.[e],index:e,offset:n,size:i}),n+=i}}if(!o)return Eb([],p,n,s,u,l);const A=a.length>0?a[a.length-1]+1:0,g=XE(f,e,t,A);if(0===g.length)return null;const v=n-1,y=Vw([],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<A&&(o+=(A-a)*l,a=A);const c=Math.min(r.end,v);for(let e=a;e<=c&&!(o>=t);e++)n.push({data:d?.[e],index:e,offset:o,size:l}),o+=l+s}}),w=Lb(c,pb),E=Lb(c,mb);if(y.length>0&&(w>0||E>0)){const e=y[0],t=y[y.length-1];if(w>0&&e.index>A){const t=Math.min(w,e.index-A),n=[];let r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){const t=EE(h,i,i)[0]?.value??e.size;r-=t+s,n.unshift({data:d?.[i],index:i,offset:r,size:t})}y.unshift(...n)}if(E>0&&t.index<v){const e=Math.min(E,v-t.index);let n=t.offset+t.size+s;for(let r=t.index+1;r<=t.index+e;r++){const e=EE(h,r,r)[0]?.value??t.size;y.push({data:d?.[r],index:r,offset:n,size:e}),n+=e+s}}}return Eb(y,p,n,s,u,l)}),Pw(e=>null!==e),Rw()),wb);Iw(_w(e,Pw(xw),Bw(e=>e?.length)),i),Iw(_w(v,Bw(e=>e.topListHeight)),u),Iw(u,l),Iw(_w(v,Bw(e=>[e.top,e.bottom])),a),Iw(_w(v,Bw(e=>e.items)),A);const y=Yw(_w(v,Pw(({items:e})=>e.length>0),Xw(i,e),Pw(([{items:e},t])=>e[e.length-1].originalIndex===t-1),Bw(([,e,t])=>[e-1,t]),Rw(TE),Bw(([e])=>e))),w=Yw(_w(v,Ww(200),Pw(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),Bw(({items:e})=>e[0].index),Rw())),E=Yw(_w(v,Pw(({items:e})=>e.length>0),Bw(({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}}),Rw(IE)));return{endReached:y,initialItemCount:m,itemsRendered:A,listState:v,minOverscanItemCount:g,rangeChanged:E,startReached:w,topItemsIndexes:p,...f}},Sw(eb,nb,yb,cb,ab,Cb,rb,DE),{singleton:!0}),Hb=Jw(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const o=Kw(),a=Gw(_w(eE(n,e,r,t,i),Bw(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return Iw(tE(a),o),{totalListHeight:a,totalListHeightChanged:o}},Sw(CE,xb),{singleton:!0}),Vb=Jw(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Qw(!1);return{alignToBottom:n,paddingTopAddition:Gw(_w(eE(n,e,t),Pw(([e])=>e),Bw(([,e,t])=>Math.max(0,e-t)),Ww(0),Rw()),0)}},Sw(CE,Hb),{singleton:!0}),kb=Jw(()=>({context:Qw(null)})),Sb=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:a})=>t<a?{...i,align:n??"start",...void 0!==r?{behavior:r}:{}}:e>o?{...i,align:n??"end",...void 0!==r?{behavior:r}:{}}:null,Zb=Jw(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:a,scrollTop:l,viewportHeight:s},{scrollToIndex:c}])=>{const d=Kw();return Iw(_w(d,Xw(t,s,n,o,i,r,l),Xw(e),Bw(([[e,t,n,r,i,o,l,s],c])=>{const{calculateViewLocation:d=Sb,done:u,...f}=e,h=WE(e,t,r-1),C=qE(h,t.offsetTree,c)+i+o,p=d({itemBottom:C+vE(t.sizeTree,h)[1],itemTop:C,locationParams:f,viewportBottom:s+n-l,viewportTop:s+o});return null!==p?u&&Tw(_w(a,Pw(e=>!e),Uw(Nw(a)?1:2)),u):u?.(),p}),Pw(e=>null!==e)),c),{scrollIntoView:d}},Sw(eb,CE,ab,xb,sE),{singleton:!0});function Ob(e){return!1!==e&&("smooth"===e?"smooth":"auto")}const zb=Jw(([{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=Qw(!1),p=Kw();let m=null;function A(e){Ow(a,{align:"end",behavior:e,index:"LAST"})}function g(e){const t=Tw(i,t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&null===m&&(Nw(d)("scrolling to bottom due to increased size",{},rE),A("auto"))});setTimeout(t,100)}Zw(_w(eE(_w(tE(t),Uw(1)),s),Xw(tE(C),o,l,u),Bw(([[e,t],n,r,i,o])=>{let a=t&&i,l="auto";return a&&(l=((e,t)=>"function"==typeof e?Ob(e(t)):t&&Ob(e))(n,r||o),a=a&&!1!==l),{followOutputBehavior:l,shouldFollow:a,totalCount:e}}),Pw(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{null!==m&&(m(),m=null),void 0!==Nw(n)?requestAnimationFrame(()=>{Nw(d)("following output to ",{totalCount:r},rE),A(t)}):m=Tw(e,()=>{Nw(d)("following output to ",{totalCount:r},rE),A(t),m=null})}),Zw(_w(eE(tE(C),t,c),Pw(([e,,t])=>!1!==e&&t),qw(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),Pw(({refreshed:e})=>e),Xw(C,t)),([,e])=>{Nw(l)&&g(!1!==e)}),Zw(p,()=>{g(!1!==Nw(C))}),Zw(eE(tE(C),i),([e,t])=>{!1!==e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&A("auto")});const v=Qw(null),y=Kw();return Iw(nE(_w(tE(r),Bw(e=>e?.length??0)),_w(tE(t))),y),Zw(_w(eE(_w(y,Uw(1)),s),Xw(tE(v),l,u,f),Bw(([[e,t],n,r,i,o])=>t&&r&&n?.({context:o,totalCount:e,scrollingInProgress:i})),Pw(e=>!!e),Ww(0)),t=>{null!==m&&(m(),m=null),void 0!==Nw(n)?requestAnimationFrame(()=>{Nw(d)("scrolling into view",{}),Ow(h,t)}):m=Tw(e,()=>{Nw(d)("scrolling into view",{}),Ow(h,t),m=null})}),{autoscrollToBottom:p,followOutput:C,scrollIntoViewOnChange:v}},Sw(eb,Cb,ab,cb,rb,sE,CE,kb,Zb)),Nb=Jw(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:a},{didMount:l}])=>(Iw(_w(l,Xw(o),Pw(([,e])=>0!==e),Xw(i,r,t,n,e),Bw(([[,e],t,n,r,i,o=[]])=>bb(e,t,n,r,i,o))),a),{}),Sw(eb,cb,xb,rb),{singleton:!0}),Ib=Jw(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Qw(0);return Zw(_w(e,Xw(r),Pw(([,e])=>0!==e),Bw(([,e])=>({top:e}))),e=>{Tw(_w(n,Uw(1),Pw(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{Ow(t,e)})})}),{initialScrollTop:r}},Sw(rb,CE,xb),{singleton:!0}),Tb=Jw(([{scrollVelocity:e}])=>{const t=Qw(!1),n=Kw(),r=Qw(!1);return Iw(_w(e,Xw(r,t,n),Pw(([e,t])=>!1!==t&&void 0!==t),Bw(([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}),Rw()),t),Zw(_w(eE(t,e,n),Xw(r)),([[e,t,n],r])=>{e&&!1!==r&&void 0!==r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},Sw(Cb),{singleton:!0}),Db=Jw(([{scrollContainerState:e,scrollTo:t}])=>{const n=Kw(),r=Kw(),i=Kw(),o=Qw(!1),a=Qw(void 0);return Iw(_w(eE(n,r),Bw(([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n}))),e),Iw(_w(t,Xw(r),Bw(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:a,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},Sw(CE)),Fb=Jw(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:a,windowScrollContainerState:l,windowViewportRect:s}])=>{const c=Kw(),d=Qw(void 0),u=Qw(null),f=Qw(null);return Iw(l,u),Iw(s,f),Zw(_w(c,Xw(t,r,a,u,f,n)),([e,t,n,r,i,o,a])=>{const l=function(e){return ME(e).map(({k:e,v:t},n,r)=>{const i=r[n+1];return{endIndex:void 0!==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})}),Iw(_w(d,Pw(xw),Bw(Rb)),i),Iw(_w(o,Xw(d),Pw(([,e])=>void 0!==e),Rw(),Bw(([,e])=>e.ranges)),e),{getState:c,restoreStateFrom:d}},Sw(eb,CE,cb,rb,Db));function Rb(e){return{align:"start",index:0,offset:e.scrollTop}}const Pb=Jw(([{topItemsIndexes:e}])=>{const t=Qw(0);return Iw(_w(t,Pw(e=>e>=0),Bw(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},Sw(xb));function Bb(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const jb=Bb(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),_b=Jw(([{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=Yw(_w(s,Xw(a),qw(([,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]),Pw(([e])=>0!==e),Xw(r,l,n,i,h,C),Pw(([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===ub),Bw(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},rE),e))));function m(n){n>0?(Ow(t,{behavior:"auto",top:-n}),Ow(e,0)):(Ow(e,0),Ow(t,{behavior:"auto",top:-n}))}return Zw(_w(p,Xw(e,o)),([t,n,r])=>{r&&jb()?Ow(e,n-t):m(-t)}),Zw(_w(eE(Gw(o,!1),e,C),Pw(([e,t,n])=>!e&&!n&&0!==t),Bw(([e,t])=>t),Ww(1)),m),Iw(_w(u,Bw(e=>({top:-e}))),t),Zw(_w(c,Xw(f,d),Bw(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function o(e){return e*(n+i)}if(0===t.length)return o(e);let a=0;const l=gE(r,0);let s=0,c=0;for(;s<e;){s++,a+=l;let n=t.length===c+1?1/0:t[c+1]-t[c]-1;s+n>e&&(a-=l,n=e-s+1),s+=n,a+=o(n),c++}return a})),n=>{Ow(e,n),requestAnimationFrame(()=>{Ow(t,{top:n}),requestAnimationFrame(()=>{Ow(e,0),Ow(C,!1)})})}),{deviation:e}},Sw(CE,Cb,xb,eb,sE,DE)),qb=Jw(([e,t,n,r,i,o,a,l,s,c,d])=>({...e,...t,...n,...r,...i,...o,...a,...l,...s,...c,...d}),Sw(yb,Nb,rb,Tb,Hb,Ib,Vb,Db,Zb,sE,kb)),Ub=Jw(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:o,groupIndices:a,heightEstimates:l,itemSize:s,sizeRanges:c,sizes:d,statefulTotalCount:u,totalCount:f,trackItemSizes:h},{initialItemFinalLocationReached:C,initialTopMostItemIndex:p,scrolledToInitialItem:m},A,g,v,y,{scrollToIndex:w},E,{topItemCount:b},{groupCounts:M},L])=>{const{listState:x,minOverscanItemCount:H,topItemsIndexes:V,rangeChanged:k,...S}=y;return Iw(k,L.scrollSeekRangeChanged),Iw(_w(L.windowViewportRect,Bw(e=>e.visibleHeight)),A.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:o,groupCounts:M,heightEstimates:l,initialItemFinalLocationReached:C,initialTopMostItemIndex:p,scrolledToInitialItem:m,sizeRanges:c,topItemCount:b,topItemsIndexes:V,totalCount:f,...v,groupIndices:a,itemSize:s,listState:x,minOverscanItemCount:H,scrollToIndex:w,statefulTotalCount:u,trackItemSizes:h,rangeChanged:k,...S,...L,...A,sizes:d,...g}},Sw(eb,cb,CE,Fb,zb,xb,ab,_b,Pb,nb,qb));function Wb(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 Xb=typeof document<"u"?i.useLayoutEffect:i.useEffect;function Qb(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){void 0!==e.propsReady&&Ow(e.propsReady,!1);for(const r of o){Ow(e[n.required[r]],t[r])}for(const r of a)if(r in t){Ow(e[n.optional[r]],t[r])}void 0!==e.propsReady&&Ow(e.propsReady,!0)}function u(e){return s.reduce((t,r)=>(t[r]=function(e){let t,n;const r=()=>t?.();return function(i,o){switch(i){case 1:return o?n===o?void 0:(r(),n=o,t=Zw(e,o),t):(r(),Hw);case 2:return r(),void(n=null)}}}(e[n.events[r]]),t),{})}const f=i.forwardRef(function(f,h){const{children:C,...p}=f,[m]=i.useState(()=>Vw(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)})),[A]=i.useState(Lw(u,m));var g;Xb(()=>{for(const e of s)e in p&&Zw(A[e],p[e]);return()=>{Object.values(A).map(zw)}},[p,A,m]),Xb(()=>{d(m,p)}),i.useImperativeHandle(h,Ew((g=m,l.reduce((e,t)=>(e[t]=e=>{Ow(g[n.methods[t]],e)},e),{}))));const v=r;return e(c.Provider,{value:m,children:void 0!==r?e(v,{...Wb([...o,...a,...s],p),children:C}):C})});return{Component:f,useEmitter:(e,t)=>{const n=i.useContext(c)[e];Xb(()=>Zw(n,t),[t,n])},useEmitterValue:i.version.startsWith("18")?e=>{const t=i.useContext(c)[e],n=i.useCallback(e=>Zw(t,e),[t]);return i.useSyncExternalStore(n,()=>Nw(t),()=>Nw(t))}:e=>{const t=i.useContext(c)[e],[n,r]=i.useState(Lw(Nw,t));return Xb(()=>Zw(t,e=>{e!==n&&r(Ew(e))}),[t,n]),n},usePublisher:e=>{const t=i.useContext(c);return i.useCallback(n=>{Ow(t[e],n)},[t,e])}}}const Gb=i.createContext(void 0),Kb=i.createContext(void 0),Yb="-webkit-sticky",Jb="sticky",$b=Bb(()=>{if(typeof document>"u")return Jb;const e=document.createElement("div");return e.style.position=Yb,e.style.position===Yb?Yb:Jb}),eM=typeof document<"u"?i.useLayoutEffect:i.useEffect;function tM(e){return"self"in e}function nM(e,t,n,r=Hw,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)||tM(l)){const e=tM(l)?l:l.defaultView;o=!0===a?e.scrollX:e.scrollY,r=!0===a?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=!0===a?e.innerWidth:e.innerHeight}else o=!0===a?l.scrollLeft:l.scrollTop,r=!0===a?l.scrollWidth:l.scrollHeight,i=!0===a?l.offsetWidth:l.offsetHeight;const d=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};!0===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){!0===a&&(e={...void 0!==e.behavior?{behavior:e.behavior}:{},...void 0!==e.top?{left:e.top}:{}}),l.current.scrollBy(e)},scrollerRef:l,scrollToCallback:function(n){const r=l.current;if(!r||(!0===a?"offsetWidth"in r&&0===r.offsetWidth:"offsetHeight"in r&&0===r.offsetHeight))return;const i="smooth"===n.behavior;let o,d,u;tM(r)?(d=Math.max(PE(r.document.documentElement,!0===a?"width":"height"),!0===a?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),o=!0===a?r.innerWidth:r.innerHeight,u=!0===a?window.scrollX:window.scrollY):(d=r[!0===a?"scrollWidth":"scrollHeight"],o=PE(r,!0===a?"width":"height"),u=r[!0===a?"scrollLeft":"scrollTop"]);const f=d-o;if(n.top=Math.ceil(Math.max(Math.min(f,n.top),0)),db(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,!0===a&&(n={...void 0!==n.behavior?{behavior:n.behavior}:{},left:n.top}),r.scrollTo(n)}}}function rM(e){return e}const iM=Jw(()=>{const e=Qw(e=>`Item ${e}`),t=Qw(e=>`Group ${e}`),n=Qw({}),r=Qw(rM),i=Qw("div"),o=Qw(Hw),a=(e,t=null)=>Gw(_w(n,Bw(t=>t[e]),Rw()),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")}}),oM=Jw(([e,t])=>({...e,...t}),Sw(Ub,iM)),aM=({height:t})=>e("div",{style:{height:t}}),lM={overflowAnchor:"none",position:$b(),zIndex:1},sM={overflowAnchor:"none"},cM={...sM,display:"inline-block",height:"100%"},dM=i.memo(function({showTopList:t=!1}){const n=HM("listState"),r=VM("sizeRanges"),o=HM("useWindowScroll"),a=HM("customScrollParent"),l=VM("windowScrollContainerState"),s=VM("scrollContainerState"),c=a||o?l:s,d=HM("itemContent"),u=HM("context"),f=HM("groupContent"),h=HM("trackItemSizes"),C=HM("itemSize"),m=HM("log"),A=VM("gap"),g=HM("horizontalDirection"),{callbackRef:v}=uE(r,C,h,t?Hw:c,m,A,a,g,HM("skipAnimationFrameInResizeObserver")),[y,w]=i.useState(0);xM("deviation",e=>{y!==e&&w(e)});const E=HM("EmptyPlaceholder"),b=HM("ScrollSeekPlaceholder")??aM,M=HM("ListComponent"),L=HM("ItemComponent"),x=HM("GroupComponent"),H=HM("computeItemKey"),V=HM("isSeeking"),k=HM("groupIndices").length>0,S=HM("alignToBottom"),Z=HM("initialItemFinalLocationReached"),O=t?{}:{boxSizing:"border-box",...g?{display:"inline-block",height:"100%",marginLeft:0!==y?y:S?"auto":0,paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,whiteSpace:"nowrap"}:{marginTop:0!==y?y:S?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...Z?{}:{visibility:"hidden"}};return t||0!==n.totalCount||null==E?e(M,{...pM(M,u),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:v,style:O,children:(t?n.topItems:n.items).map(e=>{const t=e.originalIndex,r=H(t+n.firstItemIndex,e.data,u);return V?p(b,{...pM(b,u),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?p(x,{...pM(x,u),"data-index":t,"data-item-index":e.index,"data-known-size":e.size,key:r,style:lM},f(e.index,u)):p(L,{...pM(L,u),...mM(L,e.data),"data-index":t,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:g?cM:sM},k?d(e.index,e.groupIndex,e.data,u):d(e.index,e.data,u))})}):e(E,{...pM(E,u)})}),uM={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},fM={outline:"none",overflowX:"auto",position:"relative"},hM=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),CM={position:$b(),top:0,width:"100%",zIndex:1};function pM(e,t){if("string"!=typeof e)return{context:t}}function mM(e,t){return{item:"string"==typeof e?void 0:t}}const AM=i.memo(function(){const t=HM("HeaderComponent"),n=VM("headerHeight"),r=HM("HeaderFooterTag"),o=cE(i.useMemo(()=>e=>{n(PE(e,"height"))},[n]),!0,HM("skipAnimationFrameInResizeObserver")),a=HM("context");return null!=t?e(r,{ref:o,children:e(t,{...pM(t,a)})}):null}),gM=i.memo(function(){const t=HM("FooterComponent"),n=VM("footerHeight"),r=HM("HeaderFooterTag"),o=cE(i.useMemo(()=>e=>{n(PE(e,"height"))},[n]),!0,HM("skipAnimationFrameInResizeObserver")),a=HM("context");return null!=t?e(r,{ref:o,children:e(t,{...pM(t,a)})}):null});function vM({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:i,style:o,context:a,...l}){const s=r("scrollContainerState"),c=n("ScrollerComponent"),d=r("smoothScrollTargetReached"),u=n("scrollerRef"),f=n("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:C,scrollToCallback:p}=nM(s,d,c,u,void 0,f);return t("scrollTo",p),t("scrollBy",h),e(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:C,style:{...f?fM:uM,...o},tabIndex:0,...l,...pM(c,a),children:i})})}function yM({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:o,style:a,context:l,...s}){const c=r("windowScrollContainerState"),d=n("ScrollerComponent"),u=r("smoothScrollTargetReached"),f=n("totalListHeight"),h=n("deviation"),C=n("customScrollParent"),p=i.useRef(null),m=n("scrollerRef"),{scrollByCallback:A,scrollerRef:g,scrollToCallback:v}=nM(c,u,d,m,C);return eM(()=>(g.current=C||p.current?.ownerDocument.defaultView,()=>{g.current=null}),[g,C]),t("windowScrollTo",v),t("scrollBy",A),e(d,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...0!==f?{height:f+h}:void 0},...s,...pM(d,l),children:o})})}const wM=({children:t})=>{const n=i.useContext(Gb),r=VM("viewportHeight"),o=VM("fixedItemHeight"),a=HM("alignToBottom"),l=HM("horizontalDirection"),s=cE(i.useMemo(()=>Mw(r,e=>PE(e,l?"width":"height")),[r,l]),!0,HM("skipAnimationFrameInResizeObserver"));return i.useEffect(()=>{n&&(r(n.viewportHeight),o(n.itemHeight))},[n,r,o]),e("div",{"data-viewport-type":"element",ref:s,style:hM(a),children:t})},EM=({children:t})=>{const n=i.useContext(Gb),r=VM("windowViewportRect"),o=VM("fixedItemHeight"),a=HM("customScrollParent"),l=hE(r,a,HM("skipAnimationFrameInResizeObserver")),s=HM("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:hM(s),children:t})},bM=({children:t})=>{const n=HM("TopItemListComponent")??"div",r=HM("headerHeight"),i={...CM,marginTop:`${r}px`},o=HM("context");return e(n,{style:i,...pM(n,o),children:t})},MM=i.memo(function(t){const r=HM("useWindowScroll"),i=HM("topItemsIndexes").length>0,o=HM("customScrollParent"),a=HM("context");return n(o||r?SM:kM,{...t,context:a,children:[i&&e(bM,{children:e(dM,{showTopList:!0})}),n(o||r?EM:wM,{children:[e(AM,{}),e(dM,{}),e(gM,{})]})]})}),{Component:LM,useEmitter:xM,useEmitterValue:HM,usePublisher:VM}=Qb(oM,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",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"}},MM),kM=vM({useEmitter:xM,useEmitterValue:HM,usePublisher:VM}),SM=yM({useEmitter:xM,useEmitterValue:HM,usePublisher:VM}),ZM=LM,OM=Jw(()=>{const e=Qw(e=>n("td",{children:["Item $",e]})),t=Qw(null),r=Qw(e=>n("td",{colSpan:1e3,children:["Group ",e]})),i=Qw(null),o=Qw(null),a=Qw({}),l=Qw(rM),s=Qw(Hw),c=(e,t=null)=>Gw(_w(a,Bw(t=>t[e]),Rw()),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")}});Sw(Ub,OM),$b();const zM={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},NM={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:IM,floor:TM,max:DM,min:FM,round:RM}=Math;function PM(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function BM(e,t){return void 0!==e&&e.width===t.width&&e.height===t.height}function jM(e,t){return void 0!==e&&e.column===t.column&&e.row===t.row}const _M=Jw(([{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:A,windowScrollContainerState:g,windowScrollTo:v,windowViewportRect:y},w])=>{const E=Qw(0),b=Qw(0),M=Qw(zM),L=Qw({height:0,width:0}),x=Qw({height:0,width:0}),H=Kw(),V=Kw(),k=Qw(0),S=Qw(null),Z=Qw({column:0,row:0}),O=Kw(),z=Kw(),N=Qw(!1),I=Qw(0),T=Qw(!0),D=Qw(!1),F=Qw(!1);Zw(_w(C,Xw(I),Pw(([e,t])=>0!==t)),()=>{Ow(T,!1)}),Zw(_w(eE(C,T,x,L,I,D),Pw(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i)),([,,,,e])=>{Ow(D,!0),lb(1,()=>{Ow(H,e)}),Tw(_w(c),()=>{Ow(t,[0,0]),Ow(T,!0)})}),Iw(_w(z,Pw(e=>null!=e&&e.scrollTop>0),jw(0)),b),Zw(_w(C,Xw(z),Pw(([,e])=>null!=e)),([,e])=>{e&&(Ow(L,e.viewport),Ow(x,e.item),Ow(Z,e.gap),e.scrollTop>0&&(Ow(N,!0),Tw(_w(c,Uw(1)),e=>{Ow(N,!1)}),Ow(s,{top:e.scrollTop})))}),Iw(_w(L,Bw(({height:e})=>e)),u),Iw(_w(eE(tE(L,BM),tE(x,BM),tE(Z,(e,t)=>void 0!==e&&e.column===t.column&&e.row===t.row),tE(c)),Bw(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),O),Iw(_w(eE(tE(E),r,tE(Z,jM),tE(x,BM),tE(L,BM),tE(S),tE(b),tE(N),tE(T),tE(I)),Pw(([,,,,,,,e])=>!e),Bw(([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 zM;if(0===h){const t=sb(c,e);return function(e){return{...NM,items:e}}(PM(t,t+Math.max(l-1,0),a))}const p=qM(C,h,d);let m,A;s?0===t&&0===n&&l>0?(m=0,A=l-1):(m=p*TM((t+u)/(f+u)),A=p*IM((n+u)/(f+u))-1,A=FM(e-1,DM(A,p-1)),m=FM(A,DM(0,m))):(m=0,A=-1);const g=PM(m,A,a),{bottom:v,top:y}=UM(o,r,i,g),w=IM(e/p);return{bottom:v,itemHeight:f,items:g,itemWidth:h,offsetBottom:w*f+(w-1)*u-v,offsetTop:y,top:y}})),M),Iw(_w(S,Pw(e=>null!==e),Bw(e=>e.length)),E),Iw(_w(eE(L,x,M,Z),Pw(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),Bw(([e,t,{items:n},r])=>{const{bottom:i,top:o}=UM(e,r,t,n);return[o,i]}),Rw(TE)),t);const R=Qw(!1);Iw(_w(c,Xw(R),Bw(([e,t])=>t||0!==e)),R);const P=Yw(_w(eE(M,E),Pw(([{items:e}])=>e.length>0),Xw(R),Pw(([[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}),Bw(([[,e]])=>e-1),Rw())),B=Yw(_w(tE(M),Pw(({items:e})=>e.length>0&&0===e[0].index),jw(0),Rw())),j=Yw(_w(tE(M),Xw(N),Pw(([{items:e},t])=>e.length>0&&!t),Bw(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),Rw(IE),Ww(0)));Iw(j,h.scrollSeekRangeChanged),Iw(_w(H,Xw(L,x,E,Z),Bw(([e,t,n,r,i])=>{const o=ob(e),{align:a,behavior:l,offset:s}=o;let c=o.index;"LAST"===c&&(c=r-1),c=DM(0,c,FM(r-1,c));let d=WM(t,i,n,c);return"end"===a?d=RM(d-t.height+n.height):"center"===a&&(d=RM(d-t.height/2+n.height/2)),void 0!==s&&0!==s&&(d+=s),{behavior:l,top:d}})),s);const _=Gw(_w(M,Bw(e=>e.offsetBottom+e.bottom)),0);return Iw(_w(y,Bw(e=>({height:e.visibleHeight,width:e.visibleWidth}))),L),{customScrollParent:m,data:S,deviation:k,footerHeight:i,gap:Z,headerHeight:o,increaseViewportBy:e,initialItemCount:b,itemDimensions:x,overscan:n,restoreStateFrom:z,scrollBy:a,scrollContainerState:l,scrollHeight:V,scrollTo:s,scrollToIndex:H,scrollTop:c,smoothScrollTargetReached:d,totalCount:E,useWindowScroll:A,viewportDimensions:L,windowScrollContainerState:g,windowScrollTo:v,windowViewportRect:y,...h,gridState:M,horizontalDirection:F,initialTopMostItemIndex:I,totalListHeight:_,...f,endReached:P,propsReady:p,rangeChanged:j,startReached:B,stateChanged:O,stateRestoreInProgress:N,...w}},Sw(yb,CE,Cb,Tb,rb,Db,sE));function qM(e,t,n){return DM(1,TM((e+n)/(TM(t)+n)))}function UM(e,t,n,r){const{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};const o=WM(e,t,n,r[0].index);return{bottom:WM(e,t,n,r[r.length-1].index)+i,top:o}}function WM(e,t,n,r){const i=qM(e.width,n.width,t.column),o=TM(r/i),a=o*n.height+DM(0,o-1)*t.row;return a>0?a+t.row:a}const XM=Jw(()=>{const e=Qw(e=>`Item ${e}`),t=Qw({}),n=Qw(null),r=Qw("virtuoso-grid-item"),i=Qw("virtuoso-grid-list"),o=Qw(rM),a=Qw("div"),l=Qw(Hw),s=(e,n=null)=>Gw(_w(t,Bw(t=>t[e]),Rw()),n),c=Qw(!1),d=Qw(!1);return Iw(tE(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")}}),QM=Jw(([e,t])=>({...e,...t}),Sw(_M,XM)),GM=i.memo(function(){const t=nL("gridState"),n=nL("listClassName"),r=nL("itemClassName"),o=nL("itemContent"),a=nL("computeItemKey"),l=nL("isSeeking"),s=rL("scrollHeight"),c=nL("ItemComponent"),d=nL("ListComponent"),u=nL("ScrollSeekPlaceholder"),f=nL("context"),h=rL("itemDimensions"),C=rL("gap"),m=nL("log"),A=nL("stateRestoreInProgress"),g=rL("reportReadyState"),v=cE(i.useMemo(()=>e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const n=e.firstChild;if(null!==n){const{height:e,width:t}=n.getBoundingClientRect();h({height:e,width:t})}C({column:aL("column-gap",getComputedStyle(e).columnGap,m),row:aL("row-gap",getComputedStyle(e).rowGap,m)})},[s,h,C,m]),!0,!1);return eM(()=>{t.itemHeight>0&&t.itemWidth>0&&g(!0)},[t]),A?null:e(d,{className:n,ref:v,...pM(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,{...pM(u,f),height:t.itemHeight,index:n.index,width:t.itemWidth},i):p(c,{...pM(c,f),className:r,"data-index":n.index,key:i},o(n.index,n.data,f))})})}),KM=i.memo(function(){const t=nL("HeaderComponent"),n=rL("headerHeight"),r=nL("headerFooterTag"),o=cE(i.useMemo(()=>e=>{n(PE(e,"height"))},[n]),!0,!1),a=nL("context");return null!=t?e(r,{ref:o,children:e(t,{...pM(t,a)})}):null}),YM=i.memo(function(){const t=nL("FooterComponent"),n=rL("footerHeight"),r=nL("headerFooterTag"),o=cE(i.useMemo(()=>e=>{n(PE(e,"height"))},[n]),!0,!1),a=nL("context");return null!=t?e(r,{ref:o,children:e(t,{...pM(t,a)})}):null}),JM=({children:t})=>{const n=i.useContext(Kb),r=rL("itemDimensions"),o=rL("viewportDimensions"),a=cE(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:hM(!1),children:t})},$M=({children:t})=>{const n=i.useContext(Kb),r=rL("windowViewportRect"),o=rL("itemDimensions"),a=nL("customScrollParent"),l=hE(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:hM(!1),children:t})},eL=i.memo(function({...t}){const r=nL("useWindowScroll"),i=nL("customScrollParent"),o=i||r?oL:iL,a=i||r?$M:JM,l=nL("context");return e(o,{...t,...pM(o,l),children:n(a,{children:[e(KM,{}),e(GM,{}),e(YM,{})]})})}),{useEmitter:tL,useEmitterValue:nL,usePublisher:rL}=Qb(QM,{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"}},eL),iL=vM({useEmitter:tL,useEmitterValue:nL,usePublisher:rL}),oL=yM({useEmitter:tL,useEmitterValue:nL,usePublisher:rL});function aL(e,t,n){return"normal"!==t&&!0!==t?.endsWith("px")&&n(`${e} was not resolved to pixel value correctly`,t,oE),"normal"===t?0:parseInt(t??"0",10)}const lL=({optionsList:r=[],onSelectVariable:i,dropdownPosition:o,position:s="relative",width:c,height:d="160px",zIndex:u=9999,highlightedIndex:f})=>{const h={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},C=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":h[e.type||""]||"":"step_group_variable"},p=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;function m(e){if(e.endsWith("px")){const t=parseInt(e.slice(0,-2),10);return isNaN(t)?212:t-66}return 212}const A=a(null);l(()=>{void 0!==f&&f>=0&&requestAnimationFrame(()=>{A.current?.scrollToIndex({index:f,behavior:"auto",align:"center"})})},[f,r]);return e("div",{className:I("ff-variable-dropdown",s),style:o?{top:o.top,left:o.left,width:c,height:d,zIndex:u}:{width:c,height:d,zIndex:u},children:K(r)?e("div",{className:"ff-variable-option ff-variable-option-no-data",children:e(U,{as:"span",fontSize:12,children:"No Option"})}):e(ZM,{totalCount:r.length,ref:A,data:r,itemContent:o=>{const a=r[o];return a?e("div",{className:I("ff-variable-data",{"ff-variable-data--highlighted":f===o}),onMouseDown:()=>i(a),children:c.endsWith("px")?n(t,{children:[e(Y,{title:Hn(p(a),m(c),"pixel")?p(a):"",placement:"bottom",style:{width:`${m(c)}px`},children:e(U,{as:"span",fontSize:12,className:"ff-truncated_text",children:p(a)})}),e(q,{name:C(a),height:24,width:24})]}):e(ww,{option:a})},`${a.id}-${o}`):null},style:{height:d,fontSize:"12px"},overscan:10,fixedItemHeight:32})})},sL=({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:A,chartName:g,shouldCenterSinglePoint:v,xAxisLabelGap:y=16,isLeftOverflow:w=!1})=>{const E=40,b=i-80,M=o-80,[L,x]=c(!1),[H,V]=c({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});l(()=>{const e=()=>{x(!1),V(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+y,gap:y},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(U,{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:M,x2:b,y2:M,stroke:f,strokeWidth:1}),e("text",{x:b/2.1,y:M+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*(b/(l-1)),y:M+15,textAnchor:0===n?"start":n===l-1?"end":"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},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:M-i*M/r,textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:o?.toFixed(1)},`y-${n}`)})]})})})]})}function k(e){if(!isNaN(e))return parseFloat(e);const t=Vr,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 S=r?.[0]?.data?.[0]?.hasOwnProperty("date")&&r?.[0]?.data?.[0]?.hasOwnProperty("totalMemory"),Z="date",O=S?"totalMemory":"value",z=e=>{const t=r?.[0]?.data?.length;if(1===t)return v?b/2:b;const n=r[0].data.findIndex(t=>t[Z]===e);return-1===n?0:n/(t-1)*b},N=Math.max(...r?.flatMap(e=>e?.data?.map(e=>k(e[O]))),5),I=e=>{if("memory"===g){const t=Math.max(...r?.flatMap(e=>e?.data?.map(e=>k(e[O]))));return M-e*M/(t>1024?t:1024)}return M-e*M/(0===N?1024:N)},T=e=>{if(1===e?.length){const t=e?.[0],n=z(t[Z]),r=I(k(t[O]));return`M 0 ${I(0)} L ${n} ${r}`}return e?.reduce((t,n,r)=>{const i=z(n[Z]),o=I(k(n[O]));if(0===r)return`M ${i} ${o}`;const a=e[r-1],l=a?z(a[Z]):0;return`${t} C ${l+(i-l)/2} ${a?I(k(a[O])):0}, ${i-(i-l)/2} ${o}, ${i} ${o}`},"")},D=r[0].data;return n("div",{className:"ff-line-chart-text",style:{width:i+20+y,gap:y},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(U,{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>M)return x(!1),void V({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-z(t[Z]));return r<e.distance?{point:t,distance:r}:e},{point:null,distance:1/0}).point;r&&(o=r[Z],i.hoverValues[t]=((e,t=2)=>{let n="";if("string"==typeof e){const t=e.match(Lr),r=e.match(xr);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:z(r[Z]),y:I(k(r[O]))})}),x(!0),V({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:()=>V({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:M,strokeWidth:2}),e("line",{x1:0,y1:M,x2:b,y2:M,stroke:f,strokeWidth:1}),e("text",{x:b/2.1,y:M+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:T(r.data),fill:"none",stroke:r.color,strokeWidth:a,opacity:(o=r.data,o.every(e=>0===k(e[O]))?.5:1)}),H.dotPositions[i]&&n(t,{children:[e("line",{x1:H.dotPositions[i].x,y1:0,x2:H.dotPositions[i].x,y2:M,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"}),e("circle",{cx:H.dotPositions[i].x,cy:H.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:H.dotPositions[i].y,x2:b,y2:H.dotPositions[i].y,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"})]})]},i):null;var o}),(()=>{if(1===D.length){const t=D?.[0];return e("text",{x:v?b/2:b,y:M+15,textAnchor:v?"middle":"end",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=t[Z]?String(t[Z]):""},String(t[Z]))}if(D.length<7)return D.map(t=>e("text",{x:z(t[Z]),y:M+15,textAnchor:"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=t[Z]?String(t[Z]):""},String(t[Z])));{const t=(i-80-7*9.2)/6;return Array.from({length:7}).map((n,r)=>{const i=Math.floor(r*(D?.length-1)/6),o=D[i];return e("text",{x:r*t,y:M+15,fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=o?.[Z]?String(o?.[Z]):""},String(o?.[Z]))})}})(),(()=>{if("memory"===g){const t=Math.max(N,1024);return Array.from({length:6}).map((n,r)=>{const i=r*t/5,o=i/1024;return e("text",{x:-10,y:I(i),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:o.toFixed(1)},`y-${r}`)})}return Array.from({length:6}).map((t,n)=>{const r=n*N/5;return e("text",{x:-10,y:I(r),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:r.toFixed(0)},`y-${n}`)})})()]})}),L&&H.tooltip.visible&&n("div",{className:"ff-line-chart-tooltip",style:{left:w&&H.tooltip.left/2>i/1.75?H.tooltip.left-180:H.tooltip.left,top:H.tooltip.top},children:[e("div",{className:"ff-line-chart-date",children:H.currentXValue}),Object.entries(H.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))]})]})]})},cL=({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(U,{fontWeight:"semi-bold",lineHeight:"32px",className:"ff-download-client-header-text",children:"Download client"}),e(q,{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(U,{as:"div",color:"var(--download-client-content-text-color)",fontWeight:"semi-bold",textAlign:"center",lineHeight:"26px",children:a}),e(U,{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(q,{name:t,height:36,width:36})},t))})]})]})},dL=({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(U,{color:"var(--license_header_text_color)",fontSize:8,lineHeight:"12px",children:t})}),e("div",{className:"ff_children_container",children:o})]})}),uL=({onSelectVariable:t,dropdownPosition:n,filteredOptions:r=[],position:i="relative",width:o="100%",zIndex:s,truncateTextValue:c=34,highlightedIndex:d})=>{const u=a(null);return l(()=>{u.current?.scrollIntoView({block:"nearest"})},[d]),e("div",{className:I(`ff-variable-dropdown-container ${i}`),style:n?{top:n.top+30,left:n.left-30,width:o,zIndex:s}:{width:o,zIndex:s},children:K(r)?e("div",{className:"ff-variable-option no-data",children:e(U,{as:"div",children:"No Option",fontSize:14})}):r?.map((n,r)=>e("div",{className:I("ff-variable-option",{"ff-variable-option--highlighted":d===r}),onMouseDown:()=>t(n),ref:d===r?u:null,children:e(Y,{title:Hn(n?.name,c,"pixel")?n?.name:"",children:e(U,{children:xn(n?.name,c,"pixel")})})},n?.id))})},fL=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:A=!1,isOnlyHash:g=!1,dataFiles:v=[],showAddVariableIcon:y=!0,helperText:E="",error:b,autoComplete:M="off",required:L=!1,zIndex:x=9999,truncateTextValue:H=34,formProps:V={},getSelectedVariable:k=()=>{},symbol:S="$",type:Z="text",clearIcon:O=!0,inputTitle:z="",onBlur:N,helperTextWidth:T,iconProps:D={isShowIcon:!1,iconName:"",iconToolTipTitle:"",isIconDisable:!1,iconColor:"",onIconClick:()=>{}},...F},R)=>{const[P,B]=c(!1),[j,_]=c(!1),[W,X]=c(0),[Q,G]=c(!1),[J,$]=c(null),[ee,te]=c(0),[ne,re]=c(!1),[ie,oe]=c([]),ae=a(null),le=a(null),[se,ce]=c("auto"),de=D?.isShowIcon;l(()=>{const e=le.current?.querySelector(".ff-input-container");if(!e)return;const t=new ResizeObserver(e=>{for(let t of e){const e=`${t.contentRect.width}px`;ce(e)}});return t.observe(e),()=>{t.disconnect()}},[]),w(R,()=>ae.current),l(()=>{null!==J&&ae.current&&(ae.current.setSelectionRange(J,J),ae.current.focus())},[J]),l(()=>{A&&B(C.startsWith("#"));const e=v?.find(e=>e.name===C),t=o?.find(e=>e?.name===C);if(C.startsWith("#")&&A){const e=C.slice(1).toLowerCase(),t=v.filter(t=>t.name.toLowerCase().includes(e));oe(t),B(!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("#");g?re(!1):r||n||C.includes("$")||C.includes("#")?(re(!1),a&&re(!0)):i&&!C.includes("$")&&re(!0)},[C]);const ue=()=>{ae.current&&te(ae.current.selectionStart||0)},fe=ue,he=ue;l(()=>{ae.current&&te(ae.current.selectionStart||0)},[C]);const Ce=e=>{if(ae.current){const{selectionStart:t,selectionEnd:n}=ae.current,r=`${e.name}`;let o;if(o=A&&"#"===C[0]?e.name+C.slice(n||1):e.name,d){d({target:{value:o}},e),k(e.name)}ae.current.value=o,i?.(e),$((t||0)+r.length),B(!1),_(!0)}};const pe=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(S,t-1),l=e.indexOf(S,t);if(-1!==a&&(g&&"$"===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),j&&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,ee,o),me=()=>o?.filter(e=>e?.name?.toLowerCase()?.includes(pe?.searchString?.toLowerCase())),Ae=C.startsWith("#"),ge=Ae?ie:me();l(()=>{X(0)},[A,pe?.showDropdown]);const ve=Boolean(pe?.showDropdown&&Q),ye=Boolean(P&&A&&Q),we=Boolean((Ae?ye:ve)&&ge.length);return n("div",{className:"ff-add-variable-container",children:[n("div",{className:"ff-add-variable-input",ref:le,children:[e(Y,{title:z,style:{width:"100%"},children:e(Hi,{...F,name:"add_variable",ref:ae,type:Z,className:I("ff-variable-input-container",{"ff-variable-input-container--show-icon":de}),value:C,onKeyDown:e=>{switch(e.key){case"ArrowDown":if(!we)return;e.preventDefault(),e.stopPropagation(),X(e=>e<ge.length-1?e+1:e);break;case"ArrowUp":if(!we)return;e.preventDefault(),e.stopPropagation(),X(e=>e>0?e-1:0);break;case"Enter":{if(!we)return;e.preventDefault(),e.stopPropagation();const t=ge[W];t&&Ce(t);break}case"Escape":if(!we)return;e.preventDefault(),e.stopPropagation(),B(!1),G(!1),X(0)}},onChange:d,onPaste:()=>{re(!0)},variant:"primary",label:t,placeholder:s,onClick:fe,onKeyUp:he,onFocus:()=>G(!0),onBlur:e=>{(e=>{e.relatedTarget&&e.relatedTarget.closest(".dropdown-container")||G(!1)})(e),N?.(e)},autoComplete:M,helperText:E,error:b,required:L,helperTextWidth:T,...V})}),!K(C)&&ne&&y&&e("div",{className:"ff-create-variable-container",onClick:f,children:e(U,{fontWeight:"regular",fontSize:"10px",color:"var(--brand-color)",cursor:"pointer",children:"Create Variable"})}),!K(C)&&!g&&e("div",{className:I("ff-cancel-icon-container",{"ff-cancel-icon-container--show-icon":de}),children:O&&e(Y,{title:"Cancel",style:{zIndex:99999},children:e(q,{onClick:h,name:"close",height:16,width:16,hoverEffect:!0})})}),de&&e("div",{className:"ff-info-icon-container",children:e(Y,{title:de&&!D?.isIconDisable?D?.iconToolTipTitle:"",children:e(q,{name:D?.iconName||"",hoverEffect:!1,height:16,width:16,color:D?.iconColor||"var(--text-area-default-color)",onClick:e=>{D?.onIconClick&&D?.onIconClick(e)},disabled:D?.isIconDisable,cursorType:"pointer"})})})]}),pe?.showDropdown&&Q&&e(lL,{position:"absolute",zIndex:x,truncateTextValue:H,width:se,height:K(me())?"auto":m,optionsList:ge,onSelectVariable:Ce,highlightedIndex:W}),P&&A&&Q&&e(uL,{position:"relative",zIndex:x,truncateTextValue:H,width:se,filteredOptions:ge,onSelectVariable:Ce,highlightedIndex:W})]})}),hL=({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:A,dataFiles:g=[],truncateTextValue:v=34,isEnterKeySubmit:y=!1,showHideValueOption:w=!0})=>{const[E,b]=c(!1),[M,L]=c(""),[x,H]=c(),[V,k]=c(!1),[S,Z]=c(!1),[O,z]=c({name:"",value:"",isChecked:!1});l(()=>{t&&"edit"===m&&z({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":qn.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 I(e){const t=!!e,n=qn.test(e),r=$r.test(e),i=e.length>=3&&e.length<=25;return t&&n&&r&&i}l(()=>{const e=N(s);b(!!e),L(e)},[s]),l(()=>{if("edit"!==m)return;const{name:e,value:t,isChecked:n}=O;Z(s!==e||d!==t||h!==n)},[m,s,d,h,O]);const T=()=>{!V&&I(s)&&(k(!0),p())};l(()=>{if(!y)return;const e=e=>{if("Enter"===e.key){e.preventDefault();!I(s)||V||"edit"===m&&!S||T()}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[y,s,d,h,V,m,S,f]);return e(vn,{zIndex:1350,onClose:i,isOpen:t,title:"create"===m?"Create Variable":"Edit Variable",width:"284px",height:w?"280px":"250px",top:"30%",right:8,isFooterRequired:!0,overlay:!0,footerContent:e(()=>n("div",{className:"ff-create-slider-footer",children:[e(W,{onClick:i,label:"Cancel",variant:"tertiary"}),e(W,{variant:"primary",label:"create"===m?"Create":"Update",type:"submit",onClick:T,disabled:!I(s)||V||"edit"===m&&!S})]}),{}),children:n("div",{className:"ff-create-variable-slider",children:[e("div",{className:"ff-create-variable-slider-input",children:e(Hi,{label:"Variable Name",required:!0,type:"text",name:"variableName",value:s||"",onChange:e=>{k(!1),o(e.target.value)},error:E,helperText:M,onBlur:e=>{const t=e.target.value,n=N(t);b(!!n),L(n)}})}),e(Zo,{label:"Variable Type",required:!0,onChange:e=>{u(e),k(!1)},selectedOption:f,optionsList:r,optionZIndex:99999,valueAccessor:"label",disabled:"edit"===m}),e(fL,{label:"Variable Value",placeholder:"Enter Variable value or select path using #",isHash:!0,isOnlyHash:!0,zIndex:99999,truncateTextValue:v,dataFiles:g,dropdownWidth:"100%",setHashInputValue:H,hashInputValue:x||{},value:d||"",type:h?"password":"text",onChange:(e,t)=>{const n=e.target.value;a(n,t)},showAddVariableIcon:!1}),w&&n("div",{className:"ff-hide-value-content",children:[e(bn,{onChange:e=>C(e.target.checked),name:"hideValue",label:"Hide Value",checked:h,disabled:A}),e(Y,{title:"Once the value is hidden, it cannot be undone",children:e(q,{name:"info",width:12,height:12})})]})]})})},CL=e=>{if(null==e||""===e)return{};return{width:e,flex:`0 0 ${"number"==typeof e?`${e}px`:e}`}},pL=({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="number"==typeof r[0]?.width?Math.max(r[0]?.width-8,0):void 0,m=(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:"--"},A=t=>t.map((t,n)=>e("table",{className:"ff-table-accordion__table",cellSpacing:0,children:e("tbody",{className:"ff-table-accordion__tbody",children:e("tr",{className:"ff-table-accordion__body-row",children:r.map((n,r)=>e("td",{className:"ff-table-accordion__body-cell",style:CL(n.width),children:"column"===o&&0===r?"":e(U,{as:"div",className:"ff-table-accordion__cell-typography",children:n.cell?m(t,n):e(Xs,{placement:"bottom",children:m(t,n)})})},n.accessor+r))},t.id||n)})},`accordion-table-${n}`));return n("div",{style:{height:l},className:I("ff-table-accordion",{"ff-table-accordion--fixed-header":s}),children:[e("table",{cellSpacing:0,className:I("ff-table-accordion__table",{"ff-table-accordion__table--fixed-header":s}),children:e("thead",{children:e("tr",{className:"ff-table-accordion__header-row",children:r.map(t=>e("th",{style:CL(t.width),className:I("ff-table-accordion__header-cell",d&&`ff-table-accordion__header-cell--${d}`),children:e("div",{children:e(U,{fontWeight:"semi-bold",fontSize:12,children:t.header})})},`header-${t.header}`))})})}),"row"===o&&i.map((n,r)=>e(wn,{highlightText:t,headerTitle:"string"==typeof n.title?e("div",{style:{maxWidth:void 0!==p?`${p}px`:"100%"},children:e(Xs,{children:e(yn,{text:n.title,highlight:t})})}):e(Xs,{children:"row.title"}),color:"var(--text-color)",accordionContent:A(n.data),disable:n.disable,disableInfoMessage:n.disableInfoMessage,accordionStateIconName:"arrows_down_icon",AccordionStateIconWidth:u,AccordionStateIconHeight:f,className:"ff-table-accordion__row-accordion"},`accordion-row-${r}`)),"column"===o&&i.map((i,o)=>n("div",{className:"ff-table-accordion__column-group",children:[e("div",{className:"ff-display-flex",children:n("div",{className:`ff-table-accordion__column-header ${i.disable&&"ff-table-accordion__column-header--disabled"}`,style:r[0]?CL(r[0].width):{},children:[e("div",{className:"ff-table-accordion__column-label",children:e(U,{as:"div",children:e(Xs,{children:e(yn,{text:"string"==typeof i.title?i.title:"",highlight:t})})})}),e("div",{className:"ff-table-accordion__column-toggle",onClick:()=>{!i.disable&&(e=>{C(e===h?-1:e)})(o)},children:e(q,{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:A(i.data)})]},`column-accordion-${o}`)),K(i)&&e("div",{className:"ff-table-accordion__empty-state",style:{height:`calc(${l} - 50px)`},children:a})]})},mL=({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,A=s;if(void 0!==r&&void 0!==i){const e=p(i),t=p(r);t>0?(m=e/t*100,A=s||i):(m=0,A="0MB")}else m=t||0;const g=Math.max(0,Math.min(m,100));return n("div",{className:"ff-progress-bar-container "+(A?"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:`${g}%`,backgroundColor:o,height:`${l}px`},children:u&&e(U,{className:"ff-progress-bar-percentage",fontSize:f,color:h,children:`${Math.round(g)}%`})})}),A&&e("div",{className:"ff-progress-bar-label",children:e(U,{fontSize:c,color:d,children:e(Y,{title:Hn(A,10,"count")?A:"",children:xn(A,10,"count")})})})]})},AL=({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:A,isMandatory:g=!1})=>{const v=a(null),[y,w]=c(0);u(()=>{v.current&&w(v.current.getBoundingClientRect().width-10)},[C]);const E=m?.name||i,b=y?xn(E,y,"pixel"):E,M=!!y&&Hn(E,y,"pixel");return e("div",{ref:v,style:{width:C},children:e(Y,{title:M?E:"",children:e(W,{variant:t,label:b,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:A,isMandatory:g})})})},gL=({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(Y,{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(q,{name:o?"automation_testcase":"add_testcase",color:"Automation"===t?"var(--primary-button-text-color)":"var(--description-text)"})})}),e(Y,{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(q,{name:a?"manual_testcase":"add_testcase",color:"Manual"===t?"var(--primary-button-text-color)":"var(--description-text)"})})})]})},vL=({selected:t,handleClick:n,tabList:r})=>e("div",{className:"ff-switch-container",children:r.map(r=>e(Y,{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(q,{name:r.icon,color:t===r.name?"var(--primary-button-text-color)":"var(--description-text)"})})},r.name))}),yL=({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:A="video_preview",isDisabled:g=!1})=>{const[v,y]=c(!1),w=i.useRef(null),E=()=>{y(!0),h&&h(d)},b=()=>{t?.(),y(!1)},M=()=>{C&&C(d)};return l(()=>{m&&y(!0)},[m]),n("div",{children:[!m&&(p?e(q,{name:A,hoverEffect:!0,onClick:E,disabled:g}):e(vw,{mediaSrc:r,mediaType:s,onDownloadClick:M,onDeleteClick:()=>a?.(r),onExpandClick:E,fileName:o,fileId:d,thumbnailMediaSrc:u,isDelete:f})),v&&e(Sp,{isOpen:v,onClose:b,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(Y,{title:"Download File",children:e(q,{name:"download_file_icon",onClick:M,color:"var(--icons-default-color)",className:"header-icons"})}),e(Y,{title:"Expand",children:e(q,{name:"expand",onClick:E,color:"var(--icons-default-color)",className:"header-icons"})}),e(Y,{title:"close",children:e(q,{name:"close",onClick:b,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:w,onCanPlay:()=>{if(w.current){const e=w.current.play();void 0!==e&&e.catch(e=>{console.error("Autoplay failed:",e)})}}})]})})]})},wL=({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,A=s&&"left"===u;return n("div",{className:["ff-mobileskin-wrapper",f?"portrait":"landscape",A?"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(Y,{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(q,{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(Y,{title:r,children:e(q,{...i})})},n)})}),s&&A&&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(Y,{title:r,placement:"bottom",children:e(q,{...i})})},n)})})]})},EL=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:A,onFocus:g,disableInput:v,isAdditionalIcon:y=!1,additionalIconName:w,additionIconToolTip:E,onAdditionalIconClick:b},M)=>{const L=a(null);Zn([{key:"Enter",action:()=>x()}],L);const x=e=>{f&&p?.(f.trim())};return n("div",{className:I("ff-prompt-container",{"icon-left":"left"===c,"icon-right":"left"!==c}),style:{width:`${t}px`,height:`${r}px`,borderRadius:d},ref:L,children:[e(Y,{placement:"top",title:C,children:e(q,{name:s,className:"ff-prompt-icon",height:i,width:o,onClick:p,color:h,disabled:K(f)})}),e("input",{ref:M,className:"ff-prompt-input",type:"text",placeholder:l,autoFocus:u,onChange:m,onFocus:g,onBlur:A,value:f,readOnly:v}),y&&w&&e(Y,{placement:"top",title:E,children:e(q,{name:w,className:"ff-prompt-icon additional-icon",height:i,width:o,onClick:b})})]})}),bL=({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:I("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:I("content",`arrow-${a}`),children:e(U,{children:t})})}),ML=({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:A,modalHeight:g,headerContent:v="Header Content",footerContent:y="Footer Content",iconWidth:w,iconHeight:E,modalHeading:b="Ask Fia",children:M,onClearChat:x})=>{const[H,V]=c(!1),[k,S]=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(q,{className:"ff-dynamic-icon",name:r,onClick:()=>{S(e=>!e),setTimeout(()=>V(e=>!e),10)},height:E,width:w}),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(q,{name:"ask_fia_icon",height:32,width:82})})]}),k&&L(e("div",{className:I("ff-dynamic-modal",{open:H}),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:g,width:A},children:n("div",{className:"ff-dynamic-modal-content",children:[v&&e("div",{className:"ff-dynamic-modal-header",children:n("div",{className:"header-container",children:[n("div",{className:"header-left",children:[e(q,{height:16,width:16,name:"fia_icon"}),e(U,{fontWeight:"medium",children:b})]}),n("div",{className:"header-right",children:[e("span",{className:"action",children:e(Y,{title:"Clear chat",placement:"bottom",children:e(q,{height:16,width:16,name:"delete",color:"var(--tooltip-text-color)",onClick:x})})}),e("span",{className:"action",children:e(Y,{title:"Close",placement:"bottom",children:e(q,{height:16,width:16,name:"close",color:"var(--tooltip-text-color)",onClick:()=>(V(!1),void setTimeout(()=>S(!1),300))})})})]})]})}),e("div",{className:"ff-dynamic-modal-body",children:M}),y&&e("div",{className:"ff-dynamic-modal-footer",children:y})]})}),document.body)]})},LL=o(({iconName:r,hoverTitle:i,iconPosition:{top:o,left:a,bottom:l,right:s},hoverIconPosition:{top:c,left:d,bottom:u,right:f},modalPosition:{top:h,left:C,bottom:p,right:m},modalWidth:A,modalHeight:g,headerContent:v="Header Content",footerContent:y="Footer Content",iconWidth:E,iconHeight:b,children:M,isVisible:x,isOpen:H,onOpen:V,onClose:k,isIconVisible:S},Z)=>(w(Z,()=>({closeModal:k})),n(t,{children:[S&&n("div",{style:{top:void 0!==o?`${o}px`:void 0,left:void 0!==a?`${a}px`:void 0,bottom:void 0!==l?`${l}px`:void 0,right:void 0!==s?`${s}px`:void 0},className:"ff-ai-dynamic-icon-container",children:[e(q,{className:"ff-ai-dynamic-icon",name:r,onClick:V,height:b,width:E}),e("div",{style:{top:void 0!==c?`${c}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-ai-chat-icon-hover",children:e("div",{className:"ai-hover-leaf",children:e(U,{fontWeight:"bold",fontSize:14,color:"var(--chatbot-leaf-text)",children:i})})})]}),x&&L(e("div",{className:I("ff-ai-dynamic-modal",{open:H}),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:g,width:A},children:n("div",{className:"ff-ai-dynamic-modal-content",children:[v&&e("div",{className:"ff-ai-dynamic-modal-header",children:v}),e("div",{className:"ff-ai-dynamic-modal-body",children:M}),y&&e("div",{className:"ff-ai-dynamic-modal-footer",children:y})]})}),document.body)]}))),xL=({variant:t,title:r,tabTitle:i,comment:o,profileShortName:a})=>n("div",{className:"ff-history-card",children:[e("div",{className:I("header",`header--${t}`),children:e(U,{fontWeight:"semi-bold",children:i})}),n("div",{className:"body",children:[e("div",{className:"title",children:n("div",{className:"profile",children:[e(U,{className:I("avatar",`avatar--${t}`),children:a}),e(U,{children:r})]})}),n("div",{className:"comment-container",children:[e(U,{fontWeight:"semi-bold",className:"heading",children:"Comments:"}),e(U,{color:"var(--details-page-value-color)",className:"comment",children:o})]})]})]}),HL=({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:I("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(U,{className:I("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"})]})})})]}),VL=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,...A},g)=>{if(!_[t])return null;const v=a(null);l(()=>{v.current&&(void 0!==C&&v.current.setAttribute("x",String(C)),void 0!==p&&v.current.setAttribute("y",String(p)))},[C,p]);const y={ref:g,onClick:u?void 0:o,style:{height:`${n}px`,width:`${r}px`,cursor:u?"not-allowed":"pointer",opacity:u?.3:1},tabIndex:m,...A};return e("span",{...y,children:e("img",{height:n,width:r,src:i,alt:""})})}),kL=({id:r=0,serialNumber:i,activeId:o,setActiveId:s,children:d,onIconClick:u,numberChildren:f,onContainerClick:h,onNextClick:C,onPreviousClick:p,disabled:m,isEditAccess:A,versionsLength:g,count:v,hiddenActions:y=[]})=>{const[w,E]=c(!1),[b,M]=c(!1),L=a(null),x=Array.isArray(y)?y:y?[y]:[],H=(e,t)=>{e.stopPropagation(),t()};l(()=>{L.current&&(()=>{if(L.current){const e=getComputedStyle(L.current),t=1.2*parseFloat(e.fontSize)*6;L.current.scrollHeight>t&&M(!0)}})()},[]);const V=e=>{e.stopPropagation(),E(!w)};return n("div",{className:`ff-prompt-container-Block ${o===r?"active":"inactive"} `,onClick:()=>{s(r),h()},children:[e(U,{fontSize:8,className:"ff-prompt-number-bg-color",as:"span",children:`Test cases ${i}`}),n(t,{children:[n("div",{className:"ff-prompt-content "+(w?"expanded":""),ref:L,children:[d,w&&n(t,{children:[e("span",{role:"button","aria-label":"toggleExpand",onClick:V,className:"read-less-btn",children:e(U,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read Less"})})," "]})]}),b&&!w&&e("div",{role:"button","aria-label":"toggleExpand",onClick:V,className:"read-more-btn",children:e(U,{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=>!x.includes(e.action)).map((t,n)=>{const r=A&&"delete"===t?.action||"regenerate"===t?.action&&(g??0)>=3||m;return e(Y,{title:t.title,placement:"bottom",children:e(q,{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(q,{disabled:1===v,className:"ff-prompt-icons-style",name:"arrow_left_accordian",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>H(e,p),cursorType:"pointer"}),f,e(q,{disabled:v===g,className:"ff-prompt-icons-style",name:"arrow_right_icon",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>H(e,C),cursorType:"pointer"})]})]})]})},SL=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:A,autoComplete:g="off",autoFocus:v=!1,minValue:y=-1/0,maxValue:w=1/0,transparentBackground:E=!1,size:b="small",isLabelRequired:M=!0,onClick:L,onKeyUp:x,isViewMode:H=!1,...V},k)=>{const S=!K(d);return n("fieldset",{className:I("ff-link-input-fieldset",{"ff-link-input-fieldset--disabled":a}),children:[n("div",{className:I("ff-link-input-container",{"ff-link-input-container--float":S,"ff-link-input-container--disabled":!!a}),children:[M&&n("label",{className:I(`ff-link-input-label-container ff-link-input-label-container--${b}`,{"ff-link-input-label-container--danger":!!u}),htmlFor:i,children:[s&&e("span",{className:"required-asterisk",children:"*"}),e("span",{className:I(`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:k,name:i,value:d,type:t,spellCheck:!1,id:i,className:I(`ff-link-input ff-link-input-${r} default-input ff-link-input--${b}`,{"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":!M},`${C}`),placeholder:c,disabled:H||a,onChange:p,onFocus:A,onBlur:m,autoComplete:g,autoFocus:v,min:y,max:w,onClick:L,onKeyUp:x,...V}),e("div",{className:"input-link-icon",children:l||u||!S?e(q,{name:"link",disabled:!0}):e(Y,{title:"Click here to navigate",children:e("span",{children:e(q,{name:"link",disabled:!1,onClick:()=>{d&&!u&&window.open(d,"_blank")}})})})})]}),f&&u&&e("span",{className:I("ff-link-input-message",{"ff-link-input-message--danger":!!u}),children:f})]})}),ZL=({labelsList:r=[],height:i=""})=>{const o=mi(),a=e("div",{className:"ff-chip-tooltip",children:r.filter((e,t)=>t>0).map((t,n)=>e(U,{as:"div",className:"ff-chip-tooltip-label",children:t},`label-${n}-${t}`))});return e(t,{children:!K(r)&&n("div",{className:"ff-chip-with-count-container",children:[e(U,{as:"div",fontWeight:"medium",className:"ff-chip-label",style:i?{height:i}:void 0,children:e(Xs,{children:r[0]||""})}),r.length>1&&n(t,{children:[n(U,{as:"div",className:"ff-chip-count","data-tooltip-id":`tooltip-${o}`,fontWeight:"medium",children:["+",r.length-1]}),e("div",{id:`tooltip-${o}`,className:"ff-chip-tooltip-template",children:e(U,{as:"div",children:a})})]})]})})};class OL 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 zL=({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:[!K(t)&&e("div",{className:"icon-container",children:e(q,{name:t,width:s,height:c})}),n("div",{className:"typography-label-button",children:[n(U,{fontSize:"12px",fontWeight:"regular",lineHeight:"18px",children:[d+l," :"]}),e(U,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:"Click"}),e(kp,{label:i,onClick:r,iconName:"plus_user_icon",isDisable:a}),e(U,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:o})]})]}),NL=({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:I(`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(q,{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:I(`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(Y,{title:r.label.length>9?r.label:"",children:e(U,{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:I("ff-tab-label",{"ff-tab-label--active":i===r.id})})}),"default"===t&&r.count&&e("span",{className:I("tab-count",{"tab-count--active":i===r.id}),children:r.count})]}),e("div",{className:I("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(q,{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})]})},IL=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(q,{name:"danger"===a?"close":r,color:d[a]||d.default,className:`ff-status-indicator__icon ff-status-indicator__icon--${a}`}),e(U,{as:"div",fontSize:12,className:`ff-status-indicator__label ff-status-indicator__label--${a}`,fontWeight:"medium",lineHeight:"20px",children:t})]})})}),TL=({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))})]})},DL=({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(Sp,{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(U,{fontSize:24,lineHeight:"36px",fontWeight:"semi-bold",children:"OTP Verification"}),e(q,{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(W,{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)`:""]})]})})},FL=({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:A=!0,width:g="800px",height:v="432px",showControls:y=!0,customStyle:w,overlay:E=!0,children:b,showControlDownload:M=!1,showControlExpand:L=!1,isFullscreen:x=!1})=>{const H=a(null),V=a(null),[k,S]=c(0),[Z,O]=c(0),[z,N]=c(!1),[I,T]=c(0);l(()=>{"video"===s&&H.current&&!b&&(i?H.current.play():H.current.pause())},[i,s,b]);const D=C(()=>{if(H.current&&!z){const e=H.current.currentTime/H.current.duration*100;T(e||0),S(H.current.currentTime)}},[z]),F=C(()=>{H.current&&O(H.current.duration)},[]),R=C(()=>{S(0),T(0),o?.()},[o]),P=C(e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`,[]),B=C(e=>{if(H.current){const t=e/100*H.current.duration;H.current.currentTime=t,T(e),S(t)}},[]),j=C(e=>{if(z||!V.current)return;const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B,z]),_=C(e=>{if(!V.current)return;N(!0);const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B]),W=C(e=>{if(!z||!V.current||!H.current)return;const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[z,B]),X=C(()=>{N(!1)},[]);return l(()=>{if(z)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",X),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",X)}},[z,W,X]),t?e(iu,{isOpen:t,onClose:r,isMaximized:!1,showHeader:p,overlay:E,downloadHandler:()=>{},customStyle:w,header:n("div",{className:"ff-header-content",children:[e(q,{width:23,height:23,name:"automatic_locator"}),e(U,{children:e("span",{className:"ff-header-title",children:u})})]}),icons:e(Y,{title:"Close",children:e(q,{name:"close",onClick:r})}),width:g,height:v,zIndex:999,children:n("div",{className:"ff-video-wrapper",children:[b||("video"===s?e("video",{ref:H,src:d,className:"ff-media-video",onTimeUpdate:D,onLoadedMetadata:F,onEnded:R}):e("img",{src:d,alt:"Preview",className:"ff-media-image"})),n("div",{className:"ff-top-right-icons",children:[m&&e(Y,{title:"Download",children:e(q,{name:"download_file",color:"white",onClick:f})}),A&&e(Y,{title:x?"Minimize":"Maximize",children:e(q,{name:x?"collapse_icon":"expand_icon",color:"white",onClick:h})})]}),"video"===s&&y&&!b&&n("div",{className:"ff-media-controls",children:[e("button",{onClick:o,className:"ff-play-pause-btn",children:e(Y,{title:i?"Pause":"Play",children:e(q,{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:P(k)}),e("input",{type:"range",className:"ff-seek-bar",min:0,max:100,value:I,onChange:e=>B(parseFloat(e.target.value)),onClick:j,onMouseDown:_,ref:V}),e("span",{className:"ff-total-time",children:P(Z)})]}),n("div",{className:"ff-control-icons",children:[M&&e(Y,{title:"Download",children:e(q,{name:"download_file",color:"white",onClick:f,cursorType:"pointer"})}),L&&e(Y,{title:x?"Minimize":"Maximize",children:e(q,{name:x?"collapse_icon":"expand_icon",color:"white",onClick:h,cursorType:"pointer"})})]})]})]})}):null},RL=({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:A="top-left"})=>{const g=i&&"secondary"===d?s:l,v=a&&parseInt(a)>0,y=o&&parseInt(o)>0,w=i&&(y||v),{tooltip:E="Download",iconName:b="download_file",disabled:M=!1,onClick:L,className:x=""}=p?.download||{},{tooltip:H="Delete",iconName:V="delete_icon",disabled:k=!1,onClick:S,className:Z=""}=p?.delete||{},O=()=>n("div",{className:"ff-dropdown-header-icons",children:[p?.download&&e(Y,{title:E,children:e(q,{name:b||"",className:`ff-dropdown-icon ff-download-icon ${x}`,onClick:L,width:18,height:20,disabled:M,hoverEffect:!0})}),p?.delete&&e(Y,{title:H,children:e(q,{name:V||"",className:`ff-dropdown-icon ff-delete-icon ${Z}`,onClick:S,width:25,height:25,disabled:k,hoverEffect:!0})})]});return n("div",{className:"ff-resolution-dropdown",style:c?{minWidth:c}:{},children:[e("div",{className:"ff-dropdown-notch "+("bottom-center"===A?"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(Au,{tabsData:m,activeTabId:u,onTabClick:e=>{C&&C(e),"tab-1"===e&&f?f():"tab-2"===e&&h&&h()}}),w&&O()]}):i&&w?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(U,{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(U,{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(U,{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(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]})]}):e(U,{fontSize:16,fontWeight:"semi-bold",children:r})})}),e("ul",{className:"ff-dropdown-list",children:g?.map((t,n)=>e("li",{className:"ff-dropdown-item",children:t},n))})]})},PL=(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:"--"},BL=(t,n=[],r,i,o)=>{let a=n;const l=void 0!==i?!i:r;return K(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))})},jL=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:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:E})=>{const b={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:b,children:[i.isTree&&BL(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?uu:T,{})]})}),n("span",{className:"tree-table-fn-td-content "+(i.isTree&&l.container?"folder":""),children:[!l?.isNewNode&&n(t,{children:[i.isTree&&"checkbox"===c&&!(A&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:"none"===l.selectedStatus?e(Y,{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(bn,{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(bn,{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&&!(A&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:e(uc,{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})})]}),e("div",{className:"tree-table-cell-flex",children:l.isNewNode&&i.isTree?e(du,{onCancel:h,onConfirm:f,value:l.value,label:l?.label,optionsList:l.options,selectedOption:l.selectedOption,withDropdown:"inputWithDropdown"===l.type,handleCustomError:C,inputFieldWidth:g,selectFieldWidth:v,confirmIconTooltip:l.confirmIconTooltip,cancelIconTooltip:l.cancelIconTooltip,isEditable:w,setIsEditable:E,isOnBlurTrue:!1,isDisable:{confirm:y},isTableTree:!0}):n(t,{children:[e("span",{className:"tree-table-fn-td-content-text",children:PL(l,i)}),i.actions&&!l?.isNewNode&&e("div",{className:"table-tree-fn-row-action",children:i.actions(l,r)})]})})]})]})]})});jL.displayName="TableCell";const _L=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,addModuleInputWidth:A,addModuleSelectWidth:g,disableEditLabelConfirmIcon:v,isEditable:y,setIsEditable:w,style:E})=>{const b=a(null);return e("div",{"data-level":t.hierarchy,ref:b,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:E,children:n.map((n,a)=>e(jL,{treeRowRef:b,col:n,colIndex:a,node:t,selected:i,select:o,onCheckBoxChange:c,onToggleExpand:s,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,hideOnDisable:m,addModuleInputWidth:A,addModuleSelectWidth:g,disableEditLabelConfirmIcon:v,isEditable:y,setIsEditable:w,columnMeta:r?.[a]},n.name))})});_L.displayName="TableRow";const qL=({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:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:E})=>e("div",{className:"ff-table-tree-fn-body",style:{height:`${a}px`,position:"relative"},children:t?.map((t,a)=>e(_L,{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:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:E,style:{transform:`translateY(${(o+a)*i}px)`,height:`${i}px`,position:"absolute",top:0,left:0,right:0}},t.key))}),UL=i.memo(({columnsData:t,columnMeta:r,totalWidth:i,rootNode:o,selected:s,onCheckBoxChange:d,selectedNode:u,tableHeaderBgColor:f,hideOnDisable:h,transparentHeader:C,showHeader:p=!0,showRootNodeColumnActions:m})=>{const A=a(null),[g,v]=c(!1);l(()=>{v(!0)},[]);const y=(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:[p&&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:{...y(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:A,children:t.map((t,i)=>e("div",{className:"ff-table-tree-fn-td "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:y(i,t.width),children:n("span",{className:"tree-table-fn-default-content "+(0===i?"ff-table-root-index-0":""),children:[0===i&&"checkbox"===o.select&&!(h&&o.node.isDisabled)&&e(bn,{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(uc,{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("div",{className:"tree-table-cell-flex",children:[e(Xs,{children:"name"===t.accessor?o.node[t.accessor]:PL(o.node,t)}),o.cell&&0===i&&e("span",{className:"table-tree--fn-root-cell",children:o.cell(o.node)}),o.actions&&0===i&&g&&A.current&&e("div",{className:"table-tree-fn-row-action",children:o.actions(o.node,A)}),m&&t.actions&&"name"!==t.accessor&&e("div",{className:"table-tree-fn-row-action",children:t.actions(o.node,A)})]})]})},i))})]})});UL.displayName="TableHead";const WL=32,XL="__root__",QL=(e,t)=>{if(!e?.length)return[];const n=new Map,r=new Map,i=new Map,o=new Map;t&&t.key&&n.set(String(t.key),t),e.forEach(e=>{n.set(String(e.key),e);const t=e.parentId?String(e.parentId):XL;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(String(e.key),t)})});const a=e=>{const t=e.parentId?String(e.parentId):XL,a=r.get(t);if(!a||0===a.length)return!1;if((i.get(String(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(String(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,i=r?t.parentSiblings:(e=>{const t=[];let r=e;for(;r&&(r.parentId&&t.unshift(a(r)),r.parentId);)r=n.get(String(r.parentId));return t})(e),o=r?t.hierarchy:i.length;return{...e,lastChild:!a(e),parentSiblings:i,hierarchy:o,selectedStatus:l(e)}})},GL=o(({treeData:t,columnsData:r,selected:i=[],select:o=null,onChange:s=()=>{},onClick:d=()=>{},onExpand:f=()=>{},loadMore:p=()=>{},tableBorder:m,height:A="calc(100vh - 134px)",newNode:g,onAddConfirm:v=()=>{},onAddCancel:y=()=>{},handleEditFieldError:w,loading:E=!1,rootNode:b,pagination:M=!0,selectedNode:L,tableHeaderBgColor:x="var(--border-color-as-bg)",hideOnDisable:H=!1,freezeColumns:V,addModuleInputWidth:k=150,addModuleSelectWidth:S,onScroll:Z,onScrollEnd:O,disableEditLabelConfirmIcon:z=!1,transparentHeader:N=!1,navigateTreeNode:I=null,handleRemoveNavigateTreeNode:T=()=>{},scrollThreshold:D=128,showHeader:F=!0,resetScroll:R=!1,setResetScroll:P=()=>{},showRootNodeColumnActions:B=!1},j)=>{const[_,q]=c(null),[U,W]=c(null),[X,Q]=c({start:0,end:20}),[G,Y]=c(!1),J=a(null),$=a(null),ee=a(0),te=a(E),ne=a(null),re=a(null),ie=a({lastScrollTop:0}),oe=a([]),ae=a(0),le=a(null),se=a(null),ce=a(null),de=a({key:null,attempts:0}),ue=a(null),fe=(e,t)=>{const n=String(e??t);return n.endsWith("%")?{value:parseFloat(n),unit:"%"}:{value:parseFloat(n)||0,unit:"px"}},he=h(()=>{let e=0,t=0;return r.map((n,r)=>{const{value:i,unit:o}=fe(n.width,400),a=!!V&&r<V,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+(V??0)-r:1}})},[r,V]),Ce=h(()=>{let e=0,t=0;return r.forEach(n=>{const{value:r,unit:i}=fe(n.width,400);"%"===i?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[r]),pe=h(()=>{if(!V)return"0px";let e=0,t=0;return he.slice(0,V).forEach(n=>{const r=parseFloat(n.width)||0;n.width.endsWith("%")?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[he,V]),me=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})),A=d?{label:d,value:d}:void 0,g=new Map;e.forEach(e=>g.set(e.key,e)),n&&g.set(n.key,n);const v=g.get(r);let y;h&&(y=g.get(h));let w=v??("addInside"===i?y:void 0);!w&&"addInside"===i&&C&&(w=g.get(C));const E="addInside"===i&&!w&&e.length>=0;if(!w&&!E)return e;const b=[...e],M=w?e.findIndex(e=>e.key===w.key):-1;let L=null,x=0,H=M+1;switch(i){case"addAbove":{const t=w;if(!t)return e;L=t.parentId,x=t.hierarchy;break}case"addBelow":{const t=w;if(!t)return e;L=y?.parentId??t.parentId,x=y?.hierarchy??t.hierarchy;break}case"addInside":{if(E){L=C??h??r??null,x=p??1,H=b.length;break}const t=y??w;if(!t)return e;L=t.key,x=(t.hierarchy??0)+1;const n=b.findIndex(e=>e.key===r);-1!==n&&(H=n+1);break}}const V={hierarchy:x,parentId:L,sourceId:w?.key??r??h??"new-node",isNewNode:!0,key:"new-node",value:o,error:a,label:l,type:s,options:m,selectedOption:A,confirmIconTooltip:u,cancelIconTooltip:f};switch(i){case"addAbove":b.splice(M,0,V);break;case"addBelow":b.splice(M+1,0,V);break;case"addInside":b.splice(Math.max(0,H),0,V)}return b})(t,g,b?.node),[t,g,b]),Ae=h(()=>QL(me,b?.node),[me,b?.node]),ge=h(()=>Ae.filter(e=>!e.hide),[Ae]),ve=h(()=>{const e=new Map;return Ae.forEach(t=>e.set(t.key,t)),e},[Ae]),ye=h(()=>{const e=new Map;return ge.forEach((t,n)=>e.set(t.key,n)),e},[ge]),we=C(e=>{q(t=>t?e&&t!==e?t:null:t),e&&se.current?.key!==e||(se.current=null),ce.current&&(clearTimeout(ce.current),ce.current=null)},[]);l(()=>{te.current=E},[E]),l(()=>{ne.current=U},[U]);const Ee=C(e=>{ne.current=e,W(e)},[]),be=C(()=>{const e=J.current;if(!e)return;const t=ee.current||0,n=Math.max(0,e.scrollTop-t),r=e.clientHeight-t;let i=Math.floor(n/WL)-6,o=Math.ceil((n+r)/WL)+6;i=Math.max(0,i),o=Math.min(ge.length,o),Q(e=>e.start===i&&e.end===o?e:{start:i,end:o})},[ge.length]),Me=C(()=>{null===re.current&&(re.current=requestAnimationFrame(()=>{re.current=null,be()}))},[be]),Le=C(()=>{const e=J.current;if(!e)return;const n=e.scrollTop,r=n>ie.current.lastScrollTop?"down":"up";if(ie.current.lastScrollTop=n,Me(),Z?.(),le.current?.(),!M||E||ne.current||K(t))return;const i=e.scrollHeight,o=e.clientHeight;"down"===r&&i-(n+o)<D&&!t[t.length-1]?.lastResource&&(Ee("below"),p("below"))},[t,M,E,U,D,Me,Z,p,Ee]);l(()=>{if(E||!M||K(t))return;const e=t[0],n=!e?.lastResource,{totalSubContainerCount:r=0,totalResourceCount:i=0}=b?.node||{},o=r+i,a=ge.length<10&&ge.length<o;n&&a&&(Ee("above"),p("above"))},[E,M,t,ge.length,b,p,Ee]),u(()=>{const e=oe.current,t=ge,n=J.current;if(R&&n)return n.scrollTop=0,ie.current.lastScrollTop=0,void P(!1);if(n&&e.length>0&&t.length>0&&!E){const r=ie.current.lastScrollTop,i=Math.max(0,Math.floor(r/WL));let o=-1,a=-1;for(let t=i;t<e.length;t++){const n=e[t]?.key,r=ye.get(n??"");if(void 0!==r){o=t,a=r;break}}if(-1===o)for(let t=i-1;t>=0;t--){const n=e[t]?.key,r=ye.get(n??"");if(void 0!==r){o=t,a=r;break}}if(-1!==o&&-1!==a){const e=a-o,t=Math.max(0,r+e*WL);n.scrollTop!==t&&(n.scrollTop=t,ie.current.lastScrollTop=n.scrollTop,be())}else if("above"===U)0!==n.scrollTop&&(n.scrollTop=0,ie.current.lastScrollTop=0,be());else{const e=ee.current||0,r=Math.max(0,t.length*WL-(n.clientHeight-e));n.scrollTop>r&&(n.scrollTop=r,ie.current.lastScrollTop=r,be())}U&&Ee(null)}oe.current=t},[E,U,ye,ge,Ee,be,R,P]),l(()=>{const e=J.current;if(!e)return;const n=n=>{n.deltaY>=0||!M||K(t)||te.current||ne.current||e.scrollTop>1||t[0]?.lastResource||(Ee("above"),p("above"))};return e.addEventListener("wheel",n,{passive:!0}),()=>{e.removeEventListener("wheel",n)}},[M,t,p,Ee]),l(()=>{const e=J.current;if(e)return le.current=O?Ys(()=>{O?.()},150):null,e.addEventListener("scroll",Le,{passive:!0}),()=>{e.removeEventListener("scroll",Le),le.current?.cancel()}},[Le,O]),l(()=>{const e=J.current;if(!e)return;const t=e=>{Date.now()<ae.current&&e.stopImmediatePropagation()};return e.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{e.removeEventListener("scroll",t,!0)}},[]),l(()=>{const e=$.current;if(!e)return;const t=new ResizeObserver(()=>{ee.current=e.getBoundingClientRect().height,be()});return t.observe(e),()=>t.disconnect()},[be]),u(()=>{if(!g||!J.current)return;const e=J.current,t=ye.get("new-node");if(void 0===t)return;const n=ee.current||0,r=e.clientHeight-n;if(r<=0)return;const i=t*WL,o=i+WL,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&&(ae.current=Date.now()+300,e.scrollTop=l+n,ie.current.lastScrollTop=e.scrollTop,be());const s=requestAnimationFrame(()=>{Y(!0)});return()=>cancelAnimationFrame(s)},[g,ye,be]),l(()=>{g||Y(!1)},[g]),u(()=>{if(!_||E)return;const e=se.current;if(!e||e.key!==_){const e=requestAnimationFrame(()=>{we(_)});return()=>cancelAnimationFrame(e)}const t=ve.get(e.key);if(!t){const t=requestAnimationFrame(()=>{we(e.key)});return()=>cancelAnimationFrame(t)}if(Boolean(t.expanded)!==e.expanded)return;const n=requestAnimationFrame(()=>{we(e.key)});return()=>cancelAnimationFrame(n)},[ve,_,E,we]),l(()=>{de.current.key!==I&&(de.current={key:I,attempts:0}),!I&&ue.current&&(clearTimeout(ue.current),ue.current=null)},[I]),u(()=>{if(!I||g)return;const e=J.current;if(!e)return;const n=ye.get(I);if(void 0!==n){de.current={key:I,attempts:0};const t=ee.current||0,r=Math.max(WL,e.clientHeight-t),i=n*WL+16,o=Math.max(0,i-r/2)+t;return ae.current=Date.now()+400,e.scrollTo({top:o,behavior:"smooth"}),Me(),ue.current&&clearTimeout(ue.current),void(ue.current=setTimeout(()=>{T?.()},350))}if(E||U)return;const r=de.current;if(r.key!==I&&(r.key=I,r.attempts=0),r.attempts+=1,!(r.attempts>30))return M&&!0!==t[0]?.lastResource?(Ee("above"),void p("above")):void(r.attempts>2&&T?.());T?.()},[I,g,ye,E,U,M,t,p,Me,T,Ee]);const xe=C(e=>{if(_)return;const t=!e?.expanded;q(e.key),se.current={key:e.key,expanded:t},ce.current&&clearTimeout(ce.current);const n=Date.now(),r=()=>{if(se.current?.key!==e.key)return;const t=te.current,i=Date.now()-n>=2e3;!t||i?we(e.key):ce.current=setTimeout(r,1e3)};ce.current=setTimeout(r,1e3),f?.(e)},[_,f,we]),He=C((e,t)=>{_||s?.(e,t)},[s,_]),Ve=C((e,t)=>{_||d?.(e,t)},[d,_]);l(()=>()=>{null!==re.current&&(cancelAnimationFrame(re.current),re.current=null),ce.current&&clearTimeout(ce.current),ue.current&&clearTimeout(ue.current)},[]);const ke=ge.length*WL,Se=ge.slice(X.start,X.end);return e("div",{className:"tree-table-wrapper-container table-tree-fn",children:e("div",{className:"tree-table-fn-wrap",ref:j,children:e("div",{className:"table-fn-scrollable "+(ge.length?"":"table-fn-empty"),ref:J,style:{"--table-height":ge.length?A:"auto","--frozen-column-width":pe,border:m},children:n("div",{className:"tree-table-fn",style:{width:Ce},children:[e("div",{ref:$,style:{position:"sticky",top:0,zIndex:98},children:e(UL,{columnsData:r,columnMeta:he,totalWidth:Ce,rootNode:b,onCheckBoxChange:He,selected:i,selectedNode:L,tableHeaderBgColor:x,hideOnDisable:H,transparentHeader:N,showHeader:F,showRootNodeColumnActions:B})}),e(qL,{flattenedTreeData:Se,columnsData:r,columnMeta:he,totalWidth:Ce,rowHeight:WL,startIndex:X.start,totalHeight:ke,selected:i,select:o,onRowClick:Ve,onToggleExpand:xe,onCheckBoxChange:He,onAddConfirm:v,onAddCancel:y,handleEditFieldError:w,expanding:_,selectedNode:L,hideOnDisable:H,addModuleInputWidth:k,addModuleSelectWidth:S,disableEditLabelConfirmIcon:z,isEditable:g?G:void 0,setIsEditable:g?e=>{Y(Boolean(e))}:void 0})]})})})})});GL.displayName="TableTreeFn";const KL=t=>e(uA,{logo:()=>"FireFlink"===t?.name?e(q,{height:100,width:100,name:"fire_flink_loader_logo"}):e("img",{src:t?.loaderName,width:100,height:100,alt:"loader"})}),YL=({isVisible:t})=>t?n("div",{className:"no_data_message",children:[e(q,{name:"no_content",width:120,height:120}),e(U,{fontSize:"20px",lineHeight:"30px",fontWeight:"semi-bold",children:"No Data Available"})]}):null,JL=({text:t=" No Results Found",iconName:r="no_license_found",fontSize:i="24px",textAlign:o="left",direction:a="column",iconWidth:l=120,iconHeight:s=120,fontWeight:c="semi-bold",marginTop:d="0px"})=>e("article",{className:"no_results_container",children:n("div",{className:`no_results_container__${a}`,style:{marginTop:d},children:[e(q,{name:r,width:l,height:s}),e("div",{children:e(U,{as:"div",fontSize:i,lineHeight:"36px",fontWeight:c,color:"var(--text-color)",textAlign:o,children:t})})]})}),$L=({drawerProps:n,showDrawer:r,children:i,zIndex:o=1200,top:a="56px"})=>r?e(vn,{isOpen:n?.isOpen??!0,...n,zIndex:o,top:a,children:i}):e(t,{children:i});const ex=({children:n,offlineContent:r,hasError:i=!1,onNetworkStatusChange:o,overlayClassName:a,overlayZIndex:s=99998,iconWidth:d=300,iconHeight:u=300})=>{const f=function(){const[e,t]=c(navigator.onLine);return l(()=>{const e=()=>{t(!0)},n=()=>{t(!1)};return window.addEventListener("online",e),window.addEventListener("offline",n),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}},[]),e}();return l(()=>{o&&o(f)},[f,o]),i||!f?e("div",{className:`offlineOverlay ${a??""}`,style:{zIndex:s},children:r||e(q,{name:"offline_404_icon",height:u,width:d})}):e(t,{children:n})},tx=e=>{const t=Number.isFinite(e)&&e>0?e:0,n=Math.floor(t/60),r=Math.floor(t%60);return`${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},nx=[.5,1,1.5,2],rx=({duration:r,currentTime:i,isPlaying:o=!1,onPlayPause:l=()=>{},onSeek:s=()=>{},isMuted:d=!1,onMuteToggle:u=()=>{},menuOptions:f,showCaptions:h=!1,onMenuOptionClick:C=()=>{},playbackRate:p=1,onPlaybackRateChange:m=()=>{},disabled:A=!1,seekStep:g=5,formatTime:v=tx,className:y="",style:w={}})=>{const E=r>0?i/r*100:0,b=a(null),M=a(null),[x,H]=c(!1),[V,k]=c({top:0,left:0}),[S,Z]=c(0),O=a(null),z=f??[...h?[{label:"Captions",value:"captions",icon:"captions"}]:[],{label:n("div",{ref:M,className:"playback-menu-option",children:["Playback Speed ",e(xi,{label:`${p.toFixed(1)} x`})]}),value:"playback-speed",icon:"playback",keepMenuOpen:!0}],N=e=>Math.min(Math.max(e,0),r||0);return n("div",{className:`ff-audio-player ${y}`,style:w,"aria-disabled":A,tabIndex:A?-1:0,role:"group","aria-label":"Audio player",onKeyDown:e=>{if(A)return;if("INPUT"!==e.target.tagName)switch(e.key){case" ":case"Spacebar":e.preventDefault(),l();break;case"m":case"M":e.preventDefault(),u();break;case"ArrowRight":e.preventDefault(),s(N(i+g));break;case"ArrowLeft":e.preventDefault(),s(N(i-g))}},children:[e("button",{type:"button",className:"ff-audio-play-btn",onClick:l,disabled:A,"aria-label":o?"Pause":"Play",children:o?n("span",{className:"ff-audio-pause-shape",children:[e("span",{className:"ff-audio-pause-bar"}),e("span",{className:"ff-audio-pause-bar"})]}):e(q,{name:"play",width:8,height:8,cursorType:"pointer",withPadding:!1,className:"ff-audio-play"})}),e(U,{fontSize:8,className:"ff-audio-time",children:v(i)}),n("div",{className:"ff-audio-seek-wrap",children:[e("div",{className:"ff-audio-seek-track"}),e("div",{className:"ff-audio-seek-fill",style:{width:`${E}%`}}),e("input",{type:"range",className:"ff-audio-seek",min:0,max:r||0,step:1,value:i,disabled:A,onChange:e=>{s(Number(e.target.value))},"aria-label":"Seek"})]}),e(U,{fontSize:8,className:"ff-audio-time",children:v(r)}),e(q,{name:"speaker",onClick:A?()=>{}:u,disabled:A,withPadding:!1,className:"ff-audio-speaker-icon"+(d?" ff-audio-speaker-muted":""),cursorType:"pointer"}),e("div",{className:"ff-audio-more-wrap",ref:b,children:e(Do,{iconName:"more",options:z,onOptionClick:e=>{if("playback-speed"===e.value){const e=M.current?.getBoundingClientRect();if(e){let t=e.top,n=e.right+8;t+102>window.innerHeight-8&&(t=Math.max(8,e.bottom-102)),n+36>window.innerWidth-8&&(n=Math.max(8,e.left-36-8)),k({top:t,left:n})}const t=nx.indexOf(p);return Z(t>=0?t:0),H(!0),void requestAnimationFrame(()=>O.current?.focus())}C(e)},dropdownPlacement:"bottomLeft",displayCard:!0,disabled:A,iconSize:12})}),x&&L(n(t,{children:[e("div",{className:"ff-audio-speed-overlay",onClick:()=>H(!1)}),e("div",{className:"ff-audio-speed-menu",style:{top:V.top,left:V.left},ref:O,tabIndex:-1,role:"listbox","aria-label":"Playback speed",onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),Z(e=>(e+1)%nx.length);break;case"ArrowUp":e.preventDefault(),Z(e=>(e-1+nx.length)%nx.length);break;case"Enter":e.preventDefault(),m(nx[S]),H(!1);break;case"Escape":e.preventDefault(),H(!1)}},children:nx.map((t,r)=>{const i=t===p;return e("button",{type:"button",role:"option","aria-selected":i,className:["ff-audio-speed-option",r===S&&"ff-audio-speed-option-highlighted",i&&"ff-audio-speed-option-selected"].filter(Boolean).join(" "),onMouseEnter:()=>Z(r),onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation(),m(t),H(!1)},children:n(U,{fontSize:10,children:[t.toFixed(1),"x"]})},t)})})]}),document.body)]})};function ix(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)}const ox=(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)=>ox(e,o[t]));{const n=new Set(o);return i.every(r=>n.has(r)&&ox(e[r],t[r]))}},ax=(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every((e,n)=>{const r=t[n];return ox(e,r)}));function lx(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function sx(e,t){return e&t}function cx(e,t){return e|t}function dx(e,t){return e^t}function ux(e,t){return e&~t}function fx(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 hx(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var Cx,px="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function mx(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=px.charAt(n>>6)+px.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=px.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=px.charAt(n>>2)+px.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function Ax(e){var t,n="",r=0,i=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var o=px.indexOf(e.charAt(t));o<0||(0==r?(n+=lx(o>>2),i=3&o,r=1):1==r?(n+=lx(i<<2|o>>4),i=15&o,r=2):2==r?(n+=lx(i),n+=lx(o>>2),i=3&o,r=3):(n+=lx(i<<2|o>>4),n+=lx(15&o),r=0))}return 1==r&&(n+=lx(i<<2)),n}var gx,vx=function(e){var t;if(void 0===Cx){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(Cx={},t=0;t<16;++t)Cx[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)Cx[n.charAt(t)]=t;for(t=0;t<8;++t)Cx[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=Cx[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},yx={decode:function(e){var t;if(void 0===gx){var n="= \f\n\r\t \u2028\u2029";for(gx=Object.create(null),t=0;t<64;++t)gx["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(gx["-"]=62,gx._=63,t=0;t<9;++t)gx[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=gx[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=yx.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 yx.decode(e)}},wx=1e13,Ex=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)<wx?t=0:r-=(t=0|r/wx)*wx,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+=wx,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+=(wx+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*wx+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),bx=/^(\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)?)?$/,Mx=/^(\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 Lx(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}var xx,Hx=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?bx:Mx).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 Ex(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+Lx(o,n)}return i+o},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return Lx(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 Ex,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 Ex)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 Lx(r,n);i=new Ex,o=0}}return o>0&&(r+=".incomplete"),r},e}(),Vx=function(){function e(e,t,n,r,i){if(!(r instanceof kx))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 Lx(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return Lx(this.stream.parseStringISO(t,t+n),e);case 30:return Lx(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.substring(t,t+n)},e.decode=function(t){var n;n=t instanceof Hx?t:new Hx(t,0);var r=new Hx(n),i=new kx(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}(),kx=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 Ex;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}(),Sx=[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],Zx=(1<<26)/Sx[Sx.length-1],Ox=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=lx(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+=lx(n));return i?o:"0"},e.prototype.negate=function(){var t=Dx();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)+Ux(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=Dx();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 Nx(t):new Ix(t),this.exp(e,n)},e.prototype.clone=function(){var e=Dx();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=Dx();return this.bitwiseTo(e,sx,t),t},e.prototype.or=function(e){var t=Dx();return this.bitwiseTo(e,cx,t),t},e.prototype.xor=function(e){var t=Dx();return this.bitwiseTo(e,dx,t),t},e.prototype.andNot=function(e){var t=Dx();return this.bitwiseTo(e,ux,t),t},e.prototype.not=function(){for(var e=Dx(),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=Dx();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=Dx();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+fx(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+=hx(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,cx)},e.prototype.clearBit=function(e){return this.changeBit(e,ux)},e.prototype.flipBit=function(e){return this.changeBit(e,dx)},e.prototype.add=function(e){var t=Dx();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=Dx();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=Dx();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=Dx();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=Dx();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=Dx(),n=Dx();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),o=qx(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new Nx(t):t.isEven()?new Tx(t):new Ix(t);var a=[],l=3,s=n-1,c=(1<<n)-1;if(a[1]=r.convert(this),n>1){var d=Dx();for(r.sqrTo(a[1],d);l<=c;)a[l]=Dx(),r.mulTo(d,a[l-2],a[l]),l+=2}var u,f,h=e.t-1,C=!0,p=Dx();for(i=Ux(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=qx(1),a=qx(0),l=qx(0),s=qx(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 zx)},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]<=Sx[Sx.length-1]){for(t=0;t<Sx.length;++t)if(n[0]==Sx[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<Sx.length;){for(var r=Sx[t],i=t+1;i<Sx.length&&r<Zx;)r*=Sx[i++];for(r=n.modInt(r);t<i;)if(r%Sx[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]:_x(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=Dx());var a=Dx(),l=this.s,s=t.s,c=this.DB-Ux(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,A=m-d,g=null==n?Dx():n;for(a.dlShiftTo(A,g),r.compareTo(g)>=0&&(r[r.t++]=1,r.subTo(g,r)),e.ONE.dlShiftTo(d,g),g.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--A>=0;){var v=r[--m]==u?this.DM:Math.floor(r[m]*h+(r[m-1]+p)*C);if((r[m]+=a.am(0,v,r,A,0,d))<v)for(a.dlShiftTo(A,g),r.subTo(g,r);r[m]<--v;)r.subTo(g,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=Dx(),i=Dx(),o=n.convert(this),a=Ux(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=qx(n),i=Dx(),o=Dx(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substring(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=_x(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),cx,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)>Sx.length&&(t=Sx.length);for(var o=Dx(),a=0;a<t;++a){o.fromInt(Sx[Math.floor(Math.random()*Sx.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=Dx();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),cx,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}(),zx=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}(),Nx=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}(),Ix=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=Dx();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Ox.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=Dx();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}(),Tx=function(){function e(e){this.m=e,this.r2=Dx(),this.q3=Dx(),Ox.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=Dx();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 Dx(){return new Ox(null)}function Fx(e,t){return new Ox(e,t)}var Rx="undefined"!=typeof navigator;Rx&&"Microsoft Internet Explorer"==navigator.appName?(Ox.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},xx=30):Rx&&"Netscape"!=navigator.appName?(Ox.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},xx=26):(Ox.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},xx=28),Ox.prototype.DB=xx,Ox.prototype.DM=(1<<xx)-1,Ox.prototype.DV=1<<xx;Ox.prototype.FV=Math.pow(2,52),Ox.prototype.F1=52-xx,Ox.prototype.F2=2*xx-52;var Px,Bx,jx=[];for(Px="0".charCodeAt(0),Bx=0;Bx<=9;++Bx)jx[Px++]=Bx;for(Px="a".charCodeAt(0),Bx=10;Bx<36;++Bx)jx[Px++]=Bx;for(Px="A".charCodeAt(0),Bx=10;Bx<36;++Bx)jx[Px++]=Bx;function _x(e,t){var n=jx[e.charCodeAt(t)];return null==n?-1:n}function qx(e){var t=Dx();return t.fromInt(e),t}function Ux(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}Ox.ZERO=qx(0),Ox.ONE=qx(1);var Wx=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 Xx,Qx,Gx=null;if(null==Gx){Gx=[],Qx=0;var Kx=void 0;if("undefined"!=typeof window&&self.crypto&&self.crypto.getRandomValues){var Yx=new Uint32Array(256);for(self.crypto.getRandomValues(Yx),Kx=0;Kx<Yx.length;++Kx)Gx[Qx++]=255&Yx[Kx]}var Jx=0,$x=function(e){if((Jx=Jx||0)>=256||Qx>=256)self.removeEventListener?self.removeEventListener("mousemove",$x,!1):self.detachEvent&&self.detachEvent("onmousemove",$x);else try{var t=e.x+e.y;Gx[Qx++]=255&t,Jx+=1}catch(e){}};"undefined"!=typeof window&&(self.addEventListener?self.addEventListener("mousemove",$x,!1):self.attachEvent&&self.attachEvent("onmousemove",$x))}function eH(){if(null==Xx){for(Xx=new Wx;Qx<256;){var e=Math.floor(65536*Math.random());Gx[Qx++]=255&e}for(Xx.init(Gx),Qx=0;Qx<Gx.length;++Qx)Gx[Qx]=0;Qx=0}return Xx.next()}var tH=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=eH()},e}();function nH(e){return function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}(function(e,t){var n,r,i,o,a,l,s,c,d,u,f,h,C=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),p=new Array(64);for(e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t,d=0;d<e.length;d+=16){for(n=C[0],r=C[1],i=C[2],o=C[3],a=C[4],l=C[5],s=C[6],c=C[7],u=0;u<64;u++)p[u]=u<16?e[u+d]:hH(hH(hH(uH(p[u-2]),p[u-7]),dH(p[u-15])),p[u-16]),f=hH(hH(hH(hH(c,cH(a)),aH(a,l,s)),fH[u]),p[u]),h=hH(sH(n),lH(n,r,i)),c=s,s=l,l=a,a=hH(o,f),o=i,i=r,r=n,n=hH(f,h);C[0]=hH(n,C[0]),C[1]=hH(r,C[1]),C[2]=hH(i,C[2]),C[3]=hH(o,C[3]),C[4]=hH(a,C[4]),C[5]=hH(l,C[5]),C[6]=hH(s,C[6]),C[7]=hH(c,C[7])}return C}(function(e){for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}(e),8*e.length))}function rH(e){for(var t="0123456789abcdef",n="",r=0;r<e.length;r++){var i=e.charCodeAt(r);n+=t.charAt(i>>>4&15)+t.charAt(15&i)}return n}function iH(e,t){return e>>>t|e<<32-t}function oH(e,t){return e>>>t}function aH(e,t,n){return e&t^~e&n}function lH(e,t,n){return e&t^e&n^t&n}function sH(e){return iH(e,2)^iH(e,13)^iH(e,22)}function cH(e){return iH(e,6)^iH(e,11)^iH(e,25)}function dH(e){return iH(e,7)^iH(e,18)^oH(e,3)}function uH(e){return iH(e,17)^iH(e,19)^oH(e,10)}var fH=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function hH(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function CH(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 tH,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 Ox(n)}function pH(e,t,n){for(var r="",i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return r}function mH(e,t){var n=nH;if(e.length+64+2>t)throw"Message too long for RSA";var r,i="";for(r=0;r<t-e.length-64-2;r+=1)i+="\0";var o=n("")+i+""+e,a=new Array(32);(new tH).nextBytes(a);var l=pH(a,o.length,n),s=[];for(r=0;r<o.length;r+=1)s[r]=o.charCodeAt(r)^l.charCodeAt(r);var c=pH(s,a.length,n),d=[0];for(r=0;r<a.length;r+=1)d[r+1]=a[r]^c.charCodeAt(r);return new Ox(d.concat(s))}var AH=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=Fx(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e,t){void 0===t&&(t=CH);var n=this.n.bitLength()+7>>3,r=t(e,n);if(null==r)return null;var i=this.doPublic(r);if(null==i)return null;for(var o=i.toString(16),a=o.length,l=0;l<2*n-a;l++)o="0"+o;return o},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=Fx(e,16),this.e=parseInt(t,16),this.d=Fx(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=Fx(e,16),this.e=parseInt(t,16),this.d=Fx(n,16),this.p=Fx(r,16),this.q=Fx(i,16),this.dmp1=Fx(o,16),this.dmq1=Fx(a,16),this.coeff=Fx(l,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new tH,r=e>>1;this.e=parseInt(t,16);for(var i=new Ox(t,16);;){for(;this.p=new Ox(e-r,1,n),0!=this.p.subtract(Ox.ONE).gcd(i).compareTo(Ox.ONE)||!this.p.isProbablePrime(10););for(;this.q=new Ox(r,1,n),0!=this.q.subtract(Ox.ONE).gcd(i).compareTo(Ox.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(Ox.ONE),l=this.q.subtract(Ox.ONE),s=a.multiply(l);if(0==s.gcd(i).compareTo(Ox.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=Fx(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 tH,i=e>>1;this.e=parseInt(t,16);var o=new Ox(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(Ox.ONE),r=a.q.subtract(Ox.ONE),i=t.multiply(r);0==i.gcd(o).compareTo(Ox.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=Dx(),a.q.fromNumberAsync(i,1,r,function(){a.q.subtract(Ox.ONE).gcda(o,function(e){0==e.compareTo(Ox.ONE)&&a.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(s,0)})})},c=function(){a.p=Dx(),a.p.fromNumberAsync(e-i,1,r,function(){a.p.subtract(Ox.ONE).gcda(o,function(e){0==e.compareTo(Ox.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=(gH[n]||"")+t(e).toString(),i=this.n.bitLength()/4,o=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 Fx("0001"+r+"00"+e,16)}(r,i);if(null==o)return null;var a=this.doPrivate(o);if(null==a)return null;for(var l=a.toString(16),s=l.length,c=0;c<i-s;c++)l="0"+l;return l},e.prototype.verify=function(e,t,n){var r=Fx(t,16),i=this.doPublic(r);return null==i?null:function(e){for(var t in gH)if(gH.hasOwnProperty(t)){var n=gH[t],r=n.length;if(e.substring(0,r)==n)return e.substring(r)}return e}(i.toString(16).replace(/^1f+00/,""))==n(e).toString()},e}();var gH={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function vH(e,t,n){if(!t||!e)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}
37
37
  /**
38
38
  * @fileOverview
39
39
  * @name asn1-1.0.js