1719 lines
1.6 MiB
1719 lines
1.6 MiB
var C4=Object.defineProperty,A4=Object.defineProperties;var O4=Object.getOwnPropertyDescriptors;var Gu=Object.getOwnPropertySymbols;var $b=Object.prototype.hasOwnProperty,Wb=Object.prototype.propertyIsEnumerable;var rc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),M4=e=>{throw TypeError(e)};var ng=(e,t,a)=>t in e?C4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,ie=(e,t)=>{for(var a in t||(t={}))$b.call(t,a)&&ng(e,a,t[a]);if(Gu)for(var a of Gu(t))Wb.call(t,a)&&ng(e,a,t[a]);return e},Ee=(e,t)=>A4(e,O4(t));var fn=(e,t)=>{var a={};for(var s in e)$b.call(e,s)&&t.indexOf(s)<0&&(a[s]=e[s]);if(e!=null&&Gu)for(var s of Gu(e))t.indexOf(s)<0&&Wb.call(e,s)&&(a[s]=e[s]);return a};var L4=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Kn=(e,t,a)=>ng(e,typeof t!="symbol"?t+"":t,a);var oe=(e,t,a)=>new Promise((s,i)=>{var d=g=>{try{f(a.next(g))}catch(p){i(p)}},c=g=>{try{f(a.throw(g))}catch(p){i(p)}},f=g=>g.done?s(g.value):Promise.resolve(g.value).then(d,c);f((a=a.apply(e,t)).next())}),Zl=function(e,t){this[0]=e,this[1]=t},sg=(e,t,a)=>{var s=(c,f,g,p)=>{try{var x=a[c](f),y=(f=x.value)instanceof Zl,_=x.done;Promise.resolve(y?f[0]:f).then(k=>y?s(c==="return"?c:"next",f[1]?{done:k.done,value:k.value}:k,g,p):g({value:k,done:_})).catch(k=>s("throw",k,g,p))}catch(k){p(k)}},i=c=>d[c]=f=>new Promise((g,p)=>s(c,f,g,p)),d={};return a=a.apply(e,t),d[rc("asyncIterator")]=()=>d,i("next"),i("throw"),i("return"),d},ig=e=>{var t=e[rc("asyncIterator")],a=!1,s,i={};return t==null?(t=e[rc("iterator")](),s=d=>i[d]=c=>t[d](c)):(t=t.call(e),s=d=>i[d]=c=>{if(a){if(a=!1,d==="throw")throw c;return c}return a=!0,{done:!1,value:new Zl(new Promise(f=>{var g=t[d](c);g instanceof Object||M4("Object expected"),f(g)}),1)}}),i[rc("iterator")]=()=>i,s("next"),"throw"in t?s("throw"):i.throw=d=>{throw d},"return"in t&&s("return"),i},Vb=(e,t,a)=>(t=e[rc("asyncIterator")])?t.call(e):(e=e[rc("iterator")](),t={},a=(s,i)=>(i=e[s])&&(t[s]=d=>new Promise((c,f,g)=>(d=i.call(e,d),g=d.done,Promise.resolve(d.value).then(p=>c({value:p,done:g}),f)))),a("next"),a("return"),t);var uD=L4(et=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const d of i)if(d.type==="childList")for(const c of d.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function a(i){const d={};return i.integrity&&(d.integrity=i.integrity),i.referrerPolicy&&(d.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?d.credentials="include":i.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function s(i){if(i.ep)return;i.ep=!0;const d=a(i);fetch(i.href,d)}})();function Jv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lg={exports:{}},Rd={};var Gb;function D4(){if(Gb)return Rd;Gb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(s,i,d){var c=null;if(d!==void 0&&(c=""+d),i.key!==void 0&&(c=""+i.key),"key"in i){d={};for(var f in i)f!=="key"&&(d[f]=i[f])}else d=i;return i=d.ref,{$$typeof:e,type:s,key:c,ref:i!==void 0?i:null,props:d}}return Rd.Fragment=t,Rd.jsx=a,Rd.jsxs=a,Rd}var Zb;function P4(){return Zb||(Zb=1,lg.exports=D4()),lg.exports}var r=P4(),og={exports:{}},Zt={};var qb;function R4(){if(qb)return Zt;qb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),_=Symbol.iterator;function k(F){return F===null||typeof F!="object"?null:(F=_&&F[_]||F["@@iterator"],typeof F=="function"?F:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,S={};function O(F,D,W){this.props=F,this.context=D,this.refs=S,this.updater=W||T}O.prototype.isReactComponent={},O.prototype.setState=function(F,D){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,D,"setState")},O.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function C(){}C.prototype=O.prototype;function A(F,D,W){this.props=F,this.context=D,this.refs=S,this.updater=W||T}var P=A.prototype=new C;P.constructor=A,N(P,O.prototype),P.isPureReactComponent=!0;var I=Array.isArray;function ee(){}var B={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function Y(F,D,W){var G=W.ref;return{$$typeof:e,type:F,key:D,ref:G!==void 0?G:null,props:W}}function ue(F,D){return Y(F.type,D,F.props)}function xe(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function le(F){var D={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(W){return D[W]})}var ge=/\/+/g;function be(F,D){return typeof F=="object"&&F!==null&&F.key!=null?le(""+F.key):D.toString(36)}function me(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(ee,ee):(F.status="pending",F.then(function(D){F.status==="pending"&&(F.status="fulfilled",F.value=D)},function(D){F.status==="pending"&&(F.status="rejected",F.reason=D)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function ae(F,D,W,G,J){var de=typeof F;(de==="undefined"||de==="boolean")&&(F=null);var De=!1;if(F===null)De=!0;else switch(de){case"bigint":case"string":case"number":De=!0;break;case"object":switch(F.$$typeof){case e:case t:De=!0;break;case x:return De=F._init,ae(De(F._payload),D,W,G,J)}}if(De)return J=J(F),De=G===""?"."+be(F,0):G,I(J)?(W="",De!=null&&(W=De.replace(ge,"$&/")+"/"),ae(J,D,W,"",function(Ve){return Ve})):J!=null&&(xe(J)&&(J=ue(J,W+(J.key==null||F&&F.key===J.key?"":(""+J.key).replace(ge,"$&/")+"/")+De)),D.push(J)),1;De=0;var Ne=G===""?".":G+":";if(I(F))for(var $e=0;$e<F.length;$e++)G=F[$e],de=Ne+be(G,$e),De+=ae(G,D,W,de,J);else if($e=k(F),typeof $e=="function")for(F=$e.call(F),$e=0;!(G=F.next()).done;)G=G.value,de=Ne+be(G,$e++),De+=ae(G,D,W,de,J);else if(de==="object"){if(typeof F.then=="function")return ae(me(F),D,W,G,J);throw D=String(F),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return De}function Z(F,D,W){if(F==null)return F;var G=[],J=0;return ae(F,G,"","",function(de){return D.call(W,de,J++)}),G}function K(F){if(F._status===-1){var D=F._result;D=D(),D.then(function(W){(F._status===0||F._status===-1)&&(F._status=1,F._result=W)},function(W){(F._status===0||F._status===-1)&&(F._status=2,F._result=W)}),F._status===-1&&(F._status=0,F._result=D)}if(F._status===1)return F._result.default;throw F._result}var te=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},se={map:Z,forEach:function(F,D,W){Z(F,function(){D.apply(this,arguments)},W)},count:function(F){var D=0;return Z(F,function(){D++}),D},toArray:function(F){return Z(F,function(D){return D})||[]},only:function(F){if(!xe(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return Zt.Activity=y,Zt.Children=se,Zt.Component=O,Zt.Fragment=a,Zt.Profiler=i,Zt.PureComponent=A,Zt.StrictMode=s,Zt.Suspense=g,Zt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Zt.__COMPILER_RUNTIME={__proto__:null,c:function(F){return B.H.useMemoCache(F)}},Zt.cache=function(F){return function(){return F.apply(null,arguments)}},Zt.cacheSignal=function(){return null},Zt.cloneElement=function(F,D,W){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var G=N({},F.props),J=F.key;if(D!=null)for(de in D.key!==void 0&&(J=""+D.key),D)!H.call(D,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&D.ref===void 0||(G[de]=D[de]);var de=arguments.length-2;if(de===1)G.children=W;else if(1<de){for(var De=Array(de),Ne=0;Ne<de;Ne++)De[Ne]=arguments[Ne+2];G.children=De}return Y(F.type,J,G)},Zt.createContext=function(F){return F={$$typeof:c,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:d,_context:F},F},Zt.createElement=function(F,D,W){var G,J={},de=null;if(D!=null)for(G in D.key!==void 0&&(de=""+D.key),D)H.call(D,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=D[G]);var De=arguments.length-2;if(De===1)J.children=W;else if(1<De){for(var Ne=Array(De),$e=0;$e<De;$e++)Ne[$e]=arguments[$e+2];J.children=Ne}if(F&&F.defaultProps)for(G in De=F.defaultProps,De)J[G]===void 0&&(J[G]=De[G]);return Y(F,de,J)},Zt.createRef=function(){return{current:null}},Zt.forwardRef=function(F){return{$$typeof:f,render:F}},Zt.isValidElement=xe,Zt.lazy=function(F){return{$$typeof:x,_payload:{_status:-1,_result:F},_init:K}},Zt.memo=function(F,D){return{$$typeof:p,type:F,compare:D===void 0?null:D}},Zt.startTransition=function(F){var D=B.T,W={};B.T=W;try{var G=F(),J=B.S;J!==null&&J(W,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(ee,te)}catch(de){te(de)}finally{D!==null&&W.types!==null&&(D.types=W.types),B.T=D}},Zt.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Zt.use=function(F){return B.H.use(F)},Zt.useActionState=function(F,D,W){return B.H.useActionState(F,D,W)},Zt.useCallback=function(F,D){return B.H.useCallback(F,D)},Zt.useContext=function(F){return B.H.useContext(F)},Zt.useDebugValue=function(){},Zt.useDeferredValue=function(F,D){return B.H.useDeferredValue(F,D)},Zt.useEffect=function(F,D){return B.H.useEffect(F,D)},Zt.useEffectEvent=function(F){return B.H.useEffectEvent(F)},Zt.useId=function(){return B.H.useId()},Zt.useImperativeHandle=function(F,D,W){return B.H.useImperativeHandle(F,D,W)},Zt.useInsertionEffect=function(F,D){return B.H.useInsertionEffect(F,D)},Zt.useLayoutEffect=function(F,D){return B.H.useLayoutEffect(F,D)},Zt.useMemo=function(F,D){return B.H.useMemo(F,D)},Zt.useOptimistic=function(F,D){return B.H.useOptimistic(F,D)},Zt.useReducer=function(F,D,W){return B.H.useReducer(F,D,W)},Zt.useRef=function(F){return B.H.useRef(F)},Zt.useState=function(F){return B.H.useState(F)},Zt.useSyncExternalStore=function(F,D,W){return B.H.useSyncExternalStore(F,D,W)},Zt.useTransition=function(){return B.H.useTransition()},Zt.version="19.2.1",Zt}var Yb;function Bf(){return Yb||(Yb=1,og.exports=R4()),og.exports}var j=Bf();const ia=Jv(j);var cg={exports:{}},Fd={},dg={exports:{}},ug={};var Xb;function F4(){return Xb||(Xb=1,(function(e){function t(ae,Z){var K=ae.length;ae.push(Z);e:for(;0<K;){var te=K-1>>>1,se=ae[te];if(0<i(se,Z))ae[te]=Z,ae[K]=se,K=te;else break e}}function a(ae){return ae.length===0?null:ae[0]}function s(ae){if(ae.length===0)return null;var Z=ae[0],K=ae.pop();if(K!==Z){ae[0]=K;e:for(var te=0,se=ae.length,F=se>>>1;te<F;){var D=2*(te+1)-1,W=ae[D],G=D+1,J=ae[G];if(0>i(W,K))G<se&&0>i(J,W)?(ae[te]=J,ae[G]=K,te=G):(ae[te]=W,ae[D]=K,te=D);else if(G<se&&0>i(J,K))ae[te]=J,ae[G]=K,te=G;else break e}}return Z}function i(ae,Z){var K=ae.sortIndex-Z.sortIndex;return K!==0?K:ae.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var g=[],p=[],x=1,y=null,_=3,k=!1,T=!1,N=!1,S=!1,O=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate!="undefined"?setImmediate:null;function P(ae){for(var Z=a(p);Z!==null;){if(Z.callback===null)s(p);else if(Z.startTime<=ae)s(p),Z.sortIndex=Z.expirationTime,t(g,Z);else break;Z=a(p)}}function I(ae){if(N=!1,P(ae),!T)if(a(g)!==null)T=!0,ee||(ee=!0,le());else{var Z=a(p);Z!==null&&me(I,Z.startTime-ae)}}var ee=!1,B=-1,H=5,Y=-1;function ue(){return S?!0:!(e.unstable_now()-Y<H)}function xe(){if(S=!1,ee){var ae=e.unstable_now();Y=ae;var Z=!0;try{e:{T=!1,N&&(N=!1,C(B),B=-1),k=!0;var K=_;try{t:{for(P(ae),y=a(g);y!==null&&!(y.expirationTime>ae&&ue());){var te=y.callback;if(typeof te=="function"){y.callback=null,_=y.priorityLevel;var se=te(y.expirationTime<=ae);if(ae=e.unstable_now(),typeof se=="function"){y.callback=se,P(ae),Z=!0;break t}y===a(g)&&s(g),P(ae)}else s(g);y=a(g)}if(y!==null)Z=!0;else{var F=a(p);F!==null&&me(I,F.startTime-ae),Z=!1}}break e}finally{y=null,_=K,k=!1}Z=void 0}}finally{Z?le():ee=!1}}}var le;if(typeof A=="function")le=function(){A(xe)};else if(typeof MessageChannel!="undefined"){var ge=new MessageChannel,be=ge.port2;ge.port1.onmessage=xe,le=function(){be.postMessage(null)}}else le=function(){O(xe,0)};function me(ae,Z){B=O(function(){ae(e.unstable_now())},Z)}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(ae){ae.callback=null},e.unstable_forceFrameRate=function(ae){0>ae||125<ae?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<ae?Math.floor(1e3/ae):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(ae){switch(_){case 1:case 2:case 3:var Z=3;break;default:Z=_}var K=_;_=Z;try{return ae()}finally{_=K}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(ae,Z){switch(ae){case 1:case 2:case 3:case 4:case 5:break;default:ae=3}var K=_;_=ae;try{return Z()}finally{_=K}},e.unstable_scheduleCallback=function(ae,Z,K){var te=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?te+K:te):K=te,ae){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=K+se,ae={id:x++,callback:Z,priorityLevel:ae,startTime:K,expirationTime:se,sortIndex:-1},K>te?(ae.sortIndex=K,t(p,ae),a(g)===null&&ae===a(p)&&(N?(C(B),B=-1):N=!0,me(I,K-te))):(ae.sortIndex=se,t(g,ae),T||k||(T=!0,ee||(ee=!0,le()))),ae},e.unstable_shouldYield=ue,e.unstable_wrapCallback=function(ae){var Z=_;return function(){var K=_;_=Z;try{return ae.apply(this,arguments)}finally{_=K}}}})(ug)),ug}var Jb;function I4(){return Jb||(Jb=1,dg.exports=F4()),dg.exports}var fg={exports:{}},Ur={};var Kb;function z4(){if(Kb)return Ur;Kb=1;var e=Bf();function t(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)p+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var s={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},i=Symbol.for("react.portal");function d(g,p,x){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:y==null?null:""+y,children:g,containerInfo:p,implementation:x}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ur.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Ur.createPortal=function(g,p){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return d(g,p,null,x)},Ur.flushSync=function(g){var p=c.T,x=s.p;try{if(c.T=null,s.p=2,g)return g()}finally{c.T=p,s.p=x,s.d.f()}},Ur.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(g,p))},Ur.prefetchDNS=function(g){typeof g=="string"&&s.d.D(g)},Ur.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var x=p.as,y=f(x,p.crossOrigin),_=typeof p.integrity=="string"?p.integrity:void 0,k=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;x==="style"?s.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:_,fetchPriority:k}):x==="script"&&s.d.X(g,{crossOrigin:y,integrity:_,fetchPriority:k,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ur.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var x=f(p.as,p.crossOrigin);s.d.M(g,{crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(g)},Ur.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var x=p.as,y=f(x,p.crossOrigin);s.d.L(g,x,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ur.preloadModule=function(g,p){if(typeof g=="string")if(p){var x=f(p.as,p.crossOrigin);s.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(g)},Ur.requestFormReset=function(g){s.d.r(g)},Ur.unstable_batchedUpdates=function(g,p){return g(p)},Ur.useFormState=function(g,p,x){return c.H.useFormState(g,p,x)},Ur.useFormStatus=function(){return c.H.useHostTransitionStatus()},Ur.version="19.2.1",Ur}var Qb;function Kv(){if(Qb)return fg.exports;Qb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),fg.exports=z4(),fg.exports}var e1;function B4(){if(e1)return Fd;e1=1;var e=I4(),t=Bf(),a=Kv();function s(n){var l="https://react.dev/errors/"+n;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+n+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function d(n){var l=n,u=n;if(n.alternate)for(;l.return;)l=l.return;else{n=l;do l=n,(l.flags&4098)!==0&&(u=l.return),n=l.return;while(n)}return l.tag===3?u:null}function c(n){if(n.tag===13){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function f(n){if(n.tag===31){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function g(n){if(d(n)!==n)throw Error(s(188))}function p(n){var l=n.alternate;if(!l){if(l=d(n),l===null)throw Error(s(188));return l!==n?null:n}for(var u=n,m=l;;){var v=u.return;if(v===null)break;var w=v.alternate;if(w===null){if(m=v.return,m!==null){u=m;continue}break}if(v.child===w.child){for(w=v.child;w;){if(w===u)return g(v),n;if(w===m)return g(v),l;w=w.sibling}throw Error(s(188))}if(u.return!==m.return)u=v,m=w;else{for(var R=!1,q=v.child;q;){if(q===u){R=!0,u=v,m=w;break}if(q===m){R=!0,m=v,u=w;break}q=q.sibling}if(!R){for(q=w.child;q;){if(q===u){R=!0,u=w,m=v;break}if(q===m){R=!0,m=w,u=v;break}q=q.sibling}if(!R)throw Error(s(189))}}if(u.alternate!==m)throw Error(s(190))}if(u.tag!==3)throw Error(s(188));return u.stateNode.current===u?n:l}function x(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n;for(n=n.child;n!==null;){if(l=x(n),l!==null)return l;n=n.sibling}return null}var y=Object.assign,_=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),A=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),ue=Symbol.for("react.memo_cache_sentinel"),xe=Symbol.iterator;function le(n){return n===null||typeof n!="object"?null:(n=xe&&n[xe]||n["@@iterator"],typeof n=="function"?n:null)}var ge=Symbol.for("react.client.reference");function be(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ge?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case N:return"Fragment";case O:return"Profiler";case S:return"StrictMode";case I:return"Suspense";case ee:return"SuspenseList";case Y:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case A:return n.displayName||"Context";case C:return(n._context.displayName||"Context")+".Consumer";case P:var l=n.render;return n=n.displayName,n||(n=l.displayName||l.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case B:return l=n.displayName||null,l!==null?l:be(n.type)||"Memo";case H:l=n._payload,n=n._init;try{return be(n(l))}catch(u){}}return null}var me=Array.isArray,ae=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},te=[],se=-1;function F(n){return{current:n}}function D(n){0>se||(n.current=te[se],te[se]=null,se--)}function W(n,l){se++,te[se]=n.current,n.current=l}var G=F(null),J=F(null),de=F(null),De=F(null);function Ne(n,l){switch(W(de,l),W(J,n),W(G,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?fb(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=fb(l),n=hb(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}D(G),W(G,n)}function $e(){D(G),D(J),D(de)}function Ve(n){n.memoizedState!==null&&W(De,n);var l=G.current,u=hb(l,n.type);l!==u&&(W(J,n),W(G,u))}function st(n){J.current===n&&(D(G),D(J)),De.current===n&&(D(De),Md._currentValue=K)}var gt,zt;function Ge(n){if(gt===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);gt=l&&l[1]||"",zt=-1<u.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+gt+n+zt}var Ct=!1;function St(n,l){if(!n||Ct)return"";Ct=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var Qe=function(){throw Error()};if(Object.defineProperty(Qe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Qe,[])}catch(He){var Re=He}Reflect.construct(n,[],Qe)}else{try{Qe.call()}catch(He){Re=He}n.call(Qe.prototype)}}else{try{throw Error()}catch(He){Re=He}(Qe=n())&&typeof Qe.catch=="function"&&Qe.catch(function(){})}}catch(He){if(He&&Re&&typeof He.stack=="string")return[He.stack,Re.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=m.DetermineComponentFrameRoot(),R=w[0],q=w[1];if(R&&q){var pe=R.split(`
|
||
`),Le=q.split(`
|
||
`);for(v=m=0;m<pe.length&&!pe[m].includes("DetermineComponentFrameRoot");)m++;for(;v<Le.length&&!Le[v].includes("DetermineComponentFrameRoot");)v++;if(m===pe.length||v===Le.length)for(m=pe.length-1,v=Le.length-1;1<=m&&0<=v&&pe[m]!==Le[v];)v--;for(;1<=m&&0<=v;m--,v--)if(pe[m]!==Le[v]){if(m!==1||v!==1)do if(m--,v--,0>v||pe[m]!==Le[v]){var Ye=`
|
||
`+pe[m].replace(" at new "," at ");return n.displayName&&Ye.includes("<anonymous>")&&(Ye=Ye.replace("<anonymous>",n.displayName)),Ye}while(1<=m&&0<=v);break}}}finally{Ct=!1,Error.prepareStackTrace=u}return(u=n?n.displayName||n.name:"")?Ge(u):""}function Ue(n,l){switch(n.tag){case 26:case 27:case 5:return Ge(n.type);case 16:return Ge("Lazy");case 13:return n.child!==l&&l!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return St(n.type,!1);case 11:return St(n.type.render,!1);case 1:return St(n.type,!0);case 31:return Ge("Activity");default:return""}}function ce(n){try{var l="",u=null;do l+=Ue(n,u),u=n,n=n.return;while(n);return l}catch(m){return`
|
||
Error generating stack: `+m.message+`
|
||
`+m.stack}}var we=Object.prototype.hasOwnProperty,Ie=e.unstable_scheduleCallback,lt=e.unstable_cancelCallback,ft=e.unstable_shouldYield,Ze=e.unstable_requestPaint,ze=e.unstable_now,bt=e.unstable_getCurrentPriorityLevel,Nt=e.unstable_ImmediatePriority,Ot=e.unstable_UserBlockingPriority,Pt=e.unstable_NormalPriority,je=e.unstable_LowPriority,ut=e.unstable_IdlePriority,jt=e.log,$t=e.unstable_setDisableYieldValue,Fe=null,ot=null;function dt(n){if(typeof jt=="function"&&$t(n),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(Fe,n)}catch(l){}}var wt=Math.clz32?Math.clz32:Je,Ft=Math.log,la=Math.LN2;function Je(n){return n>>>=0,n===0?32:31-(Ft(n)/la|0)|0}var Lt=256,ye=262144,We=4194304;function at(n){var l=n&42;if(l!==0)return l;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Vt(n,l,u){var m=n.pendingLanes;if(m===0)return 0;var v=0,w=n.suspendedLanes,R=n.pingedLanes;n=n.warmLanes;var q=m&134217727;return q!==0?(m=q&~w,m!==0?v=at(m):(R&=q,R!==0?v=at(R):u||(u=q&~n,u!==0&&(v=at(u))))):(q=m&~w,q!==0?v=at(q):R!==0?v=at(R):u||(u=m&~n,u!==0&&(v=at(u)))),v===0?0:l!==0&&l!==v&&(l&w)===0&&(w=v&-v,u=l&-l,w>=u||w===32&&(u&4194048)!==0)?l:v}function aa(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function Va(n,l){switch(n){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ma(){var n=We;return We<<=1,(We&62914560)===0&&(We=4194304),n}function zn(n){for(var l=[],u=0;31>u;u++)l.push(n);return l}function Vr(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function ns(n,l,u,m,v,w){var R=n.pendingLanes;n.pendingLanes=u,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=u,n.entangledLanes&=u,n.errorRecoveryDisabledLanes&=u,n.shellSuspendCounter=0;var q=n.entanglements,pe=n.expirationTimes,Le=n.hiddenUpdates;for(u=R&~u;0<u;){var Ye=31-wt(u),Qe=1<<Ye;q[Ye]=0,pe[Ye]=-1;var Re=Le[Ye];if(Re!==null)for(Le[Ye]=null,Ye=0;Ye<Re.length;Ye++){var He=Re[Ye];He!==null&&(He.lane&=-536870913)}u&=~Qe}m!==0&&bn(n,m,0),w!==0&&v===0&&n.tag!==0&&(n.suspendedLanes|=w&~(R&~l))}function bn(n,l,u){n.pendingLanes|=l,n.suspendedLanes&=~l;var m=31-wt(l);n.entangledLanes|=l,n.entanglements[m]=n.entanglements[m]|1073741824|u&261930}function Bn(n,l){var u=n.entangledLanes|=l;for(n=n.entanglements;u;){var m=31-wt(u),v=1<<m;v&l|n[m]&l&&(n[m]|=l),u&=~v}}function js(n,l){var u=l&-l;return u=(u&42)!==0?1:er(u),(u&(n.suspendedLanes|l))!==0?0:u}function er(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function ve(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function U(){var n=Z.p;return n!==0?n:(n=window.event,n===void 0?32:Rb(n.type))}function ne(n,l){var u=Z.p;try{return Z.p=n,l()}finally{Z.p=u}}var X=Math.random().toString(36).slice(2),Q="__reactFiber$"+X,re="__reactProps$"+X,z="__reactContainer$"+X,he="__reactEvents$"+X,Me="__reactListeners$"+X,ke="__reactHandles$"+X,Ae="__reactResources$"+X,Ce="__reactMarker$"+X;function tt(n){delete n[Q],delete n[re],delete n[he],delete n[Me],delete n[ke]}function ct(n){var l=n[Q];if(l)return l;for(var u=n.parentNode;u;){if(l=u[z]||u[Q]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(n=vb(n);n!==null;){if(u=n[Q])return u;n=vb(n)}return l}n=u,u=n.parentNode}return null}function pt(n){if(n=n[Q]||n[z]){var l=n.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return n}return null}function it(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n.stateNode;throw Error(s(33))}function xt(n){var l=n[Ae];return l||(l=n[Ae]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function _t(n){n[Ce]=!0}var ja=new Set,Sa={};function Fa(n,l){Ir(n,l),Ir(n+"Capture",l)}function Ir(n,l){for(Sa[n]=l,n=0;n<l.length;n++)ja.add(l[n])}var vn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ss={},_n={};function is(n){return we.call(_n,n)?!0:we.call(ss,n)?!1:vn.test(n)?_n[n]=!0:(ss[n]=!0,!1)}function Ht(n,l,u){if(is(l))if(u===null)n.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":n.removeAttribute(l);return;case"boolean":var m=l.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){n.removeAttribute(l);return}}n.setAttribute(l,""+u)}}function Ta(n,l,u){if(u===null)n.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttribute(l,""+u)}}function en(n,l,u,m){if(m===null)n.removeAttribute(u);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(u);return}n.setAttributeNS(l,u,""+m)}}function ur(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Zs(n){var l=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Bc(n,l,u){var m=Object.getOwnPropertyDescriptor(n.constructor.prototype,l);if(!n.hasOwnProperty(l)&&typeof m!="undefined"&&typeof m.get=="function"&&typeof m.set=="function"){var v=m.get,w=m.set;return Object.defineProperty(n,l,{configurable:!0,get:function(){return v.call(this)},set:function(R){u=""+R,w.call(this,R)}}),Object.defineProperty(n,l,{enumerable:m.enumerable}),{getValue:function(){return u},setValue:function(R){u=""+R},stopTracking:function(){n._valueTracker=null,delete n[l]}}}}function Gt(n){if(!n._valueTracker){var l=Zs(n)?"checked":"value";n._valueTracker=Bc(n,l,""+n[l])}}function Ua(n){if(!n)return!1;var l=n._valueTracker;if(!l)return!0;var u=l.getValue(),m="";return n&&(m=Zs(n)?n.checked?"true":"false":n.value),n=m,n!==u?(l.setValue(n),!0):!1}function ki(n){if(n=n||(typeof document!="undefined"?document:void 0),typeof n=="undefined")return null;try{return n.activeElement||n.body}catch(l){return n.body}}var xo=/[\n"\\]/g;function Ia(n){return n.replace(xo,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Uc(n,l,u,m,v,w,R,q){n.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?n.type=R:n.removeAttribute("type"),l!=null?R==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+ur(l)):n.value!==""+ur(l)&&(n.value=""+ur(l)):R!=="submit"&&R!=="reset"||n.removeAttribute("value"),l!=null?ls(n,R,ur(l)):u!=null?ls(n,R,ur(u)):m!=null&&n.removeAttribute("value"),v==null&&w!=null&&(n.defaultChecked=!!w),v!=null&&(n.checked=v&&typeof v!="function"&&typeof v!="symbol"),q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?n.name=""+ur(q):n.removeAttribute("name")}function gl(n,l,u,m,v,w,R,q){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.type=w),l!=null||u!=null){if(!(w!=="submit"&&w!=="reset"||l!=null)){Gt(n);return}u=u!=null?""+ur(u):"",l=l!=null?""+ur(l):u,q||l===n.value||(n.value=l),n.defaultValue=l}m=m!=null?m:v,m=typeof m!="function"&&typeof m!="symbol"&&!!m,n.checked=q?n.checked:!!m,n.defaultChecked=!!m,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(n.name=R),Gt(n)}function ls(n,l,u){l==="number"&&ki(n.ownerDocument)===n||n.defaultValue===""+u||(n.defaultValue=""+u)}function La(n,l,u,m){if(n=n.options,l){l={};for(var v=0;v<u.length;v++)l["$"+u[v]]=!0;for(u=0;u<n.length;u++)v=l.hasOwnProperty("$"+n[u].value),n[u].selected!==v&&(n[u].selected=v),v&&m&&(n[u].defaultSelected=!0)}else{for(u=""+ur(u),l=null,v=0;v<n.length;v++){if(n[v].value===u){n[v].selected=!0,m&&(n[v].defaultSelected=!0);return}l!==null||n[v].disabled||(l=n[v])}l!==null&&(l.selected=!0)}}function Ss(n,l,u){if(l!=null&&(l=""+ur(l),l!==n.value&&(n.value=l),u==null)){n.defaultValue!==l&&(n.defaultValue=l);return}n.defaultValue=u!=null?""+ur(u):""}function Ni(n,l,u,m){if(l==null){if(m!=null){if(u!=null)throw Error(s(92));if(me(m)){if(1<m.length)throw Error(s(93));m=m[0]}u=m}u==null&&(u=""),l=u}u=ur(l),n.defaultValue=u,m=n.textContent,m===u&&m!==""&&m!==null&&(n.value=m),Gt(n)}function Un(n,l){if(l){var u=n.firstChild;if(u&&u===n.lastChild&&u.nodeType===3){u.nodeValue=l;return}}n.textContent=l}var Hc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ji(n,l,u){var m=l.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?m?n.setProperty(l,""):l==="float"?n.cssFloat="":n[l]="":m?n.setProperty(l,u):typeof u!="number"||u===0||Hc.has(l)?l==="float"?n.cssFloat=u:n[l]=(""+u).trim():n[l]=u+"px"}function yo(n,l,u){if(l!=null&&typeof l!="object")throw Error(s(62));if(n=n.style,u!=null){for(var m in u)!u.hasOwnProperty(m)||l!=null&&l.hasOwnProperty(m)||(m.indexOf("--")===0?n.setProperty(m,""):m==="float"?n.cssFloat="":n[m]="");for(var v in l)m=l[v],l.hasOwnProperty(v)&&u[v]!==m&&ji(n,v,m)}else for(var w in l)l.hasOwnProperty(w)&&ji(n,w,l[w])}function pl(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bo=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),$c=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Si(n){return $c.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function tn(){}var vo=null;function xl(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ti=null,Ut=null;function wn(n){var l=pt(n);if(l&&(n=l.stateNode)){var u=n[re]||null;e:switch(n=l.stateNode,l.type){case"input":if(Uc(n,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),l=u.name,u.type==="radio"&&l!=null){for(u=n;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ia(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var m=u[l];if(m!==n&&m.form===n.form){var v=m[re]||null;if(!v)throw Error(s(90));Uc(m,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(l=0;l<u.length;l++)m=u[l],m.form===n.form&&Ua(m)}break e;case"textarea":Ss(n,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&La(n,!!u.multiple,l,!1)}}}var xa=!1;function Wc(n,l,u){if(xa)return n(l,u);xa=!0;try{var m=n(l);return m}finally{if(xa=!1,(Ti!==null||Ut!==null)&&(Nu(),Ti&&(l=Ti,n=Ut,Ut=Ti=null,wn(l),n)))for(l=0;l<n.length;l++)wn(n[l])}}function qs(n,l){var u=n.stateNode;if(u===null)return null;var m=u[re]||null;if(m===null)return null;u=m[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(n=n.type,m=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!m;break e;default:n=!1}if(n)return null;if(u&&typeof u!="function")throw Error(s(231,l,typeof u));return u}var kn=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),yl=!1;if(kn)try{var Nn={};Object.defineProperty(Nn,"passive",{get:function(){yl=!0}}),window.addEventListener("test",Nn,Nn),window.removeEventListener("test",Nn,Nn)}catch(n){yl=!1}var Hn=null,Ys=null,Ga=null;function Ts(){if(Ga)return Ga;var n,l=Ys,u=l.length,m,v="value"in Hn?Hn.value:Hn.textContent,w=v.length;for(n=0;n<u&&l[n]===v[n];n++);var R=u-n;for(m=1;m<=R&&l[u-m]===v[w-m];m++);return Ga=v.slice(n,1<m?1-m:void 0)}function bl(n){var l=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&l===13&&(n=13)):n=l,n===10&&(n=13),32<=n||n===13?n:0}function vl(){return!0}function C0(){return!1}function Tr(n){function l(u,m,v,w,R){this._reactName=u,this._targetInst=v,this.type=m,this.nativeEvent=w,this.target=R,this.currentTarget=null;for(var q in n)n.hasOwnProperty(q)&&(u=n[q],this[q]=u?u(w):w[q]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?vl:C0,this.isPropagationStopped=C0,this}return y(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=vl)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=vl)},persist:function(){},isPersistent:vl}),l}var os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_o=Tr(os),Ei=y({},os,{view:0,detail:0}),ra=Tr(Ei),Vc,Gr,cs,_l=y({},Ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jc,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==cs&&(cs&&n.type==="mousemove"?(Vc=n.screenX-cs.screenX,Gr=n.screenY-cs.screenY):Gr=Vc=0,cs=n),Vc)},movementY:function(n){return"movementY"in n?n.movementY:Gr}}),A0=Tr(_l),Gc=y({},_l,{dataTransfer:0}),mh=Tr(Gc),O0=y({},Ei,{relatedTarget:0}),Zc=Tr(O0),gh=y({},os,{animationName:0,elapsedTime:0,pseudoElement:0}),qc=Tr(gh),ph=y({},os,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),$n=Tr(ph),xh=y({},os,{data:0}),Yc=Tr(xh),Es={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},M0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},L0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xc(n){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(n):(n=L0[n])?!!l[n]:!1}function Jc(){return Xc}var D0=y({},Ei,{key:function(n){if(n.key){var l=Es[n.key]||n.key;if(l!=="Unidentified")return l}return n.type==="keypress"?(n=bl(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?M0[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jc,charCode:function(n){return n.type==="keypress"?bl(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?bl(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),P0=Tr(D0),yh=y({},_l,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),R0=Tr(yh),Kc=y({},Ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jc}),bh=Tr(Kc),F0=y({},os,{propertyName:0,elapsedTime:0,pseudoElement:0}),I0=Tr(F0),wo=y({},_l,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Xs=Tr(wo),vh=y({},os,{newState:0,oldState:0}),wl=Tr(vh),an=[9,13,27,32],ko=kn&&"CompositionEvent"in window,Ci=null;kn&&"documentMode"in document&&(Ci=document.documentMode);var _h=kn&&"TextEvent"in window&&!Ci,No=kn&&(!ko||Ci&&8<Ci&&11>=Ci),jo=" ",z0=!1;function B0(n,l){switch(n){case"keyup":return an.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qc(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ai=!1;function jn(n,l){switch(n){case"compositionend":return Qc(l);case"keypress":return l.which!==32?null:(z0=!0,jo);case"textInput":return n=l.data,n===jo&&z0?null:n;default:return null}}function Oi(n,l){if(Ai)return n==="compositionend"||!ko&&B0(n,l)?(n=Ts(),Ga=Ys=Hn=null,Ai=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return No&&l.locale!=="ko"?null:l.data;default:return null}}var wh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wn(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l==="input"?!!wh[n.type]:l==="textarea"}function U0(n,l,u,m){Ti?Ut?Ut.push(m):Ut=[m]:Ti=m,l=Ou(l,"onChange"),0<l.length&&(u=new _o("onChange","change",null,u,m),n.push({event:u,listeners:l}))}var Vn=null,kl=null;function Nl(n){ib(n,0)}function jl(n){var l=it(n);if(Ua(l))return n}function Sl(n,l){if(n==="change")return l}var H0=!1;if(kn){var Gn;if(kn){var Mi="oninput"in document;if(!Mi){var $0=document.createElement("div");$0.setAttribute("oninput","return;"),Mi=typeof $0.oninput=="function"}Gn=Mi}else Gn=!1;H0=Gn&&(!document.documentMode||9<document.documentMode)}function So(){Vn&&(Vn.detachEvent("onpropertychange",W0),kl=Vn=null)}function W0(n){if(n.propertyName==="value"&&jl(kl)){var l=[];U0(l,kl,n,xl(n)),Wc(Nl,l)}}function ds(n,l,u){n==="focusin"?(So(),Vn=l,kl=u,Vn.attachEvent("onpropertychange",W0)):n==="focusout"&&So()}function kh(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return jl(kl)}function Li(n,l){if(n==="click")return jl(l)}function Nh(n,l){if(n==="input"||n==="change")return jl(l)}function us(n,l){return n===l&&(n!==0||1/n===1/l)||n!==n&&l!==l}var gr=typeof Object.is=="function"?Object.is:us;function Di(n,l){if(gr(n,l))return!0;if(typeof n!="object"||n===null||typeof l!="object"||l===null)return!1;var u=Object.keys(n),m=Object.keys(l);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var v=u[m];if(!we.call(l,v)||!gr(n[v],l[v]))return!1}return!0}function To(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Tl(n,l){var u=To(n);n=0;for(var m;u;){if(u.nodeType===3){if(m=n+u.textContent.length,n<=l&&m>=l)return{node:u,offset:l-n};n=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=To(u)}}function Eo(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?Eo(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function El(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=ki(n.document);l instanceof n.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch(m){u=!1}if(u)n=l.contentWindow;else break;l=ki(n.document)}return l}function Cs(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}var Co=kn&&"documentMode"in document&&11>=document.documentMode,As=null,Ao=null,Cl=null,Pi=!1;function V0(n,l,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Pi||As==null||As!==ki(m)||(m=As,"selectionStart"in m&&Cs(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Cl&&Di(Cl,m)||(Cl=m,m=Ou(Ao,"onSelect"),0<m.length&&(l=new _o("onSelect","select",null,l,u),n.push({event:l,listeners:m}),l.target=As)))}function Os(n,l){var u={};return u[n.toLowerCase()]=l.toLowerCase(),u["Webkit"+n]="webkit"+l,u["Moz"+n]="moz"+l,u}var Ri={animationend:Os("Animation","AnimationEnd"),animationiteration:Os("Animation","AnimationIteration"),animationstart:Os("Animation","AnimationStart"),transitionrun:Os("Transition","TransitionRun"),transitionstart:Os("Transition","TransitionStart"),transitioncancel:Os("Transition","TransitionCancel"),transitionend:Os("Transition","TransitionEnd")},Oo={},G0={};kn&&(G0=document.createElement("div").style,"AnimationEvent"in window||(delete Ri.animationend.animation,delete Ri.animationiteration.animation,delete Ri.animationstart.animation),"TransitionEvent"in window||delete Ri.transitionend.transition);function pr(n){if(Oo[n])return Oo[n];if(!Ri[n])return n;var l=Ri[n],u;for(u in l)if(l.hasOwnProperty(u)&&u in G0)return Oo[n]=l[u];return n}var Al=pr("animationend"),Z0=pr("animationiteration"),Ol=pr("animationstart"),jh=pr("transitionrun"),q0=pr("transitionstart"),Sh=pr("transitioncancel"),Fi=pr("transitionend"),Y0=new Map,Ms="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ms.push("scrollEnd");function rn(n,l){Y0.set(n,l),Fa(l,[n])}var Ml=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},nn=[],zr=0,Mo=0;function Ll(){for(var n=zr,l=Mo=zr=0;l<n;){var u=nn[l];nn[l++]=null;var m=nn[l];nn[l++]=null;var v=nn[l];nn[l++]=null;var w=nn[l];if(nn[l++]=null,m!==null&&v!==null){var R=m.pending;R===null?v.next=v:(v.next=R.next,R.next=v),m.pending=v}w!==0&&Ii(u,v,w)}}function Ls(n,l,u,m){nn[zr++]=n,nn[zr++]=l,nn[zr++]=u,nn[zr++]=m,Mo|=m,n.lanes|=m,n=n.alternate,n!==null&&(n.lanes|=m)}function ed(n,l,u,m){return Ls(n,l,u,m),Dl(n)}function Zn(n,l){return Ls(n,null,null,l),Dl(n)}function Ii(n,l,u){n.lanes|=u;var m=n.alternate;m!==null&&(m.lanes|=u);for(var v=!1,w=n.return;w!==null;)w.childLanes|=u,m=w.alternate,m!==null&&(m.childLanes|=u),w.tag===22&&(n=w.stateNode,n===null||n._visibility&1||(v=!0)),n=w,w=w.return;return n.tag===3?(w=n.stateNode,v&&l!==null&&(v=31-wt(u),n=w.hiddenUpdates,m=n[v],m===null?n[v]=[l]:m.push(l),l.lane=u|536870912),w):null}function Dl(n){if(50<jd)throw jd=0,Em=null,Error(s(185));for(var l=n.return;l!==null;)n=l,l=n.return;return n.tag===3?n.stateNode:null}var Js={};function Th(n,l,u,m){this.tag=n,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Br(n,l,u,m){return new Th(n,l,u,m)}function Lo(n){return n=n.prototype,!(!n||!n.isReactComponent)}function qn(n,l){var u=n.alternate;return u===null?(u=Br(n.tag,l,n.key,n.mode),u.elementType=n.elementType,u.type=n.type,u.stateNode=n.stateNode,u.alternate=n,n.alternate=u):(u.pendingProps=l,u.type=n.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=n.flags&65011712,u.childLanes=n.childLanes,u.lanes=n.lanes,u.child=n.child,u.memoizedProps=n.memoizedProps,u.memoizedState=n.memoizedState,u.updateQueue=n.updateQueue,l=n.dependencies,u.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},u.sibling=n.sibling,u.index=n.index,u.ref=n.ref,u.refCleanup=n.refCleanup,u}function td(n,l){n.flags&=65011714;var u=n.alternate;return u===null?(n.childLanes=0,n.lanes=l,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=u.childLanes,n.lanes=u.lanes,n.child=u.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=u.memoizedProps,n.memoizedState=u.memoizedState,n.updateQueue=u.updateQueue,n.type=u.type,l=u.dependencies,n.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),n}function Pl(n,l,u,m,v,w){var R=0;if(m=n,typeof n=="function")Lo(n)&&(R=1);else if(typeof n=="string")R=x4(n,u,G.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case Y:return n=Br(31,u,l,v),n.elementType=Y,n.lanes=w,n;case N:return Ks(u.children,v,w,l);case S:R=8,v|=24;break;case O:return n=Br(12,u,l,v|2),n.elementType=O,n.lanes=w,n;case I:return n=Br(13,u,l,v),n.elementType=I,n.lanes=w,n;case ee:return n=Br(19,u,l,v),n.elementType=ee,n.lanes=w,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case A:R=10;break e;case C:R=9;break e;case P:R=11;break e;case B:R=14;break e;case H:R=16,m=null;break e}R=29,u=Error(s(130,n===null?"null":typeof n,"")),m=null}return l=Br(R,u,l,v),l.elementType=n,l.type=m,l.lanes=w,l}function Ks(n,l,u,m){return n=Br(7,n,m,l),n.lanes=u,n}function Do(n,l,u){return n=Br(6,n,null,l),n.lanes=u,n}function ad(n){var l=Br(18,null,null,0);return l.stateNode=n,l}function rd(n,l,u){return l=Br(4,n.children!==null?n.children:[],n.key,l),l.lanes=u,l.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},l}var o=new WeakMap;function h(n,l){if(typeof n=="object"&&n!==null){var u=o.get(n);return u!==void 0?u:(l={value:n,source:l,stack:ce(l)},o.set(n,l),l)}return{value:n,source:l,stack:ce(l)}}var b=[],E=0,M=null,V=0,fe=[],Te=0,Pe=null,Ke=1,yt="";function Dt(n,l){b[E++]=V,b[E++]=M,M=n,V=l}function Xt(n,l,u){fe[Te++]=Ke,fe[Te++]=yt,fe[Te++]=Pe,Pe=n;var m=Ke;n=yt;var v=32-wt(m)-1;m&=~(1<<v),u+=1;var w=32-wt(l)+v;if(30<w){var R=v-v%5;w=(m&(1<<R)-1).toString(32),m>>=R,v-=R,Ke=1<<32-wt(l)+v|u<<v|m,yt=w+n}else Ke=1<<w|u<<v|m,yt=n}function fr(n){n.return!==null&&(Dt(n,1),Xt(n,1,0))}function Za(n){for(;n===M;)M=b[--E],b[E]=null,V=b[--E],b[E]=null;for(;n===Pe;)Pe=fe[--Te],fe[Te]=null,yt=fe[--Te],fe[Te]=null,Ke=fe[--Te],fe[Te]=null}function Zr(n,l){fe[Te++]=Ke,fe[Te++]=yt,fe[Te++]=Pe,Ke=l.id,yt=l.overflow,Pe=n}var oa=null,ca=null,Qt=!1,Ds=null,sn=!1,Po=Error(s(519));function Ps(n){var l=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Rl(h(l,n)),Po}function nd(n){var l=n.stateNode,u=n.type,m=n.memoizedProps;switch(l[Q]=n,l[re]=m,u){case"dialog":ta("cancel",l),ta("close",l);break;case"iframe":case"object":case"embed":ta("load",l);break;case"video":case"audio":for(u=0;u<Td.length;u++)ta(Td[u],l);break;case"source":ta("error",l);break;case"img":case"image":case"link":ta("error",l),ta("load",l);break;case"details":ta("toggle",l);break;case"input":ta("invalid",l),gl(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":ta("invalid",l);break;case"textarea":ta("invalid",l),Ni(l,m.value,m.defaultValue,m.children)}u=m.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||l.textContent===""+u||m.suppressHydrationWarning===!0||db(l.textContent,u)?(m.popover!=null&&(ta("beforetoggle",l),ta("toggle",l)),m.onScroll!=null&&ta("scroll",l),m.onScrollEnd!=null&&ta("scrollend",l),m.onClick!=null&&(l.onclick=tn),l=!0):l=!1,l||Ps(n,!0)}function Wa(n){for(oa=n.return;oa;)switch(oa.tag){case 5:case 31:case 13:sn=!1;return;case 27:case 3:sn=!0;return;default:oa=oa.return}}function fs(n){if(n!==oa)return!1;if(!Qt)return Wa(n),Qt=!0,!1;var l=n.tag,u;if((u=l!==3&&l!==27)&&((u=l===5)&&(u=n.type,u=!(u!=="form"&&u!=="button")||$m(n.type,n.memoizedProps)),u=!u),u&&ca&&Ps(n),Wa(n),l===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));ca=bb(n)}else if(l===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));ca=bb(n)}else l===27?(l=ca,Ki(n.type)?(n=qm,qm=null,ca=n):ca=l):ca=oa?Xn(n.stateNode.nextSibling):null;return!0}function Qs(){ca=oa=null,Qt=!1}function sd(){var n=Ds;return n!==null&&(dn===null?dn=n:dn.push.apply(dn,n),Ds=null),n}function Rl(n){Ds===null?Ds=[n]:Ds.push(n)}var Fl=F(null),Rs=null,hs=null;function zi(n,l,u){W(Fl,l._currentValue),l._currentValue=u}function ei(n){n._currentValue=Fl.current,D(Fl)}function Eh(n,l,u){for(;n!==null;){var m=n.alternate;if((n.childLanes&l)!==l?(n.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),n===u)break;n=n.return}}function Ch(n,l,u,m){var v=n.child;for(v!==null&&(v.return=n);v!==null;){var w=v.dependencies;if(w!==null){var R=v.child;w=w.firstContext;e:for(;w!==null;){var q=w;w=v;for(var pe=0;pe<l.length;pe++)if(q.context===l[pe]){w.lanes|=u,q=w.alternate,q!==null&&(q.lanes|=u),Eh(w.return,u,n),m||(R=null);break e}w=q.next}}else if(v.tag===18){if(R=v.return,R===null)throw Error(s(341));R.lanes|=u,w=R.alternate,w!==null&&(w.lanes|=u),Eh(R,u,n),R=null}else R=v.child;if(R!==null)R.return=v;else for(R=v;R!==null;){if(R===n){R=null;break}if(v=R.sibling,v!==null){v.return=R.return,R=v;break}R=R.return}v=R}}function Ro(n,l,u,m){n=null;for(var v=l,w=!1;v!==null;){if(!w){if((v.flags&524288)!==0)w=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var R=v.alternate;if(R===null)throw Error(s(387));if(R=R.memoizedProps,R!==null){var q=v.type;gr(v.pendingProps.value,R.value)||(n!==null?n.push(q):n=[q])}}else if(v===De.current){if(R=v.alternate,R===null)throw Error(s(387));R.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(n!==null?n.push(Md):n=[Md])}v=v.return}n!==null&&Ch(l,n,u,m),l.flags|=262144}function X0(n){for(n=n.firstContext;n!==null;){if(!gr(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Il(n){Rs=n,hs=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Er(n){return Yp(Rs,n)}function J0(n,l){return Rs===null&&Il(n),Yp(n,l)}function Yp(n,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},hs===null){if(n===null)throw Error(s(308));hs=l,n.dependencies={lanes:0,firstContext:l},n.flags|=524288}else hs=hs.next=l;return u}var hk=typeof AbortController!="undefined"?AbortController:function(){var n=[],l=this.signal={aborted:!1,addEventListener:function(u,m){n.push(m)}};this.abort=function(){l.aborted=!0,n.forEach(function(u){return u()})}},mk=e.unstable_scheduleCallback,gk=e.unstable_NormalPriority,nr={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ah(){return{controller:new hk,data:new Map,refCount:0}}function id(n){n.refCount--,n.refCount===0&&mk(gk,function(){n.controller.abort()})}var ld=null,Oh=0,Fo=0,Io=null;function pk(n,l){if(ld===null){var u=ld=[];Oh=0,Fo=Dm(),Io={status:"pending",value:void 0,then:function(m){u.push(m)}}}return Oh++,l.then(Xp,Xp),l}function Xp(){if(--Oh===0&&ld!==null){Io!==null&&(Io.status="fulfilled");var n=ld;ld=null,Fo=0,Io=null;for(var l=0;l<n.length;l++)(0,n[l])()}}function xk(n,l){var u=[],m={status:"pending",value:null,reason:null,then:function(v){u.push(v)}};return n.then(function(){m.status="fulfilled",m.value=l;for(var v=0;v<u.length;v++)(0,u[v])(l)},function(v){for(m.status="rejected",m.reason=v,v=0;v<u.length;v++)(0,u[v])(void 0)}),m}var Jp=ae.S;ae.S=function(n,l){Dy=ze(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&pk(n,l),Jp!==null&&Jp(n,l)};var zl=F(null);function Mh(){var n=zl.current;return n!==null?n:Da.pooledCache}function K0(n,l){l===null?W(zl,zl.current):W(zl,l.pool)}function Kp(){var n=Mh();return n===null?null:{parent:nr._currentValue,pool:n}}var zo=Error(s(460)),Lh=Error(s(474)),Q0=Error(s(542)),eu={then:function(){}};function Qp(n){return n=n.status,n==="fulfilled"||n==="rejected"}function ex(n,l,u){switch(u=n[u],u===void 0?n.push(l):u!==l&&(l.then(tn,tn),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,ax(n),n;default:if(typeof l.status=="string")l.then(tn,tn);else{if(n=Da,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=l,n.status="pending",n.then(function(m){if(l.status==="pending"){var v=l;v.status="fulfilled",v.value=m}},function(m){if(l.status==="pending"){var v=l;v.status="rejected",v.reason=m}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,ax(n),n}throw Ul=l,zo}}function Bl(n){try{var l=n._init;return l(n._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Ul=u,zo):u}}var Ul=null;function tx(){if(Ul===null)throw Error(s(459));var n=Ul;return Ul=null,n}function ax(n){if(n===zo||n===Q0)throw Error(s(483))}var Bo=null,od=0;function tu(n){var l=od;return od+=1,Bo===null&&(Bo=[]),ex(Bo,n,l)}function cd(n,l){l=l.props.ref,n.ref=l!==void 0?l:null}function au(n,l){throw l.$$typeof===_?Error(s(525)):(n=Object.prototype.toString.call(l),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":n)))}function rx(n){function l(Se,_e){if(n){var Oe=Se.deletions;Oe===null?(Se.deletions=[_e],Se.flags|=16):Oe.push(_e)}}function u(Se,_e){if(!n)return null;for(;_e!==null;)l(Se,_e),_e=_e.sibling;return null}function m(Se){for(var _e=new Map;Se!==null;)Se.key!==null?_e.set(Se.key,Se):_e.set(Se.index,Se),Se=Se.sibling;return _e}function v(Se,_e){return Se=qn(Se,_e),Se.index=0,Se.sibling=null,Se}function w(Se,_e,Oe){return Se.index=Oe,n?(Oe=Se.alternate,Oe!==null?(Oe=Oe.index,Oe<_e?(Se.flags|=67108866,_e):Oe):(Se.flags|=67108866,_e)):(Se.flags|=1048576,_e)}function R(Se){return n&&Se.alternate===null&&(Se.flags|=67108866),Se}function q(Se,_e,Oe,Xe){return _e===null||_e.tag!==6?(_e=Do(Oe,Se.mode,Xe),_e.return=Se,_e):(_e=v(_e,Oe),_e.return=Se,_e)}function pe(Se,_e,Oe,Xe){var Rt=Oe.type;return Rt===N?Ye(Se,_e,Oe.props.children,Xe,Oe.key):_e!==null&&(_e.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===H&&Bl(Rt)===_e.type)?(_e=v(_e,Oe.props),cd(_e,Oe),_e.return=Se,_e):(_e=Pl(Oe.type,Oe.key,Oe.props,null,Se.mode,Xe),cd(_e,Oe),_e.return=Se,_e)}function Le(Se,_e,Oe,Xe){return _e===null||_e.tag!==4||_e.stateNode.containerInfo!==Oe.containerInfo||_e.stateNode.implementation!==Oe.implementation?(_e=rd(Oe,Se.mode,Xe),_e.return=Se,_e):(_e=v(_e,Oe.children||[]),_e.return=Se,_e)}function Ye(Se,_e,Oe,Xe,Rt){return _e===null||_e.tag!==7?(_e=Ks(Oe,Se.mode,Xe,Rt),_e.return=Se,_e):(_e=v(_e,Oe),_e.return=Se,_e)}function Qe(Se,_e,Oe){if(typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint")return _e=Do(""+_e,Se.mode,Oe),_e.return=Se,_e;if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case k:return Oe=Pl(_e.type,_e.key,_e.props,null,Se.mode,Oe),cd(Oe,_e),Oe.return=Se,Oe;case T:return _e=rd(_e,Se.mode,Oe),_e.return=Se,_e;case H:return _e=Bl(_e),Qe(Se,_e,Oe)}if(me(_e)||le(_e))return _e=Ks(_e,Se.mode,Oe,null),_e.return=Se,_e;if(typeof _e.then=="function")return Qe(Se,tu(_e),Oe);if(_e.$$typeof===A)return Qe(Se,J0(Se,_e),Oe);au(Se,_e)}return null}function Re(Se,_e,Oe,Xe){var Rt=_e!==null?_e.key:null;if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint")return Rt!==null?null:q(Se,_e,""+Oe,Xe);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case k:return Oe.key===Rt?pe(Se,_e,Oe,Xe):null;case T:return Oe.key===Rt?Le(Se,_e,Oe,Xe):null;case H:return Oe=Bl(Oe),Re(Se,_e,Oe,Xe)}if(me(Oe)||le(Oe))return Rt!==null?null:Ye(Se,_e,Oe,Xe,null);if(typeof Oe.then=="function")return Re(Se,_e,tu(Oe),Xe);if(Oe.$$typeof===A)return Re(Se,_e,J0(Se,Oe),Xe);au(Se,Oe)}return null}function He(Se,_e,Oe,Xe,Rt){if(typeof Xe=="string"&&Xe!==""||typeof Xe=="number"||typeof Xe=="bigint")return Se=Se.get(Oe)||null,q(_e,Se,""+Xe,Rt);if(typeof Xe=="object"&&Xe!==null){switch(Xe.$$typeof){case k:return Se=Se.get(Xe.key===null?Oe:Xe.key)||null,pe(_e,Se,Xe,Rt);case T:return Se=Se.get(Xe.key===null?Oe:Xe.key)||null,Le(_e,Se,Xe,Rt);case H:return Xe=Bl(Xe),He(Se,_e,Oe,Xe,Rt)}if(me(Xe)||le(Xe))return Se=Se.get(Oe)||null,Ye(_e,Se,Xe,Rt,null);if(typeof Xe.then=="function")return He(Se,_e,Oe,tu(Xe),Rt);if(Xe.$$typeof===A)return He(Se,_e,Oe,J0(_e,Xe),Rt);au(_e,Xe)}return null}function Tt(Se,_e,Oe,Xe){for(var Rt=null,da=null,Mt=_e,Jt=_e=0,sa=null;Mt!==null&&Jt<Oe.length;Jt++){Mt.index>Jt?(sa=Mt,Mt=null):sa=Mt.sibling;var ua=Re(Se,Mt,Oe[Jt],Xe);if(ua===null){Mt===null&&(Mt=sa);break}n&&Mt&&ua.alternate===null&&l(Se,Mt),_e=w(ua,_e,Jt),da===null?Rt=ua:da.sibling=ua,da=ua,Mt=sa}if(Jt===Oe.length)return u(Se,Mt),Qt&&Dt(Se,Jt),Rt;if(Mt===null){for(;Jt<Oe.length;Jt++)Mt=Qe(Se,Oe[Jt],Xe),Mt!==null&&(_e=w(Mt,_e,Jt),da===null?Rt=Mt:da.sibling=Mt,da=Mt);return Qt&&Dt(Se,Jt),Rt}for(Mt=m(Mt);Jt<Oe.length;Jt++)sa=He(Mt,Se,Jt,Oe[Jt],Xe),sa!==null&&(n&&sa.alternate!==null&&Mt.delete(sa.key===null?Jt:sa.key),_e=w(sa,_e,Jt),da===null?Rt=sa:da.sibling=sa,da=sa);return n&&Mt.forEach(function(rl){return l(Se,rl)}),Qt&&Dt(Se,Jt),Rt}function It(Se,_e,Oe,Xe){if(Oe==null)throw Error(s(151));for(var Rt=null,da=null,Mt=_e,Jt=_e=0,sa=null,ua=Oe.next();Mt!==null&&!ua.done;Jt++,ua=Oe.next()){Mt.index>Jt?(sa=Mt,Mt=null):sa=Mt.sibling;var rl=Re(Se,Mt,ua.value,Xe);if(rl===null){Mt===null&&(Mt=sa);break}n&&Mt&&rl.alternate===null&&l(Se,Mt),_e=w(rl,_e,Jt),da===null?Rt=rl:da.sibling=rl,da=rl,Mt=sa}if(ua.done)return u(Se,Mt),Qt&&Dt(Se,Jt),Rt;if(Mt===null){for(;!ua.done;Jt++,ua=Oe.next())ua=Qe(Se,ua.value,Xe),ua!==null&&(_e=w(ua,_e,Jt),da===null?Rt=ua:da.sibling=ua,da=ua);return Qt&&Dt(Se,Jt),Rt}for(Mt=m(Mt);!ua.done;Jt++,ua=Oe.next())ua=He(Mt,Se,Jt,ua.value,Xe),ua!==null&&(n&&ua.alternate!==null&&Mt.delete(ua.key===null?Jt:ua.key),_e=w(ua,_e,Jt),da===null?Rt=ua:da.sibling=ua,da=ua);return n&&Mt.forEach(function(E4){return l(Se,E4)}),Qt&&Dt(Se,Jt),Rt}function Aa(Se,_e,Oe,Xe){if(typeof Oe=="object"&&Oe!==null&&Oe.type===N&&Oe.key===null&&(Oe=Oe.props.children),typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case k:e:{for(var Rt=Oe.key;_e!==null;){if(_e.key===Rt){if(Rt=Oe.type,Rt===N){if(_e.tag===7){u(Se,_e.sibling),Xe=v(_e,Oe.props.children),Xe.return=Se,Se=Xe;break e}}else if(_e.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===H&&Bl(Rt)===_e.type){u(Se,_e.sibling),Xe=v(_e,Oe.props),cd(Xe,Oe),Xe.return=Se,Se=Xe;break e}u(Se,_e);break}else l(Se,_e);_e=_e.sibling}Oe.type===N?(Xe=Ks(Oe.props.children,Se.mode,Xe,Oe.key),Xe.return=Se,Se=Xe):(Xe=Pl(Oe.type,Oe.key,Oe.props,null,Se.mode,Xe),cd(Xe,Oe),Xe.return=Se,Se=Xe)}return R(Se);case T:e:{for(Rt=Oe.key;_e!==null;){if(_e.key===Rt)if(_e.tag===4&&_e.stateNode.containerInfo===Oe.containerInfo&&_e.stateNode.implementation===Oe.implementation){u(Se,_e.sibling),Xe=v(_e,Oe.children||[]),Xe.return=Se,Se=Xe;break e}else{u(Se,_e);break}else l(Se,_e);_e=_e.sibling}Xe=rd(Oe,Se.mode,Xe),Xe.return=Se,Se=Xe}return R(Se);case H:return Oe=Bl(Oe),Aa(Se,_e,Oe,Xe)}if(me(Oe))return Tt(Se,_e,Oe,Xe);if(le(Oe)){if(Rt=le(Oe),typeof Rt!="function")throw Error(s(150));return Oe=Rt.call(Oe),It(Se,_e,Oe,Xe)}if(typeof Oe.then=="function")return Aa(Se,_e,tu(Oe),Xe);if(Oe.$$typeof===A)return Aa(Se,_e,J0(Se,Oe),Xe);au(Se,Oe)}return typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint"?(Oe=""+Oe,_e!==null&&_e.tag===6?(u(Se,_e.sibling),Xe=v(_e,Oe),Xe.return=Se,Se=Xe):(u(Se,_e),Xe=Do(Oe,Se.mode,Xe),Xe.return=Se,Se=Xe),R(Se)):u(Se,_e)}return function(Se,_e,Oe,Xe){try{od=0;var Rt=Aa(Se,_e,Oe,Xe);return Bo=null,Rt}catch(Mt){if(Mt===zo||Mt===Q0)throw Mt;var da=Br(29,Mt,null,Se.mode);return da.lanes=Xe,da.return=Se,da}finally{}}}var Hl=rx(!0),nx=rx(!1),Bi=!1;function Dh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ph(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Ui(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Hi(n,l,u){var m=n.updateQueue;if(m===null)return null;if(m=m.shared,(ma&2)!==0){var v=m.pending;return v===null?l.next=l:(l.next=v.next,v.next=l),m.pending=l,l=Dl(n),Ii(n,null,u),l}return Ls(n,m,l,u),Dl(n)}function dd(n,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var m=l.lanes;m&=n.pendingLanes,u|=m,l.lanes=u,Bn(n,u)}}function Rh(n,l){var u=n.updateQueue,m=n.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var v=null,w=null;if(u=u.firstBaseUpdate,u!==null){do{var R={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};w===null?v=w=R:w=w.next=R,u=u.next}while(u!==null);w===null?v=w=l:w=w.next=l}else v=w=l;u={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:w,shared:m.shared,callbacks:m.callbacks},n.updateQueue=u;return}n=u.lastBaseUpdate,n===null?u.firstBaseUpdate=l:n.next=l,u.lastBaseUpdate=l}var Fh=!1;function ud(){if(Fh){var n=Io;if(n!==null)throw n}}function fd(n,l,u,m){Fh=!1;var v=n.updateQueue;Bi=!1;var w=v.firstBaseUpdate,R=v.lastBaseUpdate,q=v.shared.pending;if(q!==null){v.shared.pending=null;var pe=q,Le=pe.next;pe.next=null,R===null?w=Le:R.next=Le,R=pe;var Ye=n.alternate;Ye!==null&&(Ye=Ye.updateQueue,q=Ye.lastBaseUpdate,q!==R&&(q===null?Ye.firstBaseUpdate=Le:q.next=Le,Ye.lastBaseUpdate=pe))}if(w!==null){var Qe=v.baseState;R=0,Ye=Le=pe=null,q=w;do{var Re=q.lane&-536870913,He=Re!==q.lane;if(He?(na&Re)===Re:(m&Re)===Re){Re!==0&&Re===Fo&&(Fh=!0),Ye!==null&&(Ye=Ye.next={lane:0,tag:q.tag,payload:q.payload,callback:null,next:null});e:{var Tt=n,It=q;Re=l;var Aa=u;switch(It.tag){case 1:if(Tt=It.payload,typeof Tt=="function"){Qe=Tt.call(Aa,Qe,Re);break e}Qe=Tt;break e;case 3:Tt.flags=Tt.flags&-65537|128;case 0:if(Tt=It.payload,Re=typeof Tt=="function"?Tt.call(Aa,Qe,Re):Tt,Re==null)break e;Qe=y({},Qe,Re);break e;case 2:Bi=!0}}Re=q.callback,Re!==null&&(n.flags|=64,He&&(n.flags|=8192),He=v.callbacks,He===null?v.callbacks=[Re]:He.push(Re))}else He={lane:Re,tag:q.tag,payload:q.payload,callback:q.callback,next:null},Ye===null?(Le=Ye=He,pe=Qe):Ye=Ye.next=He,R|=Re;if(q=q.next,q===null){if(q=v.shared.pending,q===null)break;He=q,q=He.next,He.next=null,v.lastBaseUpdate=He,v.shared.pending=null}}while(!0);Ye===null&&(pe=Qe),v.baseState=pe,v.firstBaseUpdate=Le,v.lastBaseUpdate=Ye,w===null&&(v.shared.lanes=0),Zi|=R,n.lanes=R,n.memoizedState=Qe}}function sx(n,l){if(typeof n!="function")throw Error(s(191,n));n.call(l)}function ix(n,l){var u=n.callbacks;if(u!==null)for(n.callbacks=null,n=0;n<u.length;n++)sx(u[n],l)}var Uo=F(null),ru=F(0);function lx(n,l){n=ci,W(ru,n),W(Uo,l),ci=n|l.baseLanes}function Ih(){W(ru,ci),W(Uo,Uo.current)}function zh(){ci=ru.current,D(Uo),D(ru)}var Sn=F(null),Yn=null;function $i(n){var l=n.alternate;W(tr,tr.current&1),W(Sn,n),Yn===null&&(l===null||Uo.current!==null||l.memoizedState!==null)&&(Yn=n)}function Bh(n){W(tr,tr.current),W(Sn,n),Yn===null&&(Yn=n)}function ox(n){n.tag===22?(W(tr,tr.current),W(Sn,n),Yn===null&&(Yn=n)):Wi()}function Wi(){W(tr,tr.current),W(Sn,Sn.current)}function Tn(n){D(Sn),Yn===n&&(Yn=null),D(tr)}var tr=F(0);function nu(n){for(var l=n;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Gm(u)||Zm(u)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var ti=0,qt=null,Ea=null,sr=null,su=!1,Ho=!1,$l=!1,iu=0,hd=0,$o=null,yk=0;function qa(){throw Error(s(321))}function Uh(n,l){if(l===null)return!1;for(var u=0;u<l.length&&u<n.length;u++)if(!gr(n[u],l[u]))return!1;return!0}function Hh(n,l,u,m,v,w){return ti=w,qt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,ae.H=n===null||n.memoizedState===null?Vx:rm,$l=!1,w=u(m,v),$l=!1,Ho&&(w=dx(l,u,m,v)),cx(n),w}function cx(n){ae.H=pd;var l=Ea!==null&&Ea.next!==null;if(ti=0,sr=Ea=qt=null,su=!1,hd=0,$o=null,l)throw Error(s(300));n===null||ir||(n=n.dependencies,n!==null&&X0(n)&&(ir=!0))}function dx(n,l,u,m){qt=n;var v=0;do{if(Ho&&($o=null),hd=0,Ho=!1,25<=v)throw Error(s(301));if(v+=1,sr=Ea=null,n.updateQueue!=null){var w=n.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}ae.H=Gx,w=l(u,m)}while(Ho);return w}function bk(){var n=ae.H,l=n.useState()[0];return l=typeof l.then=="function"?md(l):l,n=n.useState()[0],(Ea!==null?Ea.memoizedState:null)!==n&&(qt.flags|=1024),l}function $h(){var n=iu!==0;return iu=0,n}function Wh(n,l,u){l.updateQueue=n.updateQueue,l.flags&=-2053,n.lanes&=~u}function Vh(n){if(su){for(n=n.memoizedState;n!==null;){var l=n.queue;l!==null&&(l.pending=null),n=n.next}su=!1}ti=0,sr=Ea=qt=null,Ho=!1,hd=iu=0,$o=null}function qr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sr===null?qt.memoizedState=sr=n:sr=sr.next=n,sr}function ar(){if(Ea===null){var n=qt.alternate;n=n!==null?n.memoizedState:null}else n=Ea.next;var l=sr===null?qt.memoizedState:sr.next;if(l!==null)sr=l,Ea=n;else{if(n===null)throw qt.alternate===null?Error(s(467)):Error(s(310));Ea=n,n={memoizedState:Ea.memoizedState,baseState:Ea.baseState,baseQueue:Ea.baseQueue,queue:Ea.queue,next:null},sr===null?qt.memoizedState=sr=n:sr=sr.next=n}return sr}function lu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function md(n){var l=hd;return hd+=1,$o===null&&($o=[]),n=ex($o,n,l),l=qt,(sr===null?l.memoizedState:sr.next)===null&&(l=l.alternate,ae.H=l===null||l.memoizedState===null?Vx:rm),n}function ou(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return md(n);if(n.$$typeof===A)return Er(n)}throw Error(s(438,String(n)))}function Gh(n){var l=null,u=qt.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var m=qt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(l={data:m.data.map(function(v){return v.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),u===null&&(u=lu(),qt.updateQueue=u),u.memoCache=l,u=l.data[l.index],u===void 0)for(u=l.data[l.index]=Array(n),m=0;m<n;m++)u[m]=ue;return l.index++,u}function ai(n,l){return typeof l=="function"?l(n):l}function cu(n){var l=ar();return Zh(l,Ea,n)}function Zh(n,l,u){var m=n.queue;if(m===null)throw Error(s(311));m.lastRenderedReducer=u;var v=n.baseQueue,w=m.pending;if(w!==null){if(v!==null){var R=v.next;v.next=w.next,w.next=R}l.baseQueue=v=w,m.pending=null}if(w=n.baseState,v===null)n.memoizedState=w;else{l=v.next;var q=R=null,pe=null,Le=l,Ye=!1;do{var Qe=Le.lane&-536870913;if(Qe!==Le.lane?(na&Qe)===Qe:(ti&Qe)===Qe){var Re=Le.revertLane;if(Re===0)pe!==null&&(pe=pe.next={lane:0,revertLane:0,gesture:null,action:Le.action,hasEagerState:Le.hasEagerState,eagerState:Le.eagerState,next:null}),Qe===Fo&&(Ye=!0);else if((ti&Re)===Re){Le=Le.next,Re===Fo&&(Ye=!0);continue}else Qe={lane:0,revertLane:Le.revertLane,gesture:null,action:Le.action,hasEagerState:Le.hasEagerState,eagerState:Le.eagerState,next:null},pe===null?(q=pe=Qe,R=w):pe=pe.next=Qe,qt.lanes|=Re,Zi|=Re;Qe=Le.action,$l&&u(w,Qe),w=Le.hasEagerState?Le.eagerState:u(w,Qe)}else Re={lane:Qe,revertLane:Le.revertLane,gesture:Le.gesture,action:Le.action,hasEagerState:Le.hasEagerState,eagerState:Le.eagerState,next:null},pe===null?(q=pe=Re,R=w):pe=pe.next=Re,qt.lanes|=Qe,Zi|=Qe;Le=Le.next}while(Le!==null&&Le!==l);if(pe===null?R=w:pe.next=q,!gr(w,n.memoizedState)&&(ir=!0,Ye&&(u=Io,u!==null)))throw u;n.memoizedState=w,n.baseState=R,n.baseQueue=pe,m.lastRenderedState=w}return v===null&&(m.lanes=0),[n.memoizedState,m.dispatch]}function qh(n){var l=ar(),u=l.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=n;var m=u.dispatch,v=u.pending,w=l.memoizedState;if(v!==null){u.pending=null;var R=v=v.next;do w=n(w,R.action),R=R.next;while(R!==v);gr(w,l.memoizedState)||(ir=!0),l.memoizedState=w,l.baseQueue===null&&(l.baseState=w),u.lastRenderedState=w}return[w,m]}function ux(n,l,u){var m=qt,v=ar(),w=Qt;if(w){if(u===void 0)throw Error(s(407));u=u()}else u=l();var R=!gr((Ea||v).memoizedState,u);if(R&&(v.memoizedState=u,ir=!0),v=v.queue,Jh(mx.bind(null,m,v,n),[n]),v.getSnapshot!==l||R||sr!==null&&sr.memoizedState.tag&1){if(m.flags|=2048,Wo(9,{destroy:void 0},hx.bind(null,m,v,u,l),null),Da===null)throw Error(s(349));w||(ti&127)!==0||fx(m,l,u)}return u}function fx(n,l,u){n.flags|=16384,n={getSnapshot:l,value:u},l=qt.updateQueue,l===null?(l=lu(),qt.updateQueue=l,l.stores=[n]):(u=l.stores,u===null?l.stores=[n]:u.push(n))}function hx(n,l,u,m){l.value=u,l.getSnapshot=m,gx(l)&&px(n)}function mx(n,l,u){return u(function(){gx(l)&&px(n)})}function gx(n){var l=n.getSnapshot;n=n.value;try{var u=l();return!gr(n,u)}catch(m){return!0}}function px(n){var l=Zn(n,2);l!==null&&un(l,n,2)}function Yh(n){var l=qr();if(typeof n=="function"){var u=n;if(n=u(),$l){dt(!0);try{u()}finally{dt(!1)}}}return l.memoizedState=l.baseState=n,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:n},l}function xx(n,l,u,m){return n.baseState=u,Zh(n,Ea,typeof m=="function"?m:ai)}function vk(n,l,u,m,v){if(fu(n))throw Error(s(485));if(n=l.action,n!==null){var w={payload:v,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){w.listeners.push(R)}};ae.T!==null?u(!0):w.isTransition=!1,m(w),u=l.pending,u===null?(w.next=l.pending=w,yx(l,w)):(w.next=u.next,l.pending=u.next=w)}}function yx(n,l){var u=l.action,m=l.payload,v=n.state;if(l.isTransition){var w=ae.T,R={};ae.T=R;try{var q=u(v,m),pe=ae.S;pe!==null&&pe(R,q),bx(n,l,q)}catch(Le){Xh(n,l,Le)}finally{w!==null&&R.types!==null&&(w.types=R.types),ae.T=w}}else try{w=u(v,m),bx(n,l,w)}catch(Le){Xh(n,l,Le)}}function bx(n,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(m){vx(n,l,m)},function(m){return Xh(n,l,m)}):vx(n,l,u)}function vx(n,l,u){l.status="fulfilled",l.value=u,_x(l),n.state=u,l=n.pending,l!==null&&(u=l.next,u===l?n.pending=null:(u=u.next,l.next=u,yx(n,u)))}function Xh(n,l,u){var m=n.pending;if(n.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=u,_x(l),l=l.next;while(l!==m)}n.action=null}function _x(n){n=n.listeners;for(var l=0;l<n.length;l++)(0,n[l])()}function wx(n,l){return l}function kx(n,l){if(Qt){var u=Da.formState;if(u!==null){e:{var m=qt;if(Qt){if(ca){t:{for(var v=ca,w=sn;v.nodeType!==8;){if(!w){v=null;break t}if(v=Xn(v.nextSibling),v===null){v=null;break t}}w=v.data,v=w==="F!"||w==="F"?v:null}if(v){ca=Xn(v.nextSibling),m=v.data==="F!";break e}}Ps(m)}m=!1}m&&(l=u[0])}}return u=qr(),u.memoizedState=u.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wx,lastRenderedState:l},u.queue=m,u=Hx.bind(null,qt,m),m.dispatch=u,m=Yh(!1),w=am.bind(null,qt,!1,m.queue),m=qr(),v={state:l,dispatch:null,action:n,pending:null},m.queue=v,u=vk.bind(null,qt,v,w,u),v.dispatch=u,m.memoizedState=n,[l,u,!1]}function Nx(n){var l=ar();return jx(l,Ea,n)}function jx(n,l,u){if(l=Zh(n,l,wx)[0],n=cu(ai)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=md(l)}catch(R){throw R===zo?Q0:R}else m=l;l=ar();var v=l.queue,w=v.dispatch;return u!==l.memoizedState&&(qt.flags|=2048,Wo(9,{destroy:void 0},_k.bind(null,v,u),null)),[m,w,n]}function _k(n,l){n.action=l}function Sx(n){var l=ar(),u=Ea;if(u!==null)return jx(l,u,n);ar(),l=l.memoizedState,u=ar();var m=u.queue.dispatch;return u.memoizedState=n,[l,m,!1]}function Wo(n,l,u,m){return n={tag:n,create:u,deps:m,inst:l,next:null},l=qt.updateQueue,l===null&&(l=lu(),qt.updateQueue=l),u=l.lastEffect,u===null?l.lastEffect=n.next=n:(m=u.next,u.next=n,n.next=m,l.lastEffect=n),n}function Tx(){return ar().memoizedState}function du(n,l,u,m){var v=qr();qt.flags|=n,v.memoizedState=Wo(1|l,{destroy:void 0},u,m===void 0?null:m)}function uu(n,l,u,m){var v=ar();m=m===void 0?null:m;var w=v.memoizedState.inst;Ea!==null&&m!==null&&Uh(m,Ea.memoizedState.deps)?v.memoizedState=Wo(l,w,u,m):(qt.flags|=n,v.memoizedState=Wo(1|l,w,u,m))}function Ex(n,l){du(8390656,8,n,l)}function Jh(n,l){uu(2048,8,n,l)}function wk(n){qt.flags|=4;var l=qt.updateQueue;if(l===null)l=lu(),qt.updateQueue=l,l.events=[n];else{var u=l.events;u===null?l.events=[n]:u.push(n)}}function Cx(n){var l=ar().memoizedState;return wk({ref:l,nextImpl:n}),function(){if((ma&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}function Ax(n,l){return uu(4,2,n,l)}function Ox(n,l){return uu(4,4,n,l)}function Mx(n,l){if(typeof l=="function"){n=n();var u=l(n);return function(){typeof u=="function"?u():l(null)}}if(l!=null)return n=n(),l.current=n,function(){l.current=null}}function Lx(n,l,u){u=u!=null?u.concat([n]):null,uu(4,4,Mx.bind(null,l,n),u)}function Kh(){}function Dx(n,l){var u=ar();l=l===void 0?null:l;var m=u.memoizedState;return l!==null&&Uh(l,m[1])?m[0]:(u.memoizedState=[n,l],n)}function Px(n,l){var u=ar();l=l===void 0?null:l;var m=u.memoizedState;if(l!==null&&Uh(l,m[1]))return m[0];if(m=n(),$l){dt(!0);try{n()}finally{dt(!1)}}return u.memoizedState=[m,l],m}function Qh(n,l,u){return u===void 0||(ti&1073741824)!==0&&(na&261930)===0?n.memoizedState=l:(n.memoizedState=u,n=Ry(),qt.lanes|=n,Zi|=n,u)}function Rx(n,l,u,m){return gr(u,l)?u:Uo.current!==null?(n=Qh(n,u,m),gr(n,l)||(ir=!0),n):(ti&42)===0||(ti&1073741824)!==0&&(na&261930)===0?(ir=!0,n.memoizedState=u):(n=Ry(),qt.lanes|=n,Zi|=n,l)}function Fx(n,l,u,m,v){var w=Z.p;Z.p=w!==0&&8>w?w:8;var R=ae.T,q={};ae.T=q,am(n,!1,l,u);try{var pe=v(),Le=ae.S;if(Le!==null&&Le(q,pe),pe!==null&&typeof pe=="object"&&typeof pe.then=="function"){var Ye=xk(pe,m);gd(n,l,Ye,An(n))}else gd(n,l,m,An(n))}catch(Qe){gd(n,l,{then:function(){},status:"rejected",reason:Qe},An())}finally{Z.p=w,R!==null&&q.types!==null&&(R.types=q.types),ae.T=R}}function kk(){}function em(n,l,u,m){if(n.tag!==5)throw Error(s(476));var v=Ix(n).queue;Fx(n,v,l,K,u===null?kk:function(){return zx(n),u(m)})}function Ix(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:K},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:u},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function zx(n){var l=Ix(n);l.next===null&&(l=n.alternate.memoizedState),gd(n,l.next.queue,{},An())}function tm(){return Er(Md)}function Bx(){return ar().memoizedState}function Ux(){return ar().memoizedState}function Nk(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var u=An();n=Ui(u);var m=Hi(l,n,u);m!==null&&(un(m,l,u),dd(m,l,u)),l={cache:Ah()},n.payload=l;return}l=l.return}}function jk(n,l,u){var m=An();u={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},fu(n)?$x(l,u):(u=ed(n,l,u,m),u!==null&&(un(u,n,m),Wx(u,l,m)))}function Hx(n,l,u){var m=An();gd(n,l,u,m)}function gd(n,l,u,m){var v={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(fu(n))$x(l,v);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var R=l.lastRenderedState,q=w(R,u);if(v.hasEagerState=!0,v.eagerState=q,gr(q,R))return Ls(n,l,v,0),Da===null&&Ll(),!1}catch(pe){}finally{}if(u=ed(n,l,v,m),u!==null)return un(u,n,m),Wx(u,l,m),!0}return!1}function am(n,l,u,m){if(m={lane:2,revertLane:Dm(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},fu(n)){if(l)throw Error(s(479))}else l=ed(n,u,m,2),l!==null&&un(l,n,2)}function fu(n){var l=n.alternate;return n===qt||l!==null&&l===qt}function $x(n,l){Ho=su=!0;var u=n.pending;u===null?l.next=l:(l.next=u.next,u.next=l),n.pending=l}function Wx(n,l,u){if((u&4194048)!==0){var m=l.lanes;m&=n.pendingLanes,u|=m,l.lanes=u,Bn(n,u)}}var pd={readContext:Er,use:ou,useCallback:qa,useContext:qa,useEffect:qa,useImperativeHandle:qa,useLayoutEffect:qa,useInsertionEffect:qa,useMemo:qa,useReducer:qa,useRef:qa,useState:qa,useDebugValue:qa,useDeferredValue:qa,useTransition:qa,useSyncExternalStore:qa,useId:qa,useHostTransitionStatus:qa,useFormState:qa,useActionState:qa,useOptimistic:qa,useMemoCache:qa,useCacheRefresh:qa};pd.useEffectEvent=qa;var Vx={readContext:Er,use:ou,useCallback:function(n,l){return qr().memoizedState=[n,l===void 0?null:l],n},useContext:Er,useEffect:Ex,useImperativeHandle:function(n,l,u){u=u!=null?u.concat([n]):null,du(4194308,4,Mx.bind(null,l,n),u)},useLayoutEffect:function(n,l){return du(4194308,4,n,l)},useInsertionEffect:function(n,l){du(4,2,n,l)},useMemo:function(n,l){var u=qr();l=l===void 0?null:l;var m=n();if($l){dt(!0);try{n()}finally{dt(!1)}}return u.memoizedState=[m,l],m},useReducer:function(n,l,u){var m=qr();if(u!==void 0){var v=u(l);if($l){dt(!0);try{u(l)}finally{dt(!1)}}}else v=l;return m.memoizedState=m.baseState=v,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:v},m.queue=n,n=n.dispatch=jk.bind(null,qt,n),[m.memoizedState,n]},useRef:function(n){var l=qr();return n={current:n},l.memoizedState=n},useState:function(n){n=Yh(n);var l=n.queue,u=Hx.bind(null,qt,l);return l.dispatch=u,[n.memoizedState,u]},useDebugValue:Kh,useDeferredValue:function(n,l){var u=qr();return Qh(u,n,l)},useTransition:function(){var n=Yh(!1);return n=Fx.bind(null,qt,n.queue,!0,!1),qr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,u){var m=qt,v=qr();if(Qt){if(u===void 0)throw Error(s(407));u=u()}else{if(u=l(),Da===null)throw Error(s(349));(na&127)!==0||fx(m,l,u)}v.memoizedState=u;var w={value:u,getSnapshot:l};return v.queue=w,Ex(mx.bind(null,m,w,n),[n]),m.flags|=2048,Wo(9,{destroy:void 0},hx.bind(null,m,w,u,l),null),u},useId:function(){var n=qr(),l=Da.identifierPrefix;if(Qt){var u=yt,m=Ke;u=(m&~(1<<32-wt(m)-1)).toString(32)+u,l="_"+l+"R_"+u,u=iu++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=yk++,l="_"+l+"r_"+u.toString(32)+"_";return n.memoizedState=l},useHostTransitionStatus:tm,useFormState:kx,useActionState:kx,useOptimistic:function(n){var l=qr();l.memoizedState=l.baseState=n;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=am.bind(null,qt,!0,u),u.dispatch=l,[n,l]},useMemoCache:Gh,useCacheRefresh:function(){return qr().memoizedState=Nk.bind(null,qt)},useEffectEvent:function(n){var l=qr(),u={impl:n};return l.memoizedState=u,function(){if((ma&2)!==0)throw Error(s(440));return u.impl.apply(void 0,arguments)}}},rm={readContext:Er,use:ou,useCallback:Dx,useContext:Er,useEffect:Jh,useImperativeHandle:Lx,useInsertionEffect:Ax,useLayoutEffect:Ox,useMemo:Px,useReducer:cu,useRef:Tx,useState:function(){return cu(ai)},useDebugValue:Kh,useDeferredValue:function(n,l){var u=ar();return Rx(u,Ea.memoizedState,n,l)},useTransition:function(){var n=cu(ai)[0],l=ar().memoizedState;return[typeof n=="boolean"?n:md(n),l]},useSyncExternalStore:ux,useId:Bx,useHostTransitionStatus:tm,useFormState:Nx,useActionState:Nx,useOptimistic:function(n,l){var u=ar();return xx(u,Ea,n,l)},useMemoCache:Gh,useCacheRefresh:Ux};rm.useEffectEvent=Cx;var Gx={readContext:Er,use:ou,useCallback:Dx,useContext:Er,useEffect:Jh,useImperativeHandle:Lx,useInsertionEffect:Ax,useLayoutEffect:Ox,useMemo:Px,useReducer:qh,useRef:Tx,useState:function(){return qh(ai)},useDebugValue:Kh,useDeferredValue:function(n,l){var u=ar();return Ea===null?Qh(u,n,l):Rx(u,Ea.memoizedState,n,l)},useTransition:function(){var n=qh(ai)[0],l=ar().memoizedState;return[typeof n=="boolean"?n:md(n),l]},useSyncExternalStore:ux,useId:Bx,useHostTransitionStatus:tm,useFormState:Sx,useActionState:Sx,useOptimistic:function(n,l){var u=ar();return Ea!==null?xx(u,Ea,n,l):(u.baseState=n,[n,u.queue.dispatch])},useMemoCache:Gh,useCacheRefresh:Ux};Gx.useEffectEvent=Cx;function nm(n,l,u,m){l=n.memoizedState,u=u(m,l),u=u==null?l:y({},l,u),n.memoizedState=u,n.lanes===0&&(n.updateQueue.baseState=u)}var sm={enqueueSetState:function(n,l,u){n=n._reactInternals;var m=An(),v=Ui(m);v.payload=l,u!=null&&(v.callback=u),l=Hi(n,v,m),l!==null&&(un(l,n,m),dd(l,n,m))},enqueueReplaceState:function(n,l,u){n=n._reactInternals;var m=An(),v=Ui(m);v.tag=1,v.payload=l,u!=null&&(v.callback=u),l=Hi(n,v,m),l!==null&&(un(l,n,m),dd(l,n,m))},enqueueForceUpdate:function(n,l){n=n._reactInternals;var u=An(),m=Ui(u);m.tag=2,l!=null&&(m.callback=l),l=Hi(n,m,u),l!==null&&(un(l,n,u),dd(l,n,u))}};function Zx(n,l,u,m,v,w,R){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(m,w,R):l.prototype&&l.prototype.isPureReactComponent?!Di(u,m)||!Di(v,w):!0}function qx(n,l,u,m){n=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(u,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(u,m),l.state!==n&&sm.enqueueReplaceState(l,l.state,null)}function Wl(n,l){var u=l;if("ref"in l){u={};for(var m in l)m!=="ref"&&(u[m]=l[m])}if(n=n.defaultProps){u===l&&(u=y({},u));for(var v in n)u[v]===void 0&&(u[v]=n[v])}return u}function Yx(n){Ml(n)}function Xx(n){console.error(n)}function Jx(n){Ml(n)}function hu(n,l){try{var u=n.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function Kx(n,l,u){try{var m=n.onCaughtError;m(u.value,{componentStack:u.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function im(n,l,u){return u=Ui(u),u.tag=3,u.payload={element:null},u.callback=function(){hu(n,l)},u}function Qx(n){return n=Ui(n),n.tag=3,n}function ey(n,l,u,m){var v=u.type.getDerivedStateFromError;if(typeof v=="function"){var w=m.value;n.payload=function(){return v(w)},n.callback=function(){Kx(l,u,m)}}var R=u.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(n.callback=function(){Kx(l,u,m),typeof v!="function"&&(qi===null?qi=new Set([this]):qi.add(this));var q=m.stack;this.componentDidCatch(m.value,{componentStack:q!==null?q:""})})}function Sk(n,l,u,m,v){if(u.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=u.alternate,l!==null&&Ro(l,u,v,!0),u=Sn.current,u!==null){switch(u.tag){case 31:case 13:return Yn===null?ju():u.alternate===null&&Ya===0&&(Ya=3),u.flags&=-257,u.flags|=65536,u.lanes=v,m===eu?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([m]):l.add(m),Om(n,m,v)),!1;case 22:return u.flags|=65536,m===eu?u.flags|=16384:(l=u.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([m])},u.updateQueue=l):(u=l.retryQueue,u===null?l.retryQueue=new Set([m]):u.add(m)),Om(n,m,v)),!1}throw Error(s(435,u.tag))}return Om(n,m,v),ju(),!1}if(Qt)return l=Sn.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=v,m!==Po&&(n=Error(s(422),{cause:m}),Rl(h(n,u)))):(m!==Po&&(l=Error(s(423),{cause:m}),Rl(h(l,u))),n=n.current.alternate,n.flags|=65536,v&=-v,n.lanes|=v,m=h(m,u),v=im(n.stateNode,m,v),Rh(n,v),Ya!==4&&(Ya=2)),!1;var w=Error(s(520),{cause:m});if(w=h(w,u),Nd===null?Nd=[w]:Nd.push(w),Ya!==4&&(Ya=2),l===null)return!0;m=h(m,u),u=l;do{switch(u.tag){case 3:return u.flags|=65536,n=v&-v,u.lanes|=n,n=im(u.stateNode,m,n),Rh(u,n),!1;case 1:if(l=u.type,w=u.stateNode,(u.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(qi===null||!qi.has(w))))return u.flags|=65536,v&=-v,u.lanes|=v,v=Qx(v),ey(v,n,u,m),Rh(u,v),!1}u=u.return}while(u!==null);return!1}var lm=Error(s(461)),ir=!1;function Cr(n,l,u,m){l.child=n===null?nx(l,null,u,m):Hl(l,n.child,u,m)}function ty(n,l,u,m,v){u=u.render;var w=l.ref;if("ref"in m){var R={};for(var q in m)q!=="ref"&&(R[q]=m[q])}else R=m;return Il(l),m=Hh(n,l,u,R,w,v),q=$h(),n!==null&&!ir?(Wh(n,l,v),ri(n,l,v)):(Qt&&q&&fr(l),l.flags|=1,Cr(n,l,m,v),l.child)}function ay(n,l,u,m,v){if(n===null){var w=u.type;return typeof w=="function"&&!Lo(w)&&w.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=w,ry(n,l,w,m,v)):(n=Pl(u.type,null,m,l,l.mode,v),n.ref=l.ref,n.return=l,l.child=n)}if(w=n.child,!gm(n,v)){var R=w.memoizedProps;if(u=u.compare,u=u!==null?u:Di,u(R,m)&&n.ref===l.ref)return ri(n,l,v)}return l.flags|=1,n=qn(w,m),n.ref=l.ref,n.return=l,l.child=n}function ry(n,l,u,m,v){if(n!==null){var w=n.memoizedProps;if(Di(w,m)&&n.ref===l.ref)if(ir=!1,l.pendingProps=m=w,gm(n,v))(n.flags&131072)!==0&&(ir=!0);else return l.lanes=n.lanes,ri(n,l,v)}return om(n,l,u,m,v)}function ny(n,l,u,m){var v=m.children,w=n!==null?n.memoizedState:null;if(n===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((l.flags&128)!==0){if(w=w!==null?w.baseLanes|u:u,n!==null){for(m=l.child=n.child,v=0;m!==null;)v=v|m.lanes|m.childLanes,m=m.sibling;m=v&~w}else m=0,l.child=null;return sy(n,l,w,u,m)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},n!==null&&K0(l,w!==null?w.cachePool:null),w!==null?lx(l,w):Ih(),ox(l);else return m=l.lanes=536870912,sy(n,l,w!==null?w.baseLanes|u:u,u,m)}else w!==null?(K0(l,w.cachePool),lx(l,w),Wi(),l.memoizedState=null):(n!==null&&K0(l,null),Ih(),Wi());return Cr(n,l,v,u),l.child}function xd(n,l){return n!==null&&n.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function sy(n,l,u,m,v){var w=Mh();return w=w===null?null:{parent:nr._currentValue,pool:w},l.memoizedState={baseLanes:u,cachePool:w},n!==null&&K0(l,null),Ih(),ox(l),n!==null&&Ro(n,l,m,!0),l.childLanes=v,null}function mu(n,l){return l=pu({mode:l.mode,children:l.children},n.mode),l.ref=n.ref,n.child=l,l.return=n,l}function iy(n,l,u){return Hl(l,n.child,null,u),n=mu(l,l.pendingProps),n.flags|=2,Tn(l),l.memoizedState=null,n}function Tk(n,l,u){var m=l.pendingProps,v=(l.flags&128)!==0;if(l.flags&=-129,n===null){if(Qt){if(m.mode==="hidden")return n=mu(l,m),l.lanes=536870912,xd(null,n);if(Bh(l),(n=ca)?(n=yb(n,sn),n=n!==null&&n.data==="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:Pe!==null?{id:Ke,overflow:yt}:null,retryLane:536870912,hydrationErrors:null},u=ad(n),u.return=l,l.child=u,oa=l,ca=null)):n=null,n===null)throw Ps(l);return l.lanes=536870912,null}return mu(l,m)}var w=n.memoizedState;if(w!==null){var R=w.dehydrated;if(Bh(l),v)if(l.flags&256)l.flags&=-257,l=iy(n,l,u);else if(l.memoizedState!==null)l.child=n.child,l.flags|=128,l=null;else throw Error(s(558));else if(ir||Ro(n,l,u,!1),v=(u&n.childLanes)!==0,ir||v){if(m=Da,m!==null&&(R=js(m,u),R!==0&&R!==w.retryLane))throw w.retryLane=R,Zn(n,R),un(m,n,R),lm;ju(),l=iy(n,l,u)}else n=w.treeContext,ca=Xn(R.nextSibling),oa=l,Qt=!0,Ds=null,sn=!1,n!==null&&Zr(l,n),l=mu(l,m),l.flags|=4096;return l}return n=qn(n.child,{mode:m.mode,children:m.children}),n.ref=l.ref,l.child=n,n.return=l,n}function gu(n,l){var u=l.ref;if(u===null)n!==null&&n.ref!==null&&(l.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(s(284));(n===null||n.ref!==u)&&(l.flags|=4194816)}}function om(n,l,u,m,v){return Il(l),u=Hh(n,l,u,m,void 0,v),m=$h(),n!==null&&!ir?(Wh(n,l,v),ri(n,l,v)):(Qt&&m&&fr(l),l.flags|=1,Cr(n,l,u,v),l.child)}function ly(n,l,u,m,v,w){return Il(l),l.updateQueue=null,u=dx(l,m,u,v),cx(n),m=$h(),n!==null&&!ir?(Wh(n,l,w),ri(n,l,w)):(Qt&&m&&fr(l),l.flags|=1,Cr(n,l,u,w),l.child)}function oy(n,l,u,m,v){if(Il(l),l.stateNode===null){var w=Js,R=u.contextType;typeof R=="object"&&R!==null&&(w=Er(R)),w=new u(m,w),l.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=sm,l.stateNode=w,w._reactInternals=l,w=l.stateNode,w.props=m,w.state=l.memoizedState,w.refs={},Dh(l),R=u.contextType,w.context=typeof R=="object"&&R!==null?Er(R):Js,w.state=l.memoizedState,R=u.getDerivedStateFromProps,typeof R=="function"&&(nm(l,u,R,m),w.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(R=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),R!==w.state&&sm.enqueueReplaceState(w,w.state,null),fd(l,m,w,v),ud(),w.state=l.memoizedState),typeof w.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(n===null){w=l.stateNode;var q=l.memoizedProps,pe=Wl(u,q);w.props=pe;var Le=w.context,Ye=u.contextType;R=Js,typeof Ye=="object"&&Ye!==null&&(R=Er(Ye));var Qe=u.getDerivedStateFromProps;Ye=typeof Qe=="function"||typeof w.getSnapshotBeforeUpdate=="function",q=l.pendingProps!==q,Ye||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(q||Le!==R)&&qx(l,w,m,R),Bi=!1;var Re=l.memoizedState;w.state=Re,fd(l,m,w,v),ud(),Le=l.memoizedState,q||Re!==Le||Bi?(typeof Qe=="function"&&(nm(l,u,Qe,m),Le=l.memoizedState),(pe=Bi||Zx(l,u,pe,m,Re,Le,R))?(Ye||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(l.flags|=4194308)):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=Le),w.props=m,w.state=Le,w.context=R,m=pe):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{w=l.stateNode,Ph(n,l),R=l.memoizedProps,Ye=Wl(u,R),w.props=Ye,Qe=l.pendingProps,Re=w.context,Le=u.contextType,pe=Js,typeof Le=="object"&&Le!==null&&(pe=Er(Le)),q=u.getDerivedStateFromProps,(Le=typeof q=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(R!==Qe||Re!==pe)&&qx(l,w,m,pe),Bi=!1,Re=l.memoizedState,w.state=Re,fd(l,m,w,v),ud();var He=l.memoizedState;R!==Qe||Re!==He||Bi||n!==null&&n.dependencies!==null&&X0(n.dependencies)?(typeof q=="function"&&(nm(l,u,q,m),He=l.memoizedState),(Ye=Bi||Zx(l,u,Ye,m,Re,He,pe)||n!==null&&n.dependencies!==null&&X0(n.dependencies))?(Le||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(m,He,pe),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(m,He,pe)),typeof w.componentDidUpdate=="function"&&(l.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof w.componentDidUpdate!="function"||R===n.memoizedProps&&Re===n.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||R===n.memoizedProps&&Re===n.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=He),w.props=m,w.state=He,w.context=pe,m=Ye):(typeof w.componentDidUpdate!="function"||R===n.memoizedProps&&Re===n.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||R===n.memoizedProps&&Re===n.memoizedState||(l.flags|=1024),m=!1)}return w=m,gu(n,l),m=(l.flags&128)!==0,w||m?(w=l.stateNode,u=m&&typeof u.getDerivedStateFromError!="function"?null:w.render(),l.flags|=1,n!==null&&m?(l.child=Hl(l,n.child,null,v),l.child=Hl(l,null,u,v)):Cr(n,l,u,v),l.memoizedState=w.state,n=l.child):n=ri(n,l,v),n}function cy(n,l,u,m){return Qs(),l.flags|=256,Cr(n,l,u,m),l.child}var cm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dm(n){return{baseLanes:n,cachePool:Kp()}}function um(n,l,u){return n=n!==null?n.childLanes&~u:0,l&&(n|=Cn),n}function dy(n,l,u){var m=l.pendingProps,v=!1,w=(l.flags&128)!==0,R;if((R=w)||(R=n!==null&&n.memoizedState===null?!1:(tr.current&2)!==0),R&&(v=!0,l.flags&=-129),R=(l.flags&32)!==0,l.flags&=-33,n===null){if(Qt){if(v?$i(l):Wi(),(n=ca)?(n=yb(n,sn),n=n!==null&&n.data!=="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:Pe!==null?{id:Ke,overflow:yt}:null,retryLane:536870912,hydrationErrors:null},u=ad(n),u.return=l,l.child=u,oa=l,ca=null)):n=null,n===null)throw Ps(l);return Zm(n)?l.lanes=32:l.lanes=536870912,null}var q=m.children;return m=m.fallback,v?(Wi(),v=l.mode,q=pu({mode:"hidden",children:q},v),m=Ks(m,v,u,null),q.return=l,m.return=l,q.sibling=m,l.child=q,m=l.child,m.memoizedState=dm(u),m.childLanes=um(n,R,u),l.memoizedState=cm,xd(null,m)):($i(l),fm(l,q))}var pe=n.memoizedState;if(pe!==null&&(q=pe.dehydrated,q!==null)){if(w)l.flags&256?($i(l),l.flags&=-257,l=hm(n,l,u)):l.memoizedState!==null?(Wi(),l.child=n.child,l.flags|=128,l=null):(Wi(),q=m.fallback,v=l.mode,m=pu({mode:"visible",children:m.children},v),q=Ks(q,v,u,null),q.flags|=2,m.return=l,q.return=l,m.sibling=q,l.child=m,Hl(l,n.child,null,u),m=l.child,m.memoizedState=dm(u),m.childLanes=um(n,R,u),l.memoizedState=cm,l=xd(null,m));else if($i(l),Zm(q)){if(R=q.nextSibling&&q.nextSibling.dataset,R)var Le=R.dgst;R=Le,m=Error(s(419)),m.stack="",m.digest=R,Rl({value:m,source:null,stack:null}),l=hm(n,l,u)}else if(ir||Ro(n,l,u,!1),R=(u&n.childLanes)!==0,ir||R){if(R=Da,R!==null&&(m=js(R,u),m!==0&&m!==pe.retryLane))throw pe.retryLane=m,Zn(n,m),un(R,n,m),lm;Gm(q)||ju(),l=hm(n,l,u)}else Gm(q)?(l.flags|=192,l.child=n.child,l=null):(n=pe.treeContext,ca=Xn(q.nextSibling),oa=l,Qt=!0,Ds=null,sn=!1,n!==null&&Zr(l,n),l=fm(l,m.children),l.flags|=4096);return l}return v?(Wi(),q=m.fallback,v=l.mode,pe=n.child,Le=pe.sibling,m=qn(pe,{mode:"hidden",children:m.children}),m.subtreeFlags=pe.subtreeFlags&65011712,Le!==null?q=qn(Le,q):(q=Ks(q,v,u,null),q.flags|=2),q.return=l,m.return=l,m.sibling=q,l.child=m,xd(null,m),m=l.child,q=n.child.memoizedState,q===null?q=dm(u):(v=q.cachePool,v!==null?(pe=nr._currentValue,v=v.parent!==pe?{parent:pe,pool:pe}:v):v=Kp(),q={baseLanes:q.baseLanes|u,cachePool:v}),m.memoizedState=q,m.childLanes=um(n,R,u),l.memoizedState=cm,xd(n.child,m)):($i(l),u=n.child,n=u.sibling,u=qn(u,{mode:"visible",children:m.children}),u.return=l,u.sibling=null,n!==null&&(R=l.deletions,R===null?(l.deletions=[n],l.flags|=16):R.push(n)),l.child=u,l.memoizedState=null,u)}function fm(n,l){return l=pu({mode:"visible",children:l},n.mode),l.return=n,n.child=l}function pu(n,l){return n=Br(22,n,null,l),n.lanes=0,n}function hm(n,l,u){return Hl(l,n.child,null,u),n=fm(l,l.pendingProps.children),n.flags|=2,l.memoizedState=null,n}function uy(n,l,u){n.lanes|=l;var m=n.alternate;m!==null&&(m.lanes|=l),Eh(n.return,l,u)}function mm(n,l,u,m,v,w){var R=n.memoizedState;R===null?n.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:v,treeForkCount:w}:(R.isBackwards=l,R.rendering=null,R.renderingStartTime=0,R.last=m,R.tail=u,R.tailMode=v,R.treeForkCount=w)}function fy(n,l,u){var m=l.pendingProps,v=m.revealOrder,w=m.tail;m=m.children;var R=tr.current,q=(R&2)!==0;if(q?(R=R&1|2,l.flags|=128):R&=1,W(tr,R),Cr(n,l,m,u),m=Qt?V:0,!q&&n!==null&&(n.flags&128)!==0)e:for(n=l.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&uy(n,u,l);else if(n.tag===19)uy(n,u,l);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===l)break e;for(;n.sibling===null;){if(n.return===null||n.return===l)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(v){case"forwards":for(u=l.child,v=null;u!==null;)n=u.alternate,n!==null&&nu(n)===null&&(v=u),u=u.sibling;u=v,u===null?(v=l.child,l.child=null):(v=u.sibling,u.sibling=null),mm(l,!1,v,u,w,m);break;case"backwards":case"unstable_legacy-backwards":for(u=null,v=l.child,l.child=null;v!==null;){if(n=v.alternate,n!==null&&nu(n)===null){l.child=v;break}n=v.sibling,v.sibling=u,u=v,v=n}mm(l,!0,u,null,w,m);break;case"together":mm(l,!1,null,null,void 0,m);break;default:l.memoizedState=null}return l.child}function ri(n,l,u){if(n!==null&&(l.dependencies=n.dependencies),Zi|=l.lanes,(u&l.childLanes)===0)if(n!==null){if(Ro(n,l,u,!1),(u&l.childLanes)===0)return null}else return null;if(n!==null&&l.child!==n.child)throw Error(s(153));if(l.child!==null){for(n=l.child,u=qn(n,n.pendingProps),l.child=u,u.return=l;n.sibling!==null;)n=n.sibling,u=u.sibling=qn(n,n.pendingProps),u.return=l;u.sibling=null}return l.child}function gm(n,l){return(n.lanes&l)!==0?!0:(n=n.dependencies,!!(n!==null&&X0(n)))}function Ek(n,l,u){switch(l.tag){case 3:Ne(l,l.stateNode.containerInfo),zi(l,nr,n.memoizedState.cache),Qs();break;case 27:case 5:Ve(l);break;case 4:Ne(l,l.stateNode.containerInfo);break;case 10:zi(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Bh(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?($i(l),l.flags|=128,null):(u&l.child.childLanes)!==0?dy(n,l,u):($i(l),n=ri(n,l,u),n!==null?n.sibling:null);$i(l);break;case 19:var v=(n.flags&128)!==0;if(m=(u&l.childLanes)!==0,m||(Ro(n,l,u,!1),m=(u&l.childLanes)!==0),v){if(m)return fy(n,l,u);l.flags|=128}if(v=l.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),W(tr,tr.current),m)break;return null;case 22:return l.lanes=0,ny(n,l,u,l.pendingProps);case 24:zi(l,nr,n.memoizedState.cache)}return ri(n,l,u)}function hy(n,l,u){if(n!==null)if(n.memoizedProps!==l.pendingProps)ir=!0;else{if(!gm(n,u)&&(l.flags&128)===0)return ir=!1,Ek(n,l,u);ir=(n.flags&131072)!==0}else ir=!1,Qt&&(l.flags&1048576)!==0&&Xt(l,V,l.index);switch(l.lanes=0,l.tag){case 16:e:{var m=l.pendingProps;if(n=Bl(l.elementType),l.type=n,typeof n=="function")Lo(n)?(m=Wl(n,m),l.tag=1,l=oy(null,l,n,m,u)):(l.tag=0,l=om(null,l,n,m,u));else{if(n!=null){var v=n.$$typeof;if(v===P){l.tag=11,l=ty(null,l,n,m,u);break e}else if(v===B){l.tag=14,l=ay(null,l,n,m,u);break e}}throw l=be(n)||n,Error(s(306,l,""))}}return l;case 0:return om(n,l,l.type,l.pendingProps,u);case 1:return m=l.type,v=Wl(m,l.pendingProps),oy(n,l,m,v,u);case 3:e:{if(Ne(l,l.stateNode.containerInfo),n===null)throw Error(s(387));m=l.pendingProps;var w=l.memoizedState;v=w.element,Ph(n,l),fd(l,m,null,u);var R=l.memoizedState;if(m=R.cache,zi(l,nr,m),m!==w.cache&&Ch(l,[nr],u,!0),ud(),m=R.element,w.isDehydrated)if(w={element:m,isDehydrated:!1,cache:R.cache},l.updateQueue.baseState=w,l.memoizedState=w,l.flags&256){l=cy(n,l,m,u);break e}else if(m!==v){v=h(Error(s(424)),l),Rl(v),l=cy(n,l,m,u);break e}else{switch(n=l.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(ca=Xn(n.firstChild),oa=l,Qt=!0,Ds=null,sn=!0,u=nx(l,null,m,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Qs(),m===v){l=ri(n,l,u);break e}Cr(n,l,m,u)}l=l.child}return l;case 26:return gu(n,l),n===null?(u=Nb(l.type,null,l.pendingProps,null))?l.memoizedState=u:Qt||(u=l.type,n=l.pendingProps,m=Mu(de.current).createElement(u),m[Q]=l,m[re]=n,Ar(m,u,n),_t(m),l.stateNode=m):l.memoizedState=Nb(l.type,n.memoizedProps,l.pendingProps,n.memoizedState),null;case 27:return Ve(l),n===null&&Qt&&(m=l.stateNode=_b(l.type,l.pendingProps,de.current),oa=l,sn=!0,v=ca,Ki(l.type)?(qm=v,ca=Xn(m.firstChild)):ca=v),Cr(n,l,l.pendingProps.children,u),gu(n,l),n===null&&(l.flags|=4194304),l.child;case 5:return n===null&&Qt&&((v=m=ca)&&(m=n4(m,l.type,l.pendingProps,sn),m!==null?(l.stateNode=m,oa=l,ca=Xn(m.firstChild),sn=!1,v=!0):v=!1),v||Ps(l)),Ve(l),v=l.type,w=l.pendingProps,R=n!==null?n.memoizedProps:null,m=w.children,$m(v,w)?m=null:R!==null&&$m(v,R)&&(l.flags|=32),l.memoizedState!==null&&(v=Hh(n,l,bk,null,null,u),Md._currentValue=v),gu(n,l),Cr(n,l,m,u),l.child;case 6:return n===null&&Qt&&((n=u=ca)&&(u=s4(u,l.pendingProps,sn),u!==null?(l.stateNode=u,oa=l,ca=null,n=!0):n=!1),n||Ps(l)),null;case 13:return dy(n,l,u);case 4:return Ne(l,l.stateNode.containerInfo),m=l.pendingProps,n===null?l.child=Hl(l,null,m,u):Cr(n,l,m,u),l.child;case 11:return ty(n,l,l.type,l.pendingProps,u);case 7:return Cr(n,l,l.pendingProps,u),l.child;case 8:return Cr(n,l,l.pendingProps.children,u),l.child;case 12:return Cr(n,l,l.pendingProps.children,u),l.child;case 10:return m=l.pendingProps,zi(l,l.type,m.value),Cr(n,l,m.children,u),l.child;case 9:return v=l.type._context,m=l.pendingProps.children,Il(l),v=Er(v),m=m(v),l.flags|=1,Cr(n,l,m,u),l.child;case 14:return ay(n,l,l.type,l.pendingProps,u);case 15:return ry(n,l,l.type,l.pendingProps,u);case 19:return fy(n,l,u);case 31:return Tk(n,l,u);case 22:return ny(n,l,u,l.pendingProps);case 24:return Il(l),m=Er(nr),n===null?(v=Mh(),v===null&&(v=Da,w=Ah(),v.pooledCache=w,w.refCount++,w!==null&&(v.pooledCacheLanes|=u),v=w),l.memoizedState={parent:m,cache:v},Dh(l),zi(l,nr,v)):((n.lanes&u)!==0&&(Ph(n,l),fd(l,null,null,u),ud()),v=n.memoizedState,w=l.memoizedState,v.parent!==m?(v={parent:m,cache:m},l.memoizedState=v,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=v),zi(l,nr,m)):(m=w.cache,zi(l,nr,m),m!==v.cache&&Ch(l,[nr],u,!0))),Cr(n,l,l.pendingProps.children,u),l.child;case 29:throw l.pendingProps}throw Error(s(156,l.tag))}function ni(n){n.flags|=4}function pm(n,l,u,m,v){if((l=(n.mode&32)!==0)&&(l=!1),l){if(n.flags|=16777216,(v&335544128)===v)if(n.stateNode.complete)n.flags|=8192;else if(By())n.flags|=8192;else throw Ul=eu,Lh}else n.flags&=-16777217}function my(n,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Cb(l))if(By())n.flags|=8192;else throw Ul=eu,Lh}function xu(n,l){l!==null&&(n.flags|=4),n.flags&16384&&(l=n.tag!==22?Ma():536870912,n.lanes|=l,qo|=l)}function yd(n,l){if(!Qt)switch(n.tailMode){case"hidden":l=n.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?n.tail=null:u.sibling=null;break;case"collapsed":u=n.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?l||n.tail===null?n.tail=null:n.tail.sibling=null:m.sibling=null}}function za(n){var l=n.alternate!==null&&n.alternate.child===n.child,u=0,m=0;if(l)for(var v=n.child;v!==null;)u|=v.lanes|v.childLanes,m|=v.subtreeFlags&65011712,m|=v.flags&65011712,v.return=n,v=v.sibling;else for(v=n.child;v!==null;)u|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=n,v=v.sibling;return n.subtreeFlags|=m,n.childLanes=u,l}function Ck(n,l,u){var m=l.pendingProps;switch(Za(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return za(l),null;case 1:return za(l),null;case 3:return u=l.stateNode,m=null,n!==null&&(m=n.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),ei(nr),$e(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(n===null||n.child===null)&&(fs(l)?ni(l):n===null||n.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,sd())),za(l),null;case 26:var v=l.type,w=l.memoizedState;return n===null?(ni(l),w!==null?(za(l),my(l,w)):(za(l),pm(l,v,null,m,u))):w?w!==n.memoizedState?(ni(l),za(l),my(l,w)):(za(l),l.flags&=-16777217):(n=n.memoizedProps,n!==m&&ni(l),za(l),pm(l,v,n,m,u)),null;case 27:if(st(l),u=de.current,v=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==m&&ni(l);else{if(!m){if(l.stateNode===null)throw Error(s(166));return za(l),null}n=G.current,fs(l)?nd(l):(n=_b(v,m,u),l.stateNode=n,ni(l))}return za(l),null;case 5:if(st(l),v=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==m&&ni(l);else{if(!m){if(l.stateNode===null)throw Error(s(166));return za(l),null}if(w=G.current,fs(l))nd(l);else{var R=Mu(de.current);switch(w){case 1:w=R.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:w=R.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":w=R.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":w=R.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":w=R.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof m.is=="string"?R.createElement("select",{is:m.is}):R.createElement("select"),m.multiple?w.multiple=!0:m.size&&(w.size=m.size);break;default:w=typeof m.is=="string"?R.createElement(v,{is:m.is}):R.createElement(v)}}w[Q]=l,w[re]=m;e:for(R=l.child;R!==null;){if(R.tag===5||R.tag===6)w.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===l)break e;for(;R.sibling===null;){if(R.return===null||R.return===l)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}l.stateNode=w;e:switch(Ar(w,v,m),v){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&ni(l)}}return za(l),pm(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,u),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==m&&ni(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(s(166));if(n=de.current,fs(l)){if(n=l.stateNode,u=l.memoizedProps,m=null,v=oa,v!==null)switch(v.tag){case 27:case 5:m=v.memoizedProps}n[Q]=l,n=!!(n.nodeValue===u||m!==null&&m.suppressHydrationWarning===!0||db(n.nodeValue,u)),n||Ps(l,!0)}else n=Mu(n).createTextNode(m),n[Q]=l,l.stateNode=n}return za(l),null;case 31:if(u=l.memoizedState,n===null||n.memoizedState!==null){if(m=fs(l),u!==null){if(n===null){if(!m)throw Error(s(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[Q]=l}else Qs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;za(l),n=!1}else u=sd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=u),n=!0;if(!n)return l.flags&256?(Tn(l),l):(Tn(l),null);if((l.flags&128)!==0)throw Error(s(558))}return za(l),null;case 13:if(m=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(v=fs(l),m!==null&&m.dehydrated!==null){if(n===null){if(!v)throw Error(s(318));if(v=l.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(s(317));v[Q]=l}else Qs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;za(l),v=!1}else v=sd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=v),v=!0;if(!v)return l.flags&256?(Tn(l),l):(Tn(l),null)}return Tn(l),(l.flags&128)!==0?(l.lanes=u,l):(u=m!==null,n=n!==null&&n.memoizedState!==null,u&&(m=l.child,v=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(v=m.alternate.memoizedState.cachePool.pool),w=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(w=m.memoizedState.cachePool.pool),w!==v&&(m.flags|=2048)),u!==n&&u&&(l.child.flags|=8192),xu(l,l.updateQueue),za(l),null);case 4:return $e(),n===null&&Im(l.stateNode.containerInfo),za(l),null;case 10:return ei(l.type),za(l),null;case 19:if(D(tr),m=l.memoizedState,m===null)return za(l),null;if(v=(l.flags&128)!==0,w=m.rendering,w===null)if(v)yd(m,!1);else{if(Ya!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(w=nu(n),w!==null){for(l.flags|=128,yd(m,!1),n=w.updateQueue,l.updateQueue=n,xu(l,n),l.subtreeFlags=0,n=u,u=l.child;u!==null;)td(u,n),u=u.sibling;return W(tr,tr.current&1|2),Qt&&Dt(l,m.treeForkCount),l.child}n=n.sibling}m.tail!==null&&ze()>wu&&(l.flags|=128,v=!0,yd(m,!1),l.lanes=4194304)}else{if(!v)if(n=nu(w),n!==null){if(l.flags|=128,v=!0,n=n.updateQueue,l.updateQueue=n,xu(l,n),yd(m,!0),m.tail===null&&m.tailMode==="hidden"&&!w.alternate&&!Qt)return za(l),null}else 2*ze()-m.renderingStartTime>wu&&u!==536870912&&(l.flags|=128,v=!0,yd(m,!1),l.lanes=4194304);m.isBackwards?(w.sibling=l.child,l.child=w):(n=m.last,n!==null?n.sibling=w:l.child=w,m.last=w)}return m.tail!==null?(n=m.tail,m.rendering=n,m.tail=n.sibling,m.renderingStartTime=ze(),n.sibling=null,u=tr.current,W(tr,v?u&1|2:u&1),Qt&&Dt(l,m.treeForkCount),n):(za(l),null);case 22:case 23:return Tn(l),zh(),m=l.memoizedState!==null,n!==null?n.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(u&536870912)!==0&&(l.flags&128)===0&&(za(l),l.subtreeFlags&6&&(l.flags|=8192)):za(l),u=l.updateQueue,u!==null&&xu(l,u.retryQueue),u=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==u&&(l.flags|=2048),n!==null&&D(zl),null;case 24:return u=null,n!==null&&(u=n.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),ei(nr),za(l),null;case 25:return null;case 30:return null}throw Error(s(156,l.tag))}function Ak(n,l){switch(Za(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return ei(nr),$e(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return st(l),null;case 31:if(l.memoizedState!==null){if(Tn(l),l.alternate===null)throw Error(s(340));Qs()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Tn(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(s(340));Qs()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return D(tr),null;case 4:return $e(),null;case 10:return ei(l.type),null;case 22:case 23:return Tn(l),zh(),n!==null&&D(zl),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return ei(nr),null;case 25:return null;default:return null}}function gy(n,l){switch(Za(l),l.tag){case 3:ei(nr),$e();break;case 26:case 27:case 5:st(l);break;case 4:$e();break;case 31:l.memoizedState!==null&&Tn(l);break;case 13:Tn(l);break;case 19:D(tr);break;case 10:ei(l.type);break;case 22:case 23:Tn(l),zh(),n!==null&&D(zl);break;case 24:ei(nr)}}function bd(n,l){try{var u=l.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var v=m.next;u=v;do{if((u.tag&n)===n){m=void 0;var w=u.create,R=u.inst;m=w(),R.destroy=m}u=u.next}while(u!==v)}}catch(q){ba(l,l.return,q)}}function Vi(n,l,u){try{var m=l.updateQueue,v=m!==null?m.lastEffect:null;if(v!==null){var w=v.next;m=w;do{if((m.tag&n)===n){var R=m.inst,q=R.destroy;if(q!==void 0){R.destroy=void 0,v=l;var pe=u,Le=q;try{Le()}catch(Ye){ba(v,pe,Ye)}}}m=m.next}while(m!==w)}}catch(Ye){ba(l,l.return,Ye)}}function py(n){var l=n.updateQueue;if(l!==null){var u=n.stateNode;try{ix(l,u)}catch(m){ba(n,n.return,m)}}}function xy(n,l,u){u.props=Wl(n.type,n.memoizedProps),u.state=n.memoizedState;try{u.componentWillUnmount()}catch(m){ba(n,l,m)}}function vd(n,l){try{var u=n.ref;if(u!==null){switch(n.tag){case 26:case 27:case 5:var m=n.stateNode;break;case 30:m=n.stateNode;break;default:m=n.stateNode}typeof u=="function"?n.refCleanup=u(m):u.current=m}}catch(v){ba(n,l,v)}}function Fs(n,l){var u=n.ref,m=n.refCleanup;if(u!==null)if(typeof m=="function")try{m()}catch(v){ba(n,l,v)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(v){ba(n,l,v)}else u.current=null}function yy(n){var l=n.type,u=n.memoizedProps,m=n.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&m.focus();break e;case"img":u.src?m.src=u.src:u.srcSet&&(m.srcset=u.srcSet)}}catch(v){ba(n,n.return,v)}}function xm(n,l,u){try{var m=n.stateNode;Kk(m,n.type,u,l),m[re]=l}catch(v){ba(n,n.return,v)}}function by(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ki(n.type)||n.tag===4}function ym(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||by(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Ki(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function bm(n,l,u){var m=n.tag;if(m===5||m===6)n=n.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(n,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(n),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=tn));else if(m!==4&&(m===27&&Ki(n.type)&&(u=n.stateNode,l=null),n=n.child,n!==null))for(bm(n,l,u),n=n.sibling;n!==null;)bm(n,l,u),n=n.sibling}function yu(n,l,u){var m=n.tag;if(m===5||m===6)n=n.stateNode,l?u.insertBefore(n,l):u.appendChild(n);else if(m!==4&&(m===27&&Ki(n.type)&&(u=n.stateNode),n=n.child,n!==null))for(yu(n,l,u),n=n.sibling;n!==null;)yu(n,l,u),n=n.sibling}function vy(n){var l=n.stateNode,u=n.memoizedProps;try{for(var m=n.type,v=l.attributes;v.length;)l.removeAttributeNode(v[0]);Ar(l,m,u),l[Q]=n,l[re]=u}catch(w){ba(n,n.return,w)}}var si=!1,lr=!1,vm=!1,_y=typeof WeakSet=="function"?WeakSet:Set,xr=null;function Ok(n,l){if(n=n.containerInfo,Um=zu,n=El(n),Cs(n)){if("selectionStart"in n)var u={start:n.selectionStart,end:n.selectionEnd};else e:{u=(u=n.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var v=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{u.nodeType,w.nodeType}catch(It){u=null;break e}var R=0,q=-1,pe=-1,Le=0,Ye=0,Qe=n,Re=null;t:for(;;){for(var He;Qe!==u||v!==0&&Qe.nodeType!==3||(q=R+v),Qe!==w||m!==0&&Qe.nodeType!==3||(pe=R+m),Qe.nodeType===3&&(R+=Qe.nodeValue.length),(He=Qe.firstChild)!==null;)Re=Qe,Qe=He;for(;;){if(Qe===n)break t;if(Re===u&&++Le===v&&(q=R),Re===w&&++Ye===m&&(pe=R),(He=Qe.nextSibling)!==null)break;Qe=Re,Re=Qe.parentNode}Qe=He}u=q===-1||pe===-1?null:{start:q,end:pe}}else u=null}u=u||{start:0,end:0}}else u=null;for(Hm={focusedElem:n,selectionRange:u},zu=!1,xr=l;xr!==null;)if(l=xr,n=l.child,(l.subtreeFlags&1028)!==0&&n!==null)n.return=l,xr=n;else for(;xr!==null;){switch(l=xr,w=l.alternate,n=l.flags,l.tag){case 0:if((n&4)!==0&&(n=l.updateQueue,n=n!==null?n.events:null,n!==null))for(u=0;u<n.length;u++)v=n[u],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&w!==null){n=void 0,u=l,v=w.memoizedProps,w=w.memoizedState,m=u.stateNode;try{var Tt=Wl(u.type,v);n=m.getSnapshotBeforeUpdate(Tt,w),m.__reactInternalSnapshotBeforeUpdate=n}catch(It){ba(u,u.return,It)}}break;case 3:if((n&1024)!==0){if(n=l.stateNode.containerInfo,u=n.nodeType,u===9)Vm(n);else if(u===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Vm(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=l.sibling,n!==null){n.return=l.return,xr=n;break}xr=l.return}}function wy(n,l,u){var m=u.flags;switch(u.tag){case 0:case 11:case 15:li(n,u),m&4&&bd(5,u);break;case 1:if(li(n,u),m&4)if(n=u.stateNode,l===null)try{n.componentDidMount()}catch(R){ba(u,u.return,R)}else{var v=Wl(u.type,l.memoizedProps);l=l.memoizedState;try{n.componentDidUpdate(v,l,n.__reactInternalSnapshotBeforeUpdate)}catch(R){ba(u,u.return,R)}}m&64&&py(u),m&512&&vd(u,u.return);break;case 3:if(li(n,u),m&64&&(n=u.updateQueue,n!==null)){if(l=null,u.child!==null)switch(u.child.tag){case 27:case 5:l=u.child.stateNode;break;case 1:l=u.child.stateNode}try{ix(n,l)}catch(R){ba(u,u.return,R)}}break;case 27:l===null&&m&4&&vy(u);case 26:case 5:li(n,u),l===null&&m&4&&yy(u),m&512&&vd(u,u.return);break;case 12:li(n,u);break;case 31:li(n,u),m&4&&jy(n,u);break;case 13:li(n,u),m&4&&Sy(n,u),m&64&&(n=u.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(u=Bk.bind(null,u),i4(n,u))));break;case 22:if(m=u.memoizedState!==null||si,!m){l=l!==null&&l.memoizedState!==null||lr,v=si;var w=lr;si=m,(lr=l)&&!w?oi(n,u,(u.subtreeFlags&8772)!==0):li(n,u),si=v,lr=w}break;case 30:break;default:li(n,u)}}function ky(n){var l=n.alternate;l!==null&&(n.alternate=null,ky(l)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(l=n.stateNode,l!==null&&tt(l)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Ha=null,ln=!1;function ii(n,l,u){for(u=u.child;u!==null;)Ny(n,l,u),u=u.sibling}function Ny(n,l,u){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(Fe,u)}catch(w){}switch(u.tag){case 26:lr||Fs(u,l),ii(n,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:lr||Fs(u,l);var m=Ha,v=ln;Ki(u.type)&&(Ha=u.stateNode,ln=!1),ii(n,l,u),Cd(u.stateNode),Ha=m,ln=v;break;case 5:lr||Fs(u,l);case 6:if(m=Ha,v=ln,Ha=null,ii(n,l,u),Ha=m,ln=v,Ha!==null)if(ln)try{(Ha.nodeType===9?Ha.body:Ha.nodeName==="HTML"?Ha.ownerDocument.body:Ha).removeChild(u.stateNode)}catch(w){ba(u,l,w)}else try{Ha.removeChild(u.stateNode)}catch(w){ba(u,l,w)}break;case 18:Ha!==null&&(ln?(n=Ha,pb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,u.stateNode),ac(n)):pb(Ha,u.stateNode));break;case 4:m=Ha,v=ln,Ha=u.stateNode.containerInfo,ln=!0,ii(n,l,u),Ha=m,ln=v;break;case 0:case 11:case 14:case 15:Vi(2,u,l),lr||Vi(4,u,l),ii(n,l,u);break;case 1:lr||(Fs(u,l),m=u.stateNode,typeof m.componentWillUnmount=="function"&&xy(u,l,m)),ii(n,l,u);break;case 21:ii(n,l,u);break;case 22:lr=(m=lr)||u.memoizedState!==null,ii(n,l,u),lr=m;break;default:ii(n,l,u)}}function jy(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{ac(n)}catch(u){ba(l,l.return,u)}}}function Sy(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{ac(n)}catch(u){ba(l,l.return,u)}}function Mk(n){switch(n.tag){case 31:case 13:case 19:var l=n.stateNode;return l===null&&(l=n.stateNode=new _y),l;case 22:return n=n.stateNode,l=n._retryCache,l===null&&(l=n._retryCache=new _y),l;default:throw Error(s(435,n.tag))}}function bu(n,l){var u=Mk(n);l.forEach(function(m){if(!u.has(m)){u.add(m);var v=Uk.bind(null,n,m);m.then(v,v)}})}function on(n,l){var u=l.deletions;if(u!==null)for(var m=0;m<u.length;m++){var v=u[m],w=n,R=l,q=R;e:for(;q!==null;){switch(q.tag){case 27:if(Ki(q.type)){Ha=q.stateNode,ln=!1;break e}break;case 5:Ha=q.stateNode,ln=!1;break e;case 3:case 4:Ha=q.stateNode.containerInfo,ln=!0;break e}q=q.return}if(Ha===null)throw Error(s(160));Ny(w,R,v),Ha=null,ln=!1,w=v.alternate,w!==null&&(w.return=null),v.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)Ty(l,n),l=l.sibling}var ms=null;function Ty(n,l){var u=n.alternate,m=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:on(l,n),cn(n),m&4&&(Vi(3,n,n.return),bd(3,n),Vi(5,n,n.return));break;case 1:on(l,n),cn(n),m&512&&(lr||u===null||Fs(u,u.return)),m&64&&si&&(n=n.updateQueue,n!==null&&(m=n.callbacks,m!==null&&(u=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=u===null?m:u.concat(m))));break;case 26:var v=ms;if(on(l,n),cn(n),m&512&&(lr||u===null||Fs(u,u.return)),m&4){var w=u!==null?u.memoizedState:null;if(m=n.memoizedState,u===null)if(m===null)if(n.stateNode===null){e:{m=n.type,u=n.memoizedProps,v=v.ownerDocument||v;t:switch(m){case"title":w=v.getElementsByTagName("title")[0],(!w||w[Ce]||w[Q]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=v.createElement(m),v.head.insertBefore(w,v.querySelector("head > title"))),Ar(w,m,u),w[Q]=n,_t(w),m=w;break e;case"link":var R=Tb("link","href",v).get(m+(u.href||""));if(R){for(var q=0;q<R.length;q++)if(w=R[q],w.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&w.getAttribute("rel")===(u.rel==null?null:u.rel)&&w.getAttribute("title")===(u.title==null?null:u.title)&&w.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){R.splice(q,1);break t}}w=v.createElement(m),Ar(w,m,u),v.head.appendChild(w);break;case"meta":if(R=Tb("meta","content",v).get(m+(u.content||""))){for(q=0;q<R.length;q++)if(w=R[q],w.getAttribute("content")===(u.content==null?null:""+u.content)&&w.getAttribute("name")===(u.name==null?null:u.name)&&w.getAttribute("property")===(u.property==null?null:u.property)&&w.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&w.getAttribute("charset")===(u.charSet==null?null:u.charSet)){R.splice(q,1);break t}}w=v.createElement(m),Ar(w,m,u),v.head.appendChild(w);break;default:throw Error(s(468,m))}w[Q]=n,_t(w),m=w}n.stateNode=m}else Eb(v,n.type,n.stateNode);else n.stateNode=Sb(v,m,n.memoizedProps);else w!==m?(w===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):w.count--,m===null?Eb(v,n.type,n.stateNode):Sb(v,m,n.memoizedProps)):m===null&&n.stateNode!==null&&xm(n,n.memoizedProps,u.memoizedProps)}break;case 27:on(l,n),cn(n),m&512&&(lr||u===null||Fs(u,u.return)),u!==null&&m&4&&xm(n,n.memoizedProps,u.memoizedProps);break;case 5:if(on(l,n),cn(n),m&512&&(lr||u===null||Fs(u,u.return)),n.flags&32){v=n.stateNode;try{Un(v,"")}catch(Tt){ba(n,n.return,Tt)}}m&4&&n.stateNode!=null&&(v=n.memoizedProps,xm(n,v,u!==null?u.memoizedProps:v)),m&1024&&(vm=!0);break;case 6:if(on(l,n),cn(n),m&4){if(n.stateNode===null)throw Error(s(162));m=n.memoizedProps,u=n.stateNode;try{u.nodeValue=m}catch(Tt){ba(n,n.return,Tt)}}break;case 3:if(Pu=null,v=ms,ms=Lu(l.containerInfo),on(l,n),ms=v,cn(n),m&4&&u!==null&&u.memoizedState.isDehydrated)try{ac(l.containerInfo)}catch(Tt){ba(n,n.return,Tt)}vm&&(vm=!1,Ey(n));break;case 4:m=ms,ms=Lu(n.stateNode.containerInfo),on(l,n),cn(n),ms=m;break;case 12:on(l,n),cn(n);break;case 31:on(l,n),cn(n),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,bu(n,m)));break;case 13:on(l,n),cn(n),n.child.flags&8192&&n.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(_u=ze()),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,bu(n,m)));break;case 22:v=n.memoizedState!==null;var pe=u!==null&&u.memoizedState!==null,Le=si,Ye=lr;if(si=Le||v,lr=Ye||pe,on(l,n),lr=Ye,si=Le,cn(n),m&8192)e:for(l=n.stateNode,l._visibility=v?l._visibility&-2:l._visibility|1,v&&(u===null||pe||si||lr||Vl(n)),u=null,l=n;;){if(l.tag===5||l.tag===26){if(u===null){pe=u=l;try{if(w=pe.stateNode,v)R=w.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{q=pe.stateNode;var Qe=pe.memoizedProps.style,Re=Qe!=null&&Qe.hasOwnProperty("display")?Qe.display:null;q.style.display=Re==null||typeof Re=="boolean"?"":(""+Re).trim()}}catch(Tt){ba(pe,pe.return,Tt)}}}else if(l.tag===6){if(u===null){pe=l;try{pe.stateNode.nodeValue=v?"":pe.memoizedProps}catch(Tt){ba(pe,pe.return,Tt)}}}else if(l.tag===18){if(u===null){pe=l;try{var He=pe.stateNode;v?xb(He,!0):xb(pe.stateNode,!1)}catch(Tt){ba(pe,pe.return,Tt)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===n)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break e;for(;l.sibling===null;){if(l.return===null||l.return===n)break e;u===l&&(u=null),l=l.return}u===l&&(u=null),l.sibling.return=l.return,l=l.sibling}m&4&&(m=n.updateQueue,m!==null&&(u=m.retryQueue,u!==null&&(m.retryQueue=null,bu(n,u))));break;case 19:on(l,n),cn(n),m&4&&(m=n.updateQueue,m!==null&&(n.updateQueue=null,bu(n,m)));break;case 30:break;case 21:break;default:on(l,n),cn(n)}}function cn(n){var l=n.flags;if(l&2){try{for(var u,m=n.return;m!==null;){if(by(m)){u=m;break}m=m.return}if(u==null)throw Error(s(160));switch(u.tag){case 27:var v=u.stateNode,w=ym(n);yu(n,w,v);break;case 5:var R=u.stateNode;u.flags&32&&(Un(R,""),u.flags&=-33);var q=ym(n);yu(n,q,R);break;case 3:case 4:var pe=u.stateNode.containerInfo,Le=ym(n);bm(n,Le,pe);break;default:throw Error(s(161))}}catch(Ye){ba(n,n.return,Ye)}n.flags&=-3}l&4096&&(n.flags&=-4097)}function Ey(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var l=n;Ey(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),n=n.sibling}}function li(n,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)wy(n,l.alternate,l),l=l.sibling}function Vl(n){for(n=n.child;n!==null;){var l=n;switch(l.tag){case 0:case 11:case 14:case 15:Vi(4,l,l.return),Vl(l);break;case 1:Fs(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&xy(l,l.return,u),Vl(l);break;case 27:Cd(l.stateNode);case 26:case 5:Fs(l,l.return),Vl(l);break;case 22:l.memoizedState===null&&Vl(l);break;case 30:Vl(l);break;default:Vl(l)}n=n.sibling}}function oi(n,l,u){for(u=u&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var m=l.alternate,v=n,w=l,R=w.flags;switch(w.tag){case 0:case 11:case 15:oi(v,w,u),bd(4,w);break;case 1:if(oi(v,w,u),m=w,v=m.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(Le){ba(m,m.return,Le)}if(m=w,v=m.updateQueue,v!==null){var q=m.stateNode;try{var pe=v.shared.hiddenCallbacks;if(pe!==null)for(v.shared.hiddenCallbacks=null,v=0;v<pe.length;v++)sx(pe[v],q)}catch(Le){ba(m,m.return,Le)}}u&&R&64&&py(w),vd(w,w.return);break;case 27:vy(w);case 26:case 5:oi(v,w,u),u&&m===null&&R&4&&yy(w),vd(w,w.return);break;case 12:oi(v,w,u);break;case 31:oi(v,w,u),u&&R&4&&jy(v,w);break;case 13:oi(v,w,u),u&&R&4&&Sy(v,w);break;case 22:w.memoizedState===null&&oi(v,w,u),vd(w,w.return);break;case 30:break;default:oi(v,w,u)}l=l.sibling}}function _m(n,l){var u=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),n=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(n=l.memoizedState.cachePool.pool),n!==u&&(n!=null&&n.refCount++,u!=null&&id(u))}function wm(n,l){n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&id(n))}function gs(n,l,u,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Cy(n,l,u,m),l=l.sibling}function Cy(n,l,u,m){var v=l.flags;switch(l.tag){case 0:case 11:case 15:gs(n,l,u,m),v&2048&&bd(9,l);break;case 1:gs(n,l,u,m);break;case 3:gs(n,l,u,m),v&2048&&(n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&id(n)));break;case 12:if(v&2048){gs(n,l,u,m),n=l.stateNode;try{var w=l.memoizedProps,R=w.id,q=w.onPostCommit;typeof q=="function"&&q(R,l.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(pe){ba(l,l.return,pe)}}else gs(n,l,u,m);break;case 31:gs(n,l,u,m);break;case 13:gs(n,l,u,m);break;case 23:break;case 22:w=l.stateNode,R=l.alternate,l.memoizedState!==null?w._visibility&2?gs(n,l,u,m):_d(n,l):w._visibility&2?gs(n,l,u,m):(w._visibility|=2,Vo(n,l,u,m,(l.subtreeFlags&10256)!==0||!1)),v&2048&&_m(R,l);break;case 24:gs(n,l,u,m),v&2048&&wm(l.alternate,l);break;default:gs(n,l,u,m)}}function Vo(n,l,u,m,v){for(v=v&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var w=n,R=l,q=u,pe=m,Le=R.flags;switch(R.tag){case 0:case 11:case 15:Vo(w,R,q,pe,v),bd(8,R);break;case 23:break;case 22:var Ye=R.stateNode;R.memoizedState!==null?Ye._visibility&2?Vo(w,R,q,pe,v):_d(w,R):(Ye._visibility|=2,Vo(w,R,q,pe,v)),v&&Le&2048&&_m(R.alternate,R);break;case 24:Vo(w,R,q,pe,v),v&&Le&2048&&wm(R.alternate,R);break;default:Vo(w,R,q,pe,v)}l=l.sibling}}function _d(n,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var u=n,m=l,v=m.flags;switch(m.tag){case 22:_d(u,m),v&2048&&_m(m.alternate,m);break;case 24:_d(u,m),v&2048&&wm(m.alternate,m);break;default:_d(u,m)}l=l.sibling}}var wd=8192;function Go(n,l,u){if(n.subtreeFlags&wd)for(n=n.child;n!==null;)Ay(n,l,u),n=n.sibling}function Ay(n,l,u){switch(n.tag){case 26:Go(n,l,u),n.flags&wd&&n.memoizedState!==null&&y4(u,ms,n.memoizedState,n.memoizedProps);break;case 5:Go(n,l,u);break;case 3:case 4:var m=ms;ms=Lu(n.stateNode.containerInfo),Go(n,l,u),ms=m;break;case 22:n.memoizedState===null&&(m=n.alternate,m!==null&&m.memoizedState!==null?(m=wd,wd=16777216,Go(n,l,u),wd=m):Go(n,l,u));break;default:Go(n,l,u)}}function Oy(n){var l=n.alternate;if(l!==null&&(n=l.child,n!==null)){l.child=null;do l=n.sibling,n.sibling=null,n=l;while(n!==null)}}function kd(n){var l=n.deletions;if((n.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var m=l[u];xr=m,Ly(m,n)}Oy(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)My(n),n=n.sibling}function My(n){switch(n.tag){case 0:case 11:case 15:kd(n),n.flags&2048&&Vi(9,n,n.return);break;case 3:kd(n);break;case 12:kd(n);break;case 22:var l=n.stateNode;n.memoizedState!==null&&l._visibility&2&&(n.return===null||n.return.tag!==13)?(l._visibility&=-3,vu(n)):kd(n);break;default:kd(n)}}function vu(n){var l=n.deletions;if((n.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var m=l[u];xr=m,Ly(m,n)}Oy(n)}for(n=n.child;n!==null;){switch(l=n,l.tag){case 0:case 11:case 15:Vi(8,l,l.return),vu(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,vu(l));break;default:vu(l)}n=n.sibling}}function Ly(n,l){for(;xr!==null;){var u=xr;switch(u.tag){case 0:case 11:case 15:Vi(8,u,l);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var m=u.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:id(u.memoizedState.cache)}if(m=u.child,m!==null)m.return=u,xr=m;else e:for(u=n;xr!==null;){m=xr;var v=m.sibling,w=m.return;if(ky(m),m===u){xr=null;break e}if(v!==null){v.return=w,xr=v;break e}xr=w}}}var Lk={getCacheForType:function(n){var l=Er(nr),u=l.data.get(n);return u===void 0&&(u=n(),l.data.set(n,u)),u},cacheSignal:function(){return Er(nr).controller.signal}},Dk=typeof WeakMap=="function"?WeakMap:Map,ma=0,Da=null,ea=null,na=0,ya=0,En=null,Gi=!1,Zo=!1,km=!1,ci=0,Ya=0,Zi=0,Gl=0,Nm=0,Cn=0,qo=0,Nd=null,dn=null,jm=!1,_u=0,Dy=0,wu=1/0,ku=null,qi=null,hr=0,Yi=null,Yo=null,di=0,Sm=0,Tm=null,Py=null,jd=0,Em=null;function An(){return(ma&2)!==0&&na!==0?na&-na:ae.T!==null?Dm():U()}function Ry(){if(Cn===0)if((na&536870912)===0||Qt){var n=ye;ye<<=1,(ye&3932160)===0&&(ye=262144),Cn=n}else Cn=536870912;return n=Sn.current,n!==null&&(n.flags|=32),Cn}function un(n,l,u){(n===Da&&(ya===2||ya===9)||n.cancelPendingCommit!==null)&&(Xo(n,0),Xi(n,na,Cn,!1)),Vr(n,u),((ma&2)===0||n!==Da)&&(n===Da&&((ma&2)===0&&(Gl|=u),Ya===4&&Xi(n,na,Cn,!1)),Is(n))}function Fy(n,l,u){if((ma&6)!==0)throw Error(s(327));var m=!u&&(l&127)===0&&(l&n.expiredLanes)===0||aa(n,l),v=m?Fk(n,l):Am(n,l,!0),w=m;do{if(v===0){Zo&&!m&&Xi(n,l,0,!1);break}else{if(u=n.current.alternate,w&&!Pk(u)){v=Am(n,l,!1),w=!1;continue}if(v===2){if(w=l,n.errorRecoveryDisabledLanes&w)var R=0;else R=n.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){l=R;e:{var q=n;v=Nd;var pe=q.current.memoizedState.isDehydrated;if(pe&&(Xo(q,R).flags|=256),R=Am(q,R,!1),R!==2){if(km&&!pe){q.errorRecoveryDisabledLanes|=w,Gl|=w,v=4;break e}w=dn,dn=v,w!==null&&(dn===null?dn=w:dn.push.apply(dn,w))}v=R}if(w=!1,v!==2)continue}}if(v===1){Xo(n,0),Xi(n,l,0,!0);break}e:{switch(m=n,w=v,w){case 0:case 1:throw Error(s(345));case 4:if((l&4194048)!==l)break;case 6:Xi(m,l,Cn,!Gi);break e;case 2:dn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((l&62914560)===l&&(v=_u+300-ze(),10<v)){if(Xi(m,l,Cn,!Gi),Vt(m,0,!0)!==0)break e;di=l,m.timeoutHandle=mb(Iy.bind(null,m,u,dn,ku,jm,l,Cn,Gl,qo,Gi,w,"Throttled",-0,0),v);break e}Iy(m,u,dn,ku,jm,l,Cn,Gl,qo,Gi,w,null,-0,0)}}break}while(!0);Is(n)}function Iy(n,l,u,m,v,w,R,q,pe,Le,Ye,Qe,Re,He){if(n.timeoutHandle=-1,Qe=l.subtreeFlags,Qe&8192||(Qe&16785408)===16785408){Qe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:tn},Ay(l,w,Qe);var Tt=(w&62914560)===w?_u-ze():(w&4194048)===w?Dy-ze():0;if(Tt=b4(Qe,Tt),Tt!==null){di=w,n.cancelPendingCommit=Tt(Gy.bind(null,n,l,w,u,m,v,R,q,pe,Ye,Qe,null,Re,He)),Xi(n,w,R,!Le);return}}Gy(n,l,w,u,m,v,R,q,pe)}function Pk(n){for(var l=n;;){var u=l.tag;if((u===0||u===11||u===15)&&l.flags&16384&&(u=l.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var m=0;m<u.length;m++){var v=u[m],w=v.getSnapshot;v=v.value;try{if(!gr(w(),v))return!1}catch(R){return!1}}if(u=l.child,l.subtreeFlags&16384&&u!==null)u.return=l,l=u;else{if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Xi(n,l,u,m){l&=~Nm,l&=~Gl,n.suspendedLanes|=l,n.pingedLanes&=~l,m&&(n.warmLanes|=l),m=n.expirationTimes;for(var v=l;0<v;){var w=31-wt(v),R=1<<w;m[w]=-1,v&=~R}u!==0&&bn(n,u,l)}function Nu(){return(ma&6)===0?(Sd(0),!1):!0}function Cm(){if(ea!==null){if(ya===0)var n=ea.return;else n=ea,hs=Rs=null,Vh(n),Bo=null,od=0,n=ea;for(;n!==null;)gy(n.alternate,n),n=n.return;ea=null}}function Xo(n,l){var u=n.timeoutHandle;u!==-1&&(n.timeoutHandle=-1,t4(u)),u=n.cancelPendingCommit,u!==null&&(n.cancelPendingCommit=null,u()),di=0,Cm(),Da=n,ea=u=qn(n.current,null),na=l,ya=0,En=null,Gi=!1,Zo=aa(n,l),km=!1,qo=Cn=Nm=Gl=Zi=Ya=0,dn=Nd=null,jm=!1,(l&8)!==0&&(l|=l&32);var m=n.entangledLanes;if(m!==0)for(n=n.entanglements,m&=l;0<m;){var v=31-wt(m),w=1<<v;l|=n[v],m&=~w}return ci=l,Ll(),u}function zy(n,l){qt=null,ae.H=pd,l===zo||l===Q0?(l=tx(),ya=3):l===Lh?(l=tx(),ya=4):ya=l===lm?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,En=l,ea===null&&(Ya=1,hu(n,h(l,n.current)))}function By(){var n=Sn.current;return n===null?!0:(na&4194048)===na?Yn===null:(na&62914560)===na||(na&536870912)!==0?n===Yn:!1}function Uy(){var n=ae.H;return ae.H=pd,n===null?pd:n}function Hy(){var n=ae.A;return ae.A=Lk,n}function ju(){Ya=4,Gi||(na&4194048)!==na&&Sn.current!==null||(Zo=!0),(Zi&134217727)===0&&(Gl&134217727)===0||Da===null||Xi(Da,na,Cn,!1)}function Am(n,l,u){var m=ma;ma|=2;var v=Uy(),w=Hy();(Da!==n||na!==l)&&(ku=null,Xo(n,l)),l=!1;var R=Ya;e:do try{if(ya!==0&&ea!==null){var q=ea,pe=En;switch(ya){case 8:Cm(),R=6;break e;case 3:case 2:case 9:case 6:Sn.current===null&&(l=!0);var Le=ya;if(ya=0,En=null,Jo(n,q,pe,Le),u&&Zo){R=0;break e}break;default:Le=ya,ya=0,En=null,Jo(n,q,pe,Le)}}Rk(),R=Ya;break}catch(Ye){zy(n,Ye)}while(!0);return l&&n.shellSuspendCounter++,hs=Rs=null,ma=m,ae.H=v,ae.A=w,ea===null&&(Da=null,na=0,Ll()),R}function Rk(){for(;ea!==null;)$y(ea)}function Fk(n,l){var u=ma;ma|=2;var m=Uy(),v=Hy();Da!==n||na!==l?(ku=null,wu=ze()+500,Xo(n,l)):Zo=aa(n,l);e:do try{if(ya!==0&&ea!==null){l=ea;var w=En;t:switch(ya){case 1:ya=0,En=null,Jo(n,l,w,1);break;case 2:case 9:if(Qp(w)){ya=0,En=null,Wy(l);break}l=function(){ya!==2&&ya!==9||Da!==n||(ya=7),Is(n)},w.then(l,l);break e;case 3:ya=7;break e;case 4:ya=5;break e;case 7:Qp(w)?(ya=0,En=null,Wy(l)):(ya=0,En=null,Jo(n,l,w,7));break;case 5:var R=null;switch(ea.tag){case 26:R=ea.memoizedState;case 5:case 27:var q=ea;if(R?Cb(R):q.stateNode.complete){ya=0,En=null;var pe=q.sibling;if(pe!==null)ea=pe;else{var Le=q.return;Le!==null?(ea=Le,Su(Le)):ea=null}break t}}ya=0,En=null,Jo(n,l,w,5);break;case 6:ya=0,En=null,Jo(n,l,w,6);break;case 8:Cm(),Ya=6;break e;default:throw Error(s(462))}}Ik();break}catch(Ye){zy(n,Ye)}while(!0);return hs=Rs=null,ae.H=m,ae.A=v,ma=u,ea!==null?0:(Da=null,na=0,Ll(),Ya)}function Ik(){for(;ea!==null&&!ft();)$y(ea)}function $y(n){var l=hy(n.alternate,n,ci);n.memoizedProps=n.pendingProps,l===null?Su(n):ea=l}function Wy(n){var l=n,u=l.alternate;switch(l.tag){case 15:case 0:l=ly(u,l,l.pendingProps,l.type,void 0,na);break;case 11:l=ly(u,l,l.pendingProps,l.type.render,l.ref,na);break;case 5:Vh(l);default:gy(u,l),l=ea=td(l,ci),l=hy(u,l,ci)}n.memoizedProps=n.pendingProps,l===null?Su(n):ea=l}function Jo(n,l,u,m){hs=Rs=null,Vh(l),Bo=null,od=0;var v=l.return;try{if(Sk(n,v,l,u,na)){Ya=1,hu(n,h(u,n.current)),ea=null;return}}catch(w){if(v!==null)throw ea=v,w;Ya=1,hu(n,h(u,n.current)),ea=null;return}l.flags&32768?(Qt||m===1?n=!0:Zo||(na&536870912)!==0?n=!1:(Gi=n=!0,(m===2||m===9||m===3||m===6)&&(m=Sn.current,m!==null&&m.tag===13&&(m.flags|=16384))),Vy(l,n)):Su(l)}function Su(n){var l=n;do{if((l.flags&32768)!==0){Vy(l,Gi);return}n=l.return;var u=Ck(l.alternate,l,ci);if(u!==null){ea=u;return}if(l=l.sibling,l!==null){ea=l;return}ea=l=n}while(l!==null);Ya===0&&(Ya=5)}function Vy(n,l){do{var u=Ak(n.alternate,n);if(u!==null){u.flags&=32767,ea=u;return}if(u=n.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(n=n.sibling,n!==null)){ea=n;return}ea=n=u}while(n!==null);Ya=6,ea=null}function Gy(n,l,u,m,v,w,R,q,pe){n.cancelPendingCommit=null;do Tu();while(hr!==0);if((ma&6)!==0)throw Error(s(327));if(l!==null){if(l===n.current)throw Error(s(177));if(w=l.lanes|l.childLanes,w|=Mo,ns(n,u,w,R,q,pe),n===Da&&(ea=Da=null,na=0),Yo=l,Yi=n,di=u,Sm=w,Tm=v,Py=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,Hk(Pt,function(){return Jy(),null})):(n.callbackNode=null,n.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=ae.T,ae.T=null,v=Z.p,Z.p=2,R=ma,ma|=4;try{Ok(n,l,u)}finally{ma=R,Z.p=v,ae.T=m}}hr=1,Zy(),qy(),Yy()}}function Zy(){if(hr===1){hr=0;var n=Yi,l=Yo,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=ae.T,ae.T=null;var m=Z.p;Z.p=2;var v=ma;ma|=4;try{Ty(l,n);var w=Hm,R=El(n.containerInfo),q=w.focusedElem,pe=w.selectionRange;if(R!==q&&q&&q.ownerDocument&&Eo(q.ownerDocument.documentElement,q)){if(pe!==null&&Cs(q)){var Le=pe.start,Ye=pe.end;if(Ye===void 0&&(Ye=Le),"selectionStart"in q)q.selectionStart=Le,q.selectionEnd=Math.min(Ye,q.value.length);else{var Qe=q.ownerDocument||document,Re=Qe&&Qe.defaultView||window;if(Re.getSelection){var He=Re.getSelection(),Tt=q.textContent.length,It=Math.min(pe.start,Tt),Aa=pe.end===void 0?It:Math.min(pe.end,Tt);!He.extend&&It>Aa&&(R=Aa,Aa=It,It=R);var Se=Tl(q,It),_e=Tl(q,Aa);if(Se&&_e&&(He.rangeCount!==1||He.anchorNode!==Se.node||He.anchorOffset!==Se.offset||He.focusNode!==_e.node||He.focusOffset!==_e.offset)){var Oe=Qe.createRange();Oe.setStart(Se.node,Se.offset),He.removeAllRanges(),It>Aa?(He.addRange(Oe),He.extend(_e.node,_e.offset)):(Oe.setEnd(_e.node,_e.offset),He.addRange(Oe))}}}}for(Qe=[],He=q;He=He.parentNode;)He.nodeType===1&&Qe.push({element:He,left:He.scrollLeft,top:He.scrollTop});for(typeof q.focus=="function"&&q.focus(),q=0;q<Qe.length;q++){var Xe=Qe[q];Xe.element.scrollLeft=Xe.left,Xe.element.scrollTop=Xe.top}}zu=!!Um,Hm=Um=null}finally{ma=v,Z.p=m,ae.T=u}}n.current=l,hr=2}}function qy(){if(hr===2){hr=0;var n=Yi,l=Yo,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=ae.T,ae.T=null;var m=Z.p;Z.p=2;var v=ma;ma|=4;try{wy(n,l.alternate,l)}finally{ma=v,Z.p=m,ae.T=u}}hr=3}}function Yy(){if(hr===4||hr===3){hr=0,Ze();var n=Yi,l=Yo,u=di,m=Py;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?hr=5:(hr=0,Yo=Yi=null,Xy(n,n.pendingLanes));var v=n.pendingLanes;if(v===0&&(qi=null),ve(u),l=l.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(Fe,l,void 0,(l.current.flags&128)===128)}catch(pe){}if(m!==null){l=ae.T,v=Z.p,Z.p=2,ae.T=null;try{for(var w=n.onRecoverableError,R=0;R<m.length;R++){var q=m[R];w(q.value,{componentStack:q.stack})}}finally{ae.T=l,Z.p=v}}(di&3)!==0&&Tu(),Is(n),v=n.pendingLanes,(u&261930)!==0&&(v&42)!==0?n===Em?jd++:(jd=0,Em=n):jd=0,Sd(0)}}function Xy(n,l){(n.pooledCacheLanes&=l)===0&&(l=n.pooledCache,l!=null&&(n.pooledCache=null,id(l)))}function Tu(){return Zy(),qy(),Yy(),Jy()}function Jy(){if(hr!==5)return!1;var n=Yi,l=Sm;Sm=0;var u=ve(di),m=ae.T,v=Z.p;try{Z.p=32>u?32:u,ae.T=null,u=Tm,Tm=null;var w=Yi,R=di;if(hr=0,Yo=Yi=null,di=0,(ma&6)!==0)throw Error(s(331));var q=ma;if(ma|=4,My(w.current),Cy(w,w.current,R,u),ma=q,Sd(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(Fe,w)}catch(pe){}return!0}finally{Z.p=v,ae.T=m,Xy(n,l)}}function Ky(n,l,u){l=h(u,l),l=im(n.stateNode,l,2),n=Hi(n,l,2),n!==null&&(Vr(n,2),Is(n))}function ba(n,l,u){if(n.tag===3)Ky(n,n,u);else for(;l!==null;){if(l.tag===3){Ky(l,n,u);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(qi===null||!qi.has(m))){n=h(u,n),u=Qx(2),m=Hi(l,u,2),m!==null&&(ey(u,m,l,n),Vr(m,2),Is(m));break}}l=l.return}}function Om(n,l,u){var m=n.pingCache;if(m===null){m=n.pingCache=new Dk;var v=new Set;m.set(l,v)}else v=m.get(l),v===void 0&&(v=new Set,m.set(l,v));v.has(u)||(km=!0,v.add(u),n=zk.bind(null,n,l,u),l.then(n,n))}function zk(n,l,u){var m=n.pingCache;m!==null&&m.delete(l),n.pingedLanes|=n.suspendedLanes&u,n.warmLanes&=~u,Da===n&&(na&u)===u&&(Ya===4||Ya===3&&(na&62914560)===na&&300>ze()-_u?(ma&2)===0&&Xo(n,0):Nm|=u,qo===na&&(qo=0)),Is(n)}function Qy(n,l){l===0&&(l=Ma()),n=Zn(n,l),n!==null&&(Vr(n,l),Is(n))}function Bk(n){var l=n.memoizedState,u=0;l!==null&&(u=l.retryLane),Qy(n,u)}function Uk(n,l){var u=0;switch(n.tag){case 31:case 13:var m=n.stateNode,v=n.memoizedState;v!==null&&(u=v.retryLane);break;case 19:m=n.stateNode;break;case 22:m=n.stateNode._retryCache;break;default:throw Error(s(314))}m!==null&&m.delete(l),Qy(n,u)}function Hk(n,l){return Ie(n,l)}var Eu=null,Ko=null,Mm=!1,Cu=!1,Lm=!1,Ji=0;function Is(n){n!==Ko&&n.next===null&&(Ko===null?Eu=Ko=n:Ko=Ko.next=n),Cu=!0,Mm||(Mm=!0,Wk())}function Sd(n,l){if(!Lm&&Cu){Lm=!0;do for(var u=!1,m=Eu;m!==null;){if(n!==0){var v=m.pendingLanes;if(v===0)var w=0;else{var R=m.suspendedLanes,q=m.pingedLanes;w=(1<<31-wt(42|n)+1)-1,w&=v&~(R&~q),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(u=!0,rb(m,w))}else w=na,w=Vt(m,m===Da?w:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(w&3)===0||aa(m,w)||(u=!0,rb(m,w));m=m.next}while(u);Lm=!1}}function $k(){eb()}function eb(){Cu=Mm=!1;var n=0;Ji!==0&&e4()&&(n=Ji);for(var l=ze(),u=null,m=Eu;m!==null;){var v=m.next,w=tb(m,l);w===0?(m.next=null,u===null?Eu=v:u.next=v,v===null&&(Ko=u)):(u=m,(n!==0||(w&3)!==0)&&(Cu=!0)),m=v}hr!==0&&hr!==5||Sd(n),Ji!==0&&(Ji=0)}function tb(n,l){for(var u=n.suspendedLanes,m=n.pingedLanes,v=n.expirationTimes,w=n.pendingLanes&-62914561;0<w;){var R=31-wt(w),q=1<<R,pe=v[R];pe===-1?((q&u)===0||(q&m)!==0)&&(v[R]=Va(q,l)):pe<=l&&(n.expiredLanes|=q),w&=~q}if(l=Da,u=na,u=Vt(n,n===l?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),m=n.callbackNode,u===0||n===l&&(ya===2||ya===9)||n.cancelPendingCommit!==null)return m!==null&&m!==null&<(m),n.callbackNode=null,n.callbackPriority=0;if((u&3)===0||aa(n,u)){if(l=u&-u,l===n.callbackPriority)return l;switch(m!==null&<(m),ve(u)){case 2:case 8:u=Ot;break;case 32:u=Pt;break;case 268435456:u=ut;break;default:u=Pt}return m=ab.bind(null,n),u=Ie(u,m),n.callbackPriority=l,n.callbackNode=u,l}return m!==null&&m!==null&<(m),n.callbackPriority=2,n.callbackNode=null,2}function ab(n,l){if(hr!==0&&hr!==5)return n.callbackNode=null,n.callbackPriority=0,null;var u=n.callbackNode;if(Tu()&&n.callbackNode!==u)return null;var m=na;return m=Vt(n,n===Da?m:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),m===0?null:(Fy(n,m,l),tb(n,ze()),n.callbackNode!=null&&n.callbackNode===u?ab.bind(null,n):null)}function rb(n,l){if(Tu())return null;Fy(n,l,!0)}function Wk(){a4(function(){(ma&6)!==0?Ie(Nt,$k):eb()})}function Dm(){if(Ji===0){var n=Fo;n===0&&(n=Lt,Lt<<=1,(Lt&261888)===0&&(Lt=256)),Ji=n}return Ji}function nb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Si(""+n)}function sb(n,l){var u=l.ownerDocument.createElement("input");return u.name=l.name,u.value=l.value,n.id&&u.setAttribute("form",n.id),l.parentNode.insertBefore(u,l),n=new FormData(n),u.parentNode.removeChild(u),n}function Vk(n,l,u,m,v){if(l==="submit"&&u&&u.stateNode===v){var w=nb((v[re]||null).action),R=m.submitter;R&&(l=(l=R[re]||null)?nb(l.formAction):R.getAttribute("formAction"),l!==null&&(w=l,R=null));var q=new _o("action","action",null,m,v);n.push({event:q,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Ji!==0){var pe=R?sb(v,R):new FormData(v);em(u,{pending:!0,data:pe,method:v.method,action:w},null,pe)}}else typeof w=="function"&&(q.preventDefault(),pe=R?sb(v,R):new FormData(v),em(u,{pending:!0,data:pe,method:v.method,action:w},w,pe))},currentTarget:v}]})}}for(var Pm=0;Pm<Ms.length;Pm++){var Rm=Ms[Pm],Gk=Rm.toLowerCase(),Zk=Rm[0].toUpperCase()+Rm.slice(1);rn(Gk,"on"+Zk)}rn(Al,"onAnimationEnd"),rn(Z0,"onAnimationIteration"),rn(Ol,"onAnimationStart"),rn("dblclick","onDoubleClick"),rn("focusin","onFocus"),rn("focusout","onBlur"),rn(jh,"onTransitionRun"),rn(q0,"onTransitionStart"),rn(Sh,"onTransitionCancel"),rn(Fi,"onTransitionEnd"),Ir("onMouseEnter",["mouseout","mouseover"]),Ir("onMouseLeave",["mouseout","mouseover"]),Ir("onPointerEnter",["pointerout","pointerover"]),Ir("onPointerLeave",["pointerout","pointerover"]),Fa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Td="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),qk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Td));function ib(n,l){l=(l&4)!==0;for(var u=0;u<n.length;u++){var m=n[u],v=m.event;m=m.listeners;e:{var w=void 0;if(l)for(var R=m.length-1;0<=R;R--){var q=m[R],pe=q.instance,Le=q.currentTarget;if(q=q.listener,pe!==w&&v.isPropagationStopped())break e;w=q,v.currentTarget=Le;try{w(v)}catch(Ye){Ml(Ye)}v.currentTarget=null,w=pe}else for(R=0;R<m.length;R++){if(q=m[R],pe=q.instance,Le=q.currentTarget,q=q.listener,pe!==w&&v.isPropagationStopped())break e;w=q,v.currentTarget=Le;try{w(v)}catch(Ye){Ml(Ye)}v.currentTarget=null,w=pe}}}}function ta(n,l){var u=l[he];u===void 0&&(u=l[he]=new Set);var m=n+"__bubble";u.has(m)||(lb(l,n,2,!1),u.add(m))}function Fm(n,l,u){var m=0;l&&(m|=4),lb(u,n,m,l)}var Au="_reactListening"+Math.random().toString(36).slice(2);function Im(n){if(!n[Au]){n[Au]=!0,ja.forEach(function(u){u!=="selectionchange"&&(qk.has(u)||Fm(u,!1,n),Fm(u,!0,n))});var l=n.nodeType===9?n:n.ownerDocument;l===null||l[Au]||(l[Au]=!0,Fm("selectionchange",!1,l))}}function lb(n,l,u,m){switch(Rb(l)){case 2:var v=w4;break;case 8:v=k4;break;default:v=Qm}u=v.bind(null,l,u,n),v=void 0,!yl||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(v=!0),m?v!==void 0?n.addEventListener(l,u,{capture:!0,passive:v}):n.addEventListener(l,u,!0):v!==void 0?n.addEventListener(l,u,{passive:v}):n.addEventListener(l,u,!1)}function zm(n,l,u,m,v){var w=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var R=m.tag;if(R===3||R===4){var q=m.stateNode.containerInfo;if(q===v)break;if(R===4)for(R=m.return;R!==null;){var pe=R.tag;if((pe===3||pe===4)&&R.stateNode.containerInfo===v)return;R=R.return}for(;q!==null;){if(R=ct(q),R===null)return;if(pe=R.tag,pe===5||pe===6||pe===26||pe===27){m=w=R;continue e}q=q.parentNode}}m=m.return}Wc(function(){var Le=w,Ye=xl(u),Qe=[];e:{var Re=Y0.get(n);if(Re!==void 0){var He=_o,Tt=n;switch(n){case"keypress":if(bl(u)===0)break e;case"keydown":case"keyup":He=P0;break;case"focusin":Tt="focus",He=Zc;break;case"focusout":Tt="blur",He=Zc;break;case"beforeblur":case"afterblur":He=Zc;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":He=A0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":He=mh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":He=bh;break;case Al:case Z0:case Ol:He=qc;break;case Fi:He=I0;break;case"scroll":case"scrollend":He=ra;break;case"wheel":He=Xs;break;case"copy":case"cut":case"paste":He=$n;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":He=R0;break;case"toggle":case"beforetoggle":He=wl}var It=(l&4)!==0,Aa=!It&&(n==="scroll"||n==="scrollend"),Se=It?Re!==null?Re+"Capture":null:Re;It=[];for(var _e=Le,Oe;_e!==null;){var Xe=_e;if(Oe=Xe.stateNode,Xe=Xe.tag,Xe!==5&&Xe!==26&&Xe!==27||Oe===null||Se===null||(Xe=qs(_e,Se),Xe!=null&&It.push(Ed(_e,Xe,Oe))),Aa)break;_e=_e.return}0<It.length&&(Re=new He(Re,Tt,null,u,Ye),Qe.push({event:Re,listeners:It}))}}if((l&7)===0){e:{if(Re=n==="mouseover"||n==="pointerover",He=n==="mouseout"||n==="pointerout",Re&&u!==vo&&(Tt=u.relatedTarget||u.fromElement)&&(ct(Tt)||Tt[z]))break e;if((He||Re)&&(Re=Ye.window===Ye?Ye:(Re=Ye.ownerDocument)?Re.defaultView||Re.parentWindow:window,He?(Tt=u.relatedTarget||u.toElement,He=Le,Tt=Tt?ct(Tt):null,Tt!==null&&(Aa=d(Tt),It=Tt.tag,Tt!==Aa||It!==5&&It!==27&&It!==6)&&(Tt=null)):(He=null,Tt=Le),He!==Tt)){if(It=A0,Xe="onMouseLeave",Se="onMouseEnter",_e="mouse",(n==="pointerout"||n==="pointerover")&&(It=R0,Xe="onPointerLeave",Se="onPointerEnter",_e="pointer"),Aa=He==null?Re:it(He),Oe=Tt==null?Re:it(Tt),Re=new It(Xe,_e+"leave",He,u,Ye),Re.target=Aa,Re.relatedTarget=Oe,Xe=null,ct(Ye)===Le&&(It=new It(Se,_e+"enter",Tt,u,Ye),It.target=Oe,It.relatedTarget=Aa,Xe=It),Aa=Xe,He&&Tt)t:{for(It=Yk,Se=He,_e=Tt,Oe=0,Xe=Se;Xe;Xe=It(Xe))Oe++;Xe=0;for(var Rt=_e;Rt;Rt=It(Rt))Xe++;for(;0<Oe-Xe;)Se=It(Se),Oe--;for(;0<Xe-Oe;)_e=It(_e),Xe--;for(;Oe--;){if(Se===_e||_e!==null&&Se===_e.alternate){It=Se;break t}Se=It(Se),_e=It(_e)}It=null}else It=null;He!==null&&ob(Qe,Re,He,It,!1),Tt!==null&&Aa!==null&&ob(Qe,Aa,Tt,It,!0)}}e:{if(Re=Le?it(Le):window,He=Re.nodeName&&Re.nodeName.toLowerCase(),He==="select"||He==="input"&&Re.type==="file")var da=Sl;else if(Wn(Re))if(H0)da=Nh;else{da=kh;var Mt=ds}else He=Re.nodeName,!He||He.toLowerCase()!=="input"||Re.type!=="checkbox"&&Re.type!=="radio"?Le&&pl(Le.elementType)&&(da=Sl):da=Li;if(da&&(da=da(n,Le))){U0(Qe,da,u,Ye);break e}Mt&&Mt(n,Re,Le),n==="focusout"&&Le&&Re.type==="number"&&Le.memoizedProps.value!=null&&ls(Re,"number",Re.value)}switch(Mt=Le?it(Le):window,n){case"focusin":(Wn(Mt)||Mt.contentEditable==="true")&&(As=Mt,Ao=Le,Cl=null);break;case"focusout":Cl=Ao=As=null;break;case"mousedown":Pi=!0;break;case"contextmenu":case"mouseup":case"dragend":Pi=!1,V0(Qe,u,Ye);break;case"selectionchange":if(Co)break;case"keydown":case"keyup":V0(Qe,u,Ye)}var Jt;if(ko)e:{switch(n){case"compositionstart":var sa="onCompositionStart";break e;case"compositionend":sa="onCompositionEnd";break e;case"compositionupdate":sa="onCompositionUpdate";break e}sa=void 0}else Ai?B0(n,u)&&(sa="onCompositionEnd"):n==="keydown"&&u.keyCode===229&&(sa="onCompositionStart");sa&&(No&&u.locale!=="ko"&&(Ai||sa!=="onCompositionStart"?sa==="onCompositionEnd"&&Ai&&(Jt=Ts()):(Hn=Ye,Ys="value"in Hn?Hn.value:Hn.textContent,Ai=!0)),Mt=Ou(Le,sa),0<Mt.length&&(sa=new Yc(sa,n,null,u,Ye),Qe.push({event:sa,listeners:Mt}),Jt?sa.data=Jt:(Jt=Qc(u),Jt!==null&&(sa.data=Jt)))),(Jt=_h?jn(n,u):Oi(n,u))&&(sa=Ou(Le,"onBeforeInput"),0<sa.length&&(Mt=new Yc("onBeforeInput","beforeinput",null,u,Ye),Qe.push({event:Mt,listeners:sa}),Mt.data=Jt)),Vk(Qe,n,Le,u,Ye)}ib(Qe,l)})}function Ed(n,l,u){return{instance:n,listener:l,currentTarget:u}}function Ou(n,l){for(var u=l+"Capture",m=[];n!==null;){var v=n,w=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||w===null||(v=qs(n,u),v!=null&&m.unshift(Ed(n,v,w)),v=qs(n,l),v!=null&&m.push(Ed(n,v,w))),n.tag===3)return m;n=n.return}return[]}function Yk(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function ob(n,l,u,m,v){for(var w=l._reactName,R=[];u!==null&&u!==m;){var q=u,pe=q.alternate,Le=q.stateNode;if(q=q.tag,pe!==null&&pe===m)break;q!==5&&q!==26&&q!==27||Le===null||(pe=Le,v?(Le=qs(u,w),Le!=null&&R.unshift(Ed(u,Le,pe))):v||(Le=qs(u,w),Le!=null&&R.push(Ed(u,Le,pe)))),u=u.return}R.length!==0&&n.push({event:l,listeners:R})}var Xk=/\r\n?/g,Jk=/\u0000|\uFFFD/g;function cb(n){return(typeof n=="string"?n:""+n).replace(Xk,`
|
||
`).replace(Jk,"")}function db(n,l){return l=cb(l),cb(n)===l}function Ca(n,l,u,m,v,w){switch(u){case"children":typeof m=="string"?l==="body"||l==="textarea"&&m===""||Un(n,m):(typeof m=="number"||typeof m=="bigint")&&l!=="body"&&Un(n,""+m);break;case"className":Ta(n,"class",m);break;case"tabIndex":Ta(n,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Ta(n,u,m);break;case"style":yo(n,m,w);break;case"data":if(l!=="object"){Ta(n,"data",m);break}case"src":case"href":if(m===""&&(l!=="a"||u!=="href")){n.removeAttribute(u);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){n.removeAttribute(u);break}m=Si(""+m),n.setAttribute(u,m);break;case"action":case"formAction":if(typeof m=="function"){n.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof w=="function"&&(u==="formAction"?(l!=="input"&&Ca(n,l,"name",v.name,v,null),Ca(n,l,"formEncType",v.formEncType,v,null),Ca(n,l,"formMethod",v.formMethod,v,null),Ca(n,l,"formTarget",v.formTarget,v,null)):(Ca(n,l,"encType",v.encType,v,null),Ca(n,l,"method",v.method,v,null),Ca(n,l,"target",v.target,v,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){n.removeAttribute(u);break}m=Si(""+m),n.setAttribute(u,m);break;case"onClick":m!=null&&(n.onclick=tn);break;case"onScroll":m!=null&&ta("scroll",n);break;case"onScrollEnd":m!=null&&ta("scrollend",n);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(s(61));if(u=m.__html,u!=null){if(v.children!=null)throw Error(s(60));n.innerHTML=u}}break;case"multiple":n.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":n.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){n.removeAttribute("xlink:href");break}u=Si(""+m),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?n.setAttribute(u,""+m):n.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?n.setAttribute(u,""):n.removeAttribute(u);break;case"capture":case"download":m===!0?n.setAttribute(u,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?n.setAttribute(u,m):n.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?n.setAttribute(u,m):n.removeAttribute(u);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?n.removeAttribute(u):n.setAttribute(u,m);break;case"popover":ta("beforetoggle",n),ta("toggle",n),Ht(n,"popover",m);break;case"xlinkActuate":en(n,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":en(n,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":en(n,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":en(n,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":en(n,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":en(n,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":en(n,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":en(n,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":en(n,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Ht(n,"is",m);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=bo.get(u)||u,Ht(n,u,m))}}function Bm(n,l,u,m,v,w){switch(u){case"style":yo(n,m,w);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(s(61));if(u=m.__html,u!=null){if(v.children!=null)throw Error(s(60));n.innerHTML=u}}break;case"children":typeof m=="string"?Un(n,m):(typeof m=="number"||typeof m=="bigint")&&Un(n,""+m);break;case"onScroll":m!=null&&ta("scroll",n);break;case"onScrollEnd":m!=null&&ta("scrollend",n);break;case"onClick":m!=null&&(n.onclick=tn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sa.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(v=u.endsWith("Capture"),l=u.slice(2,v?u.length-7:void 0),w=n[re]||null,w=w!=null?w[u]:null,typeof w=="function"&&n.removeEventListener(l,w,v),typeof m=="function")){typeof w!="function"&&w!==null&&(u in n?n[u]=null:n.hasAttribute(u)&&n.removeAttribute(u)),n.addEventListener(l,m,v);break e}u in n?n[u]=m:m===!0?n.setAttribute(u,""):Ht(n,u,m)}}}function Ar(n,l,u){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ta("error",n),ta("load",n);var m=!1,v=!1,w;for(w in u)if(u.hasOwnProperty(w)){var R=u[w];if(R!=null)switch(w){case"src":m=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,l));default:Ca(n,l,w,R,u,null)}}v&&Ca(n,l,"srcSet",u.srcSet,u,null),m&&Ca(n,l,"src",u.src,u,null);return;case"input":ta("invalid",n);var q=w=R=v=null,pe=null,Le=null;for(m in u)if(u.hasOwnProperty(m)){var Ye=u[m];if(Ye!=null)switch(m){case"name":v=Ye;break;case"type":R=Ye;break;case"checked":pe=Ye;break;case"defaultChecked":Le=Ye;break;case"value":w=Ye;break;case"defaultValue":q=Ye;break;case"children":case"dangerouslySetInnerHTML":if(Ye!=null)throw Error(s(137,l));break;default:Ca(n,l,m,Ye,u,null)}}gl(n,w,q,pe,Le,R,v,!1);return;case"select":ta("invalid",n),m=R=w=null;for(v in u)if(u.hasOwnProperty(v)&&(q=u[v],q!=null))switch(v){case"value":w=q;break;case"defaultValue":R=q;break;case"multiple":m=q;default:Ca(n,l,v,q,u,null)}l=w,u=R,n.multiple=!!m,l!=null?La(n,!!m,l,!1):u!=null&&La(n,!!m,u,!0);return;case"textarea":ta("invalid",n),w=v=m=null;for(R in u)if(u.hasOwnProperty(R)&&(q=u[R],q!=null))switch(R){case"value":m=q;break;case"defaultValue":v=q;break;case"children":w=q;break;case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(91));break;default:Ca(n,l,R,q,u,null)}Ni(n,m,v,w);return;case"option":for(pe in u)if(u.hasOwnProperty(pe)&&(m=u[pe],m!=null))switch(pe){case"selected":n.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Ca(n,l,pe,m,u,null)}return;case"dialog":ta("beforetoggle",n),ta("toggle",n),ta("cancel",n),ta("close",n);break;case"iframe":case"object":ta("load",n);break;case"video":case"audio":for(m=0;m<Td.length;m++)ta(Td[m],n);break;case"image":ta("error",n),ta("load",n);break;case"details":ta("toggle",n);break;case"embed":case"source":case"link":ta("error",n),ta("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Le in u)if(u.hasOwnProperty(Le)&&(m=u[Le],m!=null))switch(Le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,l));default:Ca(n,l,Le,m,u,null)}return;default:if(pl(l)){for(Ye in u)u.hasOwnProperty(Ye)&&(m=u[Ye],m!==void 0&&Bm(n,l,Ye,m,u,void 0));return}}for(q in u)u.hasOwnProperty(q)&&(m=u[q],m!=null&&Ca(n,l,q,m,u,null))}function Kk(n,l,u,m){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,w=null,R=null,q=null,pe=null,Le=null,Ye=null;for(He in u){var Qe=u[He];if(u.hasOwnProperty(He)&&Qe!=null)switch(He){case"checked":break;case"value":break;case"defaultValue":pe=Qe;default:m.hasOwnProperty(He)||Ca(n,l,He,null,m,Qe)}}for(var Re in m){var He=m[Re];if(Qe=u[Re],m.hasOwnProperty(Re)&&(He!=null||Qe!=null))switch(Re){case"type":w=He;break;case"name":v=He;break;case"checked":Le=He;break;case"defaultChecked":Ye=He;break;case"value":R=He;break;case"defaultValue":q=He;break;case"children":case"dangerouslySetInnerHTML":if(He!=null)throw Error(s(137,l));break;default:He!==Qe&&Ca(n,l,Re,He,m,Qe)}}Uc(n,R,q,pe,Le,Ye,w,v);return;case"select":He=R=q=Re=null;for(w in u)if(pe=u[w],u.hasOwnProperty(w)&&pe!=null)switch(w){case"value":break;case"multiple":He=pe;default:m.hasOwnProperty(w)||Ca(n,l,w,null,m,pe)}for(v in m)if(w=m[v],pe=u[v],m.hasOwnProperty(v)&&(w!=null||pe!=null))switch(v){case"value":Re=w;break;case"defaultValue":q=w;break;case"multiple":R=w;default:w!==pe&&Ca(n,l,v,w,m,pe)}l=q,u=R,m=He,Re!=null?La(n,!!u,Re,!1):!!m!=!!u&&(l!=null?La(n,!!u,l,!0):La(n,!!u,u?[]:"",!1));return;case"textarea":He=Re=null;for(q in u)if(v=u[q],u.hasOwnProperty(q)&&v!=null&&!m.hasOwnProperty(q))switch(q){case"value":break;case"children":break;default:Ca(n,l,q,null,m,v)}for(R in m)if(v=m[R],w=u[R],m.hasOwnProperty(R)&&(v!=null||w!=null))switch(R){case"value":Re=v;break;case"defaultValue":He=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(s(91));break;default:v!==w&&Ca(n,l,R,v,m,w)}Ss(n,Re,He);return;case"option":for(var Tt in u)if(Re=u[Tt],u.hasOwnProperty(Tt)&&Re!=null&&!m.hasOwnProperty(Tt))switch(Tt){case"selected":n.selected=!1;break;default:Ca(n,l,Tt,null,m,Re)}for(pe in m)if(Re=m[pe],He=u[pe],m.hasOwnProperty(pe)&&Re!==He&&(Re!=null||He!=null))switch(pe){case"selected":n.selected=Re&&typeof Re!="function"&&typeof Re!="symbol";break;default:Ca(n,l,pe,Re,m,He)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var It in u)Re=u[It],u.hasOwnProperty(It)&&Re!=null&&!m.hasOwnProperty(It)&&Ca(n,l,It,null,m,Re);for(Le in m)if(Re=m[Le],He=u[Le],m.hasOwnProperty(Le)&&Re!==He&&(Re!=null||He!=null))switch(Le){case"children":case"dangerouslySetInnerHTML":if(Re!=null)throw Error(s(137,l));break;default:Ca(n,l,Le,Re,m,He)}return;default:if(pl(l)){for(var Aa in u)Re=u[Aa],u.hasOwnProperty(Aa)&&Re!==void 0&&!m.hasOwnProperty(Aa)&&Bm(n,l,Aa,void 0,m,Re);for(Ye in m)Re=m[Ye],He=u[Ye],!m.hasOwnProperty(Ye)||Re===He||Re===void 0&&He===void 0||Bm(n,l,Ye,Re,m,He);return}}for(var Se in u)Re=u[Se],u.hasOwnProperty(Se)&&Re!=null&&!m.hasOwnProperty(Se)&&Ca(n,l,Se,null,m,Re);for(Qe in m)Re=m[Qe],He=u[Qe],!m.hasOwnProperty(Qe)||Re===He||Re==null&&He==null||Ca(n,l,Qe,Re,m,He)}function ub(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Qk(){if(typeof performance.getEntriesByType=="function"){for(var n=0,l=0,u=performance.getEntriesByType("resource"),m=0;m<u.length;m++){var v=u[m],w=v.transferSize,R=v.initiatorType,q=v.duration;if(w&&q&&ub(R)){for(R=0,q=v.responseEnd,m+=1;m<u.length;m++){var pe=u[m],Le=pe.startTime;if(Le>q)break;var Ye=pe.transferSize,Qe=pe.initiatorType;Ye&&ub(Qe)&&(pe=pe.responseEnd,R+=Ye*(pe<q?1:(q-Le)/(pe-Le)))}if(--m,l+=8*(w+R)/(v.duration/1e3),n++,10<n)break}}if(0<n)return l/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Um=null,Hm=null;function Mu(n){return n.nodeType===9?n:n.ownerDocument}function fb(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function hb(n,l){if(n===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&l==="foreignObject"?0:n}function $m(n,l){return n==="textarea"||n==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Wm=null;function e4(){var n=window.event;return n&&n.type==="popstate"?n===Wm?!1:(Wm=n,!0):(Wm=null,!1)}var mb=typeof setTimeout=="function"?setTimeout:void 0,t4=typeof clearTimeout=="function"?clearTimeout:void 0,gb=typeof Promise=="function"?Promise:void 0,a4=typeof queueMicrotask=="function"?queueMicrotask:typeof gb!="undefined"?function(n){return gb.resolve(null).then(n).catch(r4)}:mb;function r4(n){setTimeout(function(){throw n})}function Ki(n){return n==="head"}function pb(n,l){var u=l,m=0;do{var v=u.nextSibling;if(n.removeChild(u),v&&v.nodeType===8)if(u=v.data,u==="/$"||u==="/&"){if(m===0){n.removeChild(v),ac(l);return}m--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")m++;else if(u==="html")Cd(n.ownerDocument.documentElement);else if(u==="head"){u=n.ownerDocument.head,Cd(u);for(var w=u.firstChild;w;){var R=w.nextSibling,q=w.nodeName;w[Ce]||q==="SCRIPT"||q==="STYLE"||q==="LINK"&&w.rel.toLowerCase()==="stylesheet"||u.removeChild(w),w=R}}else u==="body"&&Cd(n.ownerDocument.body);u=v}while(u);ac(l)}function xb(n,l){var u=n;n=0;do{var m=u.nextSibling;if(u.nodeType===1?l?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(l?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),m&&m.nodeType===8)if(u=m.data,u==="/$"){if(n===0)break;n--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||n++;u=m}while(u)}function Vm(n){var l=n.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var u=l;switch(l=l.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Vm(u),tt(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}n.removeChild(u)}}function n4(n,l,u,m){for(;n.nodeType===1;){var v=u;if(n.nodeName.toLowerCase()!==l.toLowerCase()){if(!m&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(m){if(!n[Ce])switch(l){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(w=n.getAttribute("rel"),w==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(w!==v.rel||n.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||n.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||n.getAttribute("title")!==(v.title==null?null:v.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(w=n.getAttribute("src"),(w!==(v.src==null?null:v.src)||n.getAttribute("type")!==(v.type==null?null:v.type)||n.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&w&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(l==="input"&&n.type==="hidden"){var w=v.name==null?null:""+v.name;if(v.type==="hidden"&&n.getAttribute("name")===w)return n}else return n;if(n=Xn(n.nextSibling),n===null)break}return null}function s4(n,l,u){if(l==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!u||(n=Xn(n.nextSibling),n===null))return null;return n}function yb(n,l){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=Xn(n.nextSibling),n===null))return null;return n}function Gm(n){return n.data==="$?"||n.data==="$~"}function Zm(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function i4(n,l){var u=n.ownerDocument;if(n.data==="$~")n._reactRetry=l;else if(n.data!=="$?"||u.readyState!=="loading")l();else{var m=function(){l(),u.removeEventListener("DOMContentLoaded",m)};u.addEventListener("DOMContentLoaded",m),n._reactRetry=m}}function Xn(n){for(;n!=null;n=n.nextSibling){var l=n.nodeType;if(l===1||l===3)break;if(l===8){if(l=n.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return n}var qm=null;function bb(n){n=n.nextSibling;for(var l=0;n;){if(n.nodeType===8){var u=n.data;if(u==="/$"||u==="/&"){if(l===0)return Xn(n.nextSibling);l--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||l++}n=n.nextSibling}return null}function vb(n){n=n.previousSibling;for(var l=0;n;){if(n.nodeType===8){var u=n.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(l===0)return n;l--}else u!=="/$"&&u!=="/&"||l++}n=n.previousSibling}return null}function _b(n,l,u){switch(l=Mu(u),n){case"html":if(n=l.documentElement,!n)throw Error(s(452));return n;case"head":if(n=l.head,!n)throw Error(s(453));return n;case"body":if(n=l.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function Cd(n){for(var l=n.attributes;l.length;)n.removeAttributeNode(l[0]);tt(n)}var Jn=new Map,wb=new Set;function Lu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ui=Z.d;Z.d={f:l4,r:o4,D:c4,C:d4,L:u4,m:f4,X:m4,S:h4,M:g4};function l4(){var n=ui.f(),l=Nu();return n||l}function o4(n){var l=pt(n);l!==null&&l.tag===5&&l.type==="form"?zx(l):ui.r(n)}var Qo=typeof document=="undefined"?null:document;function kb(n,l,u){var m=Qo;if(m&&typeof l=="string"&&l){var v=Ia(l);v='link[rel="'+n+'"][href="'+v+'"]',typeof u=="string"&&(v+='[crossorigin="'+u+'"]'),wb.has(v)||(wb.add(v),n={rel:n,crossOrigin:u,href:l},m.querySelector(v)===null&&(l=m.createElement("link"),Ar(l,"link",n),_t(l),m.head.appendChild(l)))}}function c4(n){ui.D(n),kb("dns-prefetch",n,null)}function d4(n,l){ui.C(n,l),kb("preconnect",n,l)}function u4(n,l,u){ui.L(n,l,u);var m=Qo;if(m&&n&&l){var v='link[rel="preload"][as="'+Ia(l)+'"]';l==="image"&&u&&u.imageSrcSet?(v+='[imagesrcset="'+Ia(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(v+='[imagesizes="'+Ia(u.imageSizes)+'"]')):v+='[href="'+Ia(n)+'"]';var w=v;switch(l){case"style":w=ec(n);break;case"script":w=tc(n)}Jn.has(w)||(n=y({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:n,as:l},u),Jn.set(w,n),m.querySelector(v)!==null||l==="style"&&m.querySelector(Ad(w))||l==="script"&&m.querySelector(Od(w))||(l=m.createElement("link"),Ar(l,"link",n),_t(l),m.head.appendChild(l)))}}function f4(n,l){ui.m(n,l);var u=Qo;if(u&&n){var m=l&&typeof l.as=="string"?l.as:"script",v='link[rel="modulepreload"][as="'+Ia(m)+'"][href="'+Ia(n)+'"]',w=v;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=tc(n)}if(!Jn.has(w)&&(n=y({rel:"modulepreload",href:n},l),Jn.set(w,n),u.querySelector(v)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Od(w)))return}m=u.createElement("link"),Ar(m,"link",n),_t(m),u.head.appendChild(m)}}}function h4(n,l,u){ui.S(n,l,u);var m=Qo;if(m&&n){var v=xt(m).hoistableStyles,w=ec(n);l=l||"default";var R=v.get(w);if(!R){var q={loading:0,preload:null};if(R=m.querySelector(Ad(w)))q.loading=5;else{n=y({rel:"stylesheet",href:n,"data-precedence":l},u),(u=Jn.get(w))&&Ym(n,u);var pe=R=m.createElement("link");_t(pe),Ar(pe,"link",n),pe._p=new Promise(function(Le,Ye){pe.onload=Le,pe.onerror=Ye}),pe.addEventListener("load",function(){q.loading|=1}),pe.addEventListener("error",function(){q.loading|=2}),q.loading|=4,Du(R,l,m)}R={type:"stylesheet",instance:R,count:1,state:q},v.set(w,R)}}}function m4(n,l){ui.X(n,l);var u=Qo;if(u&&n){var m=xt(u).hoistableScripts,v=tc(n),w=m.get(v);w||(w=u.querySelector(Od(v)),w||(n=y({src:n,async:!0},l),(l=Jn.get(v))&&Xm(n,l),w=u.createElement("script"),_t(w),Ar(w,"link",n),u.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(v,w))}}function g4(n,l){ui.M(n,l);var u=Qo;if(u&&n){var m=xt(u).hoistableScripts,v=tc(n),w=m.get(v);w||(w=u.querySelector(Od(v)),w||(n=y({src:n,async:!0,type:"module"},l),(l=Jn.get(v))&&Xm(n,l),w=u.createElement("script"),_t(w),Ar(w,"link",n),u.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(v,w))}}function Nb(n,l,u,m){var v=(v=de.current)?Lu(v):null;if(!v)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=ec(u.href),u=xt(v).hoistableStyles,m=u.get(l),m||(m={type:"style",instance:null,count:0,state:null},u.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){n=ec(u.href);var w=xt(v).hoistableStyles,R=w.get(n);if(R||(v=v.ownerDocument||v,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,R),(w=v.querySelector(Ad(n)))&&!w._p&&(R.instance=w,R.state.loading=5),Jn.has(n)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Jn.set(n,u),w||p4(v,n,u,R.state))),l&&m===null)throw Error(s(528,""));return R}if(l&&m!==null)throw Error(s(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=tc(u),u=xt(v).hoistableScripts,m=u.get(l),m||(m={type:"script",instance:null,count:0,state:null},u.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function ec(n){return'href="'+Ia(n)+'"'}function Ad(n){return'link[rel="stylesheet"]['+n+"]"}function jb(n){return y({},n,{"data-precedence":n.precedence,precedence:null})}function p4(n,l,u,m){n.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=n.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),Ar(l,"link",u),_t(l),n.head.appendChild(l))}function tc(n){return'[src="'+Ia(n)+'"]'}function Od(n){return"script[async]"+n}function Sb(n,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var m=n.querySelector('style[data-href~="'+Ia(u.href)+'"]');if(m)return l.instance=m,_t(m),m;var v=y({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return m=(n.ownerDocument||n).createElement("style"),_t(m),Ar(m,"style",v),Du(m,u.precedence,n),l.instance=m;case"stylesheet":v=ec(u.href);var w=n.querySelector(Ad(v));if(w)return l.state.loading|=4,l.instance=w,_t(w),w;m=jb(u),(v=Jn.get(v))&&Ym(m,v),w=(n.ownerDocument||n).createElement("link"),_t(w);var R=w;return R._p=new Promise(function(q,pe){R.onload=q,R.onerror=pe}),Ar(w,"link",m),l.state.loading|=4,Du(w,u.precedence,n),l.instance=w;case"script":return w=tc(u.src),(v=n.querySelector(Od(w)))?(l.instance=v,_t(v),v):(m=u,(v=Jn.get(w))&&(m=y({},u),Xm(m,v)),n=n.ownerDocument||n,v=n.createElement("script"),_t(v),Ar(v,"link",m),n.head.appendChild(v),l.instance=v);case"void":return null;default:throw Error(s(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,Du(m,u.precedence,n));return l.instance}function Du(n,l,u){for(var m=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=m.length?m[m.length-1]:null,w=v,R=0;R<m.length;R++){var q=m[R];if(q.dataset.precedence===l)w=q;else if(w!==v)break}w?w.parentNode.insertBefore(n,w.nextSibling):(l=u.nodeType===9?u.head:u,l.insertBefore(n,l.firstChild))}function Ym(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.title==null&&(n.title=l.title)}function Xm(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.integrity==null&&(n.integrity=l.integrity)}var Pu=null;function Tb(n,l,u){if(Pu===null){var m=new Map,v=Pu=new Map;v.set(u,m)}else v=Pu,m=v.get(u),m||(m=new Map,v.set(u,m));if(m.has(n))return m;for(m.set(n,null),u=u.getElementsByTagName(n),v=0;v<u.length;v++){var w=u[v];if(!(w[Ce]||w[Q]||n==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var R=w.getAttribute(l)||"";R=n+R;var q=m.get(R);q?q.push(w):m.set(R,[w])}}return m}function Eb(n,l,u){n=n.ownerDocument||n,n.head.insertBefore(u,l==="title"?n.querySelector("head > title"):null)}function x4(n,l,u){if(u===1||l.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return n=l.disabled,typeof l.precedence=="string"&&n==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Cb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function y4(n,l,u,m){if(u.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var v=ec(m.href),w=l.querySelector(Ad(v));if(w){l=w._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Ru.bind(n),l.then(n,n)),u.state.loading|=4,u.instance=w,_t(w);return}w=l.ownerDocument||l,m=jb(m),(v=Jn.get(v))&&Ym(m,v),w=w.createElement("link"),_t(w);var R=w;R._p=new Promise(function(q,pe){R.onload=q,R.onerror=pe}),Ar(w,"link",m),u.instance=w}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(u,l),(l=u.state.preload)&&(u.state.loading&3)===0&&(n.count++,u=Ru.bind(n),l.addEventListener("load",u),l.addEventListener("error",u))}}var Jm=0;function b4(n,l){return n.stylesheets&&n.count===0&&Iu(n,n.stylesheets),0<n.count||0<n.imgCount?function(u){var m=setTimeout(function(){if(n.stylesheets&&Iu(n,n.stylesheets),n.unsuspend){var w=n.unsuspend;n.unsuspend=null,w()}},6e4+l);0<n.imgBytes&&Jm===0&&(Jm=62500*Qk());var v=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Iu(n,n.stylesheets),n.unsuspend)){var w=n.unsuspend;n.unsuspend=null,w()}},(n.imgBytes>Jm?50:800)+l);return n.unsuspend=u,function(){n.unsuspend=null,clearTimeout(m),clearTimeout(v)}}:null}function Ru(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Iu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Fu=null;function Iu(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Fu=new Map,l.forEach(v4,n),Fu=null,Ru.call(n))}function v4(n,l){if(!(l.state.loading&4)){var u=Fu.get(n);if(u)var m=u.get(null);else{u=new Map,Fu.set(n,u);for(var v=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<v.length;w++){var R=v[w];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(u.set(R.dataset.precedence,R),m=R)}m&&u.set(null,m)}v=l.instance,R=v.getAttribute("data-precedence"),w=u.get(R)||m,w===m&&u.set(null,v),u.set(R,v),this.count++,m=Ru.bind(this),v.addEventListener("load",m),v.addEventListener("error",m),w?w.parentNode.insertBefore(v,w.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(v,n.firstChild)),l.state.loading|=4}}var Md={$$typeof:A,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function _4(n,l,u,m,v,w,R,q,pe){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=zn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zn(0),this.hiddenUpdates=zn(null),this.identifierPrefix=m,this.onUncaughtError=v,this.onCaughtError=w,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=pe,this.incompleteTransitions=new Map}function Ab(n,l,u,m,v,w,R,q,pe,Le,Ye,Qe){return n=new _4(n,l,u,R,pe,Le,Ye,Qe,q),l=1,w===!0&&(l|=24),w=Br(3,null,null,l),n.current=w,w.stateNode=n,l=Ah(),l.refCount++,n.pooledCache=l,l.refCount++,w.memoizedState={element:m,isDehydrated:u,cache:l},Dh(w),n}function Ob(n){return n?(n=Js,n):Js}function Mb(n,l,u,m,v,w){v=Ob(v),m.context===null?m.context=v:m.pendingContext=v,m=Ui(l),m.payload={element:u},w=w===void 0?null:w,w!==null&&(m.callback=w),u=Hi(n,m,l),u!==null&&(un(u,n,l),dd(u,n,l))}function Lb(n,l){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var u=n.retryLane;n.retryLane=u!==0&&u<l?u:l}}function Km(n,l){Lb(n,l),(n=n.alternate)&&Lb(n,l)}function Db(n){if(n.tag===13||n.tag===31){var l=Zn(n,67108864);l!==null&&un(l,n,67108864),Km(n,67108864)}}function Pb(n){if(n.tag===13||n.tag===31){var l=An();l=er(l);var u=Zn(n,l);u!==null&&un(u,n,l),Km(n,l)}}var zu=!0;function w4(n,l,u,m){var v=ae.T;ae.T=null;var w=Z.p;try{Z.p=2,Qm(n,l,u,m)}finally{Z.p=w,ae.T=v}}function k4(n,l,u,m){var v=ae.T;ae.T=null;var w=Z.p;try{Z.p=8,Qm(n,l,u,m)}finally{Z.p=w,ae.T=v}}function Qm(n,l,u,m){if(zu){var v=eg(m);if(v===null)zm(n,l,m,Bu,u),Fb(n,m);else if(j4(v,n,l,u,m))m.stopPropagation();else if(Fb(n,m),l&4&&-1<N4.indexOf(n)){for(;v!==null;){var w=pt(v);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var R=at(w.pendingLanes);if(R!==0){var q=w;for(q.pendingLanes|=2,q.entangledLanes|=2;R;){var pe=1<<31-wt(R);q.entanglements[1]|=pe,R&=~pe}Is(w),(ma&6)===0&&(wu=ze()+500,Sd(0))}}break;case 31:case 13:q=Zn(w,2),q!==null&&un(q,w,2),Nu(),Km(w,2)}if(w=eg(m),w===null&&zm(n,l,m,Bu,u),w===v)break;v=w}v!==null&&m.stopPropagation()}else zm(n,l,m,null,u)}}function eg(n){return n=xl(n),tg(n)}var Bu=null;function tg(n){if(Bu=null,n=ct(n),n!==null){var l=d(n);if(l===null)n=null;else{var u=l.tag;if(u===13){if(n=c(l),n!==null)return n;n=null}else if(u===31){if(n=f(l),n!==null)return n;n=null}else if(u===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;n=null}else l!==n&&(n=null)}}return Bu=n,null}function Rb(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(bt()){case Nt:return 2;case Ot:return 8;case Pt:case je:return 32;case ut:return 268435456;default:return 32}default:return 32}}var ag=!1,Qi=null,el=null,tl=null,Ld=new Map,Dd=new Map,al=[],N4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Fb(n,l){switch(n){case"focusin":case"focusout":Qi=null;break;case"dragenter":case"dragleave":el=null;break;case"mouseover":case"mouseout":tl=null;break;case"pointerover":case"pointerout":Ld.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dd.delete(l.pointerId)}}function Pd(n,l,u,m,v,w){return n===null||n.nativeEvent!==w?(n={blockedOn:l,domEventName:u,eventSystemFlags:m,nativeEvent:w,targetContainers:[v]},l!==null&&(l=pt(l),l!==null&&Db(l)),n):(n.eventSystemFlags|=m,l=n.targetContainers,v!==null&&l.indexOf(v)===-1&&l.push(v),n)}function j4(n,l,u,m,v){switch(l){case"focusin":return Qi=Pd(Qi,n,l,u,m,v),!0;case"dragenter":return el=Pd(el,n,l,u,m,v),!0;case"mouseover":return tl=Pd(tl,n,l,u,m,v),!0;case"pointerover":var w=v.pointerId;return Ld.set(w,Pd(Ld.get(w)||null,n,l,u,m,v)),!0;case"gotpointercapture":return w=v.pointerId,Dd.set(w,Pd(Dd.get(w)||null,n,l,u,m,v)),!0}return!1}function Ib(n){var l=ct(n.target);if(l!==null){var u=d(l);if(u!==null){if(l=u.tag,l===13){if(l=c(u),l!==null){n.blockedOn=l,ne(n.priority,function(){Pb(u)});return}}else if(l===31){if(l=f(u),l!==null){n.blockedOn=l,ne(n.priority,function(){Pb(u)});return}}else if(l===3&&u.stateNode.current.memoizedState.isDehydrated){n.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Uu(n){if(n.blockedOn!==null)return!1;for(var l=n.targetContainers;0<l.length;){var u=eg(n.nativeEvent);if(u===null){u=n.nativeEvent;var m=new u.constructor(u.type,u);vo=m,u.target.dispatchEvent(m),vo=null}else return l=pt(u),l!==null&&Db(l),n.blockedOn=u,!1;l.shift()}return!0}function zb(n,l,u){Uu(n)&&u.delete(l)}function S4(){ag=!1,Qi!==null&&Uu(Qi)&&(Qi=null),el!==null&&Uu(el)&&(el=null),tl!==null&&Uu(tl)&&(tl=null),Ld.forEach(zb),Dd.forEach(zb)}function Hu(n,l){n.blockedOn===l&&(n.blockedOn=null,ag||(ag=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,S4)))}var $u=null;function Bb(n){$u!==n&&($u=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){$u===n&&($u=null);for(var l=0;l<n.length;l+=3){var u=n[l],m=n[l+1],v=n[l+2];if(typeof m!="function"){if(tg(m||u)===null)continue;break}var w=pt(u);w!==null&&(n.splice(l,3),l-=3,em(w,{pending:!0,data:v,method:u.method,action:m},m,v))}}))}function ac(n){function l(pe){return Hu(pe,n)}Qi!==null&&Hu(Qi,n),el!==null&&Hu(el,n),tl!==null&&Hu(tl,n),Ld.forEach(l),Dd.forEach(l);for(var u=0;u<al.length;u++){var m=al[u];m.blockedOn===n&&(m.blockedOn=null)}for(;0<al.length&&(u=al[0],u.blockedOn===null);)Ib(u),u.blockedOn===null&&al.shift();if(u=(n.ownerDocument||n).$$reactFormReplay,u!=null)for(m=0;m<u.length;m+=3){var v=u[m],w=u[m+1],R=v[re]||null;if(typeof w=="function")R||Bb(u);else if(R){var q=null;if(w&&w.hasAttribute("formAction")){if(v=w,R=w[re]||null)q=R.formAction;else if(tg(v)!==null)continue}else q=R.action;typeof q=="function"?u[m+1]=q:(u.splice(m,3),m-=3),Bb(u)}}}function Ub(){function n(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(R){return v=R})},focusReset:"manual",scroll:"manual"})}function l(){v!==null&&(v(),v=null),m||setTimeout(u,20)}function u(){if(!m&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,v=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(u,100),function(){m=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),v!==null&&(v(),v=null)}}}function rg(n){this._internalRoot=n}Wu.prototype.render=rg.prototype.render=function(n){var l=this._internalRoot;if(l===null)throw Error(s(409));var u=l.current,m=An();Mb(u,m,n,l,null,null)},Wu.prototype.unmount=rg.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var l=n.containerInfo;Mb(n.current,2,null,n,null,null),Nu(),l[z]=null}};function Wu(n){this._internalRoot=n}Wu.prototype.unstable_scheduleHydration=function(n){if(n){var l=U();n={blockedOn:null,target:n,priority:l};for(var u=0;u<al.length&&l!==0&&l<al[u].priority;u++);al.splice(u,0,n),u===0&&Ib(n)}};var Hb=t.version;if(Hb!=="19.2.1")throw Error(s(527,Hb,"19.2.1"));Z.findDOMNode=function(n){var l=n._reactInternals;if(l===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=p(l),n=n!==null?x(n):null,n=n===null?null:n.stateNode,n};var T4={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:ae,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Vu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vu.isDisabled&&Vu.supportsFiber)try{Fe=Vu.inject(T4),ot=Vu}catch(n){}}return Fd.createRoot=function(n,l){if(!i(n))throw Error(s(299));var u=!1,m="",v=Yx,w=Xx,R=Jx;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(w=l.onCaughtError),l.onRecoverableError!==void 0&&(R=l.onRecoverableError)),l=Ab(n,1,!1,null,null,u,m,null,v,w,R,Ub),n[z]=l.current,Im(n),new rg(l)},Fd.hydrateRoot=function(n,l,u){if(!i(n))throw Error(s(299));var m=!1,v="",w=Yx,R=Xx,q=Jx,pe=null;return u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(v=u.identifierPrefix),u.onUncaughtError!==void 0&&(w=u.onUncaughtError),u.onCaughtError!==void 0&&(R=u.onCaughtError),u.onRecoverableError!==void 0&&(q=u.onRecoverableError),u.formState!==void 0&&(pe=u.formState)),l=Ab(n,1,!0,l,u!=null?u:null,m,v,pe,w,R,q,Ub),l.context=Ob(null),u=l.current,m=An(),m=er(m),v=Ui(m),v.callback=null,Hi(u,v,m),u=m,l.current.lanes=u,Vr(l,u),Is(l),n[z]=l.current,Im(n),new Wu(l)},Fd.version="19.2.1",Fd}var t1;function U4(){if(t1)return cg.exports;t1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),cg.exports=B4(),cg.exports}var H4=U4();const Wt=e=>typeof e=="string",Id=()=>{let e,t;const a=new Promise((s,i)=>{e=s,t=i});return a.resolve=e,a.reject=t,a},a1=e=>e==null?"":""+e,$4=(e,t,a)=>{e.forEach(s=>{t[s]&&(a[s]=t[s])})},W4=/###/g,r1=e=>e&&e.indexOf("###")>-1?e.replace(W4,"."):e,n1=e=>!e||Wt(e),Vd=(e,t,a)=>{const s=Wt(t)?t.split("."):t;let i=0;for(;i<s.length-1;){if(n1(e))return{};const d=r1(s[i]);!e[d]&&a&&(e[d]=new a),Object.prototype.hasOwnProperty.call(e,d)?e=e[d]:e={},++i}return n1(e)?{}:{obj:e,k:r1(s[i])}},s1=(e,t,a)=>{const{obj:s,k:i}=Vd(e,t,Object);if(s!==void 0||t.length===1){s[i]=a;return}let d=t[t.length-1],c=t.slice(0,t.length-1),f=Vd(e,c,Object);for(;f.obj===void 0&&c.length;)d=`${c[c.length-1]}.${d}`,c=c.slice(0,c.length-1),f=Vd(e,c,Object),f!=null&&f.obj&&typeof f.obj[`${f.k}.${d}`]!="undefined"&&(f.obj=void 0);f.obj[`${f.k}.${d}`]=a},V4=(e,t,a,s)=>{const{obj:i,k:d}=Vd(e,t,Object);i[d]=i[d]||[],i[d].push(a)},pf=(e,t)=>{const{obj:a,k:s}=Vd(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,s))return a[s]},G4=(e,t,a)=>{const s=pf(e,a);return s!==void 0?s:pf(t,a)},Qv=(e,t,a)=>{for(const s in t)s!=="__proto__"&&s!=="constructor"&&(s in e?Wt(e[s])||e[s]instanceof String||Wt(t[s])||t[s]instanceof String?a&&(e[s]=t[s]):Qv(e[s],t[s],a):e[s]=t[s]);return e},nc=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Z4={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const q4=e=>Wt(e)?e.replace(/[&<>"'\/]/g,t=>Z4[t]):e;class Y4{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const s=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,s),this.regExpQueue.push(t),s}}const X4=[" ",",","?","!",";"],J4=new Y4(20),K4=(e,t,a)=>{t=t||"",a=a||"";const s=X4.filter(c=>t.indexOf(c)<0&&a.indexOf(c)<0);if(s.length===0)return!0;const i=J4.getRegExp(`(${s.map(c=>c==="?"?"\\?":c).join("|")})`);let d=!i.test(e);if(!d){const c=e.indexOf(a);c>0&&!i.test(e.substring(0,c))&&(d=!0)}return d},Pg=(e,t,a=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const s=t.split(a);let i=e;for(let d=0;d<s.length;){if(!i||typeof i!="object")return;let c,f="";for(let g=d;g<s.length;++g)if(g!==d&&(f+=a),f+=s[g],c=i[f],c!==void 0){if(["string","number","boolean"].indexOf(typeof c)>-1&&g<s.length-1)continue;d+=g-d+1;break}i=c}return i},t0=e=>e==null?void 0:e.replace("_","-"),Q4={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var a,s;(s=(a=console==null?void 0:console[e])==null?void 0:a.apply)==null||s.call(a,console,t)}};class xf{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||Q4,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,s,i){return i&&!this.debug?null:(Wt(t[0])&&(t[0]=`${s}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new xf(this.logger,ie({prefix:`${this.prefix}:${t}:`},this.options))}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new xf(this.logger,t)}}var Hs=new xf;class Uf{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(a)||0;this.observers[s].set(a,i+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([i,d])=>{for(let c=0;c<d;c++)i(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,d])=>{for(let c=0;c<d;c++)i.apply(i,[t,...a])})}}class i1 extends Uf{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,s,i={}){var p,x;const d=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,c=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let f;t.indexOf(".")>-1?f=t.split("."):(f=[t,a],s&&(Array.isArray(s)?f.push(...s):Wt(s)&&d?f.push(...s.split(d)):f.push(s)));const g=pf(this.data,f);return!g&&!a&&!s&&t.indexOf(".")>-1&&(t=f[0],a=f[1],s=f.slice(2).join(".")),g||!c||!Wt(s)?g:Pg((x=(p=this.data)==null?void 0:p[t])==null?void 0:x[a],s,d)}addResource(t,a,s,i,d={silent:!1}){const c=d.keySeparator!==void 0?d.keySeparator:this.options.keySeparator;let f=[t,a];s&&(f=f.concat(c?s.split(c):s)),t.indexOf(".")>-1&&(f=t.split("."),i=a,a=f[1]),this.addNamespaces(a),s1(this.data,f,i),d.silent||this.emit("added",t,a,s,i)}addResources(t,a,s,i={silent:!1}){for(const d in s)(Wt(s[d])||Array.isArray(s[d]))&&this.addResource(t,a,d,s[d],{silent:!0});i.silent||this.emit("added",t,a,s)}addResourceBundle(t,a,s,i,d,c={silent:!1,skipCopy:!1}){let f=[t,a];t.indexOf(".")>-1&&(f=t.split("."),i=s,s=a,a=f[1]),this.addNamespaces(a);let g=pf(this.data,f)||{};c.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?Qv(g,s,d):g=ie(ie({},g),s),s1(this.data,f,g),c.silent||this.emit("added",t,a,s)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(i=>a[i]&&Object.keys(a[i]).length>0)}toJSON(){return this.data}}var e_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,s,i){return e.forEach(d=>{var c,f;t=(f=(c=this.processors[d])==null?void 0:c.process(t,a,s,i))!=null?f:t}),t}};const t_=Symbol("i18next/PATH_KEY");function e3(){const e=[],t=Object.create(null);let a;return t.get=(s,i)=>{var d;return(d=a==null?void 0:a.revoke)==null||d.call(a),i===t_?e:(e.push(i),a=Proxy.revocable(s,t),a.proxy)},Proxy.revocable(Object.create(null),t).proxy}function Rg(e,t){var s;const{[t_]:a}=e(e3());return a.join((s=t==null?void 0:t.keySeparator)!=null?s:".")}const l1={},hg=e=>!Wt(e)&&typeof e!="boolean"&&typeof e!="number";class yf extends Uf{constructor(t,a={}){super(),$4(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Hs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const s=ie({},a);if(t==null)return!1;const i=this.resolve(t,s);if((i==null?void 0:i.res)===void 0)return!1;const d=hg(i.res);return!(s.returnObjects===!1&&d)}extractFromKey(t,a){let s=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let d=a.ns||this.options.defaultNS||[];const c=s&&t.indexOf(s)>-1,f=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!K4(t,s,i);if(c&&!f){const g=t.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:t,namespaces:Wt(d)?[d]:d};const p=t.split(s);(s!==i||s===i&&this.options.ns.indexOf(p[0])>-1)&&(d=p.shift()),t=p.join(i)}return{key:t,namespaces:Wt(d)?[d]:d}}translate(t,a,s){let i=typeof a=="object"?ie({},a):a;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i=ie({},i)),i||(i={}),t==null)return"";typeof t=="function"&&(t=Rg(t,ie(ie({},this.options),i))),Array.isArray(t)||(t=[String(t)]);const d=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,c=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:f,namespaces:g}=this.extractFromKey(t[t.length-1],i),p=g[g.length-1];let x=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;x===void 0&&(x=":");const y=i.lng||this.language,_=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((y==null?void 0:y.toLowerCase())==="cimode")return _?d?{res:`${p}${x}${f}`,usedKey:f,exactUsedKey:f,usedLng:y,usedNS:p,usedParams:this.getUsedParamsDetails(i)}:`${p}${x}${f}`:d?{res:f,usedKey:f,exactUsedKey:f,usedLng:y,usedNS:p,usedParams:this.getUsedParamsDetails(i)}:f;const k=this.resolve(t,i);let T=k==null?void 0:k.res;const N=(k==null?void 0:k.usedKey)||f,S=(k==null?void 0:k.exactUsedKey)||f,O=["[object Number]","[object Function]","[object RegExp]"],C=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,P=i.count!==void 0&&!Wt(i.count),I=yf.hasDefaultValue(i),ee=P?this.pluralResolver.getSuffix(y,i.count,i):"",B=i.ordinal&&P?this.pluralResolver.getSuffix(y,i.count,{ordinal:!1}):"",H=P&&!i.ordinal&&i.count===0,Y=H&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${ee}`]||i[`defaultValue${B}`]||i.defaultValue;let ue=T;A&&!T&&I&&(ue=Y);const xe=hg(ue),le=Object.prototype.toString.apply(ue);if(A&&ue&&xe&&O.indexOf(le)<0&&!(Wt(C)&&Array.isArray(ue))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ge=this.options.returnedObjectHandler?this.options.returnedObjectHandler(N,ue,Ee(ie({},i),{ns:g})):`key '${f} (${this.language})' returned an object instead of string.`;return d?(k.res=ge,k.usedParams=this.getUsedParamsDetails(i),k):ge}if(c){const ge=Array.isArray(ue),be=ge?[]:{},me=ge?S:N;for(const ae in ue)if(Object.prototype.hasOwnProperty.call(ue,ae)){const Z=`${me}${c}${ae}`;I&&!T?be[ae]=this.translate(Z,Ee(ie({},i),{defaultValue:hg(Y)?Y[ae]:void 0,joinArrays:!1,ns:g})):be[ae]=this.translate(Z,Ee(ie({},i),{joinArrays:!1,ns:g})),be[ae]===Z&&(be[ae]=ue[ae])}T=be}}else if(A&&Wt(C)&&Array.isArray(T))T=T.join(C),T&&(T=this.extendTranslation(T,t,i,s));else{let ge=!1,be=!1;!this.isValidLookup(T)&&I&&(ge=!0,T=Y),this.isValidLookup(T)||(be=!0,T=f);const ae=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&be?void 0:T,Z=I&&Y!==T&&this.options.updateMissing;if(be||ge||Z){if(this.logger.log(Z?"updateKey":"missingKey",y,p,f,Z?Y:T),c){const F=this.resolve(f,Ee(ie({},i),{keySeparator:!1}));F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let K=[];const te=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&te&&te[0])for(let F=0;F<te.length;F++)K.push(te[F]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(i.lng||this.language):K.push(i.lng||this.language);const se=(F,D,W)=>{var J;const G=I&&W!==T?W:ae;this.options.missingKeyHandler?this.options.missingKeyHandler(F,p,D,G,Z,i):(J=this.backendConnector)!=null&&J.saveMissing&&this.backendConnector.saveMissing(F,p,D,G,Z,i),this.emit("missingKey",F,p,D,T)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?K.forEach(F=>{const D=this.pluralResolver.getSuffixes(F,i);H&&i[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(W=>{se([F],f+W,i[`defaultValue${W}`]||Y)})}):se(K,f,Y))}T=this.extendTranslation(T,t,i,k,s),be&&T===f&&this.options.appendNamespaceToMissingKey&&(T=`${p}${x}${f}`),(be||ge)&&this.options.parseMissingKeyHandler&&(T=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${x}${f}`:f,ge?T:void 0,i))}return d?(k.res=T,k.usedParams=this.getUsedParamsDetails(i),k):T}extendTranslation(t,a,s,i,d){var g,p;if((g=this.i18nFormat)!=null&&g.parse)t=this.i18nFormat.parse(t,ie(ie({},this.options.interpolation.defaultVariables),s),s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(Ee(ie({},s),{interpolation:ie(ie({},this.options.interpolation),s.interpolation)}));const x=Wt(t)&&(((p=s==null?void 0:s.interpolation)==null?void 0:p.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let y;if(x){const k=t.match(this.interpolator.nestingRegexp);y=k&&k.length}let _=s.replace&&!Wt(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(_=ie(ie({},this.options.interpolation.defaultVariables),_)),t=this.interpolator.interpolate(t,_,s.lng||this.language||i.usedLng,s),x){const k=t.match(this.interpolator.nestingRegexp),T=k&&k.length;y<T&&(s.nest=!1)}!s.lng&&i&&i.res&&(s.lng=this.language||i.usedLng),s.nest!==!1&&(t=this.interpolator.nest(t,(...k)=>(d==null?void 0:d[0])===k[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${k[0]} in key: ${a[0]}`),null):this.translate(...k,a),s)),s.interpolation&&this.interpolator.reset()}const c=s.postProcess||this.options.postProcess,f=Wt(c)?[c]:c;return t!=null&&(f!=null&&f.length)&&s.applyPostProcessor!==!1&&(t=e_.handle(f,t,a,this.options&&this.options.postProcessPassResolved?ie({i18nResolved:Ee(ie({},i),{usedParams:this.getUsedParamsDetails(s)})},s):s,this)),t}resolve(t,a={}){let s,i,d,c,f;return Wt(t)&&(t=[t]),t.forEach(g=>{if(this.isValidLookup(s))return;const p=this.extractFromKey(g,a),x=p.key;i=x;let y=p.namespaces;this.options.fallbackNS&&(y=y.concat(this.options.fallbackNS));const _=a.count!==void 0&&!Wt(a.count),k=_&&!a.ordinal&&a.count===0,T=a.context!==void 0&&(Wt(a.context)||typeof a.context=="number")&&a.context!=="",N=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);y.forEach(S=>{var O,C;this.isValidLookup(s)||(f=S,!l1[`${N[0]}-${S}`]&&((O=this.utils)!=null&&O.hasLoadedNamespace)&&!((C=this.utils)!=null&&C.hasLoadedNamespace(f))&&(l1[`${N[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${N.join(", ")}" won't get resolved as namespace "${f}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),N.forEach(A=>{var ee;if(this.isValidLookup(s))return;c=A;const P=[x];if((ee=this.i18nFormat)!=null&&ee.addLookupKeys)this.i18nFormat.addLookupKeys(P,x,A,S,a);else{let B;_&&(B=this.pluralResolver.getSuffix(A,a.count,a));const H=`${this.options.pluralSeparator}zero`,Y=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(_&&(a.ordinal&&B.indexOf(Y)===0&&P.push(x+B.replace(Y,this.options.pluralSeparator)),P.push(x+B),k&&P.push(x+H)),T){const ue=`${x}${this.options.contextSeparator||"_"}${a.context}`;P.push(ue),_&&(a.ordinal&&B.indexOf(Y)===0&&P.push(ue+B.replace(Y,this.options.pluralSeparator)),P.push(ue+B),k&&P.push(ue+H))}}let I;for(;I=P.pop();)this.isValidLookup(s)||(d=I,s=this.getResource(A,S,I,a))}))})}),{res:s,usedKey:i,exactUsedKey:d,usedLng:c,usedNS:f}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,s,i={}){var d;return(d=this.i18nFormat)!=null&&d.getResource?this.i18nFormat.getResource(t,a,s,i):this.resourceStore.getResource(t,a,s,i)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=t.replace&&!Wt(t.replace);let i=s?t.replace:t;if(s&&typeof t.count!="undefined"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i=ie(ie({},this.options.interpolation.defaultVariables),i)),!s){i=ie({},i);for(const d of a)delete i[d]}return i}static hasDefaultValue(t){const a="defaultValue";for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&a===s.substring(0,a.length)&&t[s]!==void 0)return!0;return!1}}class o1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Hs.create("languageUtils")}getScriptPartFromCode(t){if(t=t0(t),!t||t.indexOf("-")<0)return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=t0(t),!t||t.indexOf("-")<0)return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(Wt(t)&&t.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch(s){}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(s=>{if(a)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(a=i)}),!a&&this.options.supportedLngs&&t.forEach(s=>{if(a)return;const i=this.getScriptPartFromCode(s);if(this.isSupportedCode(i))return a=i;const d=this.getLanguagePartFromCode(s);if(this.isSupportedCode(d))return a=d;a=this.options.supportedLngs.find(c=>{if(c===d)return c;if(!(c.indexOf("-")<0&&d.indexOf("-")<0)&&(c.indexOf("-")>0&&d.indexOf("-")<0&&c.substring(0,c.indexOf("-"))===d||c.indexOf(d)===0&&d.length>1))return c})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),Wt(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let s=t[a];return s||(s=t[this.getScriptPartFromCode(a)]),s||(s=t[this.formatLanguageCode(a)]),s||(s=t[this.getLanguagePartFromCode(a)]),s||(s=t.default),s||[]}toResolveHierarchy(t,a){const s=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),i=[],d=c=>{c&&(this.isSupportedCode(c)?i.push(c):this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`))};return Wt(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&d(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&d(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&d(this.getLanguagePartFromCode(t))):Wt(t)&&d(this.formatLanguageCode(t)),s.forEach(c=>{i.indexOf(c)<0&&d(this.formatLanguageCode(c))}),i}}const c1={zero:0,one:1,two:2,few:3,many:4,other:5},d1={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class t3{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=Hs.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,a){this.rules[t]=a}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const s=t0(t==="dev"?"en":t),i=a.ordinal?"ordinal":"cardinal",d=JSON.stringify({cleanedCode:s,type:i});if(d in this.pluralRulesCache)return this.pluralRulesCache[d];let c;try{c=new Intl.PluralRules(s,{type:i})}catch(f){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),d1;if(!t.match(/-|_/))return d1;const g=this.languageUtils.getLanguagePartFromCode(t);c=this.getRule(g,a)}return this.pluralRulesCache[d]=c,c}needsPlural(t,a={}){let s=this.getRule(t,a);return s||(s=this.getRule("dev",a)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,a,s={}){return this.getSuffixes(t,s).map(i=>`${a}${i}`)}getSuffixes(t,a={}){let s=this.getRule(t,a);return s||(s=this.getRule("dev",a)),s?s.resolvedOptions().pluralCategories.sort((i,d)=>c1[i]-c1[d]).map(i=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(t,a,s={}){const i=this.getRule(t,s);return i?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,s))}}const u1=(e,t,a,s=".",i=!0)=>{let d=G4(e,t,a);return!d&&i&&Wt(a)&&(d=Pg(e,a,s),d===void 0&&(d=Pg(t,a,s))),d},mg=e=>e.replace(/\$/g,"$$$$");class f1{constructor(t={}){var a;this.logger=Hs.create("interpolator"),this.options=t,this.format=((a=t==null?void 0:t.interpolation)==null?void 0:a.format)||(s=>s),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:s,useRawValueToEscape:i,prefix:d,prefixEscaped:c,suffix:f,suffixEscaped:g,formatSeparator:p,unescapeSuffix:x,unescapePrefix:y,nestingPrefix:_,nestingPrefixEscaped:k,nestingSuffix:T,nestingSuffixEscaped:N,nestingOptionsSeparator:S,maxReplaces:O,alwaysFormat:C}=t.interpolation;this.escape=a!==void 0?a:q4,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=d?nc(d):c||"{{",this.suffix=f?nc(f):g||"}}",this.formatSeparator=p||",",this.unescapePrefix=x?"":y||"-",this.unescapeSuffix=this.unescapePrefix?"":x||"",this.nestingPrefix=_?nc(_):k||nc("$t("),this.nestingSuffix=T?nc(T):N||nc(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=O||1e3,this.alwaysFormat=C!==void 0?C:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,s)=>(a==null?void 0:a.source)===s?(a.lastIndex=0,a):new RegExp(s,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,a,s,i){var k;let d,c,f;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=T=>{if(T.indexOf(this.formatSeparator)<0){const C=u1(a,g,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,s,Ee(ie(ie({},i),a),{interpolationkey:T})):C}const N=T.split(this.formatSeparator),S=N.shift().trim(),O=N.join(this.formatSeparator).trim();return this.format(u1(a,g,S,this.options.keySeparator,this.options.ignoreJSONStructure),O,s,Ee(ie(ie({},i),a),{interpolationkey:S}))};this.resetRegExp();const x=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,y=((k=i==null?void 0:i.interpolation)==null?void 0:k.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>mg(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?mg(this.escape(T)):mg(T)}].forEach(T=>{for(f=0;d=T.regex.exec(t);){const N=d[1].trim();if(c=p(N),c===void 0)if(typeof x=="function"){const O=x(t,d,i);c=Wt(O)?O:""}else if(i&&Object.prototype.hasOwnProperty.call(i,N))c="";else if(y){c=d[0];continue}else this.logger.warn(`missed to pass in variable ${N} for interpolating ${t}`),c="";else!Wt(c)&&!this.useRawValueToEscape&&(c=a1(c));const S=T.safeValue(c);if(t=t.replace(d[0],S),y?(T.regex.lastIndex+=c.length,T.regex.lastIndex-=d[0].length):T.regex.lastIndex=0,f++,f>=this.maxReplaces)break}}),t}nest(t,a,s={}){let i,d,c;const f=(g,p)=>{var N;const x=this.nestingOptionsSeparator;if(g.indexOf(x)<0)return g;const y=g.split(new RegExp(`${x}[ ]*{`));let _=`{${y[1]}`;g=y[0],_=this.interpolate(_,c);const k=_.match(/'/g),T=_.match(/"/g);(((N=k==null?void 0:k.length)!=null?N:0)%2===0&&!T||T.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),p&&(c=ie(ie({},p),c))}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,S),`${g}${x}${_}`}return c.defaultValue&&c.defaultValue.indexOf(this.prefix)>-1&&delete c.defaultValue,g};for(;i=this.nestingRegexp.exec(t);){let g=[];c=ie({},s),c=c.replace&&!Wt(c.replace)?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;const p=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(p!==-1&&(g=i[1].slice(p).split(this.formatSeparator).map(x=>x.trim()).filter(Boolean),i[1]=i[1].slice(0,p)),d=a(f.call(this,i[1].trim(),c),c),d&&i[0]===t&&!Wt(d))return d;Wt(d)||(d=a1(d)),d||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),d=""),g.length&&(d=g.reduce((x,y)=>this.format(x,y,s.lng,Ee(ie({},s),{interpolationkey:i[1].trim()})),d.trim())),t=t.replace(i[0],d),this.regexp.lastIndex=0}return t}}const a3=e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const s=e.split("(");t=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);t==="currency"&&i.indexOf(":")<0?a.currency||(a.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?a.range||(a.range=i.trim()):i.split(";").forEach(c=>{if(c){const[f,...g]=c.split(":"),p=g.join(":").trim().replace(/^'+|'+$/g,""),x=f.trim();a[x]||(a[x]=p),p==="false"&&(a[x]=!1),p==="true"&&(a[x]=!0),isNaN(p)||(a[x]=parseInt(p,10))}})}return{formatName:t,formatOptions:a}},h1=e=>{const t={};return(a,s,i)=>{let d=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(d=Ee(ie({},d),{[i.interpolationkey]:void 0}));const c=s+JSON.stringify(d);let f=t[c];return f||(f=e(t0(s),i),t[c]=f),f(a)}},r3=e=>(t,a,s)=>e(t0(a),s)(t);class n3{constructor(t={}){this.logger=Hs.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const s=a.cacheInBuiltFormats?h1:r3;this.formats={number:s((i,d)=>{const c=new Intl.NumberFormat(i,ie({},d));return f=>c.format(f)}),currency:s((i,d)=>{const c=new Intl.NumberFormat(i,Ee(ie({},d),{style:"currency"}));return f=>c.format(f)}),datetime:s((i,d)=>{const c=new Intl.DateTimeFormat(i,ie({},d));return f=>c.format(f)}),relativetime:s((i,d)=>{const c=new Intl.RelativeTimeFormat(i,ie({},d));return f=>c.format(f,d.range||"day")}),list:s((i,d)=>{const c=new Intl.ListFormat(i,ie({},d));return f=>c.format(f)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=h1(a)}format(t,a,s,i={}){const d=a.split(this.formatSeparator);if(d.length>1&&d[0].indexOf("(")>1&&d[0].indexOf(")")<0&&d.find(f=>f.indexOf(")")>-1)){const f=d.findIndex(g=>g.indexOf(")")>-1);d[0]=[d[0],...d.splice(1,f)].join(this.formatSeparator)}return d.reduce((f,g)=>{var y;const{formatName:p,formatOptions:x}=a3(g);if(this.formats[p]){let _=f;try{const k=((y=i==null?void 0:i.formatParams)==null?void 0:y[i.interpolationkey])||{},T=k.locale||k.lng||i.locale||i.lng||s;_=this.formats[p](f,T,ie(ie(ie({},x),i),k))}catch(k){this.logger.warn(k)}return _}else this.logger.warn(`there was no format function for ${p}`);return f},t)}}const s3=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class i3 extends Uf{constructor(t,a,s,i={}){var d,c;super(),this.backend=t,this.store=a,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=Hs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],(c=(d=this.backend)==null?void 0:d.init)==null||c.call(d,s,i.backend,i)}queueLoad(t,a,s,i){const d={},c={},f={},g={};return t.forEach(p=>{let x=!0;a.forEach(y=>{const _=`${p}|${y}`;!s.reload&&this.store.hasResourceBundle(p,y)?this.state[_]=2:this.state[_]<0||(this.state[_]===1?c[_]===void 0&&(c[_]=!0):(this.state[_]=1,x=!1,c[_]===void 0&&(c[_]=!0),d[_]===void 0&&(d[_]=!0),g[y]===void 0&&(g[y]=!0)))}),x||(f[p]=!0)}),(Object.keys(d).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(d),pending:Object.keys(c),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(g)}}loaded(t,a,s){const i=t.split("|"),d=i[0],c=i[1];a&&this.emit("failedLoading",d,c,a),!a&&s&&this.store.addResourceBundle(d,c,s,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&s&&(this.state[t]=0);const f={};this.queue.forEach(g=>{V4(g.loaded,[d],c),s3(g,t),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(p=>{f[p]||(f[p]={});const x=g.loaded[p];x.length&&x.forEach(y=>{f[p][y]===void 0&&(f[p][y]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(g=>!g.done)}read(t,a,s,i=0,d=this.retryTimeout,c){if(!t.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:s,tried:i,wait:d,callback:c});return}this.readingCalls++;const f=(p,x)=>{if(this.readingCalls--,this.waitingReads.length>0){const y=this.waitingReads.shift();this.read(y.lng,y.ns,y.fcName,y.tried,y.wait,y.callback)}if(p&&x&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,a,s,i+1,d*2,c)},d);return}c(p,x)},g=this.backend[s].bind(this.backend);if(g.length===2){try{const p=g(t,a);p&&typeof p.then=="function"?p.then(x=>f(null,x)).catch(f):f(null,p)}catch(p){f(p)}return}return g(t,a,f)}prepareLoading(t,a,s={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();Wt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Wt(a)&&(a=[a]);const d=this.queueLoad(t,a,s,i);if(!d.toLoad.length)return d.pending.length||i(),null;d.toLoad.forEach(c=>{this.loadOne(c)})}load(t,a,s){this.prepareLoading(t,a,{},s)}reload(t,a,s){this.prepareLoading(t,a,{reload:!0},s)}loadOne(t,a=""){const s=t.split("|"),i=s[0],d=s[1];this.read(i,d,"read",void 0,void 0,(c,f)=>{c&&this.logger.warn(`${a}loading namespace ${d} for language ${i} failed`,c),!c&&f&&this.logger.log(`${a}loaded namespace ${d} for language ${i}`,f),this.loaded(t,c,f)})}saveMissing(t,a,s,i,d,c={},f=()=>{}){var g,p,x,y,_;if((p=(g=this.services)==null?void 0:g.utils)!=null&&p.hasLoadedNamespace&&!((y=(x=this.services)==null?void 0:x.utils)!=null&&y.hasLoadedNamespace(a))){this.logger.warn(`did not save key "${s}" as the namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if((_=this.backend)!=null&&_.create){const k=Ee(ie({},c),{isUpdate:d}),T=this.backend.create.bind(this.backend);if(T.length<6)try{let N;T.length===5?N=T(t,a,s,i,k):N=T(t,a,s,i),N&&typeof N.then=="function"?N.then(S=>f(null,S)).catch(f):f(null,N)}catch(N){f(N)}else T(t,a,s,i,f,k)}!t||!t[0]||this.store.addResource(t[0],a,s,i)}}}const m1=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Wt(e[1])&&(t.defaultValue=e[1]),Wt(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const a=e[3]||e[2];Object.keys(a).forEach(s=>{t[s]=a[s]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),g1=e=>{var t,a;return Wt(e.ns)&&(e.ns=[e.ns]),Wt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Wt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),((a=(t=e.supportedLngs)==null?void 0:t.indexOf)==null?void 0:a.call(t,"cimode"))<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e},Zu=()=>{},l3=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(a=>{typeof e[a]=="function"&&(e[a]=e[a].bind(e))})};class Gd extends Uf{constructor(t={},a){if(super(),this.options=g1(t),this.services={},this.logger=Hs,this.modules={external:[]},l3(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(Wt(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const s=m1();this.options=ie(ie(ie({},s),this.options),g1(t)),this.options.interpolation=ie(ie({},s.interpolation),this.options.interpolation),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler);const i=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?Hs.init(i(this.modules.logger),this.options):Hs.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=n3;const x=new o1(this.options);this.store=new i1(this.options.resources,this.options);const y=this.services;y.logger=Hs,y.resourceStore=this.store,y.languageUtils=x,y.pluralResolver=new t3(x,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(y.formatter=i(p),y.formatter.init&&y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new f1(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new i3(i(this.modules.backend),y.resourceStore,y,this.options),y.backendConnector.on("*",(k,...T)=>{this.emit(k,...T)}),this.modules.languageDetector&&(y.languageDetector=i(this.modules.languageDetector),y.languageDetector.init&&y.languageDetector.init(y,this.options.detection,this.options)),this.modules.i18nFormat&&(y.i18nFormat=i(this.modules.i18nFormat),y.i18nFormat.init&&y.i18nFormat.init(this)),this.translator=new yf(this.services,this.options),this.translator.on("*",(k,...T)=>{this.emit(k,...T)}),this.modules.external.forEach(k=>{k.init&&k.init(this)})}if(this.format=this.options.interpolation.format,a||(a=Zu),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=(...x)=>this.store[p](...x)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...x)=>(this.store[p](...x),this)});const f=Id(),g=()=>{const p=(x,y)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),f.resolve(y),a(x,y)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?g():setTimeout(g,0),f}loadResources(t,a=Zu){var d,c;let s=a;const i=Wt(t)?t:this.language;if(typeof t=="function"&&(s=t),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const f=[],g=p=>{if(!p||p==="cimode")return;this.services.languageUtils.toResolveHierarchy(p).forEach(y=>{y!=="cimode"&&f.indexOf(y)<0&&f.push(y)})};i?g(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(x=>g(x)),(c=(d=this.options.preload)==null?void 0:d.forEach)==null||c.call(d,p=>g(p)),this.services.backendConnector.load(f,this.options.ns,p=>{!p&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(p)})}else s(null)}reloadResources(t,a,s){const i=Id();return typeof t=="function"&&(s=t,t=void 0),typeof a=="function"&&(s=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),s||(s=Zu),this.services.backendConnector.reload(t,a,d=>{i.resolve(),s(d)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&e_.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let a=0;a<this.languages.length;a++){const s=this.languages[a];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const s=Id();this.emit("languageChanging",t);const i=f=>{this.language=f,this.languages=this.services.languageUtils.toResolveHierarchy(f),this.resolvedLanguage=void 0,this.setResolvedLanguage(f)},d=(f,g)=>{g?this.isLanguageChangingTo===t&&(i(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,s.resolve((...p)=>this.t(...p)),a&&a(f,(...p)=>this.t(...p))},c=f=>{var x,y;!t&&!f&&this.services.languageDetector&&(f=[]);const g=Wt(f)?f:f&&f[0],p=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(Wt(f)?[f]:f);p&&(this.language||i(p),this.translator.language||this.translator.changeLanguage(p),(y=(x=this.services.languageDetector)==null?void 0:x.cacheUserLanguage)==null||y.call(x,p)),this.loadResources(p,_=>{d(_,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(t),s}getFixedT(t,a,s){const i=(d,c,...f)=>{let g;typeof c!="object"?g=this.options.overloadTranslationOptionHandler([d,c].concat(f)):g=ie({},c),g.lng=g.lng||i.lng,g.lngs=g.lngs||i.lngs,g.ns=g.ns||i.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||s||i.keyPrefix);const p=this.options.keySeparator||".";let x;return g.keyPrefix&&Array.isArray(d)?x=d.map(y=>(typeof y=="function"&&(y=Rg(y,ie(ie({},this.options),c))),`${g.keyPrefix}${p}${y}`)):(typeof d=="function"&&(d=Rg(d,ie(ie({},this.options),c))),x=g.keyPrefix?`${g.keyPrefix}${p}${d}`:d),this.t(x,g)};return Wt(t)?i.lng=t:i.lngs=t,i.ns=a,i.keyPrefix=s,i}t(...t){var a;return(a=this.translator)==null?void 0:a.translate(...t)}exists(...t){var a;return(a=this.translator)==null?void 0:a.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=a.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,d=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const c=(f,g)=>{const p=this.services.backendConnector.state[`${f}|${g}`];return p===-1||p===0||p===2};if(a.precheck){const f=a.precheck(this,c);if(f!==void 0)return f}return!!(this.hasResourceBundle(s,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(s,t)&&(!i||c(d,t)))}loadNamespaces(t,a){const s=Id();return this.options.ns?(Wt(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),a&&a(i)}),s):(a&&a(),Promise.resolve())}loadLanguages(t,a){const s=Id();Wt(t)&&(t=[t]);const i=this.options.preload||[],d=t.filter(c=>i.indexOf(c)<0&&this.services.languageUtils.isSupportedCode(c));return d.length?(this.options.preload=i.concat(d),this.loadResources(c=>{s.resolve(),a&&a(c)}),s):(a&&a(),Promise.resolve())}dir(t){var i,d;if(t||(t=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const c=new Intl.Locale(t);if(c&&c.getTextInfo){const f=c.getTextInfo();if(f&&f.direction)return f.direction}}catch(c){}const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=((d=this.services)==null?void 0:d.languageUtils)||new o1(m1());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.indexOf(s.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){const s=new Gd(t,a);return s.createInstance=Gd.createInstance,s}cloneInstance(t={},a=Zu){const s=t.forkResourceStore;s&&delete t.forkResourceStore;const i=Ee(ie(ie({},this.options),t),{isClone:!0}),d=new Gd(i);if((t.debug!==void 0||t.prefix!==void 0)&&(d.logger=d.logger.clone(t)),["store","services","language"].forEach(f=>{d[f]=this[f]}),d.services=ie({},this.services),d.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},s){const f=Object.keys(this.store.data).reduce((g,p)=>(g[p]=ie({},this.store.data[p]),g[p]=Object.keys(g[p]).reduce((x,y)=>(x[y]=ie({},g[p][y]),x),g[p]),g),{});d.store=new i1(f,i),d.services.resourceStore=d.store}return t.interpolation&&(d.services.interpolator=new f1(i)),d.translator=new yf(d.services,i),d.translator.on("*",(f,...g)=>{d.emit(f,...g)}),d.init(i,a),d.translator.options=i,d.translator.backendConnector.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},d}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Nr=Gd.createInstance();Nr.createInstance;Nr.dir;Nr.init;Nr.loadResources;Nr.reloadResources;Nr.use;Nr.changeLanguage;Nr.getFixedT;Nr.t;Nr.exists;Nr.setDefaultNamespace;Nr.hasLoadedNamespace;Nr.loadNamespaces;Nr.loadLanguages;const o3=(e,t,a,s)=>{var d,c,f,g;const i=[a,ie({code:t},s||{})];if((c=(d=e==null?void 0:e.services)==null?void 0:d.logger)!=null&&c.forward)return e.services.logger.forward(i,"warn","react-i18next::",!0);no(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),(g=(f=e==null?void 0:e.services)==null?void 0:f.logger)!=null&&g.warn?e.services.logger.warn(...i):console!=null&&console.warn&&console.warn(...i)},p1={},a_=(e,t,a,s)=>{no(a)&&p1[a]||(no(a)&&(p1[a]=new Date),o3(e,t,a,s))},r_=(e,t)=>()=>{if(e.isInitialized)t();else{const a=()=>{setTimeout(()=>{e.off("initialized",a)},0),t()};e.on("initialized",a)}},Fg=(e,t,a)=>{e.loadNamespaces(t,r_(e,a))},x1=(e,t,a,s)=>{if(no(a)&&(a=[a]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Fg(e,a,s);a.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,r_(e,s))},c3=(e,t,a={})=>!t.languages||!t.languages.length?(a_(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:a.lng,precheck:(s,i)=>{if(a.bindI18n&&a.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,e))return!1}}),no=e=>typeof e=="string",d3=e=>typeof e=="object"&&e!==null,u3=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,f3={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},h3=e=>f3[e],m3=e=>e.replace(u3,h3);let Ig={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:m3};const g3=(e={})=>{Ig=ie(ie({},Ig),e)},p3=()=>Ig;let n_;const x3=e=>{n_=e},y3=()=>n_,b3={type:"3rdParty",init(e){g3(e.options.react),x3(e)}},v3=j.createContext();class _3{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var gg={exports:{}},pg={};var y1;function w3(){if(y1)return pg;y1=1;var e=Bf();function t(y,_){return y===_&&(y!==0||1/y===1/_)||y!==y&&_!==_}var a=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,d=e.useLayoutEffect,c=e.useDebugValue;function f(y,_){var k=_(),T=s({inst:{value:k,getSnapshot:_}}),N=T[0].inst,S=T[1];return d(function(){N.value=k,N.getSnapshot=_,g(N)&&S({inst:N})},[y,k,_]),i(function(){return g(N)&&S({inst:N}),y(function(){g(N)&&S({inst:N})})},[y]),c(k),k}function g(y){var _=y.getSnapshot;y=y.value;try{var k=_();return!a(y,k)}catch(T){return!0}}function p(y,_){return _()}var x=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?p:f;return pg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,pg}var b1;function k3(){return b1||(b1=1,gg.exports=w3()),gg.exports}var N3=k3();const j3=(e,t)=>no(t)?t:d3(t)&&no(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,S3={t:j3,ready:!1},T3=()=>()=>{},Qa=(e,t={})=>{var Y,ue,xe;const{i18n:a}=t,{i18n:s,defaultNS:i}=j.useContext(v3)||{},d=a||s||y3();d&&!d.reportNamespaces&&(d.reportNamespaces=new _3),d||a_(d,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const c=j.useMemo(()=>{var le;return ie(ie(ie({},p3()),(le=d==null?void 0:d.options)==null?void 0:le.react),t)},[d,t]),{useSuspense:f,keyPrefix:g}=c,p=i||((Y=d==null?void 0:d.options)==null?void 0:Y.defaultNS),x=no(p)?[p]:p||["translation"],y=j.useMemo(()=>x,x);(xe=(ue=d==null?void 0:d.reportNamespaces)==null?void 0:ue.addUsedNamespaces)==null||xe.call(ue,y);const _=j.useRef(0),k=j.useCallback(le=>{if(!d)return T3;const{bindI18n:ge,bindI18nStore:be}=c,me=()=>{_.current+=1,le()};return ge&&d.on(ge,me),be&&d.store.on(be,me),()=>{ge&&ge.split(" ").forEach(ae=>d.off(ae,me)),be&&be.split(" ").forEach(ae=>d.store.off(ae,me))}},[d,c]),T=j.useRef(),N=j.useCallback(()=>{if(!d)return S3;const le=!!(d.isInitialized||d.initializedStoreOnce)&&y.every(K=>c3(K,d,c)),ge=t.lng||d.language,be=_.current,me=T.current;if(me&&me.ready===le&&me.lng===ge&&me.keyPrefix===g&&me.revision===be)return me;const Z={t:d.getFixedT(ge,c.nsMode==="fallback"?y:y[0],g),ready:le,lng:ge,keyPrefix:g,revision:be};return T.current=Z,Z},[d,y,g,c,t.lng]),[S,O]=j.useState(0),{t:C,ready:A}=N3.useSyncExternalStore(k,N,N);j.useEffect(()=>{if(d&&!A&&!f){const le=()=>O(ge=>ge+1);t.lng?x1(d,t.lng,y,le):Fg(d,y,le)}},[d,t.lng,y,A,f,S]);const P=d||{},I=j.useRef(null),ee=j.useRef(),B=le=>{const ge=Object.getOwnPropertyDescriptors(le);ge.__original&&delete ge.__original;const be=Object.create(Object.getPrototypeOf(le),ge);if(!Object.prototype.hasOwnProperty.call(be,"__original"))try{Object.defineProperty(be,"__original",{value:le,writable:!1,enumerable:!1,configurable:!1})}catch(me){}return be},H=j.useMemo(()=>{const le=P,ge=le==null?void 0:le.language;let be=le;le&&(I.current&&I.current.__original===le?ee.current!==ge?(be=B(le),I.current=be,ee.current=ge):be=I.current:(be=B(le),I.current=be,ee.current=ge));const me=[C,be,A];return me.t=C,me.i18n=be,me.ready=A,me},[C,P,A,P.resolvedLanguage,P.language,P.languages]);if(d&&f&&!A)throw new Promise(le=>{const ge=()=>le();t.lng?x1(d,t.lng,y,ge):Fg(d,y,ge)});return H},{slice:E3,forEach:C3}=[];function A3(e){return C3.call(E3.call(arguments,1),t=>{if(t)for(const a in t)e[a]===void 0&&(e[a]=t[a])}),e}function O3(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(a=>a.test(e))}const v1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,M3=function(e,t){const s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},i=encodeURIComponent(t);let d=`${e}=${i}`;if(s.maxAge>0){const c=s.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");d+=`; Max-Age=${Math.floor(c)}`}if(s.domain){if(!v1.test(s.domain))throw new TypeError("option domain is invalid");d+=`; Domain=${s.domain}`}if(s.path){if(!v1.test(s.path))throw new TypeError("option path is invalid");d+=`; Path=${s.path}`}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");d+=`; Expires=${s.expires.toUTCString()}`}if(s.httpOnly&&(d+="; HttpOnly"),s.secure&&(d+="; Secure"),s.sameSite)switch(typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite){case!0:d+="; SameSite=Strict";break;case"lax":d+="; SameSite=Lax";break;case"strict":d+="; SameSite=Strict";break;case"none":d+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s.partitioned&&(d+="; Partitioned"),d},_1={create(e,t,a,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};a&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+a*60*1e3)),s&&(i.domain=s),document.cookie=M3(e,t,i)},read(e){const t=`${e}=`,a=document.cookie.split(";");for(let s=0;s<a.length;s++){let i=a[s];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return i.substring(t.length,i.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var L3={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document!="undefined")return _1.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:a,cookieMinutes:s,cookieDomain:i,cookieOptions:d}=t;a&&typeof document!="undefined"&&_1.create(a,e,s,i,d)}},D3={name:"querystring",lookup(e){var s;let{lookupQuerystring:t}=e,a;if(typeof window!="undefined"){let{search:i}=window.location;!window.location.search&&((s=window.location.hash)==null?void 0:s.indexOf("?"))>-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));const c=i.substring(1).split("&");for(let f=0;f<c.length;f++){const g=c[f].indexOf("=");g>0&&c[f].substring(0,g)===t&&(a=c[f].substring(g+1))}}return a}},P3={name:"hash",lookup(e){var i;let{lookupHash:t,lookupFromHashIndex:a}=e,s;if(typeof window!="undefined"){const{hash:d}=window.location;if(d&&d.length>2){const c=d.substring(1);if(t){const f=c.split("&");for(let g=0;g<f.length;g++){const p=f[g].indexOf("=");p>0&&f[g].substring(0,p)===t&&(s=f[g].substring(p+1))}}if(s)return s;if(!s&&a>-1){const f=d.match(/\/([a-zA-Z-]*)/g);return Array.isArray(f)?(i=f[typeof a=="number"?a:0])==null?void 0:i.replace("/",""):void 0}}}return s}};let sc=null;const w1=()=>{if(sc!==null)return sc;try{if(sc=typeof window!="undefined"&&window.localStorage!==null,!sc)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){sc=!1}return sc};var R3={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&w1())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:a}=t;a&&w1()&&window.localStorage.setItem(a,e)}};let ic=null;const k1=()=>{if(ic!==null)return ic;try{if(ic=typeof window!="undefined"&&window.sessionStorage!==null,!ic)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){ic=!1}return ic};var F3={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&k1())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:a}=t;a&&k1()&&window.sessionStorage.setItem(a,e)}},I3={name:"navigator",lookup(e){const t=[];if(typeof navigator!="undefined"){const{languages:a,userLanguage:s,language:i}=navigator;if(a)for(let d=0;d<a.length;d++)t.push(a[d]);s&&t.push(s),i&&t.push(i)}return t.length>0?t:void 0}},z3={name:"htmlTag",lookup(e){let{htmlTag:t}=e,a;const s=t||(typeof document!="undefined"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(a=s.getAttribute("lang")),a}},B3={name:"path",lookup(e){var i;let{lookupFromPathIndex:t}=e;if(typeof window=="undefined")return;const a=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?(i=a[typeof t=="number"?t:0])==null?void 0:i.replace("/",""):void 0}},U3={name:"subdomain",lookup(e){var i,d;let{lookupFromSubdomainIndex:t}=e;const a=typeof t=="number"?t+1:1,s=typeof window!="undefined"&&((d=(i=window.location)==null?void 0:i.hostname)==null?void 0:d.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(s)return s[a]}};let s_=!1;try{document.cookie,s_=!0}catch(e){}const i_=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];s_||i_.splice(1,1);const H3=()=>({order:i_,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class l_{constructor(t){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,a)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=A3(a,this.options||{},H3()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(L3),this.addDetector(D3),this.addDetector(R3),this.addDetector(F3),this.addDetector(I3),this.addDetector(z3),this.addDetector(B3),this.addDetector(U3),this.addDetector(P3)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,a=[];return t.forEach(s=>{if(this.detectors[s]){let i=this.detectors[s].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(a=a.concat(i))}}),a=a.filter(s=>s!=null&&!O3(s)).map(s=>this.options.convertDetectedLanguage(s)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?a:a.length>0?a[0]:null}cacheUserLanguage(t){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;a&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||a.forEach(s=>{this.detectors[s]&&this.detectors[s].cacheUserLanguage(t,this.options)}))}}l_.type="languageDetector";const $3={dashboard:"Dashboard",assets:"Assets",workOrders:"Work Orders",maintenance:"Asset Maintenance",ppm:"PPM",logout:"Logout",login:"Login",email:"Email",password:"Password",submit:"Submit",cancel:"Cancel",save:"Save",delete:"Delete",deleting:"Deleting...",edit:"Edit",create:"Create",search:"Search",filter:"Filter",export:"Export",import:"Import",loading:"Loading...",noData:"No data available",error:"Error",success:"Success",darkMode:"Dark Mode",lightMode:"Light Mode",language:"Language",english:"English",arabic:"Arabic",backToDashboard:"Back to Dashboard"},W3={title:"Seera-ASM",loggedInAs:"Logged in as:",version:"Seera-ASM v1.0",inventory:"Inventory",ppmPlanner:"PPM Planner",maintenanceCalendar:"Maintenance Calendar",activeMap:"Active Map",maintenanceTeam:"Maintenance Team",procurement:"Procurement",sla:"Service Level Agreement (SLA)",support:"Support"},V3={title:"Seera-ASM",subtitle:"Asset Management System",signIn:"Sign in to continue",emailPlaceholder:"Enter your email",passwordPlaceholder:"Enter your password",loginFailed:"Login failed. Please check your credentials.",demoLogin:"Demo Login"},G3={title:"Dashboard",loading:"Loading dashboard...",totalAssets:"TOTAL NO. OF ASSETS",openWorkOrders:"OPEN WORK ORDERS",workOrdersInProgress:"WORK ORDERS IN PROGRESS",completedWorkOrders:"COMPLETED WORK ORDERS",totalWorkOrders:"TOTAL WORK ORDERS",overdueWorkOrders:"OVERDUE WORK ORDERS",upTime:"Up Time",downTime:"Down Time",workOrderStatus:"Work Order Status",workOrderByType:"Work Order by Type",maintenanceByAsset:"Maintenance by Asset",assigneesStatus:"Assignees Status",maintenanceFrequency:"Maintenance Frequency",maintenanceLogs:"MAINTENANCE LOGS",assetUptime:"Asset Uptime",avgResponseTime:"Avg Response Time",maintenanceEfficiency:"Maintenance Efficiency",overdueMaintenance:"Overdue Maintenance",upDownTimeChart:"Up & Down Time Chart",ppmStatus:"PPM Status"},Z3={assetId:"Asset ID",assetName:"Asset Name",serialNumber:"Serial Number",company:"Company/Hospital",location:"Location",department:"Department",deviceStatus:"Device Status",modality:"Modality",manufacturer:"Manufacturer",supplier:"Supplier",assetCategory:"Asset Category",purchaseDate:"Purchase Date",purchaseAmount:"Purchase Amount",availableForUseDate:"Available For Use Date",createdOn:"Created On",modifiedOn:"Modified On",createdBy:"Created By",modifiedBy:"Modified By",workOrderId:"Work Order ID",workOrderType:"Type",status:"Status",priority:"Priority",description:"Description",assignedTo:"Assigned To",scheduledDate:"Scheduled Date",completedDate:"Completed Date",hospital:"Hospital",assetType:"Asset Type",siteName:"Site Name",assignedSupervisor:"Assigned Supervisor",assignedContractor:"Assigned Contractor",serialNumberShort:"Serial",departmentShort:"Dept",manufacturerShort:"Mfr",workOrderIdShort:"WO ID",assetShort:"Asset",typeShort:"Type",nameShort:"Name",pmId:"PM ID",name:"Name"},q3={assetId:"Asset ID",hospital:"Hospital",name:"Name",serial:"Serial",status:"Status",location:"Location",dept:"Dept",modality:"Modality",mfr:"Mfr",supplier:"Supplier",workOrderId:"WO ID",asset:"Asset",type:"Type",priority:"Priority",allHospitals:"All Hospitals",allModalities:"All Modalities",filterByCompany:"Filter by Company",allManufacturers:"All Manufacturers"},Y3={addNew:"Add New",searchPlaceholder:"Search...",noResults:"No results found",showing:"Showing",of:"of",results:"results",selectAll:"Select All",deselectAll:"Deselect All",selected:"selected",actions:"Actions",view:"View",edit:"Edit",delete:"Delete",duplicate:"Duplicate",export:"Export",print:"Print",filters:"Filters",clearFilters:"Clear filters",applyFilters:"Apply Filters",columns:"Columns",exportSelected:"Export Selected",exportAllOnPage:"Export All on Page",exportAllWithFilters:"Export All with Filters",exportFormat:"Export Format",csv:"CSV",excel:"Excel",exporting:"Exporting...",exportComplete:"Export Complete",close:"Close",loading:"Loading...",refresh:"Refresh",deselectAllTitle:"Deselect all",selectAllTitle:"Select all",typeToSearch:"Type to search...",enterFilterName:"Enter filter name",enterFilterNameExample:"Enter filter name (e.g., 'Open High Priority')",allStatuses:"All Statuses",noIssuesFound:"No issues found",createFirstIssue:"Create your first issue",saveFilterPreset:"Save Filter Preset",saveFilter:"Save Filter",filtering:"Filtering...",noMaintenanceTeamsFound:"No maintenance teams found",createFirstTeam:"Create your first team",all:"All",tryAdjustingFilters:"Try adjusting your search or filters",getStartedCreateFirst:"Get started by creating your first PPM Planner",noMaintenanceLogsFound:"No maintenance logs found",createFirstMaintenanceLog:"Create your first maintenance log",total:"Total",noPPMSchedulesFound:"No PPM schedules found",createFirstPPMSchedule:"Create your first PPM schedule"},X3={title:"Assets",addAsset:"Add New Asset",assetDetails:"Asset Details",assetInformation:"Asset Information",newAsset:"New Asset",duplicateAsset:"Duplicate Asset",fromAsset:"From Asset",creatingFromAsset:"Creating Work Order from Asset",assetInfoPrefilled:"Asset information prefilled from",pleaseSelectWorkOrderType:"Please select a Work Order type and add any additional details",loadingAssetDetails:"Loading asset details...",pleaseEnterAssetName:"Please enter an Asset Name",pleaseSelectCategory:"Please select a Category",assetDuplicatedSuccessfully:"Asset duplicated successfully!",assetCreatedSuccessfully:"Asset created successfully!",assetUpdatedSuccessfully:"Asset updated successfully!",sourceAssetNotFound:"Source Asset Not Found",assetNotFoundMessage:"The asset you're trying to duplicate could not be found.",backToAssetsList:"Back to Assets List",newAssetDetails:"New Asset Details",noAssetsFound:"No assets found",createFirstAsset:"Create your first asset"},J3={title:"Work Orders",addWorkOrder:"Add New Work Order",workOrderDetails:"Work Order Details",newWorkOrder:"New Work Order",duplicateWorkOrder:"Duplicate Work Order",createFromAsset:"Create Work Order from Asset"},K3={title:"Asset Maintenance",maintenanceLogs:"Maintenance Logs",maintenanceDetails:"Maintenance Details",addMaintenance:"Add New Maintenance",maintenanceTeam:"Maintenance Team",newMaintenanceTeam:"New Maintenance Team",teamId:"Team ID",teamName:"Team Name",managerEmail:"Manager Email",managerName:"Manager Name",expertise:"Expertise",selectTeam:"Select Team",viewDetails:"View Details",editTeam:"Edit Team",duplicateTeam:"Duplicate Team",deleteTeam:"Delete Team",selectHospital:"Select Hospital",selectExpertise:"Select Expertise",selectManager:"Select Manager",enterTeamName:"Enter Team Name",teamInformation:"Team Information",selectUser:"Select User",selectRole:"Select Role",totalMembers:"Total Members",teamSummary:"Team Summary",addFirstMember:"Add First Member",manager:"Maintenance Manager"},Q3={title:"PPM",ppmDetails:"PPM Details",addPPM:"Add New PPM",periodicity:"Periodicity",dueDate:"Due Date",manageSchedules:"Manage PM Schedules",pmId:"PM ID",name:"Name",manufacturer:"Manufacturer"},eN={title:"Export",whatToExport:"What to Export",selectedRows:"Selected Rows",currentPage:"Current Page",allWithFilters:"All with Filters",exportSelected:"Export {count} selected",exportPage:"Export {count} on current page",exportAll:"Export all {count}",columnsToExport:"Columns to Export",selectAll:"Select All",selectDefault:"Select Default",exporting:"Exporting...",exportingSelected:"Exporting {count} selected row(s)",exportingPage:"Exporting {count} row(s) from current page",exportingAll:"Exporting all {count} row(s)",selected:"selected",rows:"rows"},tN={title:"Items",itemDetails:"Item Details",newItem:"New Item",addItem:"Add New Item",itemId:"Item ID",itemCode:"Item Code",itemName:"Item Name",itemGroup:"Item Group",stockUOM:"Stock UOM",partDescription:"Part Description",brand:"Brand",valuationRate:"Valuation Rate",openingStock:"Opening Stock",lastCalibrationDate:"Last Calibration Date",nextCalibrationDate:"Next Calibration Date",selectItem:"Select Item",selectItemGroup:"Select Item Group",selectHospital:"Select Hospital",viewDetails:"View Details",editItem:"Edit Item",duplicateItem:"Duplicate Item",deleteItem:"Delete Item",basicInformation:"Basic Information",stockInformation:"Stock Information",isStockItem:"Is Stock Item",balanceQty:"Balance Qty",calibrationInformation:"Calibration Information",additionalInformation:"Additional Information",refreshBalanceQty:"Refresh Balance Qty",warrantyMonths:"Warranty (Months)"},aN={title:"Issues",issueDetails:"Issue Details",newIssue:"New Issue",addIssue:"Add New Issue",issueId:"Issue ID",subject:"Subject",raisedBy:"Raised By",contact:"Contact",issueType:"Issue Type",openingDate:"Opening Date",resolutionDate:"Resolution Date",resolvedBy:"Resolved By",firstRespondedOn:"First Responded On",resolutionDetails:"Resolution Details",selectIssue:"Select Issue",allPriorities:"All Priorities",allCompanies:"All Companies",viewDetails:"View Details",editIssue:"Edit Issue",deleteIssue:"Delete Issue",enterSubject:"Enter issue subject",selectPriority:"Select priority",selectIssueType:"Select issue type",describeIssue:"Describe the issue in detail...",contactInformation:"Contact Information",createNewIssue:"Create a new support issue",resolution:"Resolution",describeResolution:"Describe how the issue was resolved...",selectCompany:"Select company",statusInformation:"Status Information",currentStatus:"Current Status",timeline:"Timeline"},rN={title:"Users",userDetails:"User Details",newUser:"New User",addUser:"Add New User",searchUsers:"Search users...",manageUsers:"Manage user accounts and permissions",noUsersFound:"No users found",tryAdjustingSearch:"Try adjusting your search terms.",noUsersAvailable:"No users available.",backToDashboard:"Back to Dashboard"},nN={title:"Events",eventDetails:"Event Details",newEvent:"New Event",addEvent:"Add New Event",upcomingEvents:"Upcoming Events",eventsFromFrappe:"Events from your Frappe backend",noEventsFound:"No events found",noEventsScheduled:"No events are currently scheduled.",refreshEvents:"Refresh Events"},sN={common:$3,sidebar:W3,login:V3,dashboard:G3,commonFields:Z3,filters:q3,listPages:Y3,assets:X3,workOrders:J3,maintenance:K3,ppm:Q3,exportModal:eN,items:tN,issues:aN,users:rN,events:nN},iN={dashboard:"لوحة التحكم",assets:"الأصول",workOrders:"أوامر العمل",maintenance:"صيانة الأصول",ppm:"الصيانة الوقائية",logout:"تسجيل الخروج",login:"تسجيل الدخول",email:"البريد الإلكتروني",password:"كلمة المرور",submit:"إرسال",cancel:"إلغاء",save:"حفظ",delete:"حذف",edit:"تعديل",create:"إنشاء",search:"بحث",filter:"تصفية",export:"تصدير",import:"استيراد",loading:"جاري التحميل...",noData:"لا توجد بيانات",error:"خطأ",success:"نجح",darkMode:"الوضع الداكن",lightMode:"الوضع الفاتح",language:"اللغة",english:"الإنجليزية",arabic:"العربية"},lN={title:"أصول سيرا",loggedInAs:"تم تسجيل الدخول كـ:",version:"أصول سيرا نظام إدارة الأصول الإصدار 1.0"},oN={title:"أصول سيرا",subtitle:"نظام إدارة الأصول",signIn:"قم بتسجيل الدخول للمتابعة",emailPlaceholder:"أدخل بريدك الإلكتروني",passwordPlaceholder:"أدخل كلمة المرور",loginFailed:"فشل تسجيل الدخول. يرجى التحقق من بيانات الاعتماد الخاصة بك.",demoLogin:"تسجيل دخول تجريبي"},cN={title:"لوحة التحكم",loading:"جاري تحميل لوحة التحكم...",totalAssets:"إجمالي عدد الأصول",openWorkOrders:"أوامر العمل المفتوحة",workOrdersInProgress:"أوامر العمل قيد التنفيذ",completedWorkOrders:"أوامر العمل المكتملة",totalWorkOrders:"إجمالي أوامر العمل",overdueWorkOrders:"أوامر العمل المتأخرة",upTime:"وقت التشغيل",downTime:"وقت التوقف",workOrderStatus:"حالة أمر العمل",workOrderByType:"أمر العمل حسب النوع",maintenanceByAsset:"الصيانة حسب الأصل",assigneesStatus:"حالة المكلفين",maintenanceFrequency:"تكرار الصيانة",maintenanceLogs:"سجلات الصيانة",assetUptime:"وقت تشغيل الأصل",avgResponseTime:"متوسط وقت الاستجابة",maintenanceEfficiency:"كفاءة الصيانة",overdueMaintenance:"صيانة متأخرة",upDownTimeChart:"مخطط وقت التشغيل والتوقف",ppmStatus:"حالة الصيانة الوقائية"},dN={assetId:"معرف الأصل",assetName:"اسم الأصل",serialNumber:"الرقم التسلسلي",company:"الشركة/المستشفى",location:"الموقع",department:"القسم",deviceStatus:"حالة الجهاز",modality:"الطريقة",manufacturer:"الشركة المصنعة",supplier:"المورد",assetCategory:"فئة الأصل",purchaseDate:"تاريخ الشراء",purchaseAmount:"مبلغ الشراء",availableForUseDate:"تاريخ التوفر للاستخدام",createdOn:"تم الإنشاء في",modifiedOn:"تم التعديل في",createdBy:"تم الإنشاء بواسطة",modifiedBy:"تم التعديل بواسطة",workOrderId:"معرف أمر العمل",workOrderType:"النوع",status:"الحالة",priority:"الأولوية",description:"الوصف",assignedTo:"مكلف إلى",scheduledDate:"التاريخ المجدول",completedDate:"تاريخ الإكمال"},uN={addNew:"إضافة جديد",searchPlaceholder:"بحث...",noResults:"لم يتم العثور على نتائج",showing:"عرض",of:"من",results:"نتائج",selectAll:"تحديد الكل",deselectAll:"إلغاء تحديد الكل",selected:"محدد",actions:"الإجراءات",view:"عرض",edit:"تعديل",delete:"حذف",duplicate:"نسخ",export:"تصدير",print:"طباعة",filters:"المرشحات",clearFilters:"مسح المرشحات",applyFilters:"تطبيق المرشحات",columns:"الأعمدة",exportSelected:"تصدير المحدد",exportAllOnPage:"تصدير الكل في الصفحة",exportAllWithFilters:"تصدير الكل مع المرشحات",exportFormat:"تنسيق التصدير",csv:"CSV",excel:"Excel",exporting:"جاري التصدير...",exportComplete:"اكتمل التصدير",close:"إغلاق",loading:"جاري التحميل...",refresh:"تحديث"},fN={title:"الأصول",addAsset:"إضافة أصل جديد",assetDetails:"تفاصيل الأصل"},hN={title:"أوامر العمل",addWorkOrder:"إضافة أمر عمل جديد",workOrderDetails:"تفاصيل أمر العمل",newWorkOrder:"أمر عمل جديد",duplicateWorkOrder:"نسخ أمر العمل",createFromAsset:"إنشاء أمر عمل من الأصل"},mN={title:"صيانة الأصول",maintenanceLogs:"سجلات الصيانة",maintenanceDetails:"تفاصيل الصيانة",addMaintenance:"إضافة صيانة جديدة"},gN={title:"الصيانة الوقائية",ppmDetails:"تفاصيل الصيانة الوقائية",addPPM:"إضافة صيانة وقائية جديدة"},pN={title:"تصدير",whatToExport:"ما الذي سيتم تصديره",selectedRows:"الصفوف المحددة",currentPage:"الصفحة الحالية",allWithFilters:"الكل مع المرشحات",exportSelected:"تصدير {count} محدد",exportPage:"تصدير {count} في الصفحة الحالية",exportAll:"تصدير الكل {count}",columnsToExport:"الأعمدة للتصدير",selectAll:"تحديد الكل",selectDefault:"تحديد الافتراضي",exporting:"جاري التصدير...",exportingSelected:"جاري تصدير {count} صف(وف) محدد(ة)",exportingPage:"جاري تصدير {count} صف(وف) من الصفحة الحالية",exportingAll:"جاري تصدير جميع {count} صف(وف)",selected:"محدد",rows:"صفوف"},xN={common:iN,sidebar:lN,login:oN,dashboard:cN,commonFields:dN,listPages:uN,assets:fN,workOrders:hN,maintenance:mN,ppm:gN,exportModal:pN},Bt={BASE_URL:"https://imanrdh-seeraasm.seeraarabia.com",ENDPOINTS:{USER_DETAILS:"/api/method/asset_lite.api.custom_api.get_user_details",DOCTYPE_RECORDS:"/api/method/asset_lite.api.custom_api.get_doctype_records",DASHBOARD_STATS:"/api/method/asset_lite.api.custom_api.get_dashboard_stats",DASHBOARD_NUMBER_CARDS:"/api/method/asset_lite.api.dashboard_api.get_number_cards",DASHBOARD_LIST_CHARTS:"/api/method/asset_lite.api.dashboard_api.list_dashboard_charts",DASHBOARD_CHART_DATA:"/api/method/asset_lite.api.dashboard_api.get_dashboard_chart_data",DASHBOARD_REPAIR_COST:"/api/method/asset_lite.api.dashboard_api.get_repair_cost_by_item",KYC_DETAILS:"/api/method/asset_lite.api.custom_api.get_kyc_details",GET_ASSETS:"/api/method/asset_lite.api.asset_api.get_assets",GET_ASSET_DETAILS:"/api/method/asset_lite.api.asset_api.get_asset_details",CREATE_ASSET:"/api/method/asset_lite.api.asset_api.create_asset",UPDATE_ASSET:"/api/method/asset_lite.api.asset_api.update_asset",DELETE_ASSET:"/api/method/asset_lite.api.asset_api.delete_asset",GET_ASSET_FILTERS:"/api/method/asset_lite.api.asset_api.get_asset_filters",GET_ASSET_STATS:"/api/method/asset_lite.api.asset_api.get_asset_stats",SEARCH_ASSETS:"/api/method/asset_lite.api.asset_api.search_assets",SUBMIT_ASSET:"/api/method/asset_lite.api.asset_api.submit_asset",CANCEL_ASSET:"/api/method/asset_lite.api.asset_api.cancel_asset",GET_WORK_ORDERS:"/api/method/asset_lite.api.work_order_api.get_work_orders",GET_WORK_ORDER_DETAILS:"/api/method/asset_lite.api.work_order_api.get_work_order_details",CREATE_WORK_ORDER:"/api/method/asset_lite.api.work_order_api.create_work_order",UPDATE_WORK_ORDER:"/api/method/asset_lite.api.work_order_api.update_work_order",DELETE_WORK_ORDER:"/api/method/asset_lite.api.work_order_api.delete_work_order",UPDATE_WORK_ORDER_STATUS:"/api/method/asset_lite.api.work_order_api.update_work_order_status",GET_ASSET_MAINTENANCE_LOGS:"/api/method/asset_lite.api.asset_maintenance_api.get_asset_maintenance_logs",GET_ASSET_MAINTENANCE_LOG_DETAILS:"/api/method/asset_lite.api.asset_maintenance_api.get_asset_maintenance_log_details",CREATE_ASSET_MAINTENANCE_LOG:"/api/method/asset_lite.api.asset_maintenance_api.create_asset_maintenance_log",UPDATE_ASSET_MAINTENANCE_LOG:"/api/method/asset_lite.api.asset_maintenance_api.update_asset_maintenance_log",DELETE_ASSET_MAINTENANCE_LOG:"/api/method/asset_lite.api.asset_maintenance_api.delete_asset_maintenance_log",UPDATE_MAINTENANCE_STATUS:"/api/method/asset_lite.api.asset_maintenance_api.update_maintenance_status",GET_MAINTENANCE_LOGS_BY_ASSET:"/api/method/asset_lite.api.asset_maintenance_api.get_maintenance_logs_by_asset",GET_OVERDUE_MAINTENANCE_LOGS:"/api/method/asset_lite.api.asset_maintenance_api.get_overdue_maintenance_logs",GET_ASSET_MAINTENANCES:"/api/method/asset_lite.api.ppm_api.get_asset_maintenances",GET_ASSET_MAINTENANCE_DETAILS:"/api/method/asset_lite.api.ppm_api.get_asset_maintenance_details",CREATE_ASSET_MAINTENANCE:"/api/method/asset_lite.api.ppm_api.create_asset_maintenance",UPDATE_ASSET_MAINTENANCE:"/api/method/asset_lite.api.ppm_api.update_asset_maintenance",DELETE_ASSET_MAINTENANCE:"/api/method/asset_lite.api.ppm_api.delete_asset_maintenance",GET_MAINTENANCE_TASKS:"/api/method/asset_lite.api.ppm_api.get_maintenance_tasks",GET_SERVICE_COVERAGE:"/api/method/asset_lite.api.ppm_api.get_service_coverage",GET_MAINTENANCES_BY_ASSET:"/api/method/asset_lite.api.ppm_api.get_maintenances_by_asset",GET_ACTIVE_SERVICE_CONTRACTS:"/api/method/asset_lite.api.ppm_api.get_active_service_contracts",LOGIN:"/api/method/login",LOGOUT:"/api/method/logout",CSRF_TOKEN:"/api/method/frappe.sessions.get_csrf_token",UPLOAD_FILE:"/api/method/upload_file",GET_USER_PERMISSIONS:"/api/method/asset_lite.api.userperm_api.get_user_permissions",GET_PERMISSION_FILTERS:"/api/method/asset_lite.api.userperm_api.get_permission_filters",GET_ALLOWED_VALUES:"/api/method/asset_lite.api.userperm_api.get_allowed_values",CHECK_DOCUMENT_ACCESS:"/api/method/asset_lite.api.userperm_api.check_document_access",GET_CONFIGURED_DOCTYPES:"/api/method/asset_lite.api.userperm_api.get_configured_doctypes",GET_USER_DEFAULTS:"/api/method/asset_lite.api.userperm_api.get_user_defaults"},DEFAULT_HEADERS:{"Content-Type":"application/json",Accept:"application/json"},TIMEOUT:parseInt("60000")};class yN{constructor(){Kn(this,"baseURL");Kn(this,"endpoints");Kn(this,"defaultHeaders");Kn(this,"timeout");this.baseURL=Bt.BASE_URL,this.endpoints=Bt.ENDPOINTS,this.defaultHeaders=Bt.DEFAULT_HEADERS,this.timeout=Bt.TIMEOUT}getCSRFToken(){return oe(this,null,function*(){try{if(typeof window!="undefined"&&window.csrf_token)return window.csrf_token;if(!localStorage.getItem("user"))return null;const a=yield fetch(`${this.baseURL}${this.endpoints.CSRF_TOKEN}`,{method:"GET",headers:{Accept:"application/json"},credentials:"include"});return a.ok&&(yield a.json()).message||null}catch(t){return null}})}apiCall(s){return oe(this,arguments,function*(t,a={}){const i=`${this.baseURL}${t}`,d=ie({method:"GET",headers:ie(ie({},this.defaultHeaders),a.headers)},a),c=yield this.getCSRFToken();c&&(d.headers["X-Frappe-CSRF-Token"]=c);try{const f=new AbortController,g=setTimeout(()=>f.abort(),this.timeout),p=yield fetch(i,Ee(ie({},d),{signal:f.signal}));if(clearTimeout(g),!p.ok){const y=yield p.json().catch(()=>({}));throw new Kl(y.error||`HTTP error! status: ${p.status}`,p.status)}const x=yield p.json();return x.message!==void 0?x.message:x}catch(f){throw f instanceof Error?(console.error("API call failed:",f),new Kl(f.message)):f}})}login(t){return oe(this,null,function*(){const a=new FormData;a.append("usr",t.email),a.append("pwd",t.password);const s=`${this.baseURL}${this.endpoints.LOGIN}`;try{const i=new AbortController,d=setTimeout(()=>i.abort(),this.timeout),c=yield fetch(s,{method:"POST",headers:{Accept:"application/json"},body:a,credentials:"include",signal:i.signal});if(clearTimeout(d),!c.ok){const g=yield c.json().catch(()=>({})),p="Invalid credentials. Please try again.";throw new Kl(p,c.status)}const f=yield c.json();return typeof f.message=="string"&&f.message==="Logged In"?{message:{full_name:f.full_name,user_id:f.user||f.email,home_page:f.home_page,sid:f.sid}}:f.message&&typeof f.message=="object"?{message:f.message}:f.full_name||f.user?{message:f}:{message:f}}catch(i){throw i instanceof Error?new Kl("Login failed. Please try again."):i}})}logout(){return oe(this,null,function*(){yield this.apiCall(this.endpoints.LOGOUT,{method:"POST"})})}getUserDetails(t){return oe(this,null,function*(){const a=t?`?user_id=${t}`:"";return this.apiCall(`${this.endpoints.USER_DETAILS}${a}`)})}getDoctypeRecords(t,a,s,i=20,d=0){return oe(this,null,function*(){const c=new URLSearchParams({doctype:t,limit:i.toString(),offset:d.toString()});return a&&c.append("filters",JSON.stringify(a)),s&&c.append("fields",JSON.stringify(s)),this.apiCall(`${this.endpoints.DOCTYPE_RECORDS}?${c}`)})}getDashboardStats(){return oe(this,null,function*(){return this.apiCall(this.endpoints.DASHBOARD_STATS)})}getNumberCards(){return oe(this,null,function*(){return this.apiCall(this.endpoints.DASHBOARD_NUMBER_CARDS)})}listDashboardCharts(t=!0){return oe(this,null,function*(){const a=new URLSearchParams({public_only:t?"1":"0"});return this.apiCall(`${this.endpoints.DASHBOARD_LIST_CHARTS}?${a}`)})}getDashboardChartData(t,a){return oe(this,null,function*(){const s=new URLSearchParams({chart_name:t});return a&&s.append("report_filters",JSON.stringify(a)),this.apiCall(`${this.endpoints.DASHBOARD_CHART_DATA}?${s}`)})}getKycDetails(){return oe(this,null,function*(){return this.apiCall(this.endpoints.KYC_DETAILS)})}uploadFile(t){return oe(this,null,function*(){const a=new FormData;return a.append("file",t.file),a.append("doctype",t.doctype),a.append("docname",t.docname),a.append("fieldname",t.fieldname),this.apiCall(this.endpoints.UPLOAD_FILE,{method:"POST",headers:{},body:a})})}getUserPermissions(t){return oe(this,null,function*(){const a=t?`?user=${encodeURIComponent(t)}`:"";return this.apiCall(`${this.endpoints.GET_USER_PERMISSIONS}${a}`)})}getPermissionFilters(t,a){return oe(this,null,function*(){const s=new URLSearchParams({target_doctype:t});return a&&s.append("user",a),this.apiCall(`${this.endpoints.GET_PERMISSION_FILTERS}?${s}`)})}getAllowedValues(t,a){return oe(this,null,function*(){const s=new URLSearchParams({allow_doctype:t});return a&&s.append("user",a),this.apiCall(`${this.endpoints.GET_ALLOWED_VALUES}?${s}`)})}checkDocumentAccess(t,a,s){return oe(this,null,function*(){const i=new URLSearchParams({doctype:t,docname:a});return s&&i.append("user",s),this.apiCall(`${this.endpoints.CHECK_DOCUMENT_ACCESS}?${i}`)})}getConfiguredDoctypes(){return oe(this,null,function*(){return this.apiCall(this.endpoints.GET_CONFIGURED_DOCTYPES)})}getUserDefaults(t){return oe(this,null,function*(){const a=t?`?user=${encodeURIComponent(t)}`:"";return this.apiCall(`${this.endpoints.GET_USER_DEFAULTS}${a}`)})}isAuthenticated(){return!!localStorage.getItem("frappe_session_id")}getSessionId(){return localStorage.getItem("frappe_session_id")}setSessionId(t){localStorage.setItem("frappe_session_id",t)}}class Kl extends Error{constructor(a,s,i){super(a);Kn(this,"status");Kn(this,"code");this.name="ApiError",this.status=s,this.code=i}}const rt=new yN,bN=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Kl,default:rt},Symbol.toStringTag,{value:"Module"}));function vN(e){return oe(this,null,function*(){try{const t=yield rt.getDoctypeRecords("Translation",{language:e},["source_text","translated_text","context"],1e4,0),a={};return t.records&&t.records.length>0&&t.records.forEach(s=>{const i=s.source_text,d=s.translated_text||i;if(s.context){const c=`${s.context}.${i}`;a[c]=d}else i.includes("."),a[i]=d}),a}catch(t){return console.error("Error fetching translations from Frappe:",t),{}}})}function _N(e){const t={};return Object.keys(e).forEach(a=>{if(a.includes(".")){const s=a.split(".");let i=t;for(let d=0;d<s.length-1;d++){const c=s[d];i[c]||(i[c]={}),i=i[c]}i[s[s.length-1]]=e[a]}else t[a]=e[a]}),t}function N1(e){return oe(this,null,function*(){const t=yield vN(e);return _N(t)})}Nr.use(l_).use(b3).init({resources:{en:{translation:sN},ar:{translation:xN}},fallbackLng:"en",defaultNS:"translation",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});function bf(){return oe(this,null,function*(){try{if(!localStorage.getItem("user"))return;const t=yield N1("en");Object.keys(t).length>0&&Nr.addResourceBundle("en","translation",t,!0,!0);const a=yield N1("ar");Object.keys(a).length>0&&Nr.addResourceBundle("ar","translation",a,!0,!0),console.log("✓ Translations loaded from Frappe")}catch(e){console.warn("⚠ Could not load translations from Frappe, using static translations:",e)}})}Nr.on("initialized",()=>{bf()});var j1="popstate";function wN(e={}){function t(s,i){let{pathname:d,search:c,hash:f}=s.location;return zg("",{pathname:d,search:c,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function a(s,i){return typeof i=="string"?i:a0(i)}return NN(t,a,null,e)}function $a(e,t){if(e===!1||e===null||typeof e=="undefined")throw new Error(t)}function Rn(e,t){if(!e){typeof console!="undefined"&&console.warn(t);try{throw new Error(t)}catch(a){}}}function kN(){return Math.random().toString(36).substring(2,10)}function S1(e,t){return{usr:e.state,key:e.key,idx:t}}function zg(e,t,a=null,s){return Ee(ie({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?jc(t):t),{state:a,key:t&&t.key||s||kN()})}function a0({pathname:e="/",search:t="",hash:a=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function jc(e){let t={};if(e){let a=e.indexOf("#");a>=0&&(t.hash=e.substring(a),e=e.substring(0,a));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function NN(e,t,a,s={}){let{window:i=document.defaultView,v5Compat:d=!1}=s,c=i.history,f="POP",g=null,p=x();p==null&&(p=0,c.replaceState(Ee(ie({},c.state),{idx:p}),""));function x(){return(c.state||{idx:null}).idx}function y(){f="POP";let S=x(),O=S==null?null:S-p;p=S,g&&g({action:f,location:N.location,delta:O})}function _(S,O){f="PUSH";let C=zg(N.location,S,O);p=x()+1;let A=S1(C,p),P=N.createHref(C);try{c.pushState(A,"",P)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(P)}d&&g&&g({action:f,location:N.location,delta:1})}function k(S,O){f="REPLACE";let C=zg(N.location,S,O);p=x();let A=S1(C,p),P=N.createHref(C);c.replaceState(A,"",P),d&&g&&g({action:f,location:N.location,delta:0})}function T(S){return jN(S)}let N={get action(){return f},get location(){return e(i,c)},listen(S){if(g)throw new Error("A history only accepts one active listener");return i.addEventListener(j1,y),g=S,()=>{i.removeEventListener(j1,y),g=null}},createHref(S){return t(i,S)},createURL:T,encodeLocation(S){let O=T(S);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:_,replace:k,go(S){return c.go(S)}};return N}function jN(e,t=!1){let a="http://localhost";typeof window!="undefined"&&(a=window.location.origin!=="null"?window.location.origin:window.location.href),$a(a,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:a0(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=a+s),new URL(s,a)}function o_(e,t,a="/"){return SN(e,t,a,!1)}function SN(e,t,a,s){let i=typeof t=="string"?jc(t):t,d=pi(i.pathname||"/",a);if(d==null)return null;let c=c_(e);TN(c);let f=null;for(let g=0;f==null&&g<c.length;++g){let p=IN(d);f=RN(c[g],p,s)}return f}function c_(e,t=[],a=[],s="",i=!1){let d=(c,f,g=i,p)=>{let x={relativePath:p===void 0?c.path||"":p,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(s)&&g)return;$a(x.relativePath.startsWith(s),`Absolute route path "${x.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(s.length)}let y=fi([s,x.relativePath]),_=a.concat(x);c.children&&c.children.length>0&&($a(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),c_(c.children,t,_,y,g)),!(c.path==null&&!c.index)&&t.push({path:y,score:DN(y,c.index),routesMeta:_})};return e.forEach((c,f)=>{var g;if(c.path===""||!((g=c.path)!=null&&g.includes("?")))d(c,f);else for(let p of d_(c.path))d(c,f,!0,p)}),t}function d_(e){let t=e.split("/");if(t.length===0)return[];let[a,...s]=t,i=a.endsWith("?"),d=a.replace(/\?$/,"");if(s.length===0)return i?[d,""]:[d];let c=d_(s.join("/")),f=[];return f.push(...c.map(g=>g===""?d:[d,g].join("/"))),i&&f.push(...c),f.map(g=>e.startsWith("/")&&g===""?"/":g)}function TN(e){e.sort((t,a)=>t.score!==a.score?a.score-t.score:PN(t.routesMeta.map(s=>s.childrenIndex),a.routesMeta.map(s=>s.childrenIndex)))}var EN=/^:[\w-]+$/,CN=3,AN=2,ON=1,MN=10,LN=-2,T1=e=>e==="*";function DN(e,t){let a=e.split("/"),s=a.length;return a.some(T1)&&(s+=LN),t&&(s+=AN),a.filter(i=>!T1(i)).reduce((i,d)=>i+(EN.test(d)?CN:d===""?ON:MN),s)}function PN(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function RN(e,t,a=!1){let{routesMeta:s}=e,i={},d="/",c=[];for(let f=0;f<s.length;++f){let g=s[f],p=f===s.length-1,x=d==="/"?t:t.slice(d.length)||"/",y=vf({path:g.relativePath,caseSensitive:g.caseSensitive,end:p},x),_=g.route;if(!y&&p&&a&&!s[s.length-1].route.index&&(y=vf({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},x)),!y)return null;Object.assign(i,y.params),c.push({params:i,pathname:fi([d,y.pathname]),pathnameBase:$N(fi([d,y.pathnameBase])),route:_}),y.pathnameBase!=="/"&&(d=fi([d,y.pathnameBase]))}return c}function vf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,s]=FN(e.path,e.caseSensitive,e.end),i=t.match(a);if(!i)return null;let d=i[0],c=d.replace(/(.)\/+$/,"$1"),f=i.slice(1);return{params:s.reduce((p,{paramName:x,isOptional:y},_)=>{if(x==="*"){let T=f[_]||"";c=d.slice(0,d.length-T.length).replace(/(.)\/+$/,"$1")}const k=f[_];return y&&!k?p[x]=void 0:p[x]=(k||"").replace(/%2F/g,"/"),p},{}),pathname:d,pathnameBase:c,pattern:e}}function FN(e,t=!1,a=!0){Rn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,g)=>(s.push({paramName:f,isOptional:g!=null}),g?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function IN(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Rn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function pi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let a=t.endsWith("/")?t.length-1:t.length,s=e.charAt(a);return s&&s!=="/"?null:e.slice(a)||"/"}var zN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,BN=e=>zN.test(e);function UN(e,t="/"){let{pathname:a,search:s="",hash:i=""}=typeof e=="string"?jc(e):e,d;if(a)if(BN(a))d=a;else{if(a.includes("//")){let c=a;a=a.replace(/\/\/+/g,"/"),Rn(!1,`Pathnames cannot have embedded double slashes - normalizing ${c} -> ${a}`)}a.startsWith("/")?d=E1(a.substring(1),"/"):d=E1(a,t)}else d=t;return{pathname:d,search:WN(s),hash:VN(i)}}function E1(e,t){let a=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?a.length>1&&a.pop():i!=="."&&a.push(i)}),a.length>1?a.join("/"):"/"}function xg(e,t,a,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function HN(e){return e.filter((t,a)=>a===0||t.route.path&&t.route.path.length>0)}function rp(e){let t=HN(e);return t.map((a,s)=>s===t.length-1?a.pathname:a.pathnameBase)}function np(e,t,a,s=!1){let i;typeof e=="string"?i=jc(e):(i=ie({},e),$a(!i.pathname||!i.pathname.includes("?"),xg("?","pathname","search",i)),$a(!i.pathname||!i.pathname.includes("#"),xg("#","pathname","hash",i)),$a(!i.search||!i.search.includes("#"),xg("#","search","hash",i)));let d=e===""||i.pathname==="",c=d?"/":i.pathname,f;if(c==null)f=a;else{let y=t.length-1;if(!s&&c.startsWith("..")){let _=c.split("/");for(;_[0]==="..";)_.shift(),y-=1;i.pathname=_.join("/")}f=y>=0?t[y]:"/"}let g=UN(i,f),p=c&&c!=="/"&&c.endsWith("/"),x=(d||c===".")&&a.endsWith("/");return!g.pathname.endsWith("/")&&(p||x)&&(g.pathname+="/"),g}var fi=e=>e.join("/").replace(/\/\/+/g,"/"),$N=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),WN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,VN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function GN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ZN(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var u_=["POST","PUT","PATCH","DELETE"];new Set(u_);var qN=["GET",...u_];new Set(qN);var Sc=j.createContext(null);Sc.displayName="DataRouter";var Hf=j.createContext(null);Hf.displayName="DataRouterState";j.createContext(!1);var f_=j.createContext({isTransitioning:!1});f_.displayName="ViewTransition";var YN=j.createContext(new Map);YN.displayName="Fetchers";var XN=j.createContext(null);XN.displayName="Await";var as=j.createContext(null);as.displayName="Navigation";var u0=j.createContext(null);u0.displayName="Location";var ks=j.createContext({outlet:null,matches:[],isDataRoute:!1});ks.displayName="Route";var sp=j.createContext(null);sp.displayName="RouteError";function JN(e,{relative:t}={}){$a(Tc(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:s}=j.useContext(as),{hash:i,pathname:d,search:c}=f0(e,{relative:t}),f=d;return a!=="/"&&(f=d==="/"?a:fi([a,d])),s.createHref({pathname:f,search:c,hash:i})}function Tc(){return j.useContext(u0)!=null}function Vs(){return $a(Tc(),"useLocation() may be used only in the context of a <Router> component."),j.useContext(u0).location}var h_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function m_(e){j.useContext(as).static||j.useLayoutEffect(e)}function Na(){let{isDataRoute:e}=j.useContext(ks);return e?dj():KN()}function KN(){$a(Tc(),"useNavigate() may be used only in the context of a <Router> component.");let e=j.useContext(Sc),{basename:t,navigator:a}=j.useContext(as),{matches:s}=j.useContext(ks),{pathname:i}=Vs(),d=JSON.stringify(rp(s)),c=j.useRef(!1);return m_(()=>{c.current=!0}),j.useCallback((g,p={})=>{if(Rn(c.current,h_),!c.current)return;if(typeof g=="number"){a.go(g);return}let x=np(g,JSON.parse(d),i,p.relative==="path");e==null&&t!=="/"&&(x.pathname=x.pathname==="/"?t:fi([t,x.pathname])),(p.replace?a.replace:a.push)(x,p.state,p)},[t,a,d,i,e])}j.createContext(null);function ul(){let{matches:e}=j.useContext(ks),t=e[e.length-1];return t?t.params:{}}function f0(e,{relative:t}={}){let{matches:a}=j.useContext(ks),{pathname:s}=Vs(),i=JSON.stringify(rp(a));return j.useMemo(()=>np(e,JSON.parse(i),s,t==="path"),[e,i,s,t])}function QN(e,t){return g_(e,t)}function g_(e,t,a,s,i){var C;$a(Tc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=j.useContext(as),{matches:c}=j.useContext(ks),f=c[c.length-1],g=f?f.params:{},p=f?f.pathname:"/",x=f?f.pathnameBase:"/",y=f&&f.route;{let A=y&&y.path||"";p_(p,!y||A.endsWith("*")||A.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${A}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
||
|
||
Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}/*`}">.`)}let _=Vs(),k;if(t){let A=typeof t=="string"?jc(t):t;$a(x==="/"||((C=A.pathname)==null?void 0:C.startsWith(x)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${x}" but pathname "${A.pathname}" was given in the \`location\` prop.`),k=A}else k=_;let T=k.pathname||"/",N=T;if(x!=="/"){let A=x.replace(/^\//,"").split("/");N="/"+T.replace(/^\//,"").split("/").slice(A.length).join("/")}let S=o_(e,{pathname:N});Rn(y||S!=null,`No routes matched location "${k.pathname}${k.search}${k.hash}" `),Rn(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${k.pathname}${k.search}${k.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let O=nj(S&&S.map(A=>Object.assign({},A,{params:Object.assign({},g,A.params),pathname:fi([x,d.encodeLocation?d.encodeLocation(A.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?x:fi([x,d.encodeLocation?d.encodeLocation(A.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathnameBase])})),c,a,s,i);return t&&O?j.createElement(u0.Provider,{value:{location:ie({pathname:"/",search:"",hash:"",state:null,key:"default"},k),navigationType:"POP"}},O):O}function ej(){let e=cj(),t=GN(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:s},d={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=j.createElement(j.Fragment,null,j.createElement("p",null,"💿 Hey developer 👋"),j.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",j.createElement("code",{style:d},"ErrorBoundary")," or"," ",j.createElement("code",{style:d},"errorElement")," prop on your route.")),j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),a?j.createElement("pre",{style:i},a):null,c)}var tj=j.createElement(ej,null),aj=class extends j.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?j.createElement(ks.Provider,{value:this.props.routeContext},j.createElement(sp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function rj({routeContext:e,match:t,children:a}){let s=j.useContext(Sc);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),j.createElement(ks.Provider,{value:e},a)}function nj(e,t=[],a=null,s=null,i=null){if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let d=e,c=a==null?void 0:a.errors;if(c!=null){let x=d.findIndex(y=>y.route.id&&(c==null?void 0:c[y.route.id])!==void 0);$a(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),d=d.slice(0,Math.min(d.length,x+1))}let f=!1,g=-1;if(a)for(let x=0;x<d.length;x++){let y=d[x];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(g=x),y.route.id){let{loaderData:_,errors:k}=a,T=y.route.loader&&!_.hasOwnProperty(y.route.id)&&(!k||k[y.route.id]===void 0);if(y.route.lazy||T){f=!0,g>=0?d=d.slice(0,g+1):d=[d[0]];break}}}let p=a&&s?(x,y)=>{var _,k,T;s(x,{location:a.location,params:(T=(k=(_=a.matches)==null?void 0:_[0])==null?void 0:k.params)!=null?T:{},unstable_pattern:ZN(a.matches),errorInfo:y})}:void 0;return d.reduceRight((x,y,_)=>{let k,T=!1,N=null,S=null;a&&(k=c&&y.route.id?c[y.route.id]:void 0,N=y.route.errorElement||tj,f&&(g<0&&_===0?(p_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,S=null):g===_&&(T=!0,S=y.route.hydrateFallbackElement||null)));let O=t.concat(d.slice(0,_+1)),C=()=>{let A;return k?A=N:T?A=S:y.route.Component?A=j.createElement(y.route.Component,null):y.route.element?A=y.route.element:A=x,j.createElement(rj,{match:y,routeContext:{outlet:x,matches:O,isDataRoute:a!=null},children:A})};return a&&(y.route.ErrorBoundary||y.route.errorElement||_===0)?j.createElement(aj,{location:a.location,revalidation:a.revalidation,component:N,error:k,children:C(),routeContext:{outlet:null,matches:O,isDataRoute:!0},onError:p}):C()},null)}function ip(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sj(e){let t=j.useContext(Sc);return $a(t,ip(e)),t}function ij(e){let t=j.useContext(Hf);return $a(t,ip(e)),t}function lj(e){let t=j.useContext(ks);return $a(t,ip(e)),t}function lp(e){let t=lj(e),a=t.matches[t.matches.length-1];return $a(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function oj(){return lp("useRouteId")}function cj(){var s;let e=j.useContext(sp),t=ij("useRouteError"),a=lp("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[a]}function dj(){let{router:e}=sj("useNavigate"),t=lp("useNavigate"),a=j.useRef(!1);return m_(()=>{a.current=!0}),j.useCallback((c,...f)=>oe(null,[c,...f],function*(i,d={}){Rn(a.current,h_),a.current&&(typeof i=="number"?yield e.navigate(i):yield e.navigate(i,ie({fromRouteId:t},d)))}),[e,t])}var C1={};function p_(e,t,a){!t&&!C1[e]&&(C1[e]=!0,Rn(!1,a))}j.memo(uj);function uj({routes:e,future:t,state:a,unstable_onError:s}){return g_(e,void 0,a,s,t)}function Bg({to:e,replace:t,state:a,relative:s}){$a(Tc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=j.useContext(as);Rn(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=j.useContext(ks),{pathname:c}=Vs(),f=Na(),g=np(e,rp(d),c,s==="path"),p=JSON.stringify(g);return j.useEffect(()=>{f(JSON.parse(p),{replace:t,state:a,relative:s})},[f,p,s,t,a]),null}function ga(e){$a(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function fj({basename:e="/",children:t=null,location:a,navigationType:s="POP",navigator:i,static:d=!1,unstable_useTransitions:c}){$a(!Tc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),g=j.useMemo(()=>({basename:f,navigator:i,static:d,unstable_useTransitions:c,future:{}}),[f,i,d,c]);typeof a=="string"&&(a=jc(a));let{pathname:p="/",search:x="",hash:y="",state:_=null,key:k="default"}=a,T=j.useMemo(()=>{let N=pi(p,f);return N==null?null:{location:{pathname:N,search:x,hash:y,state:_,key:k},navigationType:s}},[f,p,x,y,_,k,s]);return Rn(T!=null,`<Router basename="${f}"> is not able to match the URL "${p}${x}${y}" because it does not start with the basename, so the <Router> won't render anything.`),T==null?null:j.createElement(as.Provider,{value:g},j.createElement(u0.Provider,{children:t,value:T}))}function hj({children:e,location:t}){return QN(Ug(e),t)}function Ug(e,t=[]){let a=[];return j.Children.forEach(e,(s,i)=>{if(!j.isValidElement(s))return;let d=[...t,i];if(s.type===j.Fragment){a.push.apply(a,Ug(s.props.children,d));return}$a(s.type===ga,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),$a(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||d.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=Ug(s.props.children,d)),a.push(c)}),a}var df="get",uf="application/x-www-form-urlencoded";function $f(e){return typeof HTMLElement!="undefined"&&e instanceof HTMLElement}function mj(e){return $f(e)&&e.tagName.toLowerCase()==="button"}function gj(e){return $f(e)&&e.tagName.toLowerCase()==="form"}function pj(e){return $f(e)&&e.tagName.toLowerCase()==="input"}function xj(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yj(e,t){return e.button===0&&(!t||t==="_self")&&!xj(e)}function Hg(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,a)=>{let s=e[a];return t.concat(Array.isArray(s)?s.map(i=>[a,i]):[[a,s]])},[]))}function bj(e,t){let a=Hg(e);return t&&t.forEach((s,i)=>{a.has(i)||t.getAll(i).forEach(d=>{a.append(i,d)})}),a}var qu=null;function vj(){if(qu===null)try{new FormData(document.createElement("form"),0),qu=!1}catch(e){qu=!0}return qu}var _j=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function yg(e){return e!=null&&!_j.has(e)?(Rn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${uf}"`),null):e}function wj(e,t){let a,s,i,d,c;if(gj(e)){let f=e.getAttribute("action");s=f?pi(f,t):null,a=e.getAttribute("method")||df,i=yg(e.getAttribute("enctype"))||uf,d=new FormData(e)}else if(mj(e)||pj(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=e.getAttribute("formaction")||f.getAttribute("action");if(s=g?pi(g,t):null,a=e.getAttribute("formmethod")||f.getAttribute("method")||df,i=yg(e.getAttribute("formenctype"))||yg(f.getAttribute("enctype"))||uf,d=new FormData(f,e),!vj()){let{name:p,type:x,value:y}=e;if(x==="image"){let _=p?`${p}.`:"";d.append(`${_}x`,"0"),d.append(`${_}y`,"0")}else p&&d.append(p,y)}}else{if($f(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=df,s=null,i=uf,c=e}return d&&i==="text/plain"&&(c=d,d=void 0),{action:s,method:a.toLowerCase(),encType:i,formData:d,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function op(e,t){if(e===!1||e===null||typeof e=="undefined")throw new Error(t)}function kj(e,t,a){let s=typeof e=="string"?new URL(e,typeof window=="undefined"?"server://singlefetch/":window.location.origin):e;return s.pathname==="/"?s.pathname=`_root.${a}`:t&&pi(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}function Nj(e,t){return oe(this,null,function*(){if(e.id in t)return t[e.id];try{let a=yield import(e.module);return t[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}})}function jj(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}function Sj(e,t,a){return oe(this,null,function*(){let s=yield Promise.all(e.map(i=>oe(null,null,function*(){let d=t.routes[i.route.id];if(d){let c=yield Nj(d,a);return c.links?c.links():[]}return[]})));return Aj(s.flat(1).filter(jj).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?Ee(ie({},i),{rel:"prefetch",as:"style"}):Ee(ie({},i),{rel:"prefetch"})))})}function A1(e,t,a,s,i,d){let c=(g,p)=>a[p]?g.route.id!==a[p].route.id:!0,f=(g,p)=>{var x;return a[p].pathname!==g.pathname||((x=a[p].route.path)==null?void 0:x.endsWith("*"))&&a[p].params["*"]!==g.params["*"]};return d==="assets"?t.filter((g,p)=>c(g,p)||f(g,p)):d==="data"?t.filter((g,p)=>{var y;let x=s.routes[g.route.id];if(!x||!x.hasLoader)return!1;if(c(g,p)||f(g,p))return!0;if(g.route.shouldRevalidate){let _=g.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((y=a[0])==null?void 0:y.params)||{},nextUrl:new URL(e,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function Tj(e,t,{includeHydrateFallback:a}={}){return Ej(e.map(s=>{let i=t.routes[s.route.id];if(!i)return[];let d=[i.module];return i.clientActionModule&&(d=d.concat(i.clientActionModule)),i.clientLoaderModule&&(d=d.concat(i.clientLoaderModule)),a&&i.hydrateFallbackModule&&(d=d.concat(i.hydrateFallbackModule)),i.imports&&(d=d.concat(i.imports)),d}).flat(1))}function Ej(e){return[...new Set(e)]}function Cj(e){let t={},a=Object.keys(e).sort();for(let s of a)t[s]=e[s];return t}function Aj(e,t){let a=new Set;return new Set(t),e.reduce((s,i)=>{let d=JSON.stringify(Cj(i));return a.has(d)||(a.add(d),s.push({key:d,link:i})),s},[])}function x_(){let e=j.useContext(Sc);return op(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Oj(){let e=j.useContext(Hf);return op(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var cp=j.createContext(void 0);cp.displayName="FrameworkContext";function y_(){let e=j.useContext(cp);return op(e,"You must render this element inside a <HydratedRouter> element"),e}function Mj(e,t){let a=j.useContext(cp),[s,i]=j.useState(!1),[d,c]=j.useState(!1),{onFocus:f,onBlur:g,onMouseEnter:p,onMouseLeave:x,onTouchStart:y}=t,_=j.useRef(null);j.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let N=O=>{O.forEach(C=>{c(C.isIntersecting)})},S=new IntersectionObserver(N,{threshold:.5});return _.current&&S.observe(_.current),()=>{S.disconnect()}}},[e]),j.useEffect(()=>{if(s){let N=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(N)}}},[s]);let k=()=>{i(!0)},T=()=>{i(!1),c(!1)};return a?e!=="intent"?[d,_,{}]:[d,_,{onFocus:zd(f,k),onBlur:zd(g,T),onMouseEnter:zd(p,k),onMouseLeave:zd(x,T),onTouchStart:zd(y,k)}]:[!1,_,{}]}function zd(e,t){return a=>{e&&e(a),a.defaultPrevented||t(a)}}function Lj(a){var s=a,{page:e}=s,t=fn(s,["page"]);let{router:i}=x_(),d=j.useMemo(()=>o_(i.routes,e,i.basename),[i.routes,e,i.basename]);return d?j.createElement(Pj,ie({page:e,matches:d},t)):null}function Dj(e){let{manifest:t,routeModules:a}=y_(),[s,i]=j.useState([]);return j.useEffect(()=>{let d=!1;return Sj(e,t,a).then(c=>{d||i(c)}),()=>{d=!0}},[e,t,a]),s}function Pj(s){var i=s,{page:e,matches:t}=i,a=fn(i,["page","matches"]);let d=Vs(),{manifest:c,routeModules:f}=y_(),{basename:g}=x_(),{loaderData:p,matches:x}=Oj(),y=j.useMemo(()=>A1(e,t,x,c,d,"data"),[e,t,x,c,d]),_=j.useMemo(()=>A1(e,t,x,c,d,"assets"),[e,t,x,c,d]),k=j.useMemo(()=>{if(e===d.pathname+d.search+d.hash)return[];let S=new Set,O=!1;if(t.forEach(A=>{var I;let P=c.routes[A.route.id];!P||!P.hasLoader||(!y.some(ee=>ee.route.id===A.route.id)&&A.route.id in p&&((I=f[A.route.id])!=null&&I.shouldRevalidate)||P.hasClientLoader?O=!0:S.add(A.route.id))}),S.size===0)return[];let C=kj(e,g,"data");return O&&S.size>0&&C.searchParams.set("_routes",t.filter(A=>S.has(A.route.id)).map(A=>A.route.id).join(",")),[C.pathname+C.search]},[g,p,d,c,y,t,e,f]),T=j.useMemo(()=>Tj(_,c),[_,c]),N=Dj(_);return j.createElement(j.Fragment,null,k.map(S=>j.createElement("link",ie({key:S,rel:"prefetch",as:"fetch",href:S},a))),T.map(S=>j.createElement("link",ie({key:S,rel:"modulepreload",href:S},a))),N.map(({key:S,link:O})=>j.createElement("link",ie({key:S,nonce:a.nonce},O))))}function Rj(...e){return t=>{e.forEach(a=>{typeof a=="function"?a(t):a!=null&&(a.current=t)})}}var b_=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined";try{b_&&(window.__reactRouterVersion="7.10.0")}catch(e){}function Fj({basename:e,children:t,unstable_useTransitions:a,window:s}){let i=j.useRef();i.current==null&&(i.current=wN({window:s,v5Compat:!0}));let d=i.current,[c,f]=j.useState({action:d.action,location:d.location}),g=j.useCallback(p=>{a===!1?f(p):j.startTransition(()=>f(p))},[a]);return j.useLayoutEffect(()=>d.listen(g),[d,g]),j.createElement(fj,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:d,unstable_useTransitions:a===!0})}var v_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dp=j.forwardRef(function(T,k){var N=T,{onClick:t,discover:a="render",prefetch:s="none",relative:i,reloadDocument:d,replace:c,state:f,target:g,to:p,preventScrollReset:x,viewTransition:y}=N,_=fn(N,["onClick","discover","prefetch","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"]);let{basename:S,unstable_useTransitions:O}=j.useContext(as),C=typeof p=="string"&&v_.test(p),A,P=!1;if(typeof p=="string"&&C&&(A=p,b_))try{let le=new URL(window.location.href),ge=p.startsWith("//")?new URL(le.protocol+p):new URL(p),be=pi(ge.pathname,S);ge.origin===le.origin&&be!=null?p=be+ge.search+ge.hash:P=!0}catch(le){Rn(!1,`<Link to="${p}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let I=JN(p,{relative:i}),[ee,B,H]=Mj(s,_),Y=Uj(p,{replace:c,state:f,target:g,preventScrollReset:x,relative:i,viewTransition:y,unstable_useTransitions:O});function ue(le){t&&t(le),le.defaultPrevented||Y(le)}let xe=j.createElement("a",Ee(ie(ie({},_),H),{href:A||I,onClick:P||d?t:ue,ref:Rj(k,B),target:g,"data-discover":!C&&a==="render"?"true":void 0}));return ee&&!C?j.createElement(j.Fragment,null,xe,j.createElement(Lj,{page:I})):xe});dp.displayName="Link";var Ij=j.forwardRef(function(y,x){var _=y,{"aria-current":t="page",caseSensitive:a=!1,className:s="",end:i=!1,style:d,to:c,viewTransition:f,children:g}=_,p=fn(_,["aria-current","caseSensitive","className","end","style","to","viewTransition","children"]);let k=f0(c,{relative:p.relative}),T=Vs(),N=j.useContext(Hf),{navigator:S,basename:O}=j.useContext(as),C=N!=null&&Gj(k)&&f===!0,A=S.encodeLocation?S.encodeLocation(k).pathname:k.pathname,P=T.pathname,I=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;a||(P=P.toLowerCase(),I=I?I.toLowerCase():null,A=A.toLowerCase()),I&&O&&(I=pi(I,O)||I);const ee=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let B=P===A||!i&&P.startsWith(A)&&P.charAt(ee)==="/",H=I!=null&&(I===A||!i&&I.startsWith(A)&&I.charAt(A.length)==="/"),Y={isActive:B,isPending:H,isTransitioning:C},ue=B?t:void 0,xe;typeof s=="function"?xe=s(Y):xe=[s,B?"active":null,H?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let le=typeof d=="function"?d(Y):d;return j.createElement(dp,Ee(ie({},p),{"aria-current":ue,className:xe,ref:x,style:le,to:c,viewTransition:f}),typeof g=="function"?g(Y):g)});Ij.displayName="NavLink";var zj=j.forwardRef((T,k)=>{var N=T,{discover:e="render",fetcherKey:t,navigate:a,reloadDocument:s,replace:i,state:d,method:c=df,action:f,onSubmit:g,relative:p,preventScrollReset:x,viewTransition:y}=N,_=fn(N,["discover","fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"]);let{unstable_useTransitions:S}=j.useContext(as),O=Wj(),C=Vj(f,{relative:p}),A=c.toLowerCase()==="get"?"get":"post",P=typeof f=="string"&&v_.test(f),I=ee=>{if(g&&g(ee),ee.defaultPrevented)return;ee.preventDefault();let B=ee.nativeEvent.submitter,H=(B==null?void 0:B.getAttribute("formmethod"))||c,Y=()=>O(B||ee.currentTarget,{fetcherKey:t,method:H,navigate:a,replace:i,state:d,relative:p,preventScrollReset:x,viewTransition:y});S&&a!==!1?j.startTransition(()=>Y()):Y()};return j.createElement("form",Ee(ie({ref:k,method:A,action:C,onSubmit:s?g:I},_),{"data-discover":!P&&e==="render"?"true":void 0}))});zj.displayName="Form";function Bj(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function __(e){let t=j.useContext(Sc);return $a(t,Bj(e)),t}function Uj(e,{target:t,replace:a,state:s,preventScrollReset:i,relative:d,viewTransition:c,unstable_useTransitions:f}={}){let g=Na(),p=Vs(),x=f0(e,{relative:d});return j.useCallback(y=>{if(yj(y,t)){y.preventDefault();let _=a!==void 0?a:a0(p)===a0(x),k=()=>g(e,{replace:_,state:s,preventScrollReset:i,relative:d,viewTransition:c});f?j.startTransition(()=>k()):k()}},[p,g,x,a,s,t,e,i,d,c,f])}function fl(e){Rn(typeof URLSearchParams!="undefined","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=j.useRef(Hg(e)),a=j.useRef(!1),s=Vs(),i=j.useMemo(()=>bj(s.search,a.current?null:t.current),[s.search]),d=Na(),c=j.useCallback((f,g)=>{const p=Hg(typeof f=="function"?f(new URLSearchParams(i)):f);a.current=!0,d("?"+p,g)},[d,i]);return[i,c]}var Hj=0,$j=()=>`__${String(++Hj)}__`;function Wj(){let{router:e}=__("useSubmit"),{basename:t}=j.useContext(as),a=oj(),s=e.fetch,i=e.navigate;return j.useCallback((f,...g)=>oe(null,[f,...g],function*(d,c={}){let{action:p,method:x,encType:y,formData:_,body:k}=wj(d,t);if(c.navigate===!1){let T=c.fetcherKey||$j();yield s(T,a,c.action||p,{preventScrollReset:c.preventScrollReset,formData:_,body:k,formMethod:c.method||x,formEncType:c.encType||y,flushSync:c.flushSync})}else yield i(c.action||p,{preventScrollReset:c.preventScrollReset,formData:_,body:k,formMethod:c.method||x,formEncType:c.encType||y,replace:c.replace,state:c.state,fromRouteId:a,flushSync:c.flushSync,viewTransition:c.viewTransition})}),[s,i,t,a])}function Vj(e,{relative:t}={}){let{basename:a}=j.useContext(as),s=j.useContext(ks);$a(s,"useFormAction must be used inside a RouteContext");let[i]=s.matches.slice(-1),d=ie({},f0(e||".",{relative:t})),c=Vs();if(e==null){d.search=c.search;let f=new URLSearchParams(d.search),g=f.getAll("index");if(g.some(x=>x==="")){f.delete("index"),g.filter(y=>y).forEach(y=>f.append("index",y));let x=f.toString();d.search=x?`?${x}`:""}}return(!e||e===".")&&i.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(d.pathname=d.pathname==="/"?a:fi([a,d.pathname])),a0(d)}function Gj(e,{relative:t}={}){let a=j.useContext(f_);$a(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=__("useViewTransitionState"),i=f0(e,{relative:t});if(!a.isTransitioning)return!1;let d=pi(a.currentLocation.pathname,s)||a.currentLocation.pathname,c=pi(a.nextLocation.pathname,s)||a.nextLocation.pathname;return vf(i.pathname,c)!=null||vf(i.pathname,d)!=null}var w_=Kv();const Zj="modulepreload",qj=function(e){return"/assets/asm_ui_app/asm_app/"+e},O1={},M1=function(t,a,s){let i=Promise.resolve();if(a&&a.length>0){let p=function(x){return Promise.all(x.map(y=>Promise.resolve(y).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};var c=p;document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),g=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));i=p(a.map(x=>{if(x=qj(x),x in O1)return;O1[x]=!0;const y=x.endsWith(".css"),_=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${_}`))return;const k=document.createElement("link");if(k.rel=y?"stylesheet":Zj,y||(k.as="script"),k.crossOrigin="",k.href=x,g&&k.setAttribute("nonce",g),document.head.appendChild(k),y)return new Promise((T,N)=>{k.addEventListener("load",T),k.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${x}`)))})}))}function d(f){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=f,window.dispatchEvent(g),!g.defaultPrevented)throw f}return i.then(f=>{for(const g of f||[])g.status==="rejected"&&d(g.reason);return t().catch(d)})},k_=j.createContext(void 0),Yj=({children:e})=>{const{i18n:t}=Qa(),[a,s]=j.useState(()=>localStorage.getItem("i18nextLng")==="ar"?"ar":"en"),i=a==="ar";j.useEffect(()=>{const c=document.documentElement,f=document.documentElement;t.changeLanguage(a),f.setAttribute("lang",a),i?(f.setAttribute("dir","rtl"),c.classList.add("rtl"),c.classList.remove("ltr")):(f.setAttribute("dir","ltr"),c.classList.add("ltr"),c.classList.remove("rtl"))},[a,t,i]);const d=c=>oe(null,null,function*(){s(c),localStorage.setItem("i18nextLng",c),yield bf()});return r.jsx(k_.Provider,{value:{language:a,changeLanguage:d,isRTL:i},children:e})},up=()=>{const e=j.useContext(k_);if(!e)throw new Error("useLanguage must be used within LanguageProvider");return e},Xj=()=>{const[e,t]=j.useState({email:"",password:""}),[a,s]=j.useState(!1),[i,d]=j.useState(null),c=Na(),{t:f}=Qa(),{isRTL:g}=up(),p="/assets/asm_ui_app/asm_app/",x="?v=1765198405",y=T=>{const{name:N,value:S}=T.target;t(O=>Ee(ie({},O),{[N]:S})),d(null)},_=T=>oe(null,null,function*(){T.preventDefault(),s(!0),d(null);try{const{useAuth:N}=yield M1(()=>oe(null,null,function*(){const{useAuth:C}=yield Promise.resolve().then(()=>Jj);return{useAuth:C}}),[]),S=(yield M1(()=>oe(null,null,function*(){const{default:C}=yield Promise.resolve().then(()=>bN);return{default:C}}),void 0)).default,O=yield S.login(e);if(O&&O.message){const C=Ee(ie({},O.message),{email:e.email});localStorage.setItem("user",JSON.stringify(C)),O.message.sid&&S.setSessionId(O.message.sid);try{yield bf()}catch(A){console.warn("Could not load translations after login:",A)}c("/dashboard")}else d(f("login.loginFailed"))}catch(N){console.error("Login error:",N),d(N.message||f("login.loginFailed"))}finally{s(!1)}}),k=()=>oe(null,null,function*(){const T={full_name:"Demo User",email:"demo@seeraarabia.com",user_image:"",roles:["System Manager","Administrator"]};localStorage.setItem("user",JSON.stringify(T));try{yield bf()}catch(N){console.warn("Could not load translations after demo login:",N)}c("/dashboard")});return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-md w-full space-y-8",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex justify-center mb-6",children:r.jsxs("div",{className:"w-32 h-32 flex items-center justify-center bg-white dark:bg-gray-800 rounded-2xl shadow-2xl p-4",children:[r.jsx("img",{src:`${p}${p.endsWith("/")?"":"/"}seera-logo.png${x}`,alt:"Seera Arabia",className:"w-full h-full object-contain",onError:T=>{const N=T.currentTarget.parentElement;N&&N.classList.add("bg-gradient-to-br","from-indigo-600","to-purple-600"),T.currentTarget.style.display="none";const S=T.currentTarget.nextElementSibling;S&&S.classList.remove("hidden")}}),r.jsxs("svg",{className:"w-20 h-20 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"white",fillOpacity:"0.9"}),r.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"white",fillOpacity:"0.7"}),r.jsx("path",{d:"M12 12V17",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]})]})}),r.jsx("h2",{className:"text-center text-3xl font-semibold text-gray-900 dark:text-white",children:f("login.title")}),r.jsx("p",{className:"mt-2 text-center text-sm font-medium text-indigo-600 dark:text-indigo-400",children:f("login.subtitle")}),r.jsx("p",{className:"mt-1 text-center text-xs text-gray-600 dark:text-gray-400",children:f("login.signIn")})]}),r.jsxs("form",{className:"mt-8 space-y-6",onSubmit:_,children:[r.jsxs("div",{className:"rounded-md shadow-sm -space-y-px",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"email",className:"sr-only",children:f("common.email")}),r.jsx("input",{id:"email",name:"email",type:"email",required:!0,className:"appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 placeholder-gray-500 dark:placeholder-gray-400 text-gray-900 dark:text-white bg-white dark:bg-gray-800 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm",placeholder:f("login.emailPlaceholder"),value:e.email,onChange:y})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"password",className:"sr-only",children:f("common.password")}),r.jsx("input",{id:"password",name:"password",type:"password",required:!0,className:"appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 placeholder-gray-500 dark:placeholder-gray-400 text-gray-900 dark:text-white bg-white dark:bg-gray-800 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm",placeholder:f("login.passwordPlaceholder"),value:e.password,onChange:y})]})]}),i&&r.jsx("div",{className:"rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:r.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:i})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("button",{type:"submit",disabled:a,className:"group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed",children:a?r.jsxs("div",{className:"flex items-center",children:[r.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),f("common.loading")]}):f("common.login")}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("div",{className:"w-full border-t border-gray-300 dark:border-gray-600"})}),r.jsx("div",{className:"relative flex justify-center text-sm",children:r.jsx("span",{className:"px-2 bg-gray-50 dark:bg-gray-900 text-gray-500 dark:text-gray-400",children:"or"})})]}),r.jsxs("button",{type:"button",onClick:k,className:"w-full flex justify-center py-2 px-4 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:["🚀 ",f("login.demoLogin")]})]})]})]})})};function h0(e,t=[]){const[a,s]=j.useState(null),[i,d]=j.useState(!0),[c,f]=j.useState(null),g=j.useCallback(()=>oe(null,null,function*(){try{d(!0),f(null);const x=yield e();s(x)}catch(x){x instanceof Kl?f(x.message):f(x instanceof Error?x.message:"Unknown error")}finally{d(!1)}}),t);j.useEffect(()=>{g()},[g]);const p=j.useCallback(()=>{g()},[g]);return{data:a,loading:i,error:c,refetch:p}}function N_(e){return h0(()=>rt.getUserDetails(e),[e])}function j_(){return h0(()=>rt.getDashboardStats())}function fp(){return h0(()=>rt.getNumberCards())}function Yl(e,t){return h0(()=>rt.getDashboardChartData(e,t),[e,JSON.stringify(t||{})])}function S_(){const[e,t]=j.useState(rt.isAuthenticated());return{isAuthenticated:e,login:i=>oe(null,null,function*(){try{const d=yield rt.login(i);if(d&&d.message)return d.message.sid&&rt.setSessionId(d.message.sid),t(!0),d;throw new Error("Login failed")}catch(d){throw t(!1),d}}),logout:()=>oe(null,null,function*(){try{yield rt.logout()}finally{rt.setSessionId(""),t(!1)}})}}const Jj=Object.freeze(Object.defineProperty({__proto__:null,useApi:h0,useAuth:S_,useDashboardChart:Yl,useDashboardStats:j_,useNumberCards:fp,useUserDetails:N_},Symbol.toStringTag,{value:"Module"})),Kj=()=>{const[e,t]=j.useState({}),[a,s]=j.useState(!1),i=()=>oe(null,null,function*(){s(!0);const d={};try{console.log("Testing basic connectivity...");try{const c=yield fetch("/api/method/frappe.desk.doctype.event.event.get_events",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({start:new Date().toISOString().split("T")[0],end:new Date(Date.now()+2592e6).toISOString().split("T")[0]}),signal:AbortSignal.timeout(1e4)});c.ok?d.csrfToken="✅ Basic Connectivity: SUCCESS":d.csrfToken=`❌ Basic Connectivity: HTTP ${c.status}`}catch(c){d.csrfToken=`❌ Basic Connectivity: ${c instanceof Error?c.message:"Unknown error"}`}console.log("Testing Frappe system endpoint...");try{yield rt.apiCall("/api/method/frappe.auth.get_logged_user",{method:"GET",headers:{"Content-Type":"application/json"}}),d.dashboardStats="✅ Frappe System API: SUCCESS"}catch(c){const f=c instanceof Error?c.message:"Unknown";f.includes("403")||f.includes("401")?d.dashboardStats="✅ Frappe System API: SUCCESS (auth required)":d.dashboardStats=`❌ Frappe System API: ${f}`}console.log("Testing Custom User Details...");try{const c=yield rt.getUserDetails();d.userDetails=c?"✅ Custom API: SUCCESS":"❌ Custom API: Failed"}catch(c){d.userDetails=`❌ Custom API (Expected): ${c instanceof Error?c.message:"Unknown"}`}console.log("Testing Custom Dashboard Stats...");try{const c=yield rt.getDashboardStats();d.doctypeRecords=c?"✅ Custom Stats: SUCCESS":"❌ Custom Stats: Failed"}catch(c){d.doctypeRecords=`❌ Custom Stats (Expected): ${c instanceof Error?c.message:"Unknown"}`}}catch(c){console.error("API Test Error:",c),c instanceof Kl?d.error=`${c.message} (Status: ${c.status})`:d.error=c instanceof Error?c.message:"Unknown error"}t(d),s(!1)});return r.jsxs("div",{style:{padding:"20px",border:"1px solid #ccc",margin:"20px"},children:[r.jsx("h2",{children:"API Connection Test"}),r.jsx("button",{onClick:i,disabled:a,style:{padding:"10px 20px",marginBottom:"20px",backgroundColor:a?"#ccc":"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:a?"not-allowed":"pointer"},children:a?"Testing...":"Test API Connection"}),r.jsxs("div",{children:[r.jsx("h3",{children:"Test Results:"}),r.jsxs("div",{style:{background:"#f5f5f5",padding:"15px",borderRadius:"5px",fontSize:"14px"},children:[r.jsxs("div",{children:[r.jsx("strong",{children:"1. Basic Connectivity:"})," ",e.csrfToken||"Not tested"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"2. Frappe System API:"})," ",e.dashboardStats||"Not tested"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"3. Custom User API:"})," ",e.userDetails||"Not tested"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"4. Custom Stats API:"})," ",e.doctypeRecords||"Not tested"]}),e.error&&r.jsxs("div",{style:{color:"red"},children:[r.jsx("strong",{children:"Error:"})," ",e.error]})]}),r.jsxs("div",{style:{marginTop:"10px",fontSize:"12px",color:"#666"},children:[r.jsx("p",{children:r.jsx("strong",{children:"Expected Results:"})}),r.jsxs("ul",{children:[r.jsx("li",{children:"✅ Basic Connectivity should succeed (tests proxy connection)"}),r.jsx("li",{children:"✅ Frappe System API should succeed (tests Frappe API)"}),r.jsx("li",{children:"❌ Custom APIs will fail until you deploy the API file to your server"})]}),r.jsxs("p",{children:[r.jsx("strong",{children:"If Basic Connectivity fails:"})," Check your Frappe server is running and accessible"]})]})]})]})},bg=e=>Number.isFinite(e)?Math.max(0,e):0;function Qj({type:e,labels:t,datasets:a,height:s=220}){if(!(t!=null&&t.length)||!(a!=null&&a.length))return r.jsx("div",{className:"text-sm text-gray-500",children:"No data"});if(e.toLowerCase()==="pie"){const p=a[0].values.map(bg),x=p.reduce((S,O)=>S+O,0)||1,y=Math.min(100,s/2-10),_=y+10,k=y+10;let T=0;const N=a[0].values.map((S,O)=>a[0].color||L1(O));return r.jsx("svg",{width:_*2,height:k*2,viewBox:`0 0 ${_*2} ${k*2}`,children:p.map((S,O)=>{const C=T/x*2*Math.PI;T+=S;const A=T/x*2*Math.PI,P=A-C>Math.PI?1:0,I=_+y*Math.cos(C),ee=k+y*Math.sin(C),B=_+y*Math.cos(A),H=k+y*Math.sin(A),Y=`M ${_} ${k} L ${I} ${ee} A ${y} ${y} 0 ${P} 1 ${B} ${H} Z`;return r.jsx("path",{d:Y,fill:N[O]},O)})})}const i=a,d=Math.max(...i.flatMap(p=>p.values.map(bg)),1),c=Math.max(t.length*60,300),f=s-40,g=Math.max(20,(c-40)/t.length-10);return r.jsxs("svg",{width:c,height:s,viewBox:`0 0 ${c} ${s}`,children:[r.jsx("line",{x1:30,y1:10,x2:30,y2:f,stroke:"#e5e7eb"}),r.jsx("line",{x1:30,y1:f,x2:c-10,y2:f,stroke:"#e5e7eb"}),t.map((p,x)=>{const y=40+x*(g+10);let _=0;return r.jsxs("g",{children:[i.map((k,T)=>{const S=bg(k.values[x]||0)/d*(f-20),O=f-S-_,C=k.color||L1(T);return _+=S,r.jsx("rect",{x:y,y:O,width:g,height:S,fill:C,rx:2},T)}),r.jsx("text",{x:y+g/2,y:s-5,textAnchor:"middle",fontSize:"10",fill:"#6b7280",children:eS(p,8)})]},x)})]})}function L1(e){const t=["#4F46E5","#10B981","#F59E0B","#EF4444","#6366F1","#22C55E","#E11D48"];return t[e%t.length]}function eS(e,t){return e.length>t?e.slice(0,t-1)+"…":e}const tS=({chartName:e,filters:t})=>{const{data:a,loading:s,error:i}=Yl(e,t);return r.jsxs("div",{className:"bg-white rounded-lg shadow p-4 overflow-auto",children:[r.jsx("div",{className:"flex items-center justify-between mb-3",children:r.jsx("h4",{className:"text-sm font-semibold text-gray-800",children:e})}),s&&r.jsx("div",{className:"text-sm text-gray-500",children:"Loading…"}),i&&r.jsx("div",{className:"text-sm text-red-600",children:i}),!s&&!i&&a&&r.jsx(Qj,{type:a.type,labels:a.labels,datasets:a.datasets})]})},aS=()=>{var k,T,N,S;const[e,t]=j.useState(null),[a,s]=j.useState([]),i=Na(),{logout:d}=S_(),{loading:c,error:f}=j_(),{data:g}=fp(),{data:p,loading:x,error:y}=N_();j.useEffect(()=>{const O=localStorage.getItem("user");O?t(JSON.parse(O)):p&&t(p);const C=[{name:"USER001",full_name:"John Doe",email:"john.doe@seeraarabia.com",creation:new Date().toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0},{name:"USER002",full_name:"Jane Smith",email:"jane.smith@seeraarabia.com",creation:new Date(Date.now()-864e5).toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0},{name:"USER003",full_name:"Ahmed Al-Rashid",email:"ahmed.alrashid@seeraarabia.com",creation:new Date(Date.now()-1728e5).toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0},{name:"USER004",full_name:"Sarah Johnson",email:"sarah.johnson@seeraarabia.com",creation:new Date(Date.now()-2592e5).toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0},{name:"USER005",full_name:"Mohammed Hassan",email:"mohammed.hassan@seeraarabia.com",creation:new Date(Date.now()-3456e5).toISOString(),modified:new Date().toISOString(),modified_by:"system",owner:"system",docstatus:0}];s(C)},[p]);const _=()=>oe(null,null,function*(){try{yield d(),localStorage.removeItem("user"),i("/login")}catch(O){console.error("Logout error:",O),localStorage.removeItem("user"),i("/login")}});return c||x?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:r.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex justify-between items-center py-6",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Dashboard"})}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Welcome, ",(e==null?void 0:e.full_name)||"User"]}),r.jsx("button",{onClick:_,className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-md text-sm font-medium",children:"Logout"})]})]})})}),r.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[(f||y)&&r.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:r.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:f||y||"Failed to load dashboard data"})}),r.jsxs("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4 mb-8",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:r.jsx("div",{className:"p-5",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-indigo-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})})}),r.jsx("div",{className:"ml-5 w-0 flex-1",children:r.jsxs("dl",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Total Assets"}),r.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(k=g==null?void 0:g.total_assets)!=null?k:"-"})]})})]})})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:r.jsx("div",{className:"p-5",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})}),r.jsx("div",{className:"ml-5 w-0 flex-1",children:r.jsxs("dl",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Open Work Orders"}),r.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(T=g==null?void 0:g.work_orders_open)!=null?T:"-"})]})})]})})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:r.jsx("div",{className:"p-5",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-yellow-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})})}),r.jsx("div",{className:"ml-5 w-0 flex-1",children:r.jsxs("dl",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"In Progress"}),r.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(N=g==null?void 0:g.work_orders_in_progress)!=null?N:"-"})]})})]})})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 overflow-hidden shadow rounded-lg",children:r.jsx("div",{className:"p-5",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-purple-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M3 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z",clipRule:"evenodd"})})})}),r.jsx("div",{className:"ml-5 w-0 flex-1",children:r.jsxs("dl",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:"Completed Work Orders"}),r.jsx("dd",{className:"text-lg font-medium text-gray-900 dark:text-white",children:(S=g==null?void 0:g.work_orders_completed)!=null?S:"-"})]})})]})})})]}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-6 mb-8",children:["Up & Down Time Chart","Work Order Status Chart","Maintenance - Asset wise Count","Asset Maintenance Assignees Status Count","Asset Maintenance Frequency Chart","PPM Status","PPM Template Counts","Repair Cost"].map(O=>r.jsx(tS,{chartName:O},O))}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[r.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[r.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:"Recent Records"}),r.jsx("p",{className:"mt-1 max-w-2xl text-sm text-gray-500 dark:text-gray-400",children:"Latest entries from your Frappe backend"})]}),r.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:a.map(O=>{var C;return r.jsx("li",{children:r.jsxs("div",{className:"px-4 py-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0 h-10 w-10",children:r.jsx("div",{className:"h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center",children:r.jsx("span",{className:"text-sm font-medium text-indigo-600",children:((C=O.full_name)==null?void 0:C.charAt(0))||O.name.charAt(0)})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:O.full_name||O.name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:O.email||"No email"})]})]}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(O.creation).toLocaleDateString()})]})},O.name)})})]}),r.jsxs("div",{className:"mt-8",children:[r.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white mb-4",children:"Quick Actions"}),r.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsx("button",{onClick:()=>i("/users"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-blue-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{d:"M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"})})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"View Users"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Manage user accounts"})]})]})}),r.jsx("button",{onClick:()=>i("/settings"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-gray-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Settings"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Configure your preferences"})]})]})}),r.jsx("button",{onClick:()=>i("/events"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-purple-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Events"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"View calendar events"})]})]})}),r.jsx("button",{onClick:()=>i("/reports"),className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-md flex items-center justify-center",children:r.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Reports"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"View analytics and reports"})]})]})})]})]}),r.jsx("div",{className:"mt-8",children:r.jsx(Kj,{})})]})]})};class rS{getWorkOrders(t,a,s=20,i=0,d){return oe(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&a.length>0&&c.append("fields",JSON.stringify(a)),c.append("limit",s.toString()),c.append("offset",i.toString()),d&&c.append("order_by",d);const f=`${Bt.ENDPOINTS.GET_WORK_ORDERS}?${c.toString()}`;return rt.apiCall(f)})}getWorkOrderDetails(t){return oe(this,null,function*(){const a=`${Bt.ENDPOINTS.GET_WORK_ORDER_DETAILS}?work_order_name=${encodeURIComponent(t)}`;return rt.apiCall(a)})}createWorkOrder(t){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.CREATE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_data:t})})})}updateWorkOrder(t,a){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.UPDATE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t,work_order_data:a})})})}deleteWorkOrder(t){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.DELETE_WORK_ORDER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t})})})}updateWorkOrderStatus(t,a,s){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.UPDATE_WORK_ORDER_STATUS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({work_order_name:t,repair_status:a,workflow_state:s})})})}getWorkOrderFilters(){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.GET_WORK_ORDER_FILTERS)})}getWorkOrderStats(){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.GET_WORK_ORDER_STATS)})}searchWorkOrders(t,a=10){return oe(this,null,function*(){const s=`${Bt.ENDPOINTS.SEARCH_WORK_ORDERS}?search_term=${encodeURIComponent(t)}&limit=${a}`;return rt.apiCall(s)})}submitWorkOrder(t){return oe(this,null,function*(){return rt.apiCall("/api/method/frappe.client.submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doc:{doctype:"Asset Repair",name:t}})})})}cancelWorkOrder(t){return oe(this,null,function*(){return rt.apiCall("/api/method/frappe.client.cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doc:{doctype:"Asset Repair",name:t}})})})}getWorkOrdersByAsset(t,a=50){return oe(this,null,function*(){const s={asset:t};return(yield this.getWorkOrders(s,void 0,a,0,"creation desc")).work_orders})}getOpenWorkOrders(t=50){return oe(this,null,function*(){const a={repair_status:["not in",["Completed","Cancelled"]]};return(yield this.getWorkOrders(a,void 0,t,0,"creation desc")).work_orders})}getWorkOrdersByPriority(t,a=50){return oe(this,null,function*(){const s={custom_priority_:t};return(yield this.getWorkOrders(s,void 0,a,0,"creation desc")).work_orders})}}const Xl=new rS,nS=(e,t)=>{const a=ie({},e||{});for(const[s,i]of Object.entries(t))if(!a[s])a[s]=i;else if(Array.isArray(i)&&i[0]==="in"){const d=i[1],c=a[s];if(typeof c=="string")d.includes(c)||(a[s]=["in",[]]);else if(Array.isArray(c)&&c[0]==="in"){const g=c[1].filter(p=>d.includes(p));a[s]=["in",g]}else a[s]=i}return a};function T_(e,t=20,a=0,s,i={}){const[d,c]=j.useState([]),[f,g]=j.useState(0),[p,x]=j.useState(!1),[y,_]=j.useState(!0),[k,T]=j.useState(null),[N,S]=j.useState(0),O=j.useRef(!1),C=JSON.stringify(e),A=JSON.stringify(i);j.useEffect(()=>{if(O.current&&k)return;let I=!1;return O.current=!0,oe(null,null,function*(){try{_(!0);const B=nS(e,i);console.log("[useWorkOrders] User filters:",e),console.log("[useWorkOrders] Permission filters:",i),console.log("[useWorkOrders] Merged filters:",B);const H=yield Xl.getWorkOrders(B,void 0,t,a,s);I||(c(H.work_orders),g(H.total_count),x(H.has_more),T(null))}catch(B){if(!I){const H=B instanceof Error?B.message:"Failed to fetch work orders";H.includes("417")||H.includes("Expectation Failed")||H.includes("has no attribute")?T("API endpoint not deployed or misconfigured. Please check FIX_417_ERROR.md for solutions."):T(H),c([]),g(0),x(!1)}}finally{I||_(!1)}}),()=>{I=!0}},[C,A,t,a,s,N]);const P=j.useCallback(()=>{O.current=!1,S(I=>I+1)},[]);return{workOrders:d,totalCount:f,hasMore:p,loading:y,error:k,refetch:P}}function sS(e){const[t,a]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>oe(null,null,function*(){if(!e){a(null),i(!1);return}try{i(!0),c(null);const p=yield Xl.getWorkOrderDetails(e);a(p)}catch(p){c(p instanceof Error?p.message:"Failed to fetch work order details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const g=j.useCallback(()=>{f()},[f]);return{workOrder:t,loading:s,error:d,refetch:g}}function E_(){const[e,t]=j.useState(!1),[a,s]=j.useState(null);return{createWorkOrder:p=>oe(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Creating work order with data:",p);const x=yield Xl.createWorkOrder(p);if(console.log("[useWorkOrderMutations] Create work order response:",x),x.success)return x.work_order;{const y=x.error||"Failed to create work order";throw new Error(y)}}catch(x){console.error("[useWorkOrderMutations] Create work order error:",x);const y=x instanceof Error?x.message:"Failed to create work order";throw s(y),x}finally{t(!1)}}),updateWorkOrder:(p,x)=>oe(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Updating work order:",p,"with data:",x);const y=yield Xl.updateWorkOrder(p,x);if(console.log("[useWorkOrderMutations] Update work order response:",y),y.success)return y.work_order;{const _=y.error||"Failed to update work order";throw new Error(_)}}catch(y){console.error("[useWorkOrderMutations] Update work order error:",y);const _=y instanceof Error?y.message:"Failed to update work order";throw s(_),y}finally{t(!1)}}),deleteWorkOrder:p=>oe(null,null,function*(){try{t(!0),s(null);const x=yield Xl.deleteWorkOrder(p);if(!x.success)throw new Error("Failed to delete work order");return x}catch(x){const y=x instanceof Error?x.message:"Failed to delete work order";throw s(y),x}finally{t(!1)}}),submitWorkOrder:p=>oe(null,null,function*(){try{t(!0),s(null),console.log("[useWorkOrderMutations] Submitting work order:",p);const x=yield Xl.submitWorkOrder(p);return console.log("[useWorkOrderMutations] Submit work order response:",x),x}catch(x){console.error("[useWorkOrderMutations] Submit work order error:",x);const y=x instanceof Error?x.message:"Failed to submit work order";throw s(y),x}finally{t(!1)}}),updateStatus:(p,x,y)=>oe(null,null,function*(){try{t(!0),s(null);const _=yield Xl.updateWorkOrderStatus(p,x,y);if(_.success)return _.work_order;throw new Error("Failed to update work order status")}catch(_){const k=_ instanceof Error?_.message:"Failed to update status";throw s(k),_}finally{t(!1)}}),loading:e,error:a}}const ps=rt;class iS{getMaintenanceLogs(t,a,s=20,i=0,d){return oe(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&a.length>0&&c.append("fields",JSON.stringify(a)),c.append("limit",s.toString()),c.append("offset",i.toString()),d&&c.append("order_by",d),c.append("include_child_tables","true");const f=`${Bt.ENDPOINTS.GET_ASSET_MAINTENANCE_LOGS}?${c.toString()}`;return ps.apiCall(f)})}getMaintenanceLogDetails(t){return oe(this,null,function*(){const a=new URLSearchParams;a.append("log_name",t),a.append("include_child_tables","true");const s=`${Bt.ENDPOINTS.GET_ASSET_MAINTENANCE_LOG_DETAILS}?${a.toString()}`;return ps.apiCall(s)})}createMaintenanceLog(t){return oe(this,null,function*(){const a=this.prepareLogData(t);return ps.apiCall(Bt.ENDPOINTS.CREATE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_data:a})})})}updateMaintenanceLog(t,a){return oe(this,null,function*(){const s=this.prepareLogData(a);return ps.apiCall(Bt.ENDPOINTS.UPDATE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,log_data:s})})})}deleteMaintenanceLog(t){return oe(this,null,function*(){return ps.apiCall(Bt.ENDPOINTS.DELETE_ASSET_MAINTENANCE_LOG,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t})})})}updateMaintenanceStatus(t,a,s){return oe(this,null,function*(){return ps.apiCall(Bt.ENDPOINTS.UPDATE_MAINTENANCE_STATUS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,maintenance_status:a,workflow_state:s})})})}getMaintenanceLogsByAsset(t,a,s=20,i=0){return oe(this,null,function*(){const d=new URLSearchParams;d.append("asset_name",t),a&&d.append("filters",JSON.stringify(a)),d.append("limit",s.toString()),d.append("offset",i.toString()),d.append("include_child_tables","true");const c=`${Bt.ENDPOINTS.GET_MAINTENANCE_LOGS_BY_ASSET}?${d.toString()}`;return ps.apiCall(c)})}getOverdueMaintenanceLogs(t,a=20,s=0){return oe(this,null,function*(){const i=new URLSearchParams;t&&i.append("filters",JSON.stringify(t)),i.append("limit",a.toString()),i.append("offset",s.toString()),i.append("include_child_tables","true");const d=`${Bt.ENDPOINTS.GET_OVERDUE_MAINTENANCE_LOGS}?${i.toString()}`;return ps.apiCall(d)})}addPPMTableRow(t,a){return oe(this,null,function*(){return ps.apiCall(Bt.ENDPOINTS.ADD_PPM_TABLE_ROW||"/api/method/asset_lite.api.asset_maintenance_api.add_ppm_table_row",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,row_data:this.cleanPPMRow(a)})})})}removePPMTableRow(t,a){return oe(this,null,function*(){return ps.apiCall(Bt.ENDPOINTS.REMOVE_PPM_TABLE_ROW||"/api/method/asset_lite.api.asset_maintenance_api.remove_ppm_table_row",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,row_name:a})})})}updatePPMTableRow(t,a,s){return oe(this,null,function*(){return ps.apiCall(Bt.ENDPOINTS.UPDATE_PPM_TABLE_ROW||"/api/method/asset_lite.api.asset_maintenance_api.update_ppm_table_row",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log_name:t,row_name:a,row_data:this.cleanPPMRow(s)})})})}cleanPPMRow(t){return Ee(ie({},t.name&&!t.name.startsWith("new-")?{name:t.name}:{}),{maintenance_name:t.maintenance_name||"",working:typeof t.working=="boolean"?t.working?1:0:t.working||0,defect_found:typeof t.defect_found=="boolean"?t.defect_found?1:0:t.defect_found||0,not_working:typeof t.not_working=="boolean"?t.not_working?1:0:t.not_working||0})}prepareLogData(t){const a={},s=["asset_name","custom_asset_type","item_code","item_name","custom_asset_names","custom_hospital_name","task","task_name","maintenance_type","periodicity","custom_template","maintenance_status","due_date","completion_date","assign_to_name","has_certificate","custom_early_completion","custom_early_completion_reason","custom_accepted_by_moh","custom_accepted_by_moh_","custom_pm_overdue_reason","description","custom_table"];for(const i of s)t[i]!==void 0&&t[i]!==null&&t[i]!==""&&(a[i]=t[i]);return typeof a.has_certificate=="boolean"&&(a.has_certificate=a.has_certificate?1:0),typeof a.custom_accepted_by_moh=="boolean"&&(a.custom_accepted_by_moh=a.custom_accepted_by_moh?1:0),typeof a.custom_accepted_by_moh_=="boolean"&&(a.custom_accepted_by_moh_=a.custom_accepted_by_moh_?1:0),a.custom_table&&Array.isArray(a.custom_table)&&(a.custom_table=a.custom_table.map(i=>this.cleanPPMRow(i))),a}}const fc=new iS;function Wf(e,t=20,a=0,s){const[i,d]=j.useState([]),[c,f]=j.useState(0),[g,p]=j.useState(!1),[x,y]=j.useState(!0),[_,k]=j.useState(null),[T,N]=j.useState(0),S=j.useRef(!1),O=JSON.stringify(e);j.useEffect(()=>{if(S.current&&_)return;let A=!1;return S.current=!0,oe(null,null,function*(){try{y(!0);const I=yield fc.getMaintenanceLogs(e,void 0,t,a,s);A||(d(I.asset_maintenance_logs),f(I.total_count),p(I.has_more),k(null))}catch(I){if(!A){const ee=I instanceof Error?I.message:"Failed to fetch maintenance logs";ee.includes("417")||ee.includes("Expectation Failed")||ee.includes("has no attribute")?k("API endpoint not deployed. Please deploy asset_maintenance_api.py to your Frappe server."):k(ee),d([]),f(0),p(!1)}}finally{A||y(!1)}}),()=>{A=!0}},[O,t,a,s,T]);const C=j.useCallback(()=>{S.current=!1,N(A=>A+1)},[]);return{logs:i,totalCount:c,hasMore:g,loading:x,error:_,refetch:C}}function lS(e){const[t,a]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>oe(null,null,function*(){if(!e){a(null),i(!1);return}try{i(!0),c(null);const p=yield fc.getMaintenanceLogDetails(e);a(p)}catch(p){c(p instanceof Error?p.message:"Failed to fetch maintenance log details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const g=j.useCallback(()=>{f()},[f]);return{log:t,loading:s,error:d,refetch:g}}function C_(){const[e,t]=j.useState(!1),[a,s]=j.useState(null);return{createLog:g=>oe(null,null,function*(){try{t(!0),s(null),console.log("[useMaintenanceMutations] Creating maintenance log:",g);const p=yield fc.createMaintenanceLog(g);if(console.log("[useMaintenanceMutations] Create response:",p),p.success)return p.asset_maintenance_log;{const x=p.error||"Failed to create maintenance log";throw new Error(x)}}catch(p){console.error("[useMaintenanceMutations] Create error:",p);const x=p instanceof Error?p.message:"Failed to create maintenance log";throw s(x),p}finally{t(!1)}}),updateLog:(g,p)=>oe(null,null,function*(){try{t(!0),s(null),console.log("[useMaintenanceMutations] Updating maintenance log:",g,p);const x=yield fc.updateMaintenanceLog(g,p);if(console.log("[useMaintenanceMutations] Update response:",x),x.success)return x.asset_maintenance_log;{const y=x.error||"Failed to update maintenance log";throw new Error(y)}}catch(x){console.error("[useMaintenanceMutations] Update error:",x);const y=x instanceof Error?x.message:"Failed to update maintenance log";throw s(y),x}finally{t(!1)}}),deleteLog:g=>oe(null,null,function*(){try{t(!0),s(null);const p=yield fc.deleteMaintenanceLog(g);if(!p.success)throw new Error("Failed to delete maintenance log");return p}catch(p){const x=p instanceof Error?p.message:"Failed to delete maintenance log";throw s(x),p}finally{t(!1)}}),updateStatus:(g,p,x)=>oe(null,null,function*(){try{t(!0),s(null);const y=yield fc.updateMaintenanceStatus(g,p,x);if(y.success)return y.asset_maintenance_log;throw new Error("Failed to update maintenance status")}catch(y){const _=y instanceof Error?y.message:"Failed to update status";throw s(_),y}finally{t(!1)}}),loading:e,error:a}}class oS{getAssets(t,a,s=20,i=0,d){return oe(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&a.length>0&&c.append("fields",JSON.stringify(a)),c.append("limit",s.toString()),c.append("offset",i.toString()),d&&c.append("order_by",d);const f=`${Bt.ENDPOINTS.GET_ASSETS}?${c.toString()}`;return rt.apiCall(f)})}getAssetDetails(t){return oe(this,null,function*(){const a=`${Bt.ENDPOINTS.GET_ASSET_DETAILS}?asset_name=${encodeURIComponent(t)}`;return rt.apiCall(a)})}createAsset(t){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.CREATE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_data:t})})})}updateAsset(t,a){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.UPDATE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:t,asset_data:a})})})}deleteAsset(t){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.DELETE_ASSET,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:t})})})}getAssetFilters(){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.GET_ASSET_FILTERS)})}getAssetStats(){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.GET_ASSET_STATS)})}searchAssets(t,a=10){return oe(this,null,function*(){const s=`${Bt.ENDPOINTS.SEARCH_ASSETS}?search_term=${encodeURIComponent(t)}&limit=${a}`;return rt.apiCall(s)})}submitAsset(t){return oe(this,null,function*(){return rt.apiCall(Bt.ENDPOINTS.SUBMIT_ASSET||"/api/method/asset_lite.api.asset_api.submit_asset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_name:t})})})}}const hc=new oS,cS=(e,t)=>{const a=ie({},e||{});for(const[s,i]of Object.entries(t))if(!a[s])a[s]=i;else if(Array.isArray(i)&&i[0]==="in"){const d=i[1],c=a[s];if(typeof c=="string")d.includes(c)||(a[s]=["in",[]]);else if(Array.isArray(c)&&c[0]==="in"){const g=c[1].filter(p=>d.includes(p));a[s]=["in",g]}else a[s]=i}return a};function A_(e,t=20,a=0,s,i={}){const[d,c]=j.useState([]),[f,g]=j.useState(0),[p,x]=j.useState(!1),[y,_]=j.useState(!0),[k,T]=j.useState(null),[N,S]=j.useState(0),O=j.useRef(!1),C=JSON.stringify(e),A=JSON.stringify(i);j.useEffect(()=>{if(O.current&&k)return;let I=!1;return O.current=!0,oe(null,null,function*(){try{_(!0);const B=cS(e,i);console.log("[useAssets] User filters:",e),console.log("[useAssets] Permission filters:",i),console.log("[useAssets] Merged filters:",B);const H=yield hc.getAssets(B,void 0,t,a,s);I||(c(H.assets),g(H.total_count),x(H.has_more),T(null))}catch(B){if(!I){const H=B instanceof Error?B.message:"Failed to fetch assets";H.includes("417")||H.includes("Expectation Failed")||H.includes("has no attribute")?T("API endpoint not deployed or misconfigured. Please check FIX_417_ERROR.md for solutions."):T(H),c([]),g(0),x(!1)}}finally{I||_(!1)}}),()=>{I=!0}},[C,A,t,a,s,N]);const P=j.useCallback(()=>{O.current=!1,S(I=>I+1)},[]);return{assets:d,totalCount:f,hasMore:p,loading:y,error:k,refetch:P}}function dS(e){const[t,a]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>oe(null,null,function*(){if(!e){a(null),i(!1);return}try{i(!0),c(null);const p=yield hc.getAssetDetails(e);a(p)}catch(p){c(p instanceof Error?p.message:"Failed to fetch asset details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const g=j.useCallback(()=>{f()},[f]);return{asset:t,loading:s,error:d,refetch:g}}function O_(){const[e,t]=j.useState(!1),[a,s]=j.useState(null);return{createAsset:g=>oe(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Creating asset with data:",g);const p=yield hc.createAsset(g);if(console.log("[useAssetMutations] Create asset response:",p),p.success)return p.asset;{const x=p.error||"Failed to create asset";throw new Error(x)}}catch(p){console.error("[useAssetMutations] Create asset error:",p);const x=p instanceof Error?p.message:"Failed to create asset";throw s(x),p}finally{t(!1)}}),updateAsset:(g,p)=>oe(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Updating asset:",g,"with data:",p);const x=yield hc.updateAsset(g,p);if(console.log("[useAssetMutations] Update asset response:",x),x.success)return x.asset;{const y=x.error||"Failed to update asset";throw new Error(y)}}catch(x){console.error("[useAssetMutations] Update asset error:",x);const y=x instanceof Error?x.message:"Failed to update asset";throw s(y),x}finally{t(!1)}}),deleteAsset:g=>oe(null,null,function*(){try{t(!0),s(null);const p=yield hc.deleteAsset(g);if(!p.success)throw new Error("Failed to delete asset");return p}catch(p){const x=p instanceof Error?p.message:"Failed to delete asset";throw s(x),p}finally{t(!1)}}),submitAsset:g=>oe(null,null,function*(){try{t(!0),s(null),console.log("[useAssetMutations] Submitting asset:",g);const p=yield hc.submitAsset(g);return console.log("[useAssetMutations] Submit asset response:",p),p}catch(p){console.error("[useAssetMutations] Submit asset error:",p);const x=p instanceof Error?p.message:"Failed to submit asset";throw s(x),p}finally{t(!1)}}),loading:e,error:a}}var M_={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},D1=ia.createContext&&ia.createContext(M_),uS=["attr","size","title"];function fS(e,t){if(e==null)return{};var a=hS(e,t),s,i;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);for(i=0;i<d.length;i++)s=d[i],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function hS(e,t){if(e==null)return{};var a={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;a[s]=e[s]}return a}function _f(){return _f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},_f.apply(this,arguments)}function P1(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),a.push.apply(a,s)}return a}function wf(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?P1(Object(a),!0).forEach(function(s){mS(e,s,a[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):P1(Object(a)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(a,s))})}return e}function mS(e,t,a){return t=gS(t),t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function gS(e){var t=pS(e,"string");return typeof t=="symbol"?t:t+""}function pS(e,t){if(typeof e!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var s=a.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function L_(e){return e&&e.map((t,a)=>ia.createElement(t.tag,wf({key:a},t.attr),L_(t.child)))}function At(e){return t=>ia.createElement(xS,_f({attr:wf({},e.attr)},t),L_(e.child))}function xS(e){var t=a=>{var{attr:s,size:i,title:d}=e,c=fS(e,uS),f=i||a.size||"1em",g;return a.className&&(g=a.className),e.className&&(g=(g?g+" ":"")+e.className),ia.createElement("svg",_f({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,s,c,{className:g,style:wf(wf({color:e.color||a.color},a.style),e.style),height:f,width:f,xmlns:"http://www.w3.org/2000/svg"}),d&&ia.createElement("title",null,d),e.children)};return D1!==void 0?ia.createElement(D1.Consumer,null,a=>t(a)):t(M_)}function yS(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(e)}function Gs(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(e)}function bS(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(e)}function R1(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 512c35.32 0 63.97-28.65 63.97-64H160.03c0 35.35 28.65 64 63.97 64zm215.39-149.71c-19.32-20.76-55.47-51.99-55.47-154.29 0-77.7-54.48-139.9-127.94-155.16V32c0-17.67-14.32-32-31.98-32s-31.98 14.33-31.98 32v20.84C118.56 68.1 64.08 130.3 64.08 208c0 102.3-36.15 133.53-55.47 154.29-6 6.45-8.66 14.16-8.61 21.71.11 16.4 12.98 32 32.1 32h383.8c19.12 0 32-15.6 32.1-32 .05-7.55-2.61-15.27-8.61-21.71z"},child:[]}]})(e)}function vS(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M509.5 184.6L458.9 32.8C452.4 13.2 434.1 0 413.4 0H272v192h238.7c-.4-2.5-.4-5-1.2-7.4zM240 0H98.6c-20.7 0-39 13.2-45.5 32.8L2.5 184.6c-.8 2.4-.8 4.9-1.2 7.4H240V0zM0 224v240c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V224H0z"},child:[]}]})(e)}function _S(e){return At({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M560 288h-80v96l-32-21.3-32 21.3v-96h-80c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16h224c8.8 0 16-7.2 16-16V304c0-8.8-7.2-16-16-16zm-384-64h224c8.8 0 16-7.2 16-16V16c0-8.8-7.2-16-16-16h-80v96l-32-21.3L256 96V0h-80c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16zm64 64h-80v96l-32-21.3L96 384v-96H16c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16h224c8.8 0 16-7.2 16-16V304c0-8.8-7.2-16-16-16z"},child:[]}]})(e)}function hp(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 480h-20V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v456H12c-6.627 0-12 5.373-12 12v20h448v-20c0-6.627-5.373-12-12-12zM128 76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76zm0 96c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40zm52 148h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12zm76 160h-64v-84c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v84zm64-172c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40z"},child:[]}]})(e)}function xi(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V192H0v272zm320-196c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM192 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM64 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zM400 64h-48V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H160V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H48C21.5 64 0 85.5 0 112v48h448v-48c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function D_(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 160H12c-6.627 0-12-5.373-12-12v-36c0-26.51 21.49-48 48-48h48V12c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v52h128V12c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v52h48c26.51 0 48 21.49 48 48v36c0 6.627-5.373 12-12 12zM12 192h424c6.627 0 12 5.373 12 12v260c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V204c0-6.627 5.373-12 12-12zm333.296 95.947l-28.169-28.398c-4.667-4.705-12.265-4.736-16.97-.068L194.12 364.665l-45.98-46.352c-4.667-4.705-12.266-4.736-16.971-.068l-28.397 28.17c-4.705 4.667-4.736 12.265-.068 16.97l82.601 83.269c4.667 4.705 12.265 4.736 16.97.068l142.953-141.805c4.705-4.667 4.736-12.265.068-16.97z"},child:[]}]})(e)}function ff(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z"},child:[]}]})(e)}function wS(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16zM464 96H345.94c-21.38 0-32.09 25.85-16.97 40.97l32.4 32.4L288 242.75l-73.37-73.37c-12.5-12.5-32.76-12.5-45.25 0l-68.69 68.69c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L192 237.25l73.37 73.37c12.5 12.5 32.76 12.5 45.25 0l96-96 32.4 32.4c15.12 15.12 40.97 4.41 40.97-16.97V112c.01-8.84-7.15-16-15.99-16z"},child:[]}]})(e)}function Ja(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"},child:[]}]})(e)}function Fn(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 480H48c-26.51 0-48-21.49-48-48V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48zm-204.686-98.059l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.248-16.379-6.249-22.628 0L184 302.745l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.25 16.379 6.25 22.628.001z"},child:[]}]})(e)}function P_(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"},child:[]}]})(e)}function Ec(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(e)}function Vf(e){return At({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(e)}function Gf(e){return At({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(e)}function m0(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(e)}function Yu(e){return At({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 40c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm121.2 231.8l-143 141.8c-4.7 4.7-12.3 4.6-17-.1l-82.6-83.3c-4.7-4.7-4.6-12.3.1-17L99.1 285c4.7-4.7 12.3-4.6 17 .1l46 46.4 106-105.2c4.7-4.7 12.3-4.6 17 .1l28.2 28.4c4.7 4.8 4.6 12.3-.1 17z"},child:[]}]})(e)}function F1(e){return At({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM96 424c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm0-96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm0-96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm96-192c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm128 368c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-96c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16zm0-96c0 4.4-3.6 8-8 8H168c-4.4 0-8-3.6-8-8v-16c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16z"},child:[]}]})(e)}function ll(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z"},child:[]}]})(e)}function kS(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 32C114.6 32 0 125.1 0 240c0 49.6 21.4 95 57 130.7C44.5 421.1 2.7 466 2.2 466.5c-2.2 2.3-2.8 5.7-1.5 8.7S4.8 480 8 480c66.3 0 116-31.8 140.6-51.4 32.7 12.3 69 19.4 107.4 19.4 141.4 0 256-93.1 256-208S397.4 32 256 32z"},child:[]}]})(e)}function Cc(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"},child:[]}]})(e)}function _i(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(e)}function Rr(e){return At({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z"},child:[]}]})(e)}function g0(e){return At({attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z"},child:[]}]})(e)}function NS(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"},child:[]}]})(e)}function jS(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(e)}function yr(e){return At({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(e)}function hl(e){return At({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"},child:[]}]})(e)}function SS(e){return At({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm64 236c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-64c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-72v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm96-114.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"},child:[]}]})(e)}function Ac(e){return At({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm-96 144c0 4.42-3.58 8-8 8h-8c-8.84 0-16 7.16-16 16v32c0 8.84 7.16 16 16 16h8c4.42 0 8 3.58 8 8v16c0 4.42-3.58 8-8 8h-8c-26.51 0-48-21.49-48-48v-32c0-26.51 21.49-48 48-48h8c4.42 0 8 3.58 8 8v16zm44.27 104H160c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h12.27c5.95 0 10.41-3.5 10.41-6.62 0-1.3-.75-2.66-2.12-3.84l-21.89-18.77c-8.47-7.22-13.33-17.48-13.33-28.14 0-21.3 19.02-38.62 42.41-38.62H200c4.42 0 8 3.58 8 8v16c0 4.42-3.58 8-8 8h-12.27c-5.95 0-10.41 3.5-10.41 6.62 0 1.3.75 2.66 2.12 3.84l21.89 18.77c8.47 7.22 13.33 17.48 13.33 28.14.01 21.29-19 38.62-42.39 38.62zM256 264v20.8c0 20.27 5.7 40.17 16 56.88 10.3-16.7 16-36.61 16-56.88V264c0-4.42 3.58-8 8-8h16c4.42 0 8 3.58 8 8v20.8c0 35.48-12.88 68.89-36.28 94.09-3.02 3.25-7.27 5.11-11.72 5.11s-8.7-1.86-11.72-5.11c-23.4-25.2-36.28-58.61-36.28-94.09V264c0-4.42 3.58-8 8-8h16c4.42 0 8 3.58 8 8zm121-159L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1c0-6.3-2.5-12.4-7-16.9z"},child:[]}]})(e)}function Oc(e){return At({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm60.1 106.5L224 336l60.1 93.5c5.1 8-.6 18.5-10.1 18.5h-34.9c-4.4 0-8.5-2.4-10.6-6.3C208.9 405.5 192 373 192 373c-6.4 14.8-10 20-36.6 68.8-2.1 3.9-6.1 6.3-10.5 6.3H110c-9.5 0-15.2-10.5-10.1-18.5l60.3-93.5-60.3-93.5c-5.2-8 .6-18.5 10.1-18.5h34.8c4.4 0 8.5 2.4 10.6 6.3 26.1 48.8 20 33.6 36.6 68.5 0 0 6.1-11.7 36.6-68.5 2.1-3.9 6.2-6.3 10.6-6.3H274c9.5-.1 15.2 10.4 10.1 18.4zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"},child:[]}]})(e)}function Qr(e){return At({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M384 121.9c0-6.3-2.5-12.4-7-16.9L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128zM571 308l-95.7-96.4c-10.1-10.1-27.4-3-27.4 11.3V288h-64v64h64v65.2c0 14.3 17.3 21.4 27.4 11.3L571 332c6.6-6.6 6.6-17.4 0-24zm-379 28v-32c0-8.8 7.2-16 16-16h176V160H248c-13.2 0-24-10.8-24-24V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V352H208c-8.8 0-16-7.2-16-16z"},child:[]}]})(e)}function ws(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.976 0H24.028C2.71 0-8.047 25.866 7.058 40.971L192 225.941V432c0 7.831 3.821 15.17 10.237 19.662l80 55.98C298.02 518.69 320 507.493 320 487.98V225.941l184.947-184.97C520.021 25.896 509.338 0 487.976 0z"},child:[]}]})(e)}function I1(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M192 208c0-17.67-14.33-32-32-32h-16c-35.35 0-64 28.65-64 64v48c0 35.35 28.65 64 64 64h16c17.67 0 32-14.33 32-32V208zm176 144c35.35 0 64-28.65 64-64v-48c0-35.35-28.65-64-64-64h-16c-17.67 0-32 14.33-32 32v112c0 17.67 14.33 32 32 32h16zM256 0C113.18 0 4.58 118.83 0 256v16c0 8.84 7.16 16 16 16h16c8.84 0 16-7.16 16-16v-16c0-114.69 93.31-208 208-208s208 93.31 208 208h-.12c.08 2.43.12 165.72.12 165.72 0 23.35-18.93 42.28-42.28 42.28H320c0-26.51-21.49-48-48-48h-32c-26.51 0-48 21.49-48 48s21.49 48 48 48h181.72c49.86 0 90.28-40.42 90.28-90.28V256C507.42 118.83 398.82 0 256 0z"},child:[]}]})(e)}function $g(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 255.531c.253 136.64-111.18 248.372-247.82 248.468-59.015.042-113.223-20.53-155.822-54.911-11.077-8.94-11.905-25.541-1.839-35.607l11.267-11.267c8.609-8.609 22.353-9.551 31.891-1.984C173.062 425.135 212.781 440 256 440c101.705 0 184-82.311 184-184 0-101.705-82.311-184-184-184-48.814 0-93.149 18.969-126.068 49.932l50.754 50.754c10.08 10.08 2.941 27.314-11.313 27.314H24c-8.837 0-16-7.163-16-16V38.627c0-14.254 17.234-21.393 27.314-11.314l49.372 49.372C129.209 34.136 189.552 8 256 8c136.81 0 247.747 110.78 248 247.531zm-180.912 78.784l9.823-12.63c8.138-10.463 6.253-25.542-4.21-33.679L288 256.349V152c0-13.255-10.745-24-24-24h-16c-13.255 0-24 10.745-24 24v135.651l65.409 50.874c10.463 8.137 25.541 6.253 33.679-4.21z"},child:[]}]})(e)}function Hd(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"},child:[]}]})(e)}function vg(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(e)}function TS(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(e)}function ES(e){return At({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M0 117.66v346.32c0 11.32 11.43 19.06 21.94 14.86L160 416V32L20.12 87.95A32.006 32.006 0 0 0 0 117.66zM192 416l192 64V96L192 32v384zM554.06 33.16L416 96v384l139.88-55.95A31.996 31.996 0 0 0 576 394.34V48.02c0-11.32-11.43-19.06-21.94-14.86z"},child:[]}]})(e)}function ts(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(e)}function so(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M448 192V77.25c0-8.49-3.37-16.62-9.37-22.63L393.37 9.37c-6-6-14.14-9.37-22.63-9.37H96C78.33 0 64 14.33 64 32v160c-35.35 0-64 28.65-64 64v112c0 8.84 7.16 16 16 16h48v96c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-96h48c8.84 0 16-7.16 16-16V256c0-35.35-28.65-64-64-64zm-64 256H128v-96h256v96zm0-224H128V64h192v48c0 8.84 7.16 16 16 16h48v96zm48 72c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"},child:[]}]})(e)}function Xu(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 224h192V32H0v192zM64 96h64v64H64V96zm192-64v192h192V32H256zm128 128h-64V96h64v64zM0 480h192V288H0v192zm64-128h64v64H64v-64zm352-64h32v128h-96v-32h-32v96h-64V288h96v32h64v-32zm0 160h32v32h-32v-32zm-64 0h32v32h-32v-32z"},child:[]}]})(e)}function jr(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"},child:[]}]})(e)}function $s(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(e)}function CS(e){return At({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528.12 301.319l47.273-208C578.806 78.301 567.391 64 551.99 64H159.208l-9.166-44.81C147.758 8.021 137.93 0 126.529 0H24C10.745 0 0 10.745 0 24v16c0 13.255 10.745 24 24 24h69.883l70.248 343.435C147.325 417.1 136 435.222 136 456c0 30.928 25.072 56 56 56s56-25.072 56-56c0-15.674-6.447-29.835-16.824-40h209.647C430.447 426.165 424 440.326 424 456c0 30.928 25.072 56 56 56s56-25.072 56-56c0-22.172-12.888-41.332-31.579-50.405l5.517-24.276c3.413-15.018-8.002-29.319-23.403-29.319H218.117l-6.545-32h293.145c11.206 0 20.92-7.754 23.403-18.681z"},child:[]}]})(e)}function Pn(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"},child:[]}]})(e)}function wr(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function p0(e){return At({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"},child:[]}]})(e)}function mp(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M440.65 12.57l4 82.77A247.16 247.16 0 0 0 255.83 8C134.73 8 33.91 94.92 12.29 209.82A12 12 0 0 0 24.09 224h49.05a12 12 0 0 0 11.67-9.26 175.91 175.91 0 0 1 317-56.94l-101.46-4.86a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12H500a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12h-47.37a12 12 0 0 0-11.98 12.57zM255.83 432a175.61 175.61 0 0 1-146-77.8l101.8 4.87a12 12 0 0 0 12.57-12v-47.4a12 12 0 0 0-12-12H12a12 12 0 0 0-12 12V500a12 12 0 0 0 12 12h47.35a12 12 0 0 0 12-12.6l-4.15-82.57A247.17 247.17 0 0 0 255.83 504c121.11 0 221.93-86.92 243.55-201.82a12 12 0 0 0-11.8-14.18h-49.05a12 12 0 0 0-11.67 9.26A175.86 175.86 0 0 1 255.83 432z"},child:[]}]})(e)}function AS(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 252.118V48C0 21.49 21.49 0 48 0h204.118a48 48 0 0 1 33.941 14.059l211.882 211.882c18.745 18.745 18.745 49.137 0 67.882L293.823 497.941c-18.745 18.745-49.137 18.745-67.882 0L14.059 286.059A48 48 0 0 1 0 252.118zM112 64c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z"},child:[]}]})(e)}function Ju(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M104 224H24c-13.255 0-24 10.745-24 24v240c0 13.255 10.745 24 24 24h80c13.255 0 24-10.745 24-24V248c0-13.255-10.745-24-24-24zM64 472c-13.255 0-24-10.745-24-24s10.745-24 24-24 24 10.745 24 24-10.745 24-24 24zM384 81.452c0 42.416-25.97 66.208-33.277 94.548h101.723c33.397 0 59.397 27.746 59.553 58.098.084 17.938-7.546 37.249-19.439 49.197l-.11.11c9.836 23.337 8.237 56.037-9.308 79.469 8.681 25.895-.069 57.704-16.382 74.757 4.298 17.598 2.244 32.575-6.148 44.632C440.202 511.587 389.616 512 346.839 512l-2.845-.001c-48.287-.017-87.806-17.598-119.56-31.725-15.957-7.099-36.821-15.887-52.651-16.178-6.54-.12-11.783-5.457-11.783-11.998v-213.77c0-3.2 1.282-6.271 3.558-8.521 39.614-39.144 56.648-80.587 89.117-113.111 14.804-14.832 20.188-37.236 25.393-58.902C282.515 39.293 291.817 0 312 0c24 0 72 8 72 81.452z"},child:[]}]})(e)}function hn(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"},child:[]}]})(e)}function vt(e){return At({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(e)}function Wg(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M501.1 395.7L384 278.6c-23.1-23.1-57.6-27.6-85.4-13.9L192 158.1V96L64 0 0 64l96 128h62.1l106.6 106.6c-13.6 27.8-9.2 62.3 13.9 85.4l117.1 117.1c14.6 14.6 38.2 14.6 52.7 0l52.7-52.7c14.5-14.6 14.5-38.2 0-52.7zM331.7 225c28.3 0 54.9 11 74.9 31l19.4 19.4c15.8-6.9 30.8-16.5 43.8-29.5 37.1-37.1 49.7-89.3 37.9-136.7-2.2-9-13.5-12.1-20.1-5.5l-74.4 74.4-67.9-11.3L334 98.9l74.4-74.4c6.6-6.6 3.4-17.9-5.7-20.2-47.4-11.7-99.6.9-136.6 37.9-28.5 28.5-41.9 66.1-41.2 103.6l82.1 82.1c8.1-1.9 16.5-2.9 24.7-2.9zm-103.9 82l-56.7-56.7L18.7 402.8c-25 25-25 65.5 0 90.5s65.5 25 90.5 0l123.6-123.6c-7.6-19.9-9.9-41.6-5-62.7zM64 472c-13.2 0-24-10.8-24-24 0-13.3 10.7-24 24-24s24 10.7 24 24c0 13.2-10.7 24-24 24z"},child:[]}]})(e)}function OS(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"},child:[]}]})(e)}function ha(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"},child:[]}]})(e)}function MS(e){return At({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M624 208h-64v-64c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v64h-64c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h64v64c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-64h64c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm-400 48c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"},child:[]}]})(e)}function LS(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm95.8 32.6L272 480l-32-136 32-56h-96l32 56-32 136-47.8-191.4C56.9 292 0 350.3 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-72.1-56.9-130.4-128.2-133.8z"},child:[]}]})(e)}function R_(e){return At({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"},child:[]}]})(e)}function Zd(e){return At({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"},child:[]}]})(e)}function z1(e){return At({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"},child:[]}]})(e)}const DS=()=>{var xe,le,ge,be;const{t:e}=Qa(),{data:t,loading:a}=fp(),{workOrders:s}=T_({},1e3,0),{logs:i}=Wf({},1e3,0),{assets:d}=A_({},1e3,0),[c,f]=j.useState(null),[g,p]=j.useState(null),[x,y]=j.useState(null),[_,k]=j.useState(null),[T,N]=j.useState(null),[S,O]=j.useState(null),[C,A]=j.useState({open:0,inProgress:0,completed:0,total:0}),[P,I]=j.useState({assetUptime:0,avgResponseTime:0,maintenanceEfficiency:0,overdueTasks:0,plannedMaintenance:0}),{data:ee}=Yl("Up & Down Time Chart"),{data:B}=Yl("Work Order Status Chart"),{data:H}=Yl("Maintenance - Asset wise Count"),{data:Y}=Yl("Asset Maintenance Assignees Status Count"),{data:ue}=Yl("Asset Maintenance Frequency Chart");return j.useEffect(()=>{if(d&&d.length>0){let me=0,ae=0;d.forEach(te=>{const se=te.custom_up_time||0,F=te.custom_down_time||0;me+=typeof se=="number"?se:0,ae+=typeof F=="number"?F:0});const Z=[],K=[];if(me>0&&(Z.push(e("dashboard.upTime")),K.push(me)),ae>0&&(Z.push(e("dashboard.downTime")),K.push(ae)),Z.length>0&&K.length>0){const te=[];me>0&&te.push("#6366F1"),ae>0&&te.push("#8B5CF6"),k({labels:Z,datasets:[{name:"Time",values:K,colors:te}],type:"Pie"})}else k(null)}else k(null)},[d]),j.useEffect(()=>{if(s&&s.length>0){const me={};let ae=0,Z=0,K=0;s.forEach(Ve=>{const st=Ve.repair_status||"Unknown";me[st]=(me[st]||0)+1,st.toLowerCase()==="open"&&ae++,st.toLowerCase()==="in progress"&&Z++,st.toLowerCase()==="completed"&&K++});const te=Object.keys(me),se=Object.values(me),F={Open:"#F59E0B","In Progress":"#3B82F6",Pending:"#8B5CF6",Completed:"#10B981",Cancelled:"#EC4899",Unknown:"#6B7280"},D=te.map(Ve=>F[Ve]||"#6366F1");f({labels:te,datasets:[{name:"Work Orders",values:se,colors:D}],type:"bar"}),A({open:ae,inProgress:Z,completed:K,total:s.length});const W={},G=new Set,J=Ve=>{const st=Ve.toLowerCase().trim();return st.includes("open")?"Open":st.includes("work in progress")||st.includes("in progress")||st.includes("wip")?"Work In Progress":st.includes("pending review")||st.includes("pending")?"Pending Review":st.includes("completed")||st.includes("complete")?"Completed":st.includes("closed")?"Closed":Ve};s.forEach(Ve=>{const st=Ve.work_order_type||"null",gt=J(Ve.repair_status||"Unknown");G.add(gt),W[st]||(W[st]={}),W[st][gt]||(W[st][gt]=0),W[st][gt]++});const de=Object.keys(W),De=["Open","Work In Progress","Pending Review","Completed","Closed"],$e=Array.from(G).sort((Ve,st)=>{const gt=De.indexOf(Ve),zt=De.indexOf(st);return gt!==-1&&zt!==-1?gt-zt:gt!==-1?-1:zt!==-1?1:Ve.localeCompare(st)}).map(Ve=>{const st=de.map(gt=>W[gt][Ve]||0);return{name:Ve,values:st}});p({labels:de,datasets:$e,type:"Bar"})}else p(null)},[s]),j.useEffect(()=>{if(i&&i.length>0){const me={};let ae=0,Z=0,K=0;const te=new Date;i.forEach(Ue=>{var we,Ie;const ce=Ue.asset_name||"Unknown";me[ce]=(me[ce]||0)+1,((we=Ue.maintenance_status)==null?void 0:we.toLowerCase())==="completed"&&ae++,((Ie=Ue.maintenance_status)==null?void 0:Ie.toLowerCase())==="planned"&&Z++,Ue.due_date&&new Date(Ue.due_date)<te&&Ue.maintenance_status!=="Completed"&&K++});const se=Object.entries(me).sort(([,Ue],[,ce])=>ce-Ue).slice(0,10),F=se.map(([Ue])=>Ue),D=se.map(([,Ue])=>Ue),W=kf(F.length);y({labels:F,datasets:[{name:"Maintenance Count",values:D,colors:W}],type:"bar"});const G=i.length>0?ae/i.length*100:0;I(Ue=>Ee(ie({},Ue),{maintenanceEfficiency:G,overdueTasks:K,plannedMaintenance:Z}));const J={},de=new Set,De=(Ue,ce)=>{const we=Ue.toLowerCase().trim(),Ie=new Date,lt=ce.due_date?new Date(ce.due_date):null;return lt&<<Ie&&we!=="completed"&&we!=="cancelled"?"Overdue":we.includes("completed on time")||we==="completed on time"?"Completed On Time":we.includes("completed within")||we.includes("within sla")||we==="completed"?"Completed Within SLA":we.includes("delay")||we.includes("late")?"Delay In Completion":we.includes("pending")||we==="planned"?"Pending":we.includes("overdue")?"Overdue":we.includes("cancelled")||we==="cancelled"?"Cancelled":Ue};i.forEach(Ue=>{const ce=Ue.assign_to_name||"null",we=Ue.maintenance_status||"Unknown",Ie=De(we,Ue);de.add(Ie),J[ce]||(J[ce]={}),J[ce][Ie]||(J[ce][Ie]=0),J[ce][Ie]++});const Ne=Object.keys(J),$e=["Completed On Time","Completed Within SLA","Delay In Completion","Pending","Overdue","Cancelled"],st=Array.from(de).sort((Ue,ce)=>{const we=$e.indexOf(Ue),Ie=$e.indexOf(ce);return we!==-1&&Ie!==-1?we-Ie:we!==-1?-1:Ie!==-1?1:Ue.localeCompare(ce)}).map(Ue=>{const ce=Ne.map(we=>J[we][Ue]||0);return{name:Ue,values:ce}});N({labels:Ne,datasets:st,type:"Bar"});const gt={};i.forEach(Ue=>{const ce=Ue.periodicity||Ue.maintenance_type||"Other";gt[ce]=(gt[ce]||0)+1});const zt=Object.entries(gt).sort(([,Ue],[,ce])=>ce-Ue),Ge=zt.map(([Ue])=>Ue),Ct=zt.map(([,Ue])=>Ue),St=kf(Ge.length);O({labels:Ge,datasets:[{name:"Frequency",values:Ct,colors:St}],type:"bar"})}else N(null),O(null)},[i]),j.useEffect(()=>{if(s&&s.length>0){let me=0,ae=0;s.forEach(se=>{if(se.creation&&se.first_responded_on){const F=new Date(se.creation),W=(new Date(se.first_responded_on).getTime()-F.getTime())/(1e3*60*60);W>=0&&(me+=W,ae++)}});const Z=ae>0?me/ae:0,K=s.filter(se=>{var F;return((F=se.repair_status)==null?void 0:F.toLowerCase())==="completed"}).length,te=s.length>0?K/s.length*100:0;I(se=>Ee(ie({},se),{assetUptime:te,avgResponseTime:Z}))}},[s]),a?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto mb-4"}),r.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:e("dashboard.loading")})]})}):r.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:r.jsxs("div",{className:"max-w-[1600px] mx-auto",children:[r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-3 mb-6",children:[r.jsxs("div",{className:"lg:col-span-7 space-y-2",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700 px-4 py-4",children:r.jsxs("div",{className:"grid grid-cols-12 gap-0 w-full",children:[r.jsx("div",{className:"col-span-2",children:r.jsx(lc,{icon:r.jsx(_S,{className:"text-indigo-600"}),value:(xe=t==null?void 0:t.total_assets)!=null?xe:0,label:e("dashboard.totalAssets"),bgColor:"bg-indigo-50 dark:bg-indigo-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(lc,{icon:r.jsx(CS,{className:"text-purple-600"}),value:C.open||((le=t==null?void 0:t.work_orders_open)!=null?le:0),label:e("dashboard.openWorkOrders"),bgColor:"bg-purple-50 dark:bg-purple-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(lc,{icon:r.jsx(ll,{className:"text-blue-600"}),value:C.inProgress||((ge=t==null?void 0:t.work_orders_in_progress)!=null?ge:0),label:e("dashboard.workOrdersInProgress"),bgColor:"bg-blue-50 dark:bg-blue-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(lc,{icon:r.jsx(Ja,{className:"text-pink-600"}),value:C.completed||((be=t==null?void 0:t.work_orders_completed)!=null?be:0),label:e("dashboard.completedWorkOrders"),bgColor:"bg-pink-50 dark:bg-pink-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(lc,{icon:r.jsx(Wg,{className:"text-cyan-600"}),value:(i==null?void 0:i.length)||0,label:e("dashboard.maintenanceLogs"),bgColor:"bg-cyan-50 dark:bg-cyan-900/20"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(lc,{icon:r.jsx(wS,{className:"text-purple-600"}),value:C.total,label:e("dashboard.totalWorkOrders"),bgColor:"bg-purple-50 dark:bg-purple-900/20"})})]})}),r.jsx(PS,{totalWorkOrders:C.total,completedWorkOrders:C.completed,inProgressWorkOrders:C.inProgress})]}),r.jsx("div",{className:"lg:col-span-5",children:r.jsx(B1,{title:e("dashboard.assigneesStatus"),data:T||Y})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[r.jsx(Ku,{icon:r.jsx(Ja,{className:"text-green-500"}),title:e("dashboard.assetUptime"),value:`${P.assetUptime.toFixed(1)}%`,trend:P.assetUptime>=90?"Excellent":P.assetUptime>=75?"Good":"Needs Attention",trendUp:P.assetUptime>=75,bgColor:"bg-green-50 dark:bg-green-900/20"}),r.jsx(Ku,{icon:r.jsx(ll,{className:"text-blue-500"}),title:e("dashboard.avgResponseTime"),value:P.avgResponseTime>0?`${P.avgResponseTime.toFixed(1)} hrs`:"N/A",trend:P.avgResponseTime>0&&P.avgResponseTime<4?"Fast Response":"Monitor",trendUp:P.avgResponseTime>0&&P.avgResponseTime<4,bgColor:"bg-blue-50 dark:bg-blue-900/20"}),r.jsx(Ku,{icon:r.jsx(Wg,{className:"text-orange-500"}),title:e("dashboard.maintenanceEfficiency"),value:`${P.maintenanceEfficiency.toFixed(1)}%`,trend:P.maintenanceEfficiency>=70?"On Track":"Needs Attention",trendUp:P.maintenanceEfficiency>=70,bgColor:"bg-orange-50 dark:bg-orange-900/20"}),r.jsx(Ku,{icon:r.jsx(yr,{className:"text-red-500"}),title:e("dashboard.overdueMaintenance"),value:P.overdueTasks,trend:P.overdueTasks===0?"All Clear":P.overdueTasks<=3?"Low":"High Priority",trendUp:P.overdueTasks<=3,bgColor:"bg-red-50 dark:bg-red-900/20"})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 mb-6",children:[r.jsx("div",{className:"w-full",children:r.jsx(FS,{data:_||ee,title:e("dashboard.upDownTimeChart"),description:"Asset uptime and downtime distribution for tracking availability."})}),r.jsx("div",{className:"md:col-span-2"})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 ",children:[r.jsx(U1,{title:e("dashboard.maintenanceByAsset"),data:x||H,type:"bar"}),r.jsx(U1,{title:e("dashboard.maintenanceFrequency"),data:S||ue,type:"bar"}),r.jsx(RS,{data:c||B,totalWorkOrders:C.total,completedWorkOrders:C.completed}),r.jsx(B1,{title:e("dashboard.workOrderStatus"),data:g||B})]})]})})},lc=({icon:e,value:t,label:a,bgColor:s})=>r.jsxs("div",{className:"text-center py-2 px-1 border-r border-gray-200 dark:border-gray-700 last:border-r-0",children:[r.jsx("div",{className:`w-10 h-10 ${s} rounded-lg flex items-center justify-center text-base mx-auto mb-1.5`,children:e}),r.jsx("div",{className:"text-lg font-semibold text-gray-900 dark:text-white leading-none mb-1",children:t}),r.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide leading-tight px-1",children:a})]}),Ku=({icon:e,title:t,value:a,trend:s,trendUp:i,bgColor:d})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all p-4 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsx("div",{className:`w-10 h-10 ${d} rounded-lg flex items-center justify-center text-lg`,children:e}),r.jsxs("div",{className:`flex items-center gap-1 text-xs font-medium ${i?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[i?r.jsx(bS,{className:"text-[10px]"}):r.jsx(yS,{className:"text-[10px]"}),s]})]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-1",children:a}),r.jsx("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:t})]}),PS=({totalWorkOrders:e,completedWorkOrders:t,inProgressWorkOrders:a})=>{const s=e>0?(t/e*100).toFixed(2):"0.00";return r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all px-5 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"mb-3",children:[r.jsxs("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-2",children:[s,"%"]}),r.jsx("div",{className:"text-sm font-medium text-indigo-600 dark:text-indigo-400 mb-1",children:"Completion Rate"})]}),r.jsx("div",{className:"mt-1",children:r.jsx(IS,{})}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-2 pt-2 mb-2 pb-2 border-t border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-lg font-semibold text-indigo-600 dark:text-indigo-400",children:e}),r.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Total"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-lg font-semibold text-blue-600 dark:text-blue-400",children:a}),r.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"In Progress"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-lg font-semibold text-green-600 dark:text-green-400",children:t}),r.jsx("div",{className:"text-[9px] font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Completed"})]})]})]})},RS=({data:e,totalWorkOrders:t,completedWorkOrders:a})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all px-5 py-5 border border-gray-200 dark:border-gray-700 flex flex-col",style:{minHeight:"100%"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Work Order Status Distribution"}),r.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[r.jsxs("div",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:[t," Total"]}),r.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:[r.jsxs("span",{className:"font-medium",children:[a," Completed"]}),r.jsxs("span",{className:"ml-1",children:["(",t>0?(a/t*100).toFixed(1):0,"%)"]})]})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("button",{className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:r.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{d:"M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"})})})})]}),r.jsx("div",{className:"flex-1",children:r.jsx(F_,{data:e})})]}),FS=({data:e,title:t,description:a})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all p-5 border border-gray-200 dark:border-gray-700",children:[r.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white mb-1",children:t}),r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-4",children:a}),e?r.jsx(I_,{data:e}):r.jsx("div",{className:"h-64 flex items-center justify-center text-gray-400",children:"No data available"})]}),IS=()=>{const e=[10,15,13,17,14,18,16],t=Math.max(...e),a=400,s=80,i=e.map((c,f)=>{const g=f/(e.length-1)*a,p=s-c/t*s;return`${g},${p}`}).join(" "),d=`0,${s} ${i} ${a},${s}`;return r.jsxs("svg",{width:"100%",height:s,viewBox:`0 0 ${a} ${s}`,className:"w-full",children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:"areaGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[r.jsx("stop",{offset:"0%",style:{stopColor:"#8B5CF6",stopOpacity:.3}}),r.jsx("stop",{offset:"100%",style:{stopColor:"#8B5CF6",stopOpacity:.05}})]})}),r.jsx("polygon",{points:d,fill:"url(#areaGradient)"}),r.jsx("polyline",{points:i,fill:"none",stroke:"#8B5CF6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},zS=({data:e})=>{const t=(e==null?void 0:e.labels)||[],a=(e==null?void 0:e.datasets)||[];if(!a.length)return r.jsx("div",{className:"text-center text-gray-400 py-4 text-sm",children:"No data available"});const s=a.flatMap(k=>k.values||[]),i=Math.max(...s,1),d=240,c=Math.max(800,t.length*100),f=Math.min(120,(c-100)/t.length),g=4,p=a.length,x=Math.max(12,(f-g*(p+1))/p),y={"Completed On Time":"#6366F1","Completed Within SLA":"#3B82F6","Delay In Completion":"#8B5CF6",Pending:"#A855F7",Overdue:"#EC4899",Cancelled:"#0EA5E9",Open:"#6366F1","Work In Progress":"#3B82F6","Pending Review":"#8B5CF6",Completed:"#6366F1",Closed:"#A855F7"},_=(k,T)=>{for(const[N,S]of Object.entries(y))if(k.toLowerCase().includes(N.toLowerCase()))return S;return kf(p)[T]};return r.jsxs("div",{className:"relative w-full overflow-x-auto",children:[r.jsxs("svg",{width:"100%",height:d+40,viewBox:`0 0 ${c} ${d+40}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[r.jsx("defs",{children:a.map((k,T)=>{const N=_(k.name||"",T);return r.jsxs("linearGradient",{id:`groupedBarGradient${T}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[r.jsx("stop",{offset:"0%",style:{stopColor:N,stopOpacity:.9}}),r.jsx("stop",{offset:"100%",style:{stopColor:N,stopOpacity:.7}})]},T)})}),[0,.25,.5,.75,1].map((k,T)=>r.jsx("line",{x1:"60",y1:d-k*d,x2:c-20,y2:d-k*d,stroke:"#E5E7EB",strokeWidth:"1",className:"dark:stroke-gray-700"},T)),[0,.25,.5,.75,1].map((k,T)=>r.jsx("text",{x:"45",y:d-k*d+4,textAnchor:"end",className:"text-xs fill-gray-400 dark:fill-gray-500",children:(i*k).toFixed(k===0?0:i<5?1:0)},T)),r.jsx("text",{x:"15",y:d/2,textAnchor:"middle",transform:`rotate(-90, 15, ${d/2})`,className:"text-xs fill-gray-600 dark:fill-gray-400 font-medium",children:"Count"}),t.map((k,T)=>{const N=80+T*f;return r.jsxs("g",{children:[a.map((S,O)=>{var B;const A=(((B=S.values)==null?void 0:B[T])||0)/i*d,P=N+g+O*(x+g),I=d-A,ee=_(S.name||"",O);return r.jsx("g",{children:r.jsx("rect",{x:P,y:I,width:x,height:A,fill:ee,rx:"4",ry:"4",className:"hover:opacity-80 cursor-pointer transition-opacity"})},O)}),r.jsx("text",{x:N+f/2,y:d+15,textAnchor:"middle",className:"text-xs fill-gray-600 dark:fill-gray-400",children:k&&k.length>12?k.substring(0,10)+"...":k||"null"})]},T)})]}),r.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2 mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:a.map((k,T)=>{const N=_(k.name||"",T);return r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-2.5 h-2.5 rounded",style:{backgroundColor:N}}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:k.name&&k.name.length>20?k.name.substring(0,18)+"...":k.name||`Series ${T+1}`})]},T)})})]})},F_=({data:e})=>{var x;const t=(e==null?void 0:e.labels)||[],a=(e==null?void 0:e.datasets)||[];if(!a.length)return r.jsx("div",{className:"text-center text-gray-400 py-8",children:"No data available"});const s=a.flatMap(y=>y.values||[]),i=Math.max(...s,1),d=250,g=Math.max(800,t.length*60+100),p=((x=a[0])==null?void 0:x.values)||[];return r.jsxs("div",{className:"relative w-full overflow-x-auto",children:[r.jsxs("svg",{width:"100%",height:"320",viewBox:`0 0 ${g} ${d+70}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:"barGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[r.jsx("stop",{offset:"0%",style:{stopColor:"#8B5CF6",stopOpacity:.8}}),r.jsx("stop",{offset:"100%",style:{stopColor:"#8B5CF6",stopOpacity:.6}})]})}),[0,.25,.5,.75,1].map((y,_)=>r.jsx("line",{x1:"60",y1:d-y*d,x2:g-20,y2:d-y*d,stroke:"#E5E7EB",strokeWidth:"1",className:"dark:stroke-gray-700"},_)),[0,.25,.5,.75,1].map((y,_)=>r.jsx("text",{x:"45",y:d-y*d+4,textAnchor:"end",className:"text-xs fill-gray-400 dark:fill-gray-500",children:(i*y).toFixed(0)},_)),t.map((y,_)=>{var O,C;const T=(((C=(O=a[0])==null?void 0:O.values)==null?void 0:C[_])||0)/i*d,N=Math.min(40,(g-100)/t.length-10),S=80+_*((g-100)/t.length);return r.jsx("g",{children:r.jsx("rect",{x:S,y:d-T,width:N,height:T,fill:"url(#barGradient)",rx:"4",ry:"4",className:"hover:opacity-80 cursor-pointer transition-opacity"})},_)}),p.length>0&&r.jsx("polyline",{points:p.map((y,_)=>{const k=80+_*((g-100)/t.length)+20,T=d-y/i*d;return`${k},${T}`}).join(" "),fill:"none",stroke:"#60A5FA",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"drop-shadow-md"}),p.map((y,_)=>{const k=80+_*((g-100)/t.length)+20,T=d-y/i*d;return r.jsx("circle",{cx:k,cy:T,r:"4",fill:"#3B82F6",className:"hover:r-6 cursor-pointer transition-all"},_)}),t.map((y,_)=>{const k=(g-100)/t.length,T=80+_*k+k/2,N=y&&y.length>15?y.substring(0,13)+"...":y||"null";return r.jsx("text",{x:T,y:d+50,transform:`rotate(-45, ${T}, ${d+50})`,textAnchor:"middle",className:"text-xs fill-gray-600 dark:fill-gray-400",children:N},_)})]}),r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-3 h-3 rounded",style:{background:"#8B5CF6"}}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Total Sales"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Average"})]})]})]})},I_=({data:e})=>{var y,_,k,T;const t=(e==null?void 0:e.labels)||[],a=((_=(y=e==null?void 0:e.datasets)==null?void 0:y[0])==null?void 0:_.values)||[],s=t.some(N=>N.toLowerCase().includes("up time")||N.toLowerCase().includes("down time")||N.toLowerCase().includes("uptime")||N.toLowerCase().includes("downtime"));let i=[];if(s&&t.length>=1)i=t.map(N=>{const S=N.toLowerCase();return S.includes("up time")||S.includes("uptime")?"#6366F1":S.includes("down time")||S.includes("downtime")?"#8B5CF6":t.indexOf(N)===0?"#6366F1":"#8B5CF6"});else{const N=(T=(k=e==null?void 0:e.datasets)==null?void 0:k[0])==null?void 0:T.colors;i=N&&N.length===a.length?N:kf(a.length)}const d=a.reduce((N,S)=>N+S,0),c=100,f=c+10,g=c+10;let p=0;const x=a.map((N,S)=>{const O=p/d*2*Math.PI-Math.PI/2;p+=N;const C=p/d*2*Math.PI-Math.PI/2,A=C-O>Math.PI?1:0,P=f+c*Math.cos(O),I=g+c*Math.sin(O),ee=f+c*Math.cos(C),B=g+c*Math.sin(C);return{path:`M ${f} ${g} L ${P} ${I} A ${c} ${c} 0 ${A} 1 ${ee} ${B} Z`,color:i[S],label:t[S],value:N,percentage:(N/d*100).toFixed(1)}});return r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-around",children:[r.jsx("svg",{width:f*2,height:g*2,viewBox:`0 0 ${f*2} ${g*2}`,className:"max-w-xs",children:x.map((N,S)=>r.jsx("path",{d:N.path,fill:N.color,className:"hover:opacity-80 transition-opacity cursor-pointer drop-shadow-lg"},S))}),r.jsx("div",{className:"flex flex-col gap-3 mt-4 md:mt-0",children:x.map((N,S)=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),r.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:N.label}),r.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-white",children:N.value})]},S))})]})},B1=({title:e,data:t})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all p-3 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h3",{className:"text-sm font-semibold text-gray-800 dark:text-white",children:e}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{className:"p-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:r.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})})}),r.jsx("button",{className:"p-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:r.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{d:"M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"})})})]})]}),!t||!t.datasets||!t.datasets.length?r.jsx("div",{className:"h-48 flex items-center justify-center text-gray-400",children:r.jsx("div",{className:"text-center",children:r.jsx("div",{className:"text-xs",children:"No chart data available"})})}):r.jsx(zS,{data:t})]}),U1=({title:e,data:t,type:a})=>r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow hover:shadow-md transition-all p-5 border border-gray-200 dark:border-gray-700",children:[r.jsx("h3",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4",children:e}),!t||!t.datasets||!t.datasets.length?r.jsx("div",{className:"h-64 flex items-center justify-center text-gray-400",children:r.jsx("div",{className:"text-center",children:r.jsx("div",{className:"text-sm",children:"No chart data available"})})}):a==="pie"?r.jsx(I_,{data:t}):r.jsx(F_,{data:t})]});function kf(e){const t=["#8B5CF6","#6366F1","#3B82F6","#06B6D4","#14B8A6","#EC4899","#A855F7","#0EA5E9","#10B981","#F472B6","#7C3AED","#2DD4BF"];return Array.from({length:e},(a,s)=>t[s%t.length])}function z_(e,t){return function(){return e.apply(t,arguments)}}const{toString:BS}=Object.prototype,{getPrototypeOf:gp}=Object,{iterator:Zf,toStringTag:B_}=Symbol,qf=(e=>t=>{const a=BS.call(t);return e[a]||(e[a]=a.slice(8,-1).toLowerCase())})(Object.create(null)),Ns=e=>(e=e.toLowerCase(),t=>qf(t)===e),Yf=e=>t=>typeof t===e,{isArray:Mc}=Array,kc=Yf("undefined");function x0(e){return e!==null&&!kc(e)&&e.constructor!==null&&!kc(e.constructor)&&mn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const U_=Ns("ArrayBuffer");function US(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&U_(e.buffer),t}const HS=Yf("string"),mn=Yf("function"),H_=Yf("number"),y0=e=>e!==null&&typeof e=="object",$S=e=>e===!0||e===!1,hf=e=>{if(qf(e)!=="object")return!1;const t=gp(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(B_ in e)&&!(Zf in e)},WS=e=>{if(!y0(e)||x0(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},VS=Ns("Date"),GS=Ns("File"),ZS=Ns("Blob"),qS=Ns("FileList"),YS=e=>y0(e)&&mn(e.pipe),XS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||mn(e.append)&&((t=qf(e))==="formdata"||t==="object"&&mn(e.toString)&&e.toString()==="[object FormData]"))},JS=Ns("URLSearchParams"),[KS,QS,e6,t6]=["ReadableStream","Request","Response","Headers"].map(Ns),a6=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function b0(e,t,{allOwnKeys:a=!1}={}){if(e===null||typeof e=="undefined")return;let s,i;if(typeof e!="object"&&(e=[e]),Mc(e))for(s=0,i=e.length;s<i;s++)t.call(null,e[s],s,e);else{if(x0(e))return;const d=a?Object.getOwnPropertyNames(e):Object.keys(e),c=d.length;let f;for(s=0;s<c;s++)f=d[s],t.call(null,e[f],f,e)}}function $_(e,t){if(x0(e))return null;t=t.toLowerCase();const a=Object.keys(e);let s=a.length,i;for(;s-- >0;)if(i=a[s],t===i.toLowerCase())return i;return null}const Ql=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,W_=e=>!kc(e)&&e!==Ql;function Vg(){const{caseless:e,skipUndefined:t}=W_(this)&&this||{},a={},s=(i,d)=>{const c=e&&$_(a,d)||d;hf(a[c])&&hf(i)?a[c]=Vg(a[c],i):hf(i)?a[c]=Vg({},i):Mc(i)?a[c]=i.slice():(!t||!kc(i))&&(a[c]=i)};for(let i=0,d=arguments.length;i<d;i++)arguments[i]&&b0(arguments[i],s);return a}const r6=(e,t,a,{allOwnKeys:s}={})=>(b0(t,(i,d)=>{a&&mn(i)?e[d]=z_(i,a):e[d]=i},{allOwnKeys:s}),e),n6=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),s6=(e,t,a,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),a&&Object.assign(e.prototype,a)},i6=(e,t,a,s)=>{let i,d,c;const f={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),d=i.length;d-- >0;)c=i[d],(!s||s(c,e,t))&&!f[c]&&(t[c]=e[c],f[c]=!0);e=a!==!1&&gp(e)}while(e&&(!a||a(e,t))&&e!==Object.prototype);return t},l6=(e,t,a)=>{e=String(e),(a===void 0||a>e.length)&&(a=e.length),a-=t.length;const s=e.indexOf(t,a);return s!==-1&&s===a},o6=e=>{if(!e)return null;if(Mc(e))return e;let t=e.length;if(!H_(t))return null;const a=new Array(t);for(;t-- >0;)a[t]=e[t];return a},c6=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&gp(Uint8Array)),d6=(e,t)=>{const s=(e&&e[Zf]).call(e);let i;for(;(i=s.next())&&!i.done;){const d=i.value;t.call(e,d[0],d[1])}},u6=(e,t)=>{let a;const s=[];for(;(a=e.exec(t))!==null;)s.push(a);return s},f6=Ns("HTMLFormElement"),h6=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,s,i){return s.toUpperCase()+i}),H1=(({hasOwnProperty:e})=>(t,a)=>e.call(t,a))(Object.prototype),m6=Ns("RegExp"),V_=(e,t)=>{const a=Object.getOwnPropertyDescriptors(e),s={};b0(a,(i,d)=>{let c;(c=t(i,d,e))!==!1&&(s[d]=c||i)}),Object.defineProperties(e,s)},g6=e=>{V_(e,(t,a)=>{if(mn(e)&&["arguments","caller","callee"].indexOf(a)!==-1)return!1;const s=e[a];if(mn(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+a+"'")})}})},p6=(e,t)=>{const a={},s=i=>{i.forEach(d=>{a[d]=!0})};return Mc(e)?s(e):s(String(e).split(t)),a},x6=()=>{},y6=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function b6(e){return!!(e&&mn(e.append)&&e[B_]==="FormData"&&e[Zf])}const v6=e=>{const t=new Array(10),a=(s,i)=>{if(y0(s)){if(t.indexOf(s)>=0)return;if(x0(s))return s;if(!("toJSON"in s)){t[i]=s;const d=Mc(s)?[]:{};return b0(s,(c,f)=>{const g=a(c,i+1);!kc(g)&&(d[f]=g)}),t[i]=void 0,d}}return s};return a(e,0)},_6=Ns("AsyncFunction"),w6=e=>e&&(y0(e)||mn(e))&&mn(e.then)&&mn(e.catch),G_=((e,t)=>e?setImmediate:t?((a,s)=>(Ql.addEventListener("message",({source:i,data:d})=>{i===Ql&&d===a&&s.length&&s.shift()()},!1),i=>{s.push(i),Ql.postMessage(a,"*")}))(`axios@${Math.random()}`,[]):a=>setTimeout(a))(typeof setImmediate=="function",mn(Ql.postMessage)),k6=typeof queueMicrotask!="undefined"?queueMicrotask.bind(Ql):typeof process!="undefined"&&process.nextTick||G_,N6=e=>e!=null&&mn(e[Zf]),Be={isArray:Mc,isArrayBuffer:U_,isBuffer:x0,isFormData:XS,isArrayBufferView:US,isString:HS,isNumber:H_,isBoolean:$S,isObject:y0,isPlainObject:hf,isEmptyObject:WS,isReadableStream:KS,isRequest:QS,isResponse:e6,isHeaders:t6,isUndefined:kc,isDate:VS,isFile:GS,isBlob:ZS,isRegExp:m6,isFunction:mn,isStream:YS,isURLSearchParams:JS,isTypedArray:c6,isFileList:qS,forEach:b0,merge:Vg,extend:r6,trim:a6,stripBOM:n6,inherits:s6,toFlatObject:i6,kindOf:qf,kindOfTest:Ns,endsWith:l6,toArray:o6,forEachEntry:d6,matchAll:u6,isHTMLForm:f6,hasOwnProperty:H1,hasOwnProp:H1,reduceDescriptors:V_,freezeMethods:g6,toObjectSet:p6,toCamelCase:h6,noop:x6,toFiniteNumber:y6,findKey:$_,global:Ql,isContextDefined:W_,isSpecCompliantForm:b6,toJSONObject:v6,isAsyncFn:_6,isThenable:w6,setImmediate:G_,asap:k6,isIterable:N6};function Yt(e,t,a,s,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),a&&(this.config=a),s&&(this.request=s),i&&(this.response=i,this.status=i.status?i.status:null)}Be.inherits(Yt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Be.toJSONObject(this.config),code:this.code,status:this.status}}});const Z_=Yt.prototype,q_={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{q_[e]={value:e}});Object.defineProperties(Yt,q_);Object.defineProperty(Z_,"isAxiosError",{value:!0});Yt.from=(e,t,a,s,i,d)=>{const c=Object.create(Z_);Be.toFlatObject(e,c,function(x){return x!==Error.prototype},p=>p!=="isAxiosError");const f=e&&e.message?e.message:"Error",g=t==null&&e?e.code:t;return Yt.call(c,f,g,a,s,i),e&&c.cause==null&&Object.defineProperty(c,"cause",{value:e,configurable:!0}),c.name=e&&e.name||"Error",d&&Object.assign(c,d),c};const j6=null;function Gg(e){return Be.isPlainObject(e)||Be.isArray(e)}function Y_(e){return Be.endsWith(e,"[]")?e.slice(0,-2):e}function $1(e,t,a){return e?e.concat(t).map(function(i,d){return i=Y_(i),!a&&d?"["+i+"]":i}).join(a?".":""):t}function S6(e){return Be.isArray(e)&&!e.some(Gg)}const T6=Be.toFlatObject(Be,{},null,function(t){return/^is[A-Z]/.test(t)});function Xf(e,t,a){if(!Be.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,a=Be.toFlatObject(a,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,S){return!Be.isUndefined(S[N])});const s=a.metaTokens,i=a.visitor||x,d=a.dots,c=a.indexes,g=(a.Blob||typeof Blob!="undefined"&&Blob)&&Be.isSpecCompliantForm(t);if(!Be.isFunction(i))throw new TypeError("visitor must be a function");function p(T){if(T===null)return"";if(Be.isDate(T))return T.toISOString();if(Be.isBoolean(T))return T.toString();if(!g&&Be.isBlob(T))throw new Yt("Blob is not supported. Use a Buffer instead.");return Be.isArrayBuffer(T)||Be.isTypedArray(T)?g&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function x(T,N,S){let O=T;if(T&&!S&&typeof T=="object"){if(Be.endsWith(N,"{}"))N=s?N:N.slice(0,-2),T=JSON.stringify(T);else if(Be.isArray(T)&&S6(T)||(Be.isFileList(T)||Be.endsWith(N,"[]"))&&(O=Be.toArray(T)))return N=Y_(N),O.forEach(function(A,P){!(Be.isUndefined(A)||A===null)&&t.append(c===!0?$1([N],P,d):c===null?N:N+"[]",p(A))}),!1}return Gg(T)?!0:(t.append($1(S,N,d),p(T)),!1)}const y=[],_=Object.assign(T6,{defaultVisitor:x,convertValue:p,isVisitable:Gg});function k(T,N){if(!Be.isUndefined(T)){if(y.indexOf(T)!==-1)throw Error("Circular reference detected in "+N.join("."));y.push(T),Be.forEach(T,function(O,C){(!(Be.isUndefined(O)||O===null)&&i.call(t,O,Be.isString(C)?C.trim():C,N,_))===!0&&k(O,N?N.concat(C):[C])}),y.pop()}}if(!Be.isObject(e))throw new TypeError("data must be an object");return k(e),t}function W1(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function pp(e,t){this._pairs=[],e&&Xf(e,this,t)}const X_=pp.prototype;X_.append=function(t,a){this._pairs.push([t,a])};X_.toString=function(t){const a=t?function(s){return t.call(this,s,W1)}:W1;return this._pairs.map(function(i){return a(i[0])+"="+a(i[1])},"").join("&")};function E6(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function J_(e,t,a){if(!t)return e;const s=a&&a.encode||E6;Be.isFunction(a)&&(a={serialize:a});const i=a&&a.serialize;let d;if(i?d=i(t,a):d=Be.isURLSearchParams(t)?t.toString():new pp(t,a).toString(s),d){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+d}return e}class V1{constructor(){this.handlers=[]}use(t,a,s){return this.handlers.push({fulfilled:t,rejected:a,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Be.forEach(this.handlers,function(s){s!==null&&t(s)})}}const K_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},C6=typeof URLSearchParams!="undefined"?URLSearchParams:pp,A6=typeof FormData!="undefined"?FormData:null,O6=typeof Blob!="undefined"?Blob:null,M6={isBrowser:!0,classes:{URLSearchParams:C6,FormData:A6,Blob:O6},protocols:["http","https","file","blob","url","data"]},xp=typeof window!="undefined"&&typeof document!="undefined",Zg=typeof navigator=="object"&&navigator||void 0,L6=xp&&(!Zg||["ReactNative","NativeScript","NS"].indexOf(Zg.product)<0),D6=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",P6=xp&&window.location.href||"http://localhost",R6=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:xp,hasStandardBrowserEnv:L6,hasStandardBrowserWebWorkerEnv:D6,navigator:Zg,origin:P6},Symbol.toStringTag,{value:"Module"})),Hr=ie(ie({},R6),M6);function F6(e,t){return Xf(e,new Hr.classes.URLSearchParams,ie({visitor:function(a,s,i,d){return Hr.isNode&&Be.isBuffer(a)?(this.append(s,a.toString("base64")),!1):d.defaultVisitor.apply(this,arguments)}},t))}function I6(e){return Be.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function z6(e){const t={},a=Object.keys(e);let s;const i=a.length;let d;for(s=0;s<i;s++)d=a[s],t[d]=e[d];return t}function Q_(e){function t(a,s,i,d){let c=a[d++];if(c==="__proto__")return!0;const f=Number.isFinite(+c),g=d>=a.length;return c=!c&&Be.isArray(i)?i.length:c,g?(Be.hasOwnProp(i,c)?i[c]=[i[c],s]:i[c]=s,!f):((!i[c]||!Be.isObject(i[c]))&&(i[c]=[]),t(a,s,i[c],d)&&Be.isArray(i[c])&&(i[c]=z6(i[c])),!f)}if(Be.isFormData(e)&&Be.isFunction(e.entries)){const a={};return Be.forEachEntry(e,(s,i)=>{t(I6(s),i,a,0)}),a}return null}function B6(e,t,a){if(Be.isString(e))try{return(t||JSON.parse)(e),Be.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(a||JSON.stringify)(e)}const v0={transitional:K_,adapter:["xhr","http","fetch"],transformRequest:[function(t,a){const s=a.getContentType()||"",i=s.indexOf("application/json")>-1,d=Be.isObject(t);if(d&&Be.isHTMLForm(t)&&(t=new FormData(t)),Be.isFormData(t))return i?JSON.stringify(Q_(t)):t;if(Be.isArrayBuffer(t)||Be.isBuffer(t)||Be.isStream(t)||Be.isFile(t)||Be.isBlob(t)||Be.isReadableStream(t))return t;if(Be.isArrayBufferView(t))return t.buffer;if(Be.isURLSearchParams(t))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let f;if(d){if(s.indexOf("application/x-www-form-urlencoded")>-1)return F6(t,this.formSerializer).toString();if((f=Be.isFileList(t))||s.indexOf("multipart/form-data")>-1){const g=this.env&&this.env.FormData;return Xf(f?{"files[]":t}:t,g&&new g,this.formSerializer)}}return d||i?(a.setContentType("application/json",!1),B6(t)):t}],transformResponse:[function(t){const a=this.transitional||v0.transitional,s=a&&a.forcedJSONParsing,i=this.responseType==="json";if(Be.isResponse(t)||Be.isReadableStream(t))return t;if(t&&Be.isString(t)&&(s&&!this.responseType||i)){const c=!(a&&a.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(f){if(c)throw f.name==="SyntaxError"?Yt.from(f,Yt.ERR_BAD_RESPONSE,this,null,this.response):f}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hr.classes.FormData,Blob:Hr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Be.forEach(["delete","get","head","post","put","patch"],e=>{v0.headers[e]={}});const U6=Be.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),H6=e=>{const t={};let a,s,i;return e&&e.split(`
|
||
`).forEach(function(c){i=c.indexOf(":"),a=c.substring(0,i).trim().toLowerCase(),s=c.substring(i+1).trim(),!(!a||t[a]&&U6[a])&&(a==="set-cookie"?t[a]?t[a].push(s):t[a]=[s]:t[a]=t[a]?t[a]+", "+s:s)}),t},G1=Symbol("internals");function Bd(e){return e&&String(e).trim().toLowerCase()}function mf(e){return e===!1||e==null?e:Be.isArray(e)?e.map(mf):String(e)}function $6(e){const t=Object.create(null),a=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=a.exec(e);)t[s[1]]=s[2];return t}const W6=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function _g(e,t,a,s,i){if(Be.isFunction(s))return s.call(this,t,a);if(i&&(t=a),!!Be.isString(t)){if(Be.isString(s))return t.indexOf(s)!==-1;if(Be.isRegExp(s))return s.test(t)}}function V6(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,a,s)=>a.toUpperCase()+s)}function G6(e,t){const a=Be.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+a,{value:function(i,d,c){return this[s].call(this,t,i,d,c)},configurable:!0})})}let gn=class{constructor(t){t&&this.set(t)}set(t,a,s){const i=this;function d(f,g,p){const x=Bd(g);if(!x)throw new Error("header name must be a non-empty string");const y=Be.findKey(i,x);(!y||i[y]===void 0||p===!0||p===void 0&&i[y]!==!1)&&(i[y||g]=mf(f))}const c=(f,g)=>Be.forEach(f,(p,x)=>d(p,x,g));if(Be.isPlainObject(t)||t instanceof this.constructor)c(t,a);else if(Be.isString(t)&&(t=t.trim())&&!W6(t))c(H6(t),a);else if(Be.isObject(t)&&Be.isIterable(t)){let f={},g,p;for(const x of t){if(!Be.isArray(x))throw TypeError("Object iterator must return a key-value pair");f[p=x[0]]=(g=f[p])?Be.isArray(g)?[...g,x[1]]:[g,x[1]]:x[1]}c(f,a)}else t!=null&&d(a,t,s);return this}get(t,a){if(t=Bd(t),t){const s=Be.findKey(this,t);if(s){const i=this[s];if(!a)return i;if(a===!0)return $6(i);if(Be.isFunction(a))return a.call(this,i,s);if(Be.isRegExp(a))return a.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,a){if(t=Bd(t),t){const s=Be.findKey(this,t);return!!(s&&this[s]!==void 0&&(!a||_g(this,this[s],s,a)))}return!1}delete(t,a){const s=this;let i=!1;function d(c){if(c=Bd(c),c){const f=Be.findKey(s,c);f&&(!a||_g(s,s[f],f,a))&&(delete s[f],i=!0)}}return Be.isArray(t)?t.forEach(d):d(t),i}clear(t){const a=Object.keys(this);let s=a.length,i=!1;for(;s--;){const d=a[s];(!t||_g(this,this[d],d,t,!0))&&(delete this[d],i=!0)}return i}normalize(t){const a=this,s={};return Be.forEach(this,(i,d)=>{const c=Be.findKey(s,d);if(c){a[c]=mf(i),delete a[d];return}const f=t?V6(d):String(d).trim();f!==d&&delete a[d],a[f]=mf(i),s[f]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const a=Object.create(null);return Be.forEach(this,(s,i)=>{s!=null&&s!==!1&&(a[i]=t&&Be.isArray(s)?s.join(", "):s)}),a}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,a])=>t+": "+a).join(`
|
||
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...a){const s=new this(t);return a.forEach(i=>s.set(i)),s}static accessor(t){const s=(this[G1]=this[G1]={accessors:{}}).accessors,i=this.prototype;function d(c){const f=Bd(c);s[f]||(G6(i,c),s[f]=!0)}return Be.isArray(t)?t.forEach(d):d(t),this}};gn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Be.reduceDescriptors(gn.prototype,({value:e},t)=>{let a=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[a]=s}}});Be.freezeMethods(gn);function wg(e,t){const a=this||v0,s=t||a,i=gn.from(s.headers);let d=s.data;return Be.forEach(e,function(f){d=f.call(a,d,i.normalize(),t?t.status:void 0)}),i.normalize(),d}function e2(e){return!!(e&&e.__CANCEL__)}function Lc(e,t,a){Yt.call(this,e==null?"canceled":e,Yt.ERR_CANCELED,t,a),this.name="CanceledError"}Be.inherits(Lc,Yt,{__CANCEL__:!0});function t2(e,t,a){const s=a.config.validateStatus;!a.status||!s||s(a.status)?e(a):t(new Yt("Request failed with status code "+a.status,[Yt.ERR_BAD_REQUEST,Yt.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}function Z6(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function q6(e,t){e=e||10;const a=new Array(e),s=new Array(e);let i=0,d=0,c;return t=t!==void 0?t:1e3,function(g){const p=Date.now(),x=s[d];c||(c=p),a[i]=g,s[i]=p;let y=d,_=0;for(;y!==i;)_+=a[y++],y=y%e;if(i=(i+1)%e,i===d&&(d=(d+1)%e),p-c<t)return;const k=x&&p-x;return k?Math.round(_*1e3/k):void 0}}function Y6(e,t){let a=0,s=1e3/t,i,d;const c=(p,x=Date.now())=>{a=x,i=null,d&&(clearTimeout(d),d=null),e(...p)};return[(...p)=>{const x=Date.now(),y=x-a;y>=s?c(p,x):(i=p,d||(d=setTimeout(()=>{d=null,c(i)},s-y)))},()=>i&&c(i)]}const Nf=(e,t,a=3)=>{let s=0;const i=q6(50,250);return Y6(d=>{const c=d.loaded,f=d.lengthComputable?d.total:void 0,g=c-s,p=i(g),x=c<=f;s=c;const y={loaded:c,total:f,progress:f?c/f:void 0,bytes:g,rate:p||void 0,estimated:p&&f&&x?(f-c)/p:void 0,event:d,lengthComputable:f!=null,[t?"download":"upload"]:!0};e(y)},a)},Z1=(e,t)=>{const a=e!=null;return[s=>t[0]({lengthComputable:a,total:e,loaded:s}),t[1]]},q1=e=>(...t)=>Be.asap(()=>e(...t)),X6=Hr.hasStandardBrowserEnv?((e,t)=>a=>(a=new URL(a,Hr.origin),e.protocol===a.protocol&&e.host===a.host&&(t||e.port===a.port)))(new URL(Hr.origin),Hr.navigator&&/(msie|trident)/i.test(Hr.navigator.userAgent)):()=>!0,J6=Hr.hasStandardBrowserEnv?{write(e,t,a,s,i,d,c){if(typeof document=="undefined")return;const f=[`${e}=${encodeURIComponent(t)}`];Be.isNumber(a)&&f.push(`expires=${new Date(a).toUTCString()}`),Be.isString(s)&&f.push(`path=${s}`),Be.isString(i)&&f.push(`domain=${i}`),d===!0&&f.push("secure"),Be.isString(c)&&f.push(`SameSite=${c}`),document.cookie=f.join("; ")},read(e){if(typeof document=="undefined")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function K6(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Q6(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function a2(e,t,a){let s=!K6(t);return e&&(s||a==!1)?Q6(e,t):t}const Y1=e=>e instanceof gn?ie({},e):e;function io(e,t){t=t||{};const a={};function s(p,x,y,_){return Be.isPlainObject(p)&&Be.isPlainObject(x)?Be.merge.call({caseless:_},p,x):Be.isPlainObject(x)?Be.merge({},x):Be.isArray(x)?x.slice():x}function i(p,x,y,_){if(Be.isUndefined(x)){if(!Be.isUndefined(p))return s(void 0,p,y,_)}else return s(p,x,y,_)}function d(p,x){if(!Be.isUndefined(x))return s(void 0,x)}function c(p,x){if(Be.isUndefined(x)){if(!Be.isUndefined(p))return s(void 0,p)}else return s(void 0,x)}function f(p,x,y){if(y in t)return s(p,x);if(y in e)return s(void 0,p)}const g={url:d,method:d,data:d,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:f,headers:(p,x,y)=>i(Y1(p),Y1(x),y,!0)};return Be.forEach(Object.keys(ie(ie({},e),t)),function(x){const y=g[x]||i,_=y(e[x],t[x],x);Be.isUndefined(_)&&y!==f||(a[x]=_)}),a}const r2=e=>{const t=io({},e);let{data:a,withXSRFToken:s,xsrfHeaderName:i,xsrfCookieName:d,headers:c,auth:f}=t;if(t.headers=c=gn.from(c),t.url=J_(a2(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),f&&c.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),Be.isFormData(a)){if(Hr.hasStandardBrowserEnv||Hr.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(Be.isFunction(a.getHeaders)){const g=a.getHeaders(),p=["content-type","content-length"];Object.entries(g).forEach(([x,y])=>{p.includes(x.toLowerCase())&&c.set(x,y)})}}if(Hr.hasStandardBrowserEnv&&(s&&Be.isFunction(s)&&(s=s(t)),s||s!==!1&&X6(t.url))){const g=i&&d&&J6.read(d);g&&c.set(i,g)}return t},e5=typeof XMLHttpRequest!="undefined",t5=e5&&function(e){return new Promise(function(a,s){const i=r2(e);let d=i.data;const c=gn.from(i.headers).normalize();let{responseType:f,onUploadProgress:g,onDownloadProgress:p}=i,x,y,_,k,T;function N(){k&&k(),T&&T(),i.cancelToken&&i.cancelToken.unsubscribe(x),i.signal&&i.signal.removeEventListener("abort",x)}let S=new XMLHttpRequest;S.open(i.method.toUpperCase(),i.url,!0),S.timeout=i.timeout;function O(){if(!S)return;const A=gn.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),I={data:!f||f==="text"||f==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:A,config:e,request:S};t2(function(B){a(B),N()},function(B){s(B),N()},I),S=null}"onloadend"in S?S.onloadend=O:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(O)},S.onabort=function(){S&&(s(new Yt("Request aborted",Yt.ECONNABORTED,e,S)),S=null)},S.onerror=function(P){const I=P&&P.message?P.message:"Network Error",ee=new Yt(I,Yt.ERR_NETWORK,e,S);ee.event=P||null,s(ee),S=null},S.ontimeout=function(){let P=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const I=i.transitional||K_;i.timeoutErrorMessage&&(P=i.timeoutErrorMessage),s(new Yt(P,I.clarifyTimeoutError?Yt.ETIMEDOUT:Yt.ECONNABORTED,e,S)),S=null},d===void 0&&c.setContentType(null),"setRequestHeader"in S&&Be.forEach(c.toJSON(),function(P,I){S.setRequestHeader(I,P)}),Be.isUndefined(i.withCredentials)||(S.withCredentials=!!i.withCredentials),f&&f!=="json"&&(S.responseType=i.responseType),p&&([_,T]=Nf(p,!0),S.addEventListener("progress",_)),g&&S.upload&&([y,k]=Nf(g),S.upload.addEventListener("progress",y),S.upload.addEventListener("loadend",k)),(i.cancelToken||i.signal)&&(x=A=>{S&&(s(!A||A.type?new Lc(null,e,S):A),S.abort(),S=null)},i.cancelToken&&i.cancelToken.subscribe(x),i.signal&&(i.signal.aborted?x():i.signal.addEventListener("abort",x)));const C=Z6(i.url);if(C&&Hr.protocols.indexOf(C)===-1){s(new Yt("Unsupported protocol "+C+":",Yt.ERR_BAD_REQUEST,e));return}S.send(d||null)})},a5=(e,t)=>{const{length:a}=e=e?e.filter(Boolean):[];if(t||a){let s=new AbortController,i;const d=function(p){if(!i){i=!0,f();const x=p instanceof Error?p:this.reason;s.abort(x instanceof Yt?x:new Lc(x instanceof Error?x.message:x))}};let c=t&&setTimeout(()=>{c=null,d(new Yt(`timeout ${t} of ms exceeded`,Yt.ETIMEDOUT))},t);const f=()=>{e&&(c&&clearTimeout(c),c=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(d):p.removeEventListener("abort",d)}),e=null)};e.forEach(p=>p.addEventListener("abort",d));const{signal:g}=s;return g.unsubscribe=()=>Be.asap(f),g}},r5=function*(e,t){let a=e.byteLength;if(a<t){yield e;return}let s=0,i;for(;s<a;)i=s+t,yield e.slice(s,i),s=i},n5=function(e,t){return sg(this,null,function*(){try{for(var a=Vb(s5(e)),s,i,d;s=!(i=yield new Zl(a.next())).done;s=!1){const c=i.value;yield*ig(r5(c,t))}}catch(i){d=[i]}finally{try{s&&(i=a.return)&&(yield new Zl(i.call(a)))}finally{if(d)throw d[0]}}})},s5=function(e){return sg(this,null,function*(){if(e[Symbol.asyncIterator]){yield*ig(e);return}const t=e.getReader();try{for(;;){const{done:a,value:s}=yield new Zl(t.read());if(a)break;yield s}}finally{yield new Zl(t.cancel())}})},X1=(e,t,a,s)=>{const i=n5(e,t);let d=0,c,f=p=>{c||(c=!0,s&&s(p))};return new ReadableStream({pull(p){return oe(this,null,function*(){try{const{done:x,value:y}=yield i.next();if(x){f(),p.close();return}let _=y.byteLength;if(a){let k=d+=_;a(k)}p.enqueue(new Uint8Array(y))}catch(x){throw f(x),x}})},cancel(p){return f(p),i.return()}},{highWaterMark:2})},J1=64*1024,{isFunction:Qu}=Be,i5=(({Request:e,Response:t})=>({Request:e,Response:t}))(Be.global),{ReadableStream:K1,TextEncoder:Q1}=Be.global,ev=(e,...t)=>{try{return!!e(...t)}catch(a){return!1}},l5=e=>{e=Be.merge.call({skipUndefined:!0},i5,e);const{fetch:t,Request:a,Response:s}=e,i=t?Qu(t):typeof fetch=="function",d=Qu(a),c=Qu(s);if(!i)return!1;const f=i&&Qu(K1),g=i&&(typeof Q1=="function"?(T=>N=>T.encode(N))(new Q1):T=>oe(null,null,function*(){return new Uint8Array(yield new a(T).arrayBuffer())})),p=d&&f&&ev(()=>{let T=!1;const N=new a(Hr.origin,{body:new K1,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!N}),x=c&&f&&ev(()=>Be.isReadableStream(new s("").body)),y={stream:x&&(T=>T.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!y[T]&&(y[T]=(N,S)=>{let O=N&&N[T];if(O)return O.call(N);throw new Yt(`Response type '${T}' is not supported`,Yt.ERR_NOT_SUPPORT,S)})});const _=T=>oe(null,null,function*(){if(T==null)return 0;if(Be.isBlob(T))return T.size;if(Be.isSpecCompliantForm(T))return(yield new a(Hr.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(Be.isArrayBufferView(T)||Be.isArrayBuffer(T))return T.byteLength;if(Be.isURLSearchParams(T)&&(T=T+""),Be.isString(T))return(yield g(T)).byteLength}),k=(T,N)=>oe(null,null,function*(){const S=Be.toFiniteNumber(T.getContentLength());return S==null?_(N):S});return T=>oe(null,null,function*(){let{url:N,method:S,data:O,signal:C,cancelToken:A,timeout:P,onDownloadProgress:I,onUploadProgress:ee,responseType:B,headers:H,withCredentials:Y="same-origin",fetchOptions:ue}=r2(T),xe=t||fetch;B=B?(B+"").toLowerCase():"text";let le=a5([C,A&&A.toAbortSignal()],P),ge=null;const be=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let me;try{if(ee&&p&&S!=="get"&&S!=="head"&&(me=yield k(H,O))!==0){let F=new a(N,{method:"POST",body:O,duplex:"half"}),D;if(Be.isFormData(O)&&(D=F.headers.get("content-type"))&&H.setContentType(D),F.body){const[W,G]=Z1(me,Nf(q1(ee)));O=X1(F.body,J1,W,G)}}Be.isString(Y)||(Y=Y?"include":"omit");const ae=d&&"credentials"in a.prototype,Z=Ee(ie({},ue),{signal:le,method:S.toUpperCase(),headers:H.normalize().toJSON(),body:O,duplex:"half",credentials:ae?Y:void 0});ge=d&&new a(N,Z);let K=yield d?xe(ge,ue):xe(N,Z);const te=x&&(B==="stream"||B==="response");if(x&&(I||te&&be)){const F={};["status","statusText","headers"].forEach(J=>{F[J]=K[J]});const D=Be.toFiniteNumber(K.headers.get("content-length")),[W,G]=I&&Z1(D,Nf(q1(I),!0))||[];K=new s(X1(K.body,J1,W,()=>{G&&G(),be&&be()}),F)}B=B||"text";let se=yield y[Be.findKey(y,B)||"text"](K,T);return!te&&be&&be(),yield new Promise((F,D)=>{t2(F,D,{data:se,headers:gn.from(K.headers),status:K.status,statusText:K.statusText,config:T,request:ge})})}catch(ae){throw be&&be(),ae&&ae.name==="TypeError"&&/Load failed|fetch/i.test(ae.message)?Object.assign(new Yt("Network Error",Yt.ERR_NETWORK,T,ge),{cause:ae.cause||ae}):Yt.from(ae,ae&&ae.code,T,ge)}})},o5=new Map,n2=e=>{let t=e&&e.env||{};const{fetch:a,Request:s,Response:i}=t,d=[s,i,a];let c=d.length,f=c,g,p,x=o5;for(;f--;)g=d[f],p=x.get(g),p===void 0&&x.set(g,p=f?new Map:l5(t)),x=p;return p};n2();const yp={http:j6,xhr:t5,fetch:{get:n2}};Be.forEach(yp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(a){}Object.defineProperty(e,"adapterName",{value:t})}});const tv=e=>`- ${e}`,c5=e=>Be.isFunction(e)||e===null||e===!1;function d5(e,t){e=Be.isArray(e)?e:[e];const{length:a}=e;let s,i;const d={};for(let c=0;c<a;c++){s=e[c];let f;if(i=s,!c5(s)&&(i=yp[(f=String(s)).toLowerCase()],i===void 0))throw new Yt(`Unknown adapter '${f}'`);if(i&&(Be.isFunction(i)||(i=i.get(t))))break;d[f||"#"+c]=i}if(!i){const c=Object.entries(d).map(([g,p])=>`adapter ${g} `+(p===!1?"is not supported by the environment":"is not available in the build"));let f=a?c.length>1?`since :
|
||
`+c.map(tv).join(`
|
||
`):" "+tv(c[0]):"as no adapter specified";throw new Yt("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return i}const s2={getAdapter:d5,adapters:yp};function kg(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Lc(null,e)}function av(e){return kg(e),e.headers=gn.from(e.headers),e.data=wg.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),s2.getAdapter(e.adapter||v0.adapter,e)(e).then(function(s){return kg(e),s.data=wg.call(e,e.transformResponse,s),s.headers=gn.from(s.headers),s},function(s){return e2(s)||(kg(e),s&&s.response&&(s.response.data=wg.call(e,e.transformResponse,s.response),s.response.headers=gn.from(s.response.headers))),Promise.reject(s)})}const i2="1.13.2",Jf={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Jf[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const rv={};Jf.transitional=function(t,a,s){function i(d,c){return"[Axios v"+i2+"] Transitional option '"+d+"'"+c+(s?". "+s:"")}return(d,c,f)=>{if(t===!1)throw new Yt(i(c," has been removed"+(a?" in "+a:"")),Yt.ERR_DEPRECATED);return a&&!rv[c]&&(rv[c]=!0,console.warn(i(c," has been deprecated since v"+a+" and will be removed in the near future"))),t?t(d,c,f):!0}};Jf.spelling=function(t){return(a,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function u5(e,t,a){if(typeof e!="object")throw new Yt("options must be an object",Yt.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let i=s.length;for(;i-- >0;){const d=s[i],c=t[d];if(c){const f=e[d],g=f===void 0||c(f,d,e);if(g!==!0)throw new Yt("option "+d+" must be "+g,Yt.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new Yt("Unknown option "+d,Yt.ERR_BAD_OPTION)}}const gf={assertOptions:u5,validators:Jf},zs=gf.validators;let to=class{constructor(t){this.defaults=t||{},this.interceptors={request:new V1,response:new V1}}request(t,a){return oe(this,null,function*(){try{return yield this._request(t,a)}catch(s){if(s instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const d=i.stack?i.stack.replace(/^.+\n/,""):"";try{s.stack?d&&!String(s.stack).endsWith(d.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
||
`+d):s.stack=d}catch(c){}}throw s}})}_request(t,a){typeof t=="string"?(a=a||{},a.url=t):a=t||{},a=io(this.defaults,a);const{transitional:s,paramsSerializer:i,headers:d}=a;s!==void 0&&gf.assertOptions(s,{silentJSONParsing:zs.transitional(zs.boolean),forcedJSONParsing:zs.transitional(zs.boolean),clarifyTimeoutError:zs.transitional(zs.boolean)},!1),i!=null&&(Be.isFunction(i)?a.paramsSerializer={serialize:i}:gf.assertOptions(i,{encode:zs.function,serialize:zs.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),gf.assertOptions(a,{baseUrl:zs.spelling("baseURL"),withXsrfToken:zs.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let c=d&&Be.merge(d.common,d[a.method]);d&&Be.forEach(["delete","get","head","post","put","patch","common"],T=>{delete d[T]}),a.headers=gn.concat(c,d);const f=[];let g=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(a)===!1||(g=g&&N.synchronous,f.unshift(N.fulfilled,N.rejected))});const p=[];this.interceptors.response.forEach(function(N){p.push(N.fulfilled,N.rejected)});let x,y=0,_;if(!g){const T=[av.bind(this),void 0];for(T.unshift(...f),T.push(...p),_=T.length,x=Promise.resolve(a);y<_;)x=x.then(T[y++],T[y++]);return x}_=f.length;let k=a;for(;y<_;){const T=f[y++],N=f[y++];try{k=T(k)}catch(S){N.call(this,S);break}}try{x=av.call(this,k)}catch(T){return Promise.reject(T)}for(y=0,_=p.length;y<_;)x=x.then(p[y++],p[y++]);return x}getUri(t){t=io(this.defaults,t);const a=a2(t.baseURL,t.url,t.allowAbsoluteUrls);return J_(a,t.params,t.paramsSerializer)}};Be.forEach(["delete","get","head","options"],function(t){to.prototype[t]=function(a,s){return this.request(io(s||{},{method:t,url:a,data:(s||{}).data}))}});Be.forEach(["post","put","patch"],function(t){function a(s){return function(d,c,f){return this.request(io(f||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:d,data:c}))}}to.prototype[t]=a(),to.prototype[t+"Form"]=a(!0)});let f5=class l2{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(d){a=d});const s=this;this.promise.then(i=>{if(!s._listeners)return;let d=s._listeners.length;for(;d-- >0;)s._listeners[d](i);s._listeners=null}),this.promise.then=i=>{let d;const c=new Promise(f=>{s.subscribe(f),d=f}).then(i);return c.cancel=function(){s.unsubscribe(d)},c},t(function(d,c,f){s.reason||(s.reason=new Lc(d,c,f),a(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const a=this._listeners.indexOf(t);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const t=new AbortController,a=s=>{t.abort(s)};return this.subscribe(a),t.signal.unsubscribe=()=>this.unsubscribe(a),t.signal}static source(){let t;return{token:new l2(function(i){t=i}),cancel:t}}};function h5(e){return function(a){return e.apply(null,a)}}function m5(e){return Be.isObject(e)&&e.isAxiosError===!0}const qg={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(qg).forEach(([e,t])=>{qg[t]=e});function o2(e){const t=new to(e),a=z_(to.prototype.request,t);return Be.extend(a,to.prototype,t,{allOwnKeys:!0}),Be.extend(a,t,null,{allOwnKeys:!0}),a.create=function(i){return o2(io(e,i))},a}const rr=o2(v0);rr.Axios=to;rr.CanceledError=Lc;rr.CancelToken=f5;rr.isCancel=e2;rr.VERSION=i2;rr.toFormData=Xf;rr.AxiosError=Yt;rr.Cancel=rr.CanceledError;rr.all=function(t){return Promise.all(t)};rr.spread=h5;rr.isAxiosError=m5;rr.mergeConfig=io;rr.AxiosHeaders=gn;rr.formToJSON=e=>Q_(Be.isHTMLForm(e)?new FormData(e):e);rr.getAdapter=s2.getAdapter;rr.HttpStatusCode=qg;rr.default=rr;const{Axios:gD,AxiosError:pD,CanceledError:xD,isCancel:yD,CancelToken:bD,VERSION:vD,all:_D,Cancel:wD,isAxiosError:kD,spread:ND,toFormData:jD,AxiosHeaders:SD,HttpStatusCode:TD,formToJSON:ED,getAdapter:CD,mergeConfig:AD}=rr;class g5{constructor(){Kn(this,"client");Kn(this,"baseURL");Kn(this,"siteName");this.baseURL="http://localhost:8000",this.siteName="seeraasm-med.seeraarabia.com",this.client=rr.create({baseURL:this.baseURL,timeout:parseInt("10000"),withCredentials:!0,headers:{"Content-Type":"application/json",Accept:"application/json"}}),this.client.interceptors.request.use(t=>{var a;return(a=t.url)!=null&&a.includes("/api/")&&(t.url=`/${this.siteName}${t.url}`),t}),this.client.interceptors.response.use(t=>t,t=>{var a;return((a=t.response)==null?void 0:a.status)===401&&(window.location.href="/login"),Promise.reject(t)})}login(t){return oe(this,null,function*(){return(yield this.client.post("/api/method/login",t)).data})}logout(){return oe(this,null,function*(){return(yield this.client.post("/api/method/logout")).data})}getCurrentUser(){return oe(this,null,function*(){return(yield this.client.get("/api/method/frappe.auth.get_logged_user")).data})}callMethod(s){return oe(this,arguments,function*(t,a={}){return(yield this.client.post(`/api/method/${t}`,a)).data})}frappeGet(s){return oe(this,arguments,function*(t,a={}){return this.callMethod(t,a)})}getDocTypeRecords(i){return oe(this,arguments,function*(t,a={},s=[]){const d=new URLSearchParams;return Object.keys(a).length>0&&d.append("filters",JSON.stringify(a)),s.length>0&&d.append("fields",JSON.stringify(s)),(yield this.client.get(`/api/resource/${t}?${d.toString()}`)).data})}getDocTypeRecord(t,a){return oe(this,null,function*(){return(yield this.client.get(`/api/resource/${t}/${a}`)).data})}createDocTypeRecord(t,a){return oe(this,null,function*(){return(yield this.client.post(`/api/resource/${t}`,a)).data})}updateDocTypeRecord(t,a,s){return oe(this,null,function*(){return(yield this.client.put(`/api/resource/${t}/${a}`,s)).data})}deleteDocTypeRecord(t,a){return oe(this,null,function*(){return(yield this.client.delete(`/api/resource/${t}/${a}`)).data})}uploadFile(t,a="Home"){return oe(this,null,function*(){const s=new FormData;return s.append("file",t),s.append("folder",a),s.append("is_private","0"),(yield this.client.post("/api/method/upload_file",s,{headers:{"Content-Type":"multipart/form-data"}})).data})}}const c2=new g5,p5=()=>{const[e,t]=j.useState([]),[a,s]=j.useState(!0),[i,d]=j.useState(null),[c,f]=j.useState(""),g=Na();j.useEffect(()=>{p()},[]);const p=()=>oe(null,null,function*(){var _,k;try{s(!0);const T=yield c2.getDocTypeRecords("User",{},["name","full_name","email","enabled","creation","modified"]);t(T.message||[])}catch(T){d(((k=(_=T.response)==null?void 0:_.data)==null?void 0:k.message)||"Failed to load users")}finally{s(!1)}}),x=e.filter(_=>{var k,T,N;return((k=_.full_name)==null?void 0:k.toLowerCase().includes(c.toLowerCase()))||((T=_.email)==null?void 0:T.toLowerCase().includes(c.toLowerCase()))||((N=_.name)==null?void 0:N.toLowerCase().includes(c.toLowerCase()))}),y=_=>{g(`/users/${_.name}`)};return a?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:r.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex justify-between items-center py-6",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("button",{onClick:()=>g("/dashboard"),className:"mr-4 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:r.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),r.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Users"})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsx("button",{onClick:()=>g("/dashboard"),className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-md text-sm font-medium",children:"Back to Dashboard"})})]})})}),r.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[i&&r.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:r.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:i})}),r.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:r.jsx("svg",{className:"h-5 w-5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),r.jsx("input",{type:"text",placeholder:"Search users...",value:c,onChange:_=>f(_.target.value),className:"block w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md leading-5 bg-white dark:bg-gray-700 placeholder-gray-500 dark:placeholder-gray-400 text-gray-900 dark:text-white focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"})]})}),r.jsx("div",{className:"mt-4 sm:mt-0 sm:ml-4",children:r.jsxs("button",{onClick:p,className:"inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:[r.jsx("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]})})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[r.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[r.jsxs("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:["Users (",x.length,")"]}),r.jsx("p",{className:"mt-1 max-w-2xl text-sm text-gray-500 dark:text-gray-400",children:"Manage user accounts and permissions"})]}),x.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z"})}),r.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-white",children:"No users found"}),r.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:c?"Try adjusting your search terms.":"No users available."})]}):r.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:x.map(_=>{var k;return r.jsx("li",{children:r.jsxs("div",{className:"px-4 py-4 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer",onClick:()=>y(_),children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0 h-10 w-10",children:r.jsx("div",{className:"h-10 w-10 rounded-full bg-indigo-100 dark:bg-indigo-900 flex items-center justify-center",children:r.jsx("span",{className:"text-sm font-medium text-indigo-600 dark:text-indigo-300",children:((k=_.full_name)==null?void 0:k.charAt(0))||_.name.charAt(0)})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:_.full_name||_.name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:_.email||"No email"})]})]}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${_.enabled?"bg-green-400":"bg-red-400"}`}),_.enabled?"Active":"Inactive"]})}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Created: ",new Date(_.creation).toLocaleDateString()]}),r.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})},_.name)})})]})]})]})},x5=()=>{const[e,t]=j.useState([]),[a,s]=j.useState(!0),[i,d]=j.useState(null);j.useEffect(()=>{c()},[]);const c=()=>oe(null,null,function*(){try{s(!0);const x=yield c2.frappeGet("frappe.desk.doctype.event.event.get_events");t(x.message||[])}catch(x){console.log("API call failed, using demo events:",x);const y=[{name:"EVT001",subject:"Team Meeting - Asset Management Review",starts_on:new Date().toISOString(),ends_on:new Date(Date.now()+36e5).toISOString(),status:"Open",event_type:"Meeting",description:"Monthly review of asset management processes"},{name:"EVT002",subject:"System Maintenance Window",starts_on:new Date(Date.now()+864e5).toISOString(),ends_on:new Date(Date.now()+864e5+72e5).toISOString(),status:"Scheduled",event_type:"Maintenance",description:"Scheduled maintenance for Seera Arabia AMS"},{name:"EVT003",subject:"User Training Session",starts_on:new Date(Date.now()+1728e5).toISOString(),ends_on:new Date(Date.now()+1728e5+108e5).toISOString(),status:"Open",event_type:"Training",description:"Training session for new users on AMS features"}];t(y),d(null)}finally{s(!1)}}),f=x=>new Date(x).toLocaleString(),g=x=>{switch(x.toLowerCase()){case"open":return"bg-green-100 text-green-800";case"scheduled":return"bg-blue-100 text-blue-800";case"completed":return"bg-gray-100 text-gray-800";case"cancelled":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},p=x=>{switch(x.toLowerCase()){case"meeting":return"bg-purple-100 text-purple-800";case"training":return"bg-yellow-100 text-yellow-800";case"maintenance":return"bg-orange-100 text-orange-800";default:return"bg-gray-100 text-gray-800"}};return a?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:r.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-indigo-600"})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex justify-between items-center py-6",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Events"})}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsx("button",{onClick:c,className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-md text-sm font-medium",children:"Refresh Events"})})]})})}),r.jsxs("main",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[i&&r.jsx("div",{className:"mb-6 rounded-md bg-red-50 dark:bg-red-900/20 p-4",children:r.jsx("div",{className:"text-sm text-red-700 dark:text-red-400",children:i})}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-md",children:[r.jsxs("div",{className:"px-4 py-5 sm:px-6",children:[r.jsxs("h3",{className:"text-lg leading-6 font-medium text-gray-900 dark:text-white",children:["Upcoming Events (",e.length,")"]}),r.jsx("p",{className:"mt-1 max-w-2xl text-sm text-gray-500 dark:text-gray-400",children:"Events from your Frappe backend"})]}),e.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),r.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-white",children:"No events found"}),r.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"No events are currently scheduled."})]}):r.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:e.map(x=>r.jsx("li",{children:r.jsx("div",{className:"px-4 py-4 hover:bg-gray-50 dark:hover:bg-gray-700",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-white",children:x.subject}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${g(x.status)}`,children:x.status}),r.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${p(x.event_type)}`,children:x.event_type})]})]}),x.description&&r.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:x.description}),r.jsxs("div",{className:"mt-2 flex items-center text-sm text-gray-500 dark:text-gray-400",children:[r.jsx("svg",{className:"flex-shrink-0 mr-1.5 h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),r.jsxs("span",{children:[f(x.starts_on)," - ",f(x.ends_on)]})]})]})})})},x.name))})]}),r.jsx("div",{className:"mt-8 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-md p-4",children:r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),r.jsxs("div",{className:"ml-3",children:[r.jsx("h3",{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:"API Endpoint Information"}),r.jsxs("div",{className:"mt-2 text-sm text-blue-700 dark:text-blue-400",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Endpoint:"})," ",r.jsx("code",{children:"frappe.desk.doctype.event.event.get_events"})]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Full URL:"})," ",r.jsx("code",{children:"https://seeraasm-med.seeraarabia.com/api/method/frappe.desk.doctype.event.event.get_events"})]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Method:"})," POST (Frappe API standard)"]})]})]})]})})]})]})};var jf={};jf.version="0.18.5";var d2=1252,y5=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],u2=function(e){y5.indexOf(e)!=-1&&(d2=e)};function b5(){u2(1252)}var r0=function(e){u2(e)};function v5(){r0(1200),b5()}var ef=function(t){return String.fromCharCode(t)},nv=function(t){return String.fromCharCode(t)},Sf,sl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function n0(e){for(var t="",a=0,s=0,i=0,d=0,c=0,f=0,g=0,p=0;p<e.length;)a=e.charCodeAt(p++),d=a>>2,s=e.charCodeAt(p++),c=(a&3)<<4|s>>4,i=e.charCodeAt(p++),f=(s&15)<<2|i>>6,g=i&63,isNaN(s)?f=g=64:isNaN(i)&&(g=64),t+=sl.charAt(d)+sl.charAt(c)+sl.charAt(f)+sl.charAt(g);return t}function yi(e){var t="",a=0,s=0,i=0,d=0,c=0,f=0,g=0;e=e.replace(/[^\w\+\/\=]/g,"");for(var p=0;p<e.length;)d=sl.indexOf(e.charAt(p++)),c=sl.indexOf(e.charAt(p++)),a=d<<2|c>>4,t+=String.fromCharCode(a),f=sl.indexOf(e.charAt(p++)),s=(c&15)<<4|f>>2,f!==64&&(t+=String.fromCharCode(s)),g=sl.indexOf(e.charAt(p++)),i=(f&3)<<6|g,g!==64&&(t+=String.fromCharCode(i));return t}var pa=(function(){return typeof Buffer!="undefined"&&typeof process!="undefined"&&typeof process.versions!="undefined"&&!!process.versions.node})(),wi=(function(){if(typeof Buffer!="undefined"){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch(t){e=!0}return e?function(t,a){return a?new Buffer(t,a):new Buffer(t)}:Buffer.from.bind(Buffer)}return function(){}})();function lo(e){return pa?Buffer.alloc?Buffer.alloc(e):new Buffer(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}function sv(e){return pa?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):typeof Uint8Array!="undefined"?new Uint8Array(e):new Array(e)}var bs=function(t){return pa?wi(t,"binary"):t.split("").map(function(a){return a.charCodeAt(0)&255})};function Kf(e){if(typeof ArrayBuffer=="undefined")return bs(e);for(var t=new ArrayBuffer(e.length),a=new Uint8Array(t),s=0;s!=e.length;++s)a[s]=e.charCodeAt(s)&255;return t}function _0(e){if(Array.isArray(e))return e.map(function(s){return String.fromCharCode(s)}).join("");for(var t=[],a=0;a<e.length;++a)t[a]=String.fromCharCode(e[a]);return t.join("")}function _5(e){if(typeof Uint8Array=="undefined")throw new Error("Unsupported");return new Uint8Array(e)}var Lr=pa?function(e){return Buffer.concat(e.map(function(t){return Buffer.isBuffer(t)?t:wi(t)}))}:function(e){if(typeof Uint8Array!="undefined"){var t=0,a=0;for(t=0;t<e.length;++t)a+=e[t].length;var s=new Uint8Array(a),i=0;for(t=0,a=0;t<e.length;a+=i,++t)if(i=e[t].length,e[t]instanceof Uint8Array)s.set(e[t],a);else{if(typeof e[t]=="string")throw"wtf";s.set(new Uint8Array(e[t]),a)}return s}return[].concat.apply([],e.map(function(d){return Array.isArray(d)?d:[].slice.call(d)}))};function w5(e){for(var t=[],a=0,s=e.length+250,i=lo(e.length+255),d=0;d<e.length;++d){var c=e.charCodeAt(d);if(c<128)i[a++]=c;else if(c<2048)i[a++]=192|c>>6&31,i[a++]=128|c&63;else if(c>=55296&&c<57344){c=(c&1023)+64;var f=e.charCodeAt(++d)&1023;i[a++]=240|c>>8&7,i[a++]=128|c>>2&63,i[a++]=128|f>>6&15|(c&3)<<4,i[a++]=128|f&63}else i[a++]=224|c>>12&15,i[a++]=128|c>>6&63,i[a++]=128|c&63;a>s&&(t.push(i.slice(0,a)),a=0,i=lo(65535),s=65530)}return t.push(i.slice(0,a)),Lr(t)}var qd=/\u0000/g,tf=/[\u0001-\u0006]/g;function yc(e){for(var t="",a=e.length-1;a>=0;)t+=e.charAt(a--);return t}function vs(e,t){var a=""+e;return a.length>=t?a:Xa("0",t-a.length)+a}function bp(e,t){var a=""+e;return a.length>=t?a:Xa(" ",t-a.length)+a}function Tf(e,t){var a=""+e;return a.length>=t?a:a+Xa(" ",t-a.length)}function k5(e,t){var a=""+Math.round(e);return a.length>=t?a:Xa("0",t-a.length)+a}function N5(e,t){var a=""+e;return a.length>=t?a:Xa("0",t-a.length)+a}var iv=Math.pow(2,32);function oc(e,t){if(e>iv||e<-iv)return k5(e,t);var a=Math.round(e);return N5(a,t)}function Ef(e,t){return t=t||0,e.length>=7+t&&(e.charCodeAt(t)|32)===103&&(e.charCodeAt(t+1)|32)===101&&(e.charCodeAt(t+2)|32)===110&&(e.charCodeAt(t+3)|32)===101&&(e.charCodeAt(t+4)|32)===114&&(e.charCodeAt(t+5)|32)===97&&(e.charCodeAt(t+6)|32)===108}var lv=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],Ng=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function j5(e){return e||(e={}),e[0]="General",e[1]="0",e[2]="0.00",e[3]="#,##0",e[4]="#,##0.00",e[9]="0%",e[10]="0.00%",e[11]="0.00E+00",e[12]="# ?/?",e[13]="# ??/??",e[14]="m/d/yy",e[15]="d-mmm-yy",e[16]="d-mmm",e[17]="mmm-yy",e[18]="h:mm AM/PM",e[19]="h:mm:ss AM/PM",e[20]="h:mm",e[21]="h:mm:ss",e[22]="m/d/yy h:mm",e[37]="#,##0 ;(#,##0)",e[38]="#,##0 ;[Red](#,##0)",e[39]="#,##0.00;(#,##0.00)",e[40]="#,##0.00;[Red](#,##0.00)",e[45]="mm:ss",e[46]="[h]:mm:ss",e[47]="mmss.0",e[48]="##0.0E+0",e[49]="@",e[56]='"上午/下午 "hh"時"mm"分"ss"秒 "',e}var Ka={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "'},ov={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},S5={5:'"$"#,##0_);\\("$"#,##0\\)',63:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',41:'_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'};function Cf(e,t,a){for(var s=e<0?-1:1,i=e*s,d=0,c=1,f=0,g=1,p=0,x=0,y=Math.floor(i);p<t&&(y=Math.floor(i),f=y*c+d,x=y*p+g,!(i-y<5e-8));)i=1/(i-y),d=c,c=f,g=p,p=x;if(x>t&&(p>t?(x=g,f=d):(x=p,f=c)),!a)return[0,s*f,x];var _=Math.floor(s*f/x);return[_,s*f-_*x,x]}function af(e,t,a){if(e>2958465||e<0)return null;var s=e|0,i=Math.floor(86400*(e-s)),d=0,c=[],f={D:s,T:i,u:86400*(e-s)-i,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(f.u)<1e-6&&(f.u=0),t&&t.date1904&&(s+=1462),f.u>.9999&&(f.u=0,++i==86400&&(f.T=i=0,++s,++f.D)),s===60)c=a?[1317,10,29]:[1900,2,29],d=3;else if(s===0)c=a?[1317,8,29]:[1900,1,0],d=6;else{s>60&&--s;var g=new Date(1900,0,1);g.setDate(g.getDate()+s-1),c=[g.getFullYear(),g.getMonth()+1,g.getDate()],d=g.getDay(),s<60&&(d=(d+6)%7),a&&(d=L5(g,c))}return f.y=c[0],f.m=c[1],f.d=c[2],f.S=i%60,i=Math.floor(i/60),f.M=i%60,i=Math.floor(i/60),f.H=i,f.q=d,f}var f2=new Date(1899,11,31,0,0,0),T5=f2.getTime(),E5=new Date(1900,2,1,0,0,0);function h2(e,t){var a=e.getTime();return t?a-=1461*24*60*60*1e3:e>=E5&&(a+=1440*60*1e3),(a-(T5+(e.getTimezoneOffset()-f2.getTimezoneOffset())*6e4))/(1440*60*1e3)}function vp(e){return e.indexOf(".")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function C5(e){return e.indexOf("E")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function A5(e){var t=e<0?12:11,a=vp(e.toFixed(12));return a.length<=t||(a=e.toPrecision(10),a.length<=t)?a:e.toExponential(5)}function O5(e){var t=vp(e.toFixed(11));return t.length>(e<0?12:11)||t==="0"||t==="-0"?e.toPrecision(6):t}function M5(e){var t=Math.floor(Math.log(Math.abs(e))*Math.LOG10E),a;return t>=-4&&t<=-1?a=e.toPrecision(10+t):Math.abs(t)<=9?a=A5(e):t===10?a=e.toFixed(10).substr(0,12):a=O5(e),vp(C5(a.toUpperCase()))}function Yg(e,t){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(e|0)===e?e.toString(10):M5(e);case"undefined":return"";case"object":if(e==null)return"";if(e instanceof Date)return ol(14,h2(e,t&&t.date1904),t)}throw new Error("unsupported value in General format: "+e)}function L5(e,t){t[0]-=581;var a=e.getDay();return e<60&&(a=(a+6)%7),a}function D5(e,t,a,s){var i="",d=0,c=0,f=a.y,g,p=0;switch(e){case 98:f=a.y+543;case 121:switch(t.length){case 1:case 2:g=f%100,p=2;break;default:g=f%1e4,p=4;break}break;case 109:switch(t.length){case 1:case 2:g=a.m,p=t.length;break;case 3:return Ng[a.m-1][1];case 5:return Ng[a.m-1][0];default:return Ng[a.m-1][2]}break;case 100:switch(t.length){case 1:case 2:g=a.d,p=t.length;break;case 3:return lv[a.q][0];default:return lv[a.q][1]}break;case 104:switch(t.length){case 1:case 2:g=1+(a.H+11)%12,p=t.length;break;default:throw"bad hour format: "+t}break;case 72:switch(t.length){case 1:case 2:g=a.H,p=t.length;break;default:throw"bad hour format: "+t}break;case 77:switch(t.length){case 1:case 2:g=a.M,p=t.length;break;default:throw"bad minute format: "+t}break;case 115:if(t!="s"&&t!="ss"&&t!=".0"&&t!=".00"&&t!=".000")throw"bad second format: "+t;return a.u===0&&(t=="s"||t=="ss")?vs(a.S,t.length):(s>=2?c=s===3?1e3:100:c=s===1?10:1,d=Math.round(c*(a.S+a.u)),d>=60*c&&(d=0),t==="s"?d===0?"0":""+d/c:(i=vs(d,2+s),t==="ss"?i.substr(0,2):"."+i.substr(2,t.length-1)));case 90:switch(t){case"[h]":case"[hh]":g=a.D*24+a.H;break;case"[m]":case"[mm]":g=(a.D*24+a.H)*60+a.M;break;case"[s]":case"[ss]":g=((a.D*24+a.H)*60+a.M)*60+Math.round(a.S+a.u);break;default:throw"bad abstime format: "+t}p=t.length===3?1:2;break;case 101:g=f,p=1;break}var x=p>0?vs(g,p):"";return x}function il(e){var t=3;if(e.length<=t)return e;for(var a=e.length%t,s=e.substr(0,a);a!=e.length;a+=t)s+=(s.length>0?",":"")+e.substr(a,t);return s}var m2=/%/g;function P5(e,t,a){var s=t.replace(m2,""),i=t.length-s.length;return hi(e,s,a*Math.pow(10,2*i))+Xa("%",i)}function R5(e,t,a){for(var s=t.length-1;t.charCodeAt(s-1)===44;)--s;return hi(e,t.substr(0,s),a/Math.pow(10,3*(t.length-s)))}function g2(e,t){var a,s=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+g2(e,-t);var i=e.indexOf(".");i===-1&&(i=e.indexOf("E"));var d=Math.floor(Math.log(t)*Math.LOG10E)%i;if(d<0&&(d+=i),a=(t/Math.pow(10,d)).toPrecision(s+1+(i+d)%i),a.indexOf("e")===-1){var c=Math.floor(Math.log(t)*Math.LOG10E);for(a.indexOf(".")===-1?a=a.charAt(0)+"."+a.substr(1)+"E+"+(c-a.length+d):a+="E+"+(c-d);a.substr(0,2)==="0.";)a=a.charAt(0)+a.substr(2,i)+"."+a.substr(2+i),a=a.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");a=a.replace(/\+-/,"-")}a=a.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(f,g,p,x){return g+p+x.substr(0,(i+d)%i)+"."+x.substr(d)+"E"})}else a=t.toExponential(s);return e.match(/E\+00$/)&&a.match(/e[+-]\d$/)&&(a=a.substr(0,a.length-1)+"0"+a.charAt(a.length-1)),e.match(/E\-/)&&a.match(/e\+/)&&(a=a.replace(/e\+/,"e")),a.replace("e","E")}var p2=/# (\?+)( ?)\/( ?)(\d+)/;function F5(e,t,a){var s=parseInt(e[4],10),i=Math.round(t*s),d=Math.floor(i/s),c=i-d*s,f=s;return a+(d===0?"":""+d)+" "+(c===0?Xa(" ",e[1].length+1+e[4].length):bp(c,e[1].length)+e[2]+"/"+e[3]+vs(f,e[4].length))}function I5(e,t,a){return a+(t===0?"":""+t)+Xa(" ",e[1].length+2+e[4].length)}var x2=/^#*0*\.([0#]+)/,y2=/\).*[0#]/,b2=/\(###\) ###\\?-####/;function Yr(e){for(var t="",a,s=0;s!=e.length;++s)switch(a=e.charCodeAt(s)){case 35:break;case 63:t+=" ";break;case 48:t+="0";break;default:t+=String.fromCharCode(a)}return t}function cv(e,t){var a=Math.pow(10,t);return""+Math.round(e*a)/a}function dv(e,t){var a=e-Math.floor(e),s=Math.pow(10,t);return t<(""+Math.round(a*s)).length?0:Math.round(a*s)}function z5(e,t){return t<(""+Math.round((e-Math.floor(e))*Math.pow(10,t))).length?1:0}function B5(e){return e<2147483647&&e>-2147483648?""+(e>=0?e|0:e-1|0):""+Math.floor(e)}function Qn(e,t,a){if(e.charCodeAt(0)===40&&!t.match(y2)){var s=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return a>=0?Qn("n",s,a):"("+Qn("n",s,-a)+")"}if(t.charCodeAt(t.length-1)===44)return R5(e,t,a);if(t.indexOf("%")!==-1)return P5(e,t,a);if(t.indexOf("E")!==-1)return g2(t,a);if(t.charCodeAt(0)===36)return"$"+Qn(e,t.substr(t.charAt(1)==" "?2:1),a);var i,d,c,f,g=Math.abs(a),p=a<0?"-":"";if(t.match(/^00+$/))return p+oc(g,t.length);if(t.match(/^[#?]+$/))return i=oc(a,0),i==="0"&&(i=""),i.length>t.length?i:Yr(t.substr(0,t.length-i.length))+i;if(d=t.match(p2))return F5(d,g,p);if(t.match(/^#+0+$/))return p+oc(g,t.length-t.indexOf("0"));if(d=t.match(x2))return i=cv(a,d[1].length).replace(/^([^\.]+)$/,"$1."+Yr(d[1])).replace(/\.$/,"."+Yr(d[1])).replace(/\.(\d*)$/,function(T,N){return"."+N+Xa("0",Yr(d[1]).length-N.length)}),t.indexOf("0.")!==-1?i:i.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),d=t.match(/^(0*)\.(#*)$/))return p+cv(g,d[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,d[1].length?"0.":".");if(d=t.match(/^#{1,3},##0(\.?)$/))return p+il(oc(g,0));if(d=t.match(/^#,##0\.([#0]*0)$/))return a<0?"-"+Qn(e,t,-a):il(""+(Math.floor(a)+z5(a,d[1].length)))+"."+vs(dv(a,d[1].length),d[1].length);if(d=t.match(/^#,#*,#0/))return Qn(e,t.replace(/^#,#*,/,""),a);if(d=t.match(/^([0#]+)(\\?-([0#]+))+$/))return i=yc(Qn(e,t.replace(/[\\-]/g,""),a)),c=0,yc(yc(t.replace(/\\/g,"")).replace(/[0#]/g,function(T){return c<i.length?i.charAt(c++):T==="0"?"0":""}));if(t.match(b2))return i=Qn(e,"##########",a),"("+i.substr(0,3)+") "+i.substr(3,3)+"-"+i.substr(6);var x="";if(d=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(d[4].length,7),f=Cf(g,Math.pow(10,c)-1,!1),i=""+p,x=hi("n",d[1],f[1]),x.charAt(x.length-1)==" "&&(x=x.substr(0,x.length-1)+"0"),i+=x+d[2]+"/"+d[3],x=Tf(f[2],c),x.length<d[4].length&&(x=Yr(d[4].substr(d[4].length-x.length))+x),i+=x,i;if(d=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(Math.max(d[1].length,d[4].length),7),f=Cf(g,Math.pow(10,c)-1,!0),p+(f[0]||(f[1]?"":"0"))+" "+(f[1]?bp(f[1],c)+d[2]+"/"+d[3]+Tf(f[2],c):Xa(" ",2*c+1+d[2].length+d[3].length));if(d=t.match(/^[#0?]+$/))return i=oc(a,0),t.length<=i.length?i:Yr(t.substr(0,t.length-i.length))+i;if(d=t.match(/^([#0?]+)\.([#0]+)$/)){i=""+a.toFixed(Math.min(d[2].length,10)).replace(/([^0])0+$/,"$1"),c=i.indexOf(".");var y=t.indexOf(".")-c,_=t.length-i.length-y;return Yr(t.substr(0,y)+i+t.substr(t.length-_))}if(d=t.match(/^00,000\.([#0]*0)$/))return c=dv(a,d[1].length),a<0?"-"+Qn(e,t,-a):il(B5(a)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(T){return"00,"+(T.length<3?vs(0,3-T.length):"")+T})+"."+vs(c,d[1].length);switch(t){case"###,##0.00":return Qn(e,"#,##0.00",a);case"###,###":case"##,###":case"#,###":var k=il(oc(g,0));return k!=="0"?p+k:"";case"###,###.00":return Qn(e,"###,##0.00",a).replace(/^0\./,".");case"#,###.00":return Qn(e,"#,##0.00",a).replace(/^0\./,".")}throw new Error("unsupported format |"+t+"|")}function U5(e,t,a){for(var s=t.length-1;t.charCodeAt(s-1)===44;)--s;return hi(e,t.substr(0,s),a/Math.pow(10,3*(t.length-s)))}function H5(e,t,a){var s=t.replace(m2,""),i=t.length-s.length;return hi(e,s,a*Math.pow(10,2*i))+Xa("%",i)}function v2(e,t){var a,s=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+v2(e,-t);var i=e.indexOf(".");i===-1&&(i=e.indexOf("E"));var d=Math.floor(Math.log(t)*Math.LOG10E)%i;if(d<0&&(d+=i),a=(t/Math.pow(10,d)).toPrecision(s+1+(i+d)%i),!a.match(/[Ee]/)){var c=Math.floor(Math.log(t)*Math.LOG10E);a.indexOf(".")===-1?a=a.charAt(0)+"."+a.substr(1)+"E+"+(c-a.length+d):a+="E+"+(c-d),a=a.replace(/\+-/,"-")}a=a.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(f,g,p,x){return g+p+x.substr(0,(i+d)%i)+"."+x.substr(d)+"E"})}else a=t.toExponential(s);return e.match(/E\+00$/)&&a.match(/e[+-]\d$/)&&(a=a.substr(0,a.length-1)+"0"+a.charAt(a.length-1)),e.match(/E\-/)&&a.match(/e\+/)&&(a=a.replace(/e\+/,"e")),a.replace("e","E")}function Bs(e,t,a){if(e.charCodeAt(0)===40&&!t.match(y2)){var s=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return a>=0?Bs("n",s,a):"("+Bs("n",s,-a)+")"}if(t.charCodeAt(t.length-1)===44)return U5(e,t,a);if(t.indexOf("%")!==-1)return H5(e,t,a);if(t.indexOf("E")!==-1)return v2(t,a);if(t.charCodeAt(0)===36)return"$"+Bs(e,t.substr(t.charAt(1)==" "?2:1),a);var i,d,c,f,g=Math.abs(a),p=a<0?"-":"";if(t.match(/^00+$/))return p+vs(g,t.length);if(t.match(/^[#?]+$/))return i=""+a,a===0&&(i=""),i.length>t.length?i:Yr(t.substr(0,t.length-i.length))+i;if(d=t.match(p2))return I5(d,g,p);if(t.match(/^#+0+$/))return p+vs(g,t.length-t.indexOf("0"));if(d=t.match(x2))return i=(""+a).replace(/^([^\.]+)$/,"$1."+Yr(d[1])).replace(/\.$/,"."+Yr(d[1])),i=i.replace(/\.(\d*)$/,function(T,N){return"."+N+Xa("0",Yr(d[1]).length-N.length)}),t.indexOf("0.")!==-1?i:i.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),d=t.match(/^(0*)\.(#*)$/))return p+(""+g).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,d[1].length?"0.":".");if(d=t.match(/^#{1,3},##0(\.?)$/))return p+il(""+g);if(d=t.match(/^#,##0\.([#0]*0)$/))return a<0?"-"+Bs(e,t,-a):il(""+a)+"."+Xa("0",d[1].length);if(d=t.match(/^#,#*,#0/))return Bs(e,t.replace(/^#,#*,/,""),a);if(d=t.match(/^([0#]+)(\\?-([0#]+))+$/))return i=yc(Bs(e,t.replace(/[\\-]/g,""),a)),c=0,yc(yc(t.replace(/\\/g,"")).replace(/[0#]/g,function(T){return c<i.length?i.charAt(c++):T==="0"?"0":""}));if(t.match(b2))return i=Bs(e,"##########",a),"("+i.substr(0,3)+") "+i.substr(3,3)+"-"+i.substr(6);var x="";if(d=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(d[4].length,7),f=Cf(g,Math.pow(10,c)-1,!1),i=""+p,x=hi("n",d[1],f[1]),x.charAt(x.length-1)==" "&&(x=x.substr(0,x.length-1)+"0"),i+=x+d[2]+"/"+d[3],x=Tf(f[2],c),x.length<d[4].length&&(x=Yr(d[4].substr(d[4].length-x.length))+x),i+=x,i;if(d=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return c=Math.min(Math.max(d[1].length,d[4].length),7),f=Cf(g,Math.pow(10,c)-1,!0),p+(f[0]||(f[1]?"":"0"))+" "+(f[1]?bp(f[1],c)+d[2]+"/"+d[3]+Tf(f[2],c):Xa(" ",2*c+1+d[2].length+d[3].length));if(d=t.match(/^[#0?]+$/))return i=""+a,t.length<=i.length?i:Yr(t.substr(0,t.length-i.length))+i;if(d=t.match(/^([#0]+)\.([#0]+)$/)){i=""+a.toFixed(Math.min(d[2].length,10)).replace(/([^0])0+$/,"$1"),c=i.indexOf(".");var y=t.indexOf(".")-c,_=t.length-i.length-y;return Yr(t.substr(0,y)+i+t.substr(t.length-_))}if(d=t.match(/^00,000\.([#0]*0)$/))return a<0?"-"+Bs(e,t,-a):il(""+a).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(T){return"00,"+(T.length<3?vs(0,3-T.length):"")+T})+"."+vs(0,d[1].length);switch(t){case"###,###":case"##,###":case"#,###":var k=il(""+g);return k!=="0"?p+k:"";default:if(t.match(/\.[0#?]*$/))return Bs(e,t.slice(0,t.lastIndexOf(".")),a)+Yr(t.slice(t.lastIndexOf(".")))}throw new Error("unsupported format |"+t+"|")}function hi(e,t,a){return(a|0)===a?Bs(e,t,a):Qn(e,t,a)}function $5(e){for(var t=[],a=!1,s=0,i=0;s<e.length;++s)switch(e.charCodeAt(s)){case 34:a=!a;break;case 95:case 42:case 92:++s;break;case 59:t[t.length]=e.substr(i,s-i),i=s+1}if(t[t.length]=e.substr(i),a===!0)throw new Error("Format |"+e+"| unterminated string ");return t}var _2=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function w2(e){for(var t=0,a="",s="";t<e.length;)switch(a=e.charAt(t)){case"G":Ef(e,t)&&(t+=6),t++;break;case'"':for(;e.charCodeAt(++t)!==34&&t<e.length;);++t;break;case"\\":t+=2;break;case"_":t+=2;break;case"@":++t;break;case"B":case"b":if(e.charAt(t+1)==="1"||e.charAt(t+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(e.substr(t,3).toUpperCase()==="A/P"||e.substr(t,5).toUpperCase()==="AM/PM"||e.substr(t,5).toUpperCase()==="上午/下午")return!0;++t;break;case"[":for(s=a;e.charAt(t++)!=="]"&&t<e.length;)s+=e.charAt(t);if(s.match(_2))return!0;break;case".":case"0":case"#":for(;t<e.length&&("0#?.,E+-%".indexOf(a=e.charAt(++t))>-1||a=="\\"&&e.charAt(t+1)=="-"&&"0#".indexOf(e.charAt(t+2))>-1););break;case"?":for(;e.charAt(++t)===a;);break;case"*":++t,(e.charAt(t)==" "||e.charAt(t)=="*")&&++t;break;case"(":case")":++t;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;t<e.length&&"0123456789".indexOf(e.charAt(++t))>-1;);break;case" ":++t;break;default:++t;break}return!1}function W5(e,t,a,s){for(var i=[],d="",c=0,f="",g="t",p,x,y,_="H";c<e.length;)switch(f=e.charAt(c)){case"G":if(!Ef(e,c))throw new Error("unrecognized character "+f+" in "+e);i[i.length]={t:"G",v:"General"},c+=7;break;case'"':for(d="";(y=e.charCodeAt(++c))!==34&&c<e.length;)d+=String.fromCharCode(y);i[i.length]={t:"t",v:d},++c;break;case"\\":var k=e.charAt(++c),T=k==="("||k===")"?k:"t";i[i.length]={t:T,v:k},++c;break;case"_":i[i.length]={t:"t",v:" "},c+=2;break;case"@":i[i.length]={t:"T",v:t},++c;break;case"B":case"b":if(e.charAt(c+1)==="1"||e.charAt(c+1)==="2"){if(p==null&&(p=af(t,a,e.charAt(c+1)==="2"),p==null))return"";i[i.length]={t:"X",v:e.substr(c,2)},g=f,c+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":f=f.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(t<0||p==null&&(p=af(t,a),p==null))return"";for(d=f;++c<e.length&&e.charAt(c).toLowerCase()===f;)d+=f;f==="m"&&g.toLowerCase()==="h"&&(f="M"),f==="h"&&(f=_),i[i.length]={t:f,v:d},g=f;break;case"A":case"a":case"上":var N={t:f,v:f};if(p==null&&(p=af(t,a)),e.substr(c,3).toUpperCase()==="A/P"?(p!=null&&(N.v=p.H>=12?"P":"A"),N.t="T",_="h",c+=3):e.substr(c,5).toUpperCase()==="AM/PM"?(p!=null&&(N.v=p.H>=12?"PM":"AM"),N.t="T",c+=5,_="h"):e.substr(c,5).toUpperCase()==="上午/下午"?(p!=null&&(N.v=p.H>=12?"下午":"上午"),N.t="T",c+=5,_="h"):(N.t="t",++c),p==null&&N.t==="T")return"";i[i.length]=N,g=f;break;case"[":for(d=f;e.charAt(c++)!=="]"&&c<e.length;)d+=e.charAt(c);if(d.slice(-1)!=="]")throw'unterminated "[" block: |'+d+"|";if(d.match(_2)){if(p==null&&(p=af(t,a),p==null))return"";i[i.length]={t:"Z",v:d.toLowerCase()},g=d.charAt(1)}else d.indexOf("$")>-1&&(d=(d.match(/\$([^-\[\]]*)/)||[])[1]||"$",w2(e)||(i[i.length]={t:"t",v:d}));break;case".":if(p!=null){for(d=f;++c<e.length&&(f=e.charAt(c))==="0";)d+=f;i[i.length]={t:"s",v:d};break}case"0":case"#":for(d=f;++c<e.length&&"0#?.,E+-%".indexOf(f=e.charAt(c))>-1;)d+=f;i[i.length]={t:"n",v:d};break;case"?":for(d=f;e.charAt(++c)===f;)d+=f;i[i.length]={t:f,v:d},g=f;break;case"*":++c,(e.charAt(c)==" "||e.charAt(c)=="*")&&++c;break;case"(":case")":i[i.length]={t:s===1?"t":f,v:f},++c;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(d=f;c<e.length&&"0123456789".indexOf(e.charAt(++c))>-1;)d+=e.charAt(c);i[i.length]={t:"D",v:d};break;case" ":i[i.length]={t:f,v:f},++c;break;case"$":i[i.length]={t:"t",v:"$"},++c;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(f)===-1)throw new Error("unrecognized character "+f+" in "+e);i[i.length]={t:"t",v:f},++c;break}var S=0,O=0,C;for(c=i.length-1,g="t";c>=0;--c)switch(i[c].t){case"h":case"H":i[c].t=_,g="h",S<1&&(S=1);break;case"s":(C=i[c].v.match(/\.0+$/))&&(O=Math.max(O,C[0].length-1)),S<3&&(S=3);case"d":case"y":case"M":case"e":g=i[c].t;break;case"m":g==="s"&&(i[c].t="M",S<2&&(S=2));break;case"X":break;case"Z":S<1&&i[c].v.match(/[Hh]/)&&(S=1),S<2&&i[c].v.match(/[Mm]/)&&(S=2),S<3&&i[c].v.match(/[Ss]/)&&(S=3)}switch(S){case 0:break;case 1:p.u>=.5&&(p.u=0,++p.S),p.S>=60&&(p.S=0,++p.M),p.M>=60&&(p.M=0,++p.H);break;case 2:p.u>=.5&&(p.u=0,++p.S),p.S>=60&&(p.S=0,++p.M);break}var A="",P;for(c=0;c<i.length;++c)switch(i[c].t){case"t":case"T":case" ":case"D":break;case"X":i[c].v="",i[c].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":i[c].v=D5(i[c].t.charCodeAt(0),i[c].v,p,O),i[c].t="t";break;case"n":case"?":for(P=c+1;i[P]!=null&&((f=i[P].t)==="?"||f==="D"||(f===" "||f==="t")&&i[P+1]!=null&&(i[P+1].t==="?"||i[P+1].t==="t"&&i[P+1].v==="/")||i[c].t==="("&&(f===" "||f==="n"||f===")")||f==="t"&&(i[P].v==="/"||i[P].v===" "&&i[P+1]!=null&&i[P+1].t=="?"));)i[c].v+=i[P].v,i[P]={v:"",t:";"},++P;A+=i[c].v,c=P-1;break;case"G":i[c].t="t",i[c].v=Yg(t,a);break}var I="",ee,B;if(A.length>0){A.charCodeAt(0)==40?(ee=t<0&&A.charCodeAt(0)===45?-t:t,B=hi("n",A,ee)):(ee=t<0&&s>1?-t:t,B=hi("n",A,ee),ee<0&&i[0]&&i[0].t=="t"&&(B=B.substr(1),i[0].v="-"+i[0].v)),P=B.length-1;var H=i.length;for(c=0;c<i.length;++c)if(i[c]!=null&&i[c].t!="t"&&i[c].v.indexOf(".")>-1){H=c;break}var Y=i.length;if(H===i.length&&B.indexOf("E")===-1){for(c=i.length-1;c>=0;--c)i[c]==null||"n?".indexOf(i[c].t)===-1||(P>=i[c].v.length-1?(P-=i[c].v.length,i[c].v=B.substr(P+1,i[c].v.length)):P<0?i[c].v="":(i[c].v=B.substr(0,P+1),P=-1),i[c].t="t",Y=c);P>=0&&Y<i.length&&(i[Y].v=B.substr(0,P+1)+i[Y].v)}else if(H!==i.length&&B.indexOf("E")===-1){for(P=B.indexOf(".")-1,c=H;c>=0;--c)if(!(i[c]==null||"n?".indexOf(i[c].t)===-1)){for(x=i[c].v.indexOf(".")>-1&&c===H?i[c].v.indexOf(".")-1:i[c].v.length-1,I=i[c].v.substr(x+1);x>=0;--x)P>=0&&(i[c].v.charAt(x)==="0"||i[c].v.charAt(x)==="#")&&(I=B.charAt(P--)+I);i[c].v=I,i[c].t="t",Y=c}for(P>=0&&Y<i.length&&(i[Y].v=B.substr(0,P+1)+i[Y].v),P=B.indexOf(".")+1,c=H;c<i.length;++c)if(!(i[c]==null||"n?(".indexOf(i[c].t)===-1&&c!==H)){for(x=i[c].v.indexOf(".")>-1&&c===H?i[c].v.indexOf(".")+1:0,I=i[c].v.substr(0,x);x<i[c].v.length;++x)P<B.length&&(I+=B.charAt(P++));i[c].v=I,i[c].t="t",Y=c}}}for(c=0;c<i.length;++c)i[c]!=null&&"n?".indexOf(i[c].t)>-1&&(ee=s>1&&t<0&&c>0&&i[c-1].v==="-"?-t:t,i[c].v=hi(i[c].t,i[c].v,ee),i[c].t="t");var ue="";for(c=0;c!==i.length;++c)i[c]!=null&&(ue+=i[c].v);return ue}var uv=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function fv(e,t){if(t==null)return!1;var a=parseFloat(t[2]);switch(t[1]){case"=":if(e==a)return!0;break;case">":if(e>a)return!0;break;case"<":if(e<a)return!0;break;case"<>":if(e!=a)return!0;break;case">=":if(e>=a)return!0;break;case"<=":if(e<=a)return!0;break}return!1}function V5(e,t){var a=$5(e),s=a.length,i=a[s-1].indexOf("@");if(s<4&&i>-1&&--s,a.length>4)throw new Error("cannot find right format for |"+a.join("|")+"|");if(typeof t!="number")return[4,a.length===4||i>-1?a[a.length-1]:"@"];switch(a.length){case 1:a=i>-1?["General","General","General",a[0]]:[a[0],a[0],a[0],"@"];break;case 2:a=i>-1?[a[0],a[0],a[0],a[1]]:[a[0],a[1],a[0],"@"];break;case 3:a=i>-1?[a[0],a[1],a[0],a[2]]:[a[0],a[1],a[2],"@"];break}var d=t>0?a[0]:t<0?a[1]:a[2];if(a[0].indexOf("[")===-1&&a[1].indexOf("[")===-1)return[s,d];if(a[0].match(/\[[=<>]/)!=null||a[1].match(/\[[=<>]/)!=null){var c=a[0].match(uv),f=a[1].match(uv);return fv(t,c)?[s,a[0]]:fv(t,f)?[s,a[1]]:[s,a[c!=null&&f!=null?2:1]]}return[s,d]}function ol(e,t,a){a==null&&(a={});var s="";switch(typeof e){case"string":e=="m/d/yy"&&a.dateNF?s=a.dateNF:s=e;break;case"number":e==14&&a.dateNF?s=a.dateNF:s=(a.table!=null?a.table:Ka)[e],s==null&&(s=a.table&&a.table[ov[e]]||Ka[ov[e]]),s==null&&(s=S5[e]||"General");break}if(Ef(s,0))return Yg(t,a);t instanceof Date&&(t=h2(t,a.date1904));var i=V5(s,t);if(Ef(i[1]))return Yg(t,a);if(t===!0)t="TRUE";else if(t===!1)t="FALSE";else if(t===""||t==null)return"";return W5(i[1],t,a,i[0])}function k2(e,t){if(typeof t!="number"){t=+t||-1;for(var a=0;a<392;++a){if(Ka[a]==null){t<0&&(t=a);continue}if(Ka[a]==e){t=a;break}}t<0&&(t=391)}return Ka[t]=e,t}function Qf(e){for(var t=0;t!=392;++t)e[t]!==void 0&&k2(e[t],t)}function eh(){Ka=j5()}var N2=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function G5(e){var t=typeof e=="number"?Ka[e]:e;return t=t.replace(N2,"(\\d+)"),new RegExp("^"+t+"$")}function Z5(e,t,a){var s=-1,i=-1,d=-1,c=-1,f=-1,g=-1;(t.match(N2)||[]).forEach(function(y,_){var k=parseInt(a[_+1],10);switch(y.toLowerCase().charAt(0)){case"y":s=k;break;case"d":d=k;break;case"h":c=k;break;case"s":g=k;break;case"m":c>=0?f=k:i=k;break}}),g>=0&&f==-1&&i>=0&&(f=i,i=-1);var p=(""+(s>=0?s:new Date().getFullYear())).slice(-4)+"-"+("00"+(i>=1?i:1)).slice(-2)+"-"+("00"+(d>=1?d:1)).slice(-2);p.length==7&&(p="0"+p),p.length==8&&(p="20"+p);var x=("00"+(c>=0?c:0)).slice(-2)+":"+("00"+(f>=0?f:0)).slice(-2)+":"+("00"+(g>=0?g:0)).slice(-2);return c==-1&&f==-1&&g==-1?p:s==-1&&i==-1&&d==-1?x:p+"T"+x}var q5=(function(){var e={};e.version="1.2.0";function t(){for(var B=0,H=new Array(256),Y=0;Y!=256;++Y)B=Y,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,B=B&1?-306674912^B>>>1:B>>>1,H[Y]=B;return typeof Int32Array!="undefined"?new Int32Array(H):H}var a=t();function s(B){var H=0,Y=0,ue=0,xe=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(ue=0;ue!=256;++ue)xe[ue]=B[ue];for(ue=0;ue!=256;++ue)for(Y=B[ue],H=256+ue;H<4096;H+=256)Y=xe[H]=Y>>>8^B[Y&255];var le=[];for(ue=1;ue!=16;++ue)le[ue-1]=typeof Int32Array!="undefined"?xe.subarray(ue*256,ue*256+256):xe.slice(ue*256,ue*256+256);return le}var i=s(a),d=i[0],c=i[1],f=i[2],g=i[3],p=i[4],x=i[5],y=i[6],_=i[7],k=i[8],T=i[9],N=i[10],S=i[11],O=i[12],C=i[13],A=i[14];function P(B,H){for(var Y=H^-1,ue=0,xe=B.length;ue<xe;)Y=Y>>>8^a[(Y^B.charCodeAt(ue++))&255];return~Y}function I(B,H){for(var Y=H^-1,ue=B.length-15,xe=0;xe<ue;)Y=A[B[xe++]^Y&255]^C[B[xe++]^Y>>8&255]^O[B[xe++]^Y>>16&255]^S[B[xe++]^Y>>>24]^N[B[xe++]]^T[B[xe++]]^k[B[xe++]]^_[B[xe++]]^y[B[xe++]]^x[B[xe++]]^p[B[xe++]]^g[B[xe++]]^f[B[xe++]]^c[B[xe++]]^d[B[xe++]]^a[B[xe++]];for(ue+=15;xe<ue;)Y=Y>>>8^a[(Y^B[xe++])&255];return~Y}function ee(B,H){for(var Y=H^-1,ue=0,xe=B.length,le=0,ge=0;ue<xe;)le=B.charCodeAt(ue++),le<128?Y=Y>>>8^a[(Y^le)&255]:le<2048?(Y=Y>>>8^a[(Y^(192|le>>6&31))&255],Y=Y>>>8^a[(Y^(128|le&63))&255]):le>=55296&&le<57344?(le=(le&1023)+64,ge=B.charCodeAt(ue++)&1023,Y=Y>>>8^a[(Y^(240|le>>8&7))&255],Y=Y>>>8^a[(Y^(128|le>>2&63))&255],Y=Y>>>8^a[(Y^(128|ge>>6&15|(le&3)<<4))&255],Y=Y>>>8^a[(Y^(128|ge&63))&255]):(Y=Y>>>8^a[(Y^(224|le>>12&15))&255],Y=Y>>>8^a[(Y^(128|le>>6&63))&255],Y=Y>>>8^a[(Y^(128|le&63))&255]);return~Y}return e.table=a,e.bstr=P,e.buf=I,e.str=ee,e})(),Oa=(function(){var t={};t.version="1.2.1";function a(U,ne){for(var X=U.split("/"),Q=ne.split("/"),re=0,z=0,he=Math.min(X.length,Q.length);re<he;++re){if(z=X[re].length-Q[re].length)return z;if(X[re]!=Q[re])return X[re]<Q[re]?-1:1}return X.length-Q.length}function s(U){if(U.charAt(U.length-1)=="/")return U.slice(0,-1).indexOf("/")===-1?U:s(U.slice(0,-1));var ne=U.lastIndexOf("/");return ne===-1?U:U.slice(0,ne+1)}function i(U){if(U.charAt(U.length-1)=="/")return i(U.slice(0,-1));var ne=U.lastIndexOf("/");return ne===-1?U:U.slice(ne+1)}function d(U,ne){typeof ne=="string"&&(ne=new Date(ne));var X=ne.getHours();X=X<<6|ne.getMinutes(),X=X<<5|ne.getSeconds()>>>1,U.write_shift(2,X);var Q=ne.getFullYear()-1980;Q=Q<<4|ne.getMonth()+1,Q=Q<<5|ne.getDate(),U.write_shift(2,Q)}function c(U){var ne=U.read_shift(2)&65535,X=U.read_shift(2)&65535,Q=new Date,re=X&31;X>>>=5;var z=X&15;X>>>=4,Q.setMilliseconds(0),Q.setFullYear(X+1980),Q.setMonth(z-1),Q.setDate(re);var he=ne&31;ne>>>=5;var Me=ne&63;return ne>>>=6,Q.setHours(ne),Q.setMinutes(Me),Q.setSeconds(he<<1),Q}function f(U){Mn(U,0);for(var ne={},X=0;U.l<=U.length-4;){var Q=U.read_shift(2),re=U.read_shift(2),z=U.l+re,he={};switch(Q){case 21589:X=U.read_shift(1),X&1&&(he.mtime=U.read_shift(4)),re>5&&(X&2&&(he.atime=U.read_shift(4)),X&4&&(he.ctime=U.read_shift(4))),he.mtime&&(he.mt=new Date(he.mtime*1e3));break}U.l=z,ne[Q]=he}return ne}var g;function p(){return g||(g={})}function x(U,ne){if(U[0]==80&&U[1]==75)return Lt(U,ne);if((U[0]|32)==109&&(U[1]|32)==105)return Vr(U,ne);if(U.length<512)throw new Error("CFB file size "+U.length+" < 512");var X=3,Q=512,re=0,z=0,he=0,Me=0,ke=0,Ae=[],Ce=U.slice(0,512);Mn(Ce,0);var tt=y(Ce);switch(X=tt[0],X){case 3:Q=512;break;case 4:Q=4096;break;case 0:if(tt[1]==0)return Lt(U,ne);default:throw new Error("Major Version: Expected 3 or 4 saw "+X)}Q!==512&&(Ce=U.slice(0,Q),Mn(Ce,28));var ct=U.slice(0,Q);_(Ce,X);var pt=Ce.read_shift(4,"i");if(X===3&&pt!==0)throw new Error("# Directory Sectors: Expected 0 saw "+pt);Ce.l+=4,he=Ce.read_shift(4,"i"),Ce.l+=4,Ce.chk("00100000","Mini Stream Cutoff Size: "),Me=Ce.read_shift(4,"i"),re=Ce.read_shift(4,"i"),ke=Ce.read_shift(4,"i"),z=Ce.read_shift(4,"i");for(var it=-1,xt=0;xt<109&&(it=Ce.read_shift(4,"i"),!(it<0));++xt)Ae[xt]=it;var _t=k(U,Q);S(ke,z,_t,Q,Ae);var ja=C(_t,he,Ae,Q);ja[he].name="!Directory",re>0&&Me!==ge&&(ja[Me].name="!MiniFAT"),ja[Ae[0]].name="!FAT",ja.fat_addrs=Ae,ja.ssz=Q;var Sa={},Fa=[],Ir=[],vn=[];A(he,ja,_t,Fa,re,Sa,Ir,Me),T(Ir,vn,Fa),Fa.shift();var ss={FileIndex:Ir,FullPaths:vn};return ne&&ne.raw&&(ss.raw={header:ct,sectors:_t}),ss}function y(U){if(U[U.l]==80&&U[U.l+1]==75)return[0,0];U.chk(be,"Header Signature: "),U.l+=16;var ne=U.read_shift(2,"u");return[U.read_shift(2,"u"),ne]}function _(U,ne){var X=9;switch(U.l+=2,X=U.read_shift(2)){case 9:if(ne!=3)throw new Error("Sector Shift: Expected 9 saw "+X);break;case 12:if(ne!=4)throw new Error("Sector Shift: Expected 12 saw "+X);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+X)}U.chk("0600","Mini Sector Shift: "),U.chk("000000000000","Reserved: ")}function k(U,ne){for(var X=Math.ceil(U.length/ne)-1,Q=[],re=1;re<X;++re)Q[re-1]=U.slice(re*ne,(re+1)*ne);return Q[X-1]=U.slice(X*ne),Q}function T(U,ne,X){for(var Q=0,re=0,z=0,he=0,Me=0,ke=X.length,Ae=[],Ce=[];Q<ke;++Q)Ae[Q]=Ce[Q]=Q,ne[Q]=X[Q];for(;Me<Ce.length;++Me)Q=Ce[Me],re=U[Q].L,z=U[Q].R,he=U[Q].C,Ae[Q]===Q&&(re!==-1&&Ae[re]!==re&&(Ae[Q]=Ae[re]),z!==-1&&Ae[z]!==z&&(Ae[Q]=Ae[z])),he!==-1&&(Ae[he]=Q),re!==-1&&Q!=Ae[Q]&&(Ae[re]=Ae[Q],Ce.lastIndexOf(re)<Me&&Ce.push(re)),z!==-1&&Q!=Ae[Q]&&(Ae[z]=Ae[Q],Ce.lastIndexOf(z)<Me&&Ce.push(z));for(Q=1;Q<ke;++Q)Ae[Q]===Q&&(z!==-1&&Ae[z]!==z?Ae[Q]=Ae[z]:re!==-1&&Ae[re]!==re&&(Ae[Q]=Ae[re]));for(Q=1;Q<ke;++Q)if(U[Q].type!==0){if(Me=Q,Me!=Ae[Me])do Me=Ae[Me],ne[Q]=ne[Me]+"/"+ne[Q];while(Me!==0&&Ae[Me]!==-1&&Me!=Ae[Me]);Ae[Q]=-1}for(ne[0]+="/",Q=1;Q<ke;++Q)U[Q].type!==2&&(ne[Q]+="/")}function N(U,ne,X){for(var Q=U.start,re=U.size,z=[],he=Q;X&&re>0&&he>=0;)z.push(ne.slice(he*le,he*le+le)),re-=le,he=Jl(X,he*4);return z.length===0?qe(0):Lr(z).slice(0,U.size)}function S(U,ne,X,Q,re){var z=ge;if(U===ge){if(ne!==0)throw new Error("DIFAT chain shorter than expected")}else if(U!==-1){var he=X[U],Me=(Q>>>2)-1;if(!he)return;for(var ke=0;ke<Me&&(z=Jl(he,ke*4))!==ge;++ke)re.push(z);S(Jl(he,Q-4),ne-1,X,Q,re)}}function O(U,ne,X,Q,re){var z=[],he=[];re||(re=[]);var Me=Q-1,ke=0,Ae=0;for(ke=ne;ke>=0;){re[ke]=!0,z[z.length]=ke,he.push(U[ke]);var Ce=X[Math.floor(ke*4/Q)];if(Ae=ke*4&Me,Q<4+Ae)throw new Error("FAT boundary crossed: "+ke+" 4 "+Q);if(!U[Ce])break;ke=Jl(U[Ce],Ae)}return{nodes:z,data:vv([he])}}function C(U,ne,X,Q){var re=U.length,z=[],he=[],Me=[],ke=[],Ae=Q-1,Ce=0,tt=0,ct=0,pt=0;for(Ce=0;Ce<re;++Ce)if(Me=[],ct=Ce+ne,ct>=re&&(ct-=re),!he[ct]){ke=[];var it=[];for(tt=ct;tt>=0;){it[tt]=!0,he[tt]=!0,Me[Me.length]=tt,ke.push(U[tt]);var xt=X[Math.floor(tt*4/Q)];if(pt=tt*4&Ae,Q<4+pt)throw new Error("FAT boundary crossed: "+tt+" 4 "+Q);if(!U[xt]||(tt=Jl(U[xt],pt),it[tt]))break}z[ct]={nodes:Me,data:vv([ke])}}return z}function A(U,ne,X,Q,re,z,he,Me){for(var ke=0,Ae=Q.length?2:0,Ce=ne[U].data,tt=0,ct=0,pt;tt<Ce.length;tt+=128){var it=Ce.slice(tt,tt+128);Mn(it,64),ct=it.read_shift(2),pt=jp(it,0,ct-Ae),Q.push(pt);var xt={name:pt,type:it.read_shift(1),color:it.read_shift(1),L:it.read_shift(4,"i"),R:it.read_shift(4,"i"),C:it.read_shift(4,"i"),clsid:it.read_shift(16),state:it.read_shift(4,"i"),start:0,size:0},_t=it.read_shift(2)+it.read_shift(2)+it.read_shift(2)+it.read_shift(2);_t!==0&&(xt.ct=P(it,it.l-8));var ja=it.read_shift(2)+it.read_shift(2)+it.read_shift(2)+it.read_shift(2);ja!==0&&(xt.mt=P(it,it.l-8)),xt.start=it.read_shift(4,"i"),xt.size=it.read_shift(4,"i"),xt.size<0&&xt.start<0&&(xt.size=xt.type=0,xt.start=ge,xt.name=""),xt.type===5?(ke=xt.start,re>0&&ke!==ge&&(ne[ke].name="!StreamData")):xt.size>=4096?(xt.storage="fat",ne[xt.start]===void 0&&(ne[xt.start]=O(X,xt.start,ne.fat_addrs,ne.ssz)),ne[xt.start].name=xt.name,xt.content=ne[xt.start].data.slice(0,xt.size)):(xt.storage="minifat",xt.size<0?xt.size=0:ke!==ge&&xt.start!==ge&&ne[ke]&&(xt.content=N(xt,ne[ke].data,(ne[Me]||{}).data))),xt.content&&Mn(xt.content,0),z[pt]=xt,he.push(xt)}}function P(U,ne){return new Date((Dn(U,ne+4)/1e7*Math.pow(2,32)+Dn(U,ne)/1e7-11644473600)*1e3)}function I(U,ne){return p(),x(g.readFileSync(U),ne)}function ee(U,ne){var X=ne&&ne.type;switch(X||pa&&Buffer.isBuffer(U)&&(X="buffer"),X||"base64"){case"file":return I(U,ne);case"base64":return x(bs(yi(U)),ne);case"binary":return x(bs(U),ne)}return x(U,ne)}function B(U,ne){var X=ne||{},Q=X.root||"Root Entry";if(U.FullPaths||(U.FullPaths=[]),U.FileIndex||(U.FileIndex=[]),U.FullPaths.length!==U.FileIndex.length)throw new Error("inconsistent CFB structure");U.FullPaths.length===0&&(U.FullPaths[0]=Q+"/",U.FileIndex[0]={name:Q,type:5}),X.CLSID&&(U.FileIndex[0].clsid=X.CLSID),H(U)}function H(U){var ne="Sh33tJ5";if(!Oa.find(U,"/"+ne)){var X=qe(4);X[0]=55,X[1]=X[3]=50,X[2]=54,U.FileIndex.push({name:ne,type:2,content:X,size:4,L:69,R:69,C:69}),U.FullPaths.push(U.FullPaths[0]+ne),Y(U)}}function Y(U,ne){B(U);for(var X=!1,Q=!1,re=U.FullPaths.length-1;re>=0;--re){var z=U.FileIndex[re];switch(z.type){case 0:Q?X=!0:(U.FileIndex.pop(),U.FullPaths.pop());break;case 1:case 2:case 5:Q=!0,isNaN(z.R*z.L*z.C)&&(X=!0),z.R>-1&&z.L>-1&&z.R==z.L&&(X=!0);break;default:X=!0;break}}if(!(!X&&!ne)){var he=new Date(1987,1,19),Me=0,ke=Object.create?Object.create(null):{},Ae=[];for(re=0;re<U.FullPaths.length;++re)ke[U.FullPaths[re]]=!0,U.FileIndex[re].type!==0&&Ae.push([U.FullPaths[re],U.FileIndex[re]]);for(re=0;re<Ae.length;++re){var Ce=s(Ae[re][0]);Q=ke[Ce],Q||(Ae.push([Ce,{name:i(Ce).replace("/",""),type:1,clsid:ae,ct:he,mt:he,content:null}]),ke[Ce]=!0)}for(Ae.sort(function(pt,it){return a(pt[0],it[0])}),U.FullPaths=[],U.FileIndex=[],re=0;re<Ae.length;++re)U.FullPaths[re]=Ae[re][0],U.FileIndex[re]=Ae[re][1];for(re=0;re<Ae.length;++re){var tt=U.FileIndex[re],ct=U.FullPaths[re];if(tt.name=i(ct).replace("/",""),tt.L=tt.R=tt.C=-(tt.color=1),tt.size=tt.content?tt.content.length:0,tt.start=0,tt.clsid=tt.clsid||ae,re===0)tt.C=Ae.length>1?1:-1,tt.size=0,tt.type=5;else if(ct.slice(-1)=="/"){for(Me=re+1;Me<Ae.length&&s(U.FullPaths[Me])!=ct;++Me);for(tt.C=Me>=Ae.length?-1:Me,Me=re+1;Me<Ae.length&&s(U.FullPaths[Me])!=s(ct);++Me);tt.R=Me>=Ae.length?-1:Me,tt.type=1}else s(U.FullPaths[re+1]||"")==s(ct)&&(tt.R=re+1),tt.type=2}}}function ue(U,ne){var X=ne||{};if(X.fileType=="mad")return ns(U,X);switch(Y(U),X.fileType){case"zip":return We(U,X)}var Q=(function(pt){for(var it=0,xt=0,_t=0;_t<pt.FileIndex.length;++_t){var ja=pt.FileIndex[_t];if(ja.content){var Sa=ja.content.length;Sa>0&&(Sa<4096?it+=Sa+63>>6:xt+=Sa+511>>9)}}for(var Fa=pt.FullPaths.length+3>>2,Ir=it+7>>3,vn=it+127>>7,ss=Ir+xt+Fa+vn,_n=ss+127>>7,is=_n<=109?0:Math.ceil((_n-109)/127);ss+_n+is+127>>7>_n;)is=++_n<=109?0:Math.ceil((_n-109)/127);var Ht=[1,is,_n,vn,Fa,xt,it,0];return pt.FileIndex[0].size=it<<6,Ht[7]=(pt.FileIndex[0].start=Ht[0]+Ht[1]+Ht[2]+Ht[3]+Ht[4]+Ht[5])+(Ht[6]+7>>3),Ht})(U),re=qe(Q[7]<<9),z=0,he=0;{for(z=0;z<8;++z)re.write_shift(1,me[z]);for(z=0;z<8;++z)re.write_shift(2,0);for(re.write_shift(2,62),re.write_shift(2,3),re.write_shift(2,65534),re.write_shift(2,9),re.write_shift(2,6),z=0;z<3;++z)re.write_shift(2,0);for(re.write_shift(4,0),re.write_shift(4,Q[2]),re.write_shift(4,Q[0]+Q[1]+Q[2]+Q[3]-1),re.write_shift(4,0),re.write_shift(4,4096),re.write_shift(4,Q[3]?Q[0]+Q[1]+Q[2]-1:ge),re.write_shift(4,Q[3]),re.write_shift(-4,Q[1]?Q[0]-1:ge),re.write_shift(4,Q[1]),z=0;z<109;++z)re.write_shift(-4,z<Q[2]?Q[1]+z:-1)}if(Q[1])for(he=0;he<Q[1];++he){for(;z<236+he*127;++z)re.write_shift(-4,z<Q[2]?Q[1]+z:-1);re.write_shift(-4,he===Q[1]-1?ge:he+1)}var Me=function(pt){for(he+=pt;z<he-1;++z)re.write_shift(-4,z+1);pt&&(++z,re.write_shift(-4,ge))};for(he=z=0,he+=Q[1];z<he;++z)re.write_shift(-4,Z.DIFSECT);for(he+=Q[2];z<he;++z)re.write_shift(-4,Z.FATSECT);Me(Q[3]),Me(Q[4]);for(var ke=0,Ae=0,Ce=U.FileIndex[0];ke<U.FileIndex.length;++ke)Ce=U.FileIndex[ke],Ce.content&&(Ae=Ce.content.length,!(Ae<4096)&&(Ce.start=he,Me(Ae+511>>9)));for(Me(Q[6]+7>>3);re.l&511;)re.write_shift(-4,Z.ENDOFCHAIN);for(he=z=0,ke=0;ke<U.FileIndex.length;++ke)Ce=U.FileIndex[ke],Ce.content&&(Ae=Ce.content.length,!(!Ae||Ae>=4096)&&(Ce.start=he,Me(Ae+63>>6)));for(;re.l&511;)re.write_shift(-4,Z.ENDOFCHAIN);for(z=0;z<Q[4]<<2;++z){var tt=U.FullPaths[z];if(!tt||tt.length===0){for(ke=0;ke<17;++ke)re.write_shift(4,0);for(ke=0;ke<3;++ke)re.write_shift(4,-1);for(ke=0;ke<12;++ke)re.write_shift(4,0);continue}Ce=U.FileIndex[z],z===0&&(Ce.start=Ce.size?Ce.start-1:ge);var ct=z===0&&X.root||Ce.name;if(Ae=2*(ct.length+1),re.write_shift(64,ct,"utf16le"),re.write_shift(2,Ae),re.write_shift(1,Ce.type),re.write_shift(1,Ce.color),re.write_shift(-4,Ce.L),re.write_shift(-4,Ce.R),re.write_shift(-4,Ce.C),Ce.clsid)re.write_shift(16,Ce.clsid,"hex");else for(ke=0;ke<4;++ke)re.write_shift(4,0);re.write_shift(4,Ce.state||0),re.write_shift(4,0),re.write_shift(4,0),re.write_shift(4,0),re.write_shift(4,0),re.write_shift(4,Ce.start),re.write_shift(4,Ce.size),re.write_shift(4,0)}for(z=1;z<U.FileIndex.length;++z)if(Ce=U.FileIndex[z],Ce.size>=4096)if(re.l=Ce.start+1<<9,pa&&Buffer.isBuffer(Ce.content))Ce.content.copy(re,re.l,0,Ce.size),re.l+=Ce.size+511&-512;else{for(ke=0;ke<Ce.size;++ke)re.write_shift(1,Ce.content[ke]);for(;ke&511;++ke)re.write_shift(1,0)}for(z=1;z<U.FileIndex.length;++z)if(Ce=U.FileIndex[z],Ce.size>0&&Ce.size<4096)if(pa&&Buffer.isBuffer(Ce.content))Ce.content.copy(re,re.l,0,Ce.size),re.l+=Ce.size+63&-64;else{for(ke=0;ke<Ce.size;++ke)re.write_shift(1,Ce.content[ke]);for(;ke&63;++ke)re.write_shift(1,0)}if(pa)re.l=re.length;else for(;re.l<re.length;)re.write_shift(1,0);return re}function xe(U,ne){var X=U.FullPaths.map(function(ke){return ke.toUpperCase()}),Q=X.map(function(ke){var Ae=ke.split("/");return Ae[Ae.length-(ke.slice(-1)=="/"?2:1)]}),re=!1;ne.charCodeAt(0)===47?(re=!0,ne=X[0].slice(0,-1)+ne):re=ne.indexOf("/")!==-1;var z=ne.toUpperCase(),he=re===!0?X.indexOf(z):Q.indexOf(z);if(he!==-1)return U.FileIndex[he];var Me=!z.match(tf);for(z=z.replace(qd,""),Me&&(z=z.replace(tf,"!")),he=0;he<X.length;++he)if((Me?X[he].replace(tf,"!"):X[he]).replace(qd,"")==z||(Me?Q[he].replace(tf,"!"):Q[he]).replace(qd,"")==z)return U.FileIndex[he];return null}var le=64,ge=-2,be="d0cf11e0a1b11ae1",me=[208,207,17,224,161,177,26,225],ae="00000000000000000000000000000000",Z={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:ge,FREESECT:-1,HEADER_SIGNATURE:be,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:ae,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function K(U,ne,X){p();var Q=ue(U,X);g.writeFileSync(ne,Q)}function te(U){for(var ne=new Array(U.length),X=0;X<U.length;++X)ne[X]=String.fromCharCode(U[X]);return ne.join("")}function se(U,ne){var X=ue(U,ne);switch(ne&&ne.type||"buffer"){case"file":return p(),g.writeFileSync(ne.filename,X),X;case"binary":return typeof X=="string"?X:te(X);case"base64":return n0(typeof X=="string"?X:te(X));case"buffer":if(pa)return Buffer.isBuffer(X)?X:wi(X);case"array":return typeof X=="string"?bs(X):X}return X}var F;function D(U){try{var ne=U.InflateRaw,X=new ne;if(X._processChunk(new Uint8Array([3,0]),X._finishFlushFlag),X.bytesRead)F=U;else throw new Error("zlib does not expose bytesRead")}catch(Q){console.error("cannot use native zlib: "+(Q.message||Q))}}function W(U,ne){if(!F)return la(U,ne);var X=F.InflateRaw,Q=new X,re=Q._processChunk(U.slice(U.l),Q._finishFlushFlag);return U.l+=Q.bytesRead,re}function G(U){return F?F.deflateRawSync(U):ut(U)}var J=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],de=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],De=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];function Ne(U){var ne=(U<<1|U<<11)&139536|(U<<5|U<<15)&558144;return(ne>>16|ne>>8|ne)&255}for(var $e=typeof Uint8Array!="undefined",Ve=$e?new Uint8Array(256):[],st=0;st<256;++st)Ve[st]=Ne(st);function gt(U,ne){var X=Ve[U&255];return ne<=8?X>>>8-ne:(X=X<<8|Ve[U>>8&255],ne<=16?X>>>16-ne:(X=X<<8|Ve[U>>16&255],X>>>24-ne))}function zt(U,ne){var X=ne&7,Q=ne>>>3;return(U[Q]|(X<=6?0:U[Q+1]<<8))>>>X&3}function Ge(U,ne){var X=ne&7,Q=ne>>>3;return(U[Q]|(X<=5?0:U[Q+1]<<8))>>>X&7}function Ct(U,ne){var X=ne&7,Q=ne>>>3;return(U[Q]|(X<=4?0:U[Q+1]<<8))>>>X&15}function St(U,ne){var X=ne&7,Q=ne>>>3;return(U[Q]|(X<=3?0:U[Q+1]<<8))>>>X&31}function Ue(U,ne){var X=ne&7,Q=ne>>>3;return(U[Q]|(X<=1?0:U[Q+1]<<8))>>>X&127}function ce(U,ne,X){var Q=ne&7,re=ne>>>3,z=(1<<X)-1,he=U[re]>>>Q;return X<8-Q||(he|=U[re+1]<<8-Q,X<16-Q)||(he|=U[re+2]<<16-Q,X<24-Q)||(he|=U[re+3]<<24-Q),he&z}function we(U,ne,X){var Q=ne&7,re=ne>>>3;return Q<=5?U[re]|=(X&7)<<Q:(U[re]|=X<<Q&255,U[re+1]=(X&7)>>8-Q),ne+3}function Ie(U,ne,X){var Q=ne&7,re=ne>>>3;return X=(X&1)<<Q,U[re]|=X,ne+1}function lt(U,ne,X){var Q=ne&7,re=ne>>>3;return X<<=Q,U[re]|=X&255,X>>>=8,U[re+1]=X,ne+8}function ft(U,ne,X){var Q=ne&7,re=ne>>>3;return X<<=Q,U[re]|=X&255,X>>>=8,U[re+1]=X&255,U[re+2]=X>>>8,ne+16}function Ze(U,ne){var X=U.length,Q=2*X>ne?2*X:ne+5,re=0;if(X>=ne)return U;if(pa){var z=sv(Q);if(U.copy)U.copy(z);else for(;re<U.length;++re)z[re]=U[re];return z}else if($e){var he=new Uint8Array(Q);if(he.set)he.set(U);else for(;re<X;++re)he[re]=U[re];return he}return U.length=Q,U}function ze(U){for(var ne=new Array(U),X=0;X<U;++X)ne[X]=0;return ne}function bt(U,ne,X){var Q=1,re=0,z=0,he=0,Me=0,ke=U.length,Ae=$e?new Uint16Array(32):ze(32);for(z=0;z<32;++z)Ae[z]=0;for(z=ke;z<X;++z)U[z]=0;ke=U.length;var Ce=$e?new Uint16Array(ke):ze(ke);for(z=0;z<ke;++z)Ae[re=U[z]]++,Q<re&&(Q=re),Ce[z]=0;for(Ae[0]=0,z=1;z<=Q;++z)Ae[z+16]=Me=Me+Ae[z-1]<<1;for(z=0;z<ke;++z)Me=U[z],Me!=0&&(Ce[z]=Ae[Me+16]++);var tt=0;for(z=0;z<ke;++z)if(tt=U[z],tt!=0)for(Me=gt(Ce[z],Q)>>Q-tt,he=(1<<Q+4-tt)-1;he>=0;--he)ne[Me|he<<tt]=tt&15|z<<4;return Q}var Nt=$e?new Uint16Array(512):ze(512),Ot=$e?new Uint16Array(32):ze(32);if(!$e){for(var Pt=0;Pt<512;++Pt)Nt[Pt]=0;for(Pt=0;Pt<32;++Pt)Ot[Pt]=0}(function(){for(var U=[],ne=0;ne<32;ne++)U.push(5);bt(U,Ot,32);var X=[];for(ne=0;ne<=143;ne++)X.push(8);for(;ne<=255;ne++)X.push(9);for(;ne<=279;ne++)X.push(7);for(;ne<=287;ne++)X.push(8);bt(X,Nt,288)})();var je=(function(){for(var ne=$e?new Uint8Array(32768):[],X=0,Q=0;X<De.length-1;++X)for(;Q<De[X+1];++Q)ne[Q]=X;for(;Q<32768;++Q)ne[Q]=29;var re=$e?new Uint8Array(259):[];for(X=0,Q=0;X<de.length-1;++X)for(;Q<de[X+1];++Q)re[Q]=X;function z(Me,ke){for(var Ae=0;Ae<Me.length;){var Ce=Math.min(65535,Me.length-Ae),tt=Ae+Ce==Me.length;for(ke.write_shift(1,+tt),ke.write_shift(2,Ce),ke.write_shift(2,~Ce&65535);Ce-- >0;)ke[ke.l++]=Me[Ae++]}return ke.l}function he(Me,ke){for(var Ae=0,Ce=0,tt=$e?new Uint16Array(32768):[];Ce<Me.length;){var ct=Math.min(65535,Me.length-Ce);if(ct<10){for(Ae=we(ke,Ae,+(Ce+ct==Me.length)),Ae&7&&(Ae+=8-(Ae&7)),ke.l=Ae/8|0,ke.write_shift(2,ct),ke.write_shift(2,~ct&65535);ct-- >0;)ke[ke.l++]=Me[Ce++];Ae=ke.l*8;continue}Ae=we(ke,Ae,+(Ce+ct==Me.length)+2);for(var pt=0;ct-- >0;){var it=Me[Ce];pt=(pt<<5^it)&32767;var xt=-1,_t=0;if((xt=tt[pt])&&(xt|=Ce&-32768,xt>Ce&&(xt-=32768),xt<Ce))for(;Me[xt+_t]==Me[Ce+_t]&&_t<250;)++_t;if(_t>2){it=re[_t],it<=22?Ae=lt(ke,Ae,Ve[it+1]>>1)-1:(lt(ke,Ae,3),Ae+=5,lt(ke,Ae,Ve[it-23]>>5),Ae+=3);var ja=it<8?0:it-4>>2;ja>0&&(ft(ke,Ae,_t-de[it]),Ae+=ja),it=ne[Ce-xt],Ae=lt(ke,Ae,Ve[it]>>3),Ae-=3;var Sa=it<4?0:it-2>>1;Sa>0&&(ft(ke,Ae,Ce-xt-De[it]),Ae+=Sa);for(var Fa=0;Fa<_t;++Fa)tt[pt]=Ce&32767,pt=(pt<<5^Me[Ce])&32767,++Ce;ct-=_t-1}else it<=143?it=it+48:Ae=Ie(ke,Ae,1),Ae=lt(ke,Ae,Ve[it]),tt[pt]=Ce&32767,++Ce}Ae=lt(ke,Ae,0)-1}return ke.l=(Ae+7)/8|0,ke.l}return function(ke,Ae){return ke.length<8?z(ke,Ae):he(ke,Ae)}})();function ut(U){var ne=qe(50+Math.floor(U.length*1.1)),X=je(U,ne);return ne.slice(0,X)}var jt=$e?new Uint16Array(32768):ze(32768),$t=$e?new Uint16Array(32768):ze(32768),Fe=$e?new Uint16Array(128):ze(128),ot=1,dt=1;function wt(U,ne){var X=St(U,ne)+257;ne+=5;var Q=St(U,ne)+1;ne+=5;var re=Ct(U,ne)+4;ne+=4;for(var z=0,he=$e?new Uint8Array(19):ze(19),Me=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ke=1,Ae=$e?new Uint8Array(8):ze(8),Ce=$e?new Uint8Array(8):ze(8),tt=he.length,ct=0;ct<re;++ct)he[J[ct]]=z=Ge(U,ne),ke<z&&(ke=z),Ae[z]++,ne+=3;var pt=0;for(Ae[0]=0,ct=1;ct<=ke;++ct)Ce[ct]=pt=pt+Ae[ct-1]<<1;for(ct=0;ct<tt;++ct)(pt=he[ct])!=0&&(Me[ct]=Ce[pt]++);var it=0;for(ct=0;ct<tt;++ct)if(it=he[ct],it!=0){pt=Ve[Me[ct]]>>8-it;for(var xt=(1<<7-it)-1;xt>=0;--xt)Fe[pt|xt<<it]=it&7|ct<<3}var _t=[];for(ke=1;_t.length<X+Q;)switch(pt=Fe[Ue(U,ne)],ne+=pt&7,pt>>>=3){case 16:for(z=3+zt(U,ne),ne+=2,pt=_t[_t.length-1];z-- >0;)_t.push(pt);break;case 17:for(z=3+Ge(U,ne),ne+=3;z-- >0;)_t.push(0);break;case 18:for(z=11+Ue(U,ne),ne+=7;z-- >0;)_t.push(0);break;default:_t.push(pt),ke<pt&&(ke=pt);break}var ja=_t.slice(0,X),Sa=_t.slice(X);for(ct=X;ct<286;++ct)ja[ct]=0;for(ct=Q;ct<30;++ct)Sa[ct]=0;return ot=bt(ja,jt,286),dt=bt(Sa,$t,30),ne}function Ft(U,ne){if(U[0]==3&&!(U[1]&3))return[lo(ne),2];for(var X=0,Q=0,re=sv(ne||1<<18),z=0,he=re.length>>>0,Me=0,ke=0;(Q&1)==0;){if(Q=Ge(U,X),X+=3,Q>>>1)Q>>1==1?(Me=9,ke=5):(X=wt(U,X),Me=ot,ke=dt);else{X&7&&(X+=8-(X&7));var Ae=U[X>>>3]|U[(X>>>3)+1]<<8;if(X+=32,Ae>0)for(!ne&&he<z+Ae&&(re=Ze(re,z+Ae),he=re.length);Ae-- >0;)re[z++]=U[X>>>3],X+=8;continue}for(;;){!ne&&he<z+32767&&(re=Ze(re,z+32767),he=re.length);var Ce=ce(U,X,Me),tt=Q>>>1==1?Nt[Ce]:jt[Ce];if(X+=tt&15,tt>>>=4,(tt>>>8&255)===0)re[z++]=tt;else{if(tt==256)break;tt-=257;var ct=tt<8?0:tt-4>>2;ct>5&&(ct=0);var pt=z+de[tt];ct>0&&(pt+=ce(U,X,ct),X+=ct),Ce=ce(U,X,ke),tt=Q>>>1==1?Ot[Ce]:$t[Ce],X+=tt&15,tt>>>=4;var it=tt<4?0:tt-2>>1,xt=De[tt];for(it>0&&(xt+=ce(U,X,it),X+=it),!ne&&he<pt&&(re=Ze(re,pt+100),he=re.length);z<pt;)re[z]=re[z-xt],++z}}}return ne?[re,X+7>>>3]:[re.slice(0,z),X+7>>>3]}function la(U,ne){var X=U.slice(U.l||0),Q=Ft(X,ne);return U.l+=Q[1],Q[0]}function Je(U,ne){if(U)typeof console!="undefined"&&console.error(ne);else throw new Error(ne)}function Lt(U,ne){var X=U;Mn(X,0);var Q=[],re=[],z={FileIndex:Q,FullPaths:re};B(z,{root:ne.root});for(var he=X.length-4;(X[he]!=80||X[he+1]!=75||X[he+2]!=5||X[he+3]!=6)&&he>=0;)--he;X.l=he+4,X.l+=4;var Me=X.read_shift(2);X.l+=6;var ke=X.read_shift(4);for(X.l=ke,he=0;he<Me;++he){X.l+=20;var Ae=X.read_shift(4),Ce=X.read_shift(4),tt=X.read_shift(2),ct=X.read_shift(2),pt=X.read_shift(2);X.l+=8;var it=X.read_shift(4),xt=f(X.slice(X.l+tt,X.l+tt+ct));X.l+=tt+ct+pt;var _t=X.l;X.l=it+4,ye(X,Ae,Ce,z,xt),X.l=_t}return z}function ye(U,ne,X,Q,re){U.l+=2;var z=U.read_shift(2),he=U.read_shift(2),Me=c(U);if(z&8257)throw new Error("Unsupported ZIP encryption");for(var ke=U.read_shift(4),Ae=U.read_shift(4),Ce=U.read_shift(4),tt=U.read_shift(2),ct=U.read_shift(2),pt="",it=0;it<tt;++it)pt+=String.fromCharCode(U[U.l++]);if(ct){var xt=f(U.slice(U.l,U.l+ct));(xt[21589]||{}).mt&&(Me=xt[21589].mt),((re||{})[21589]||{}).mt&&(Me=re[21589].mt)}U.l+=ct;var _t=U.slice(U.l,U.l+Ae);switch(he){case 8:_t=W(U,Ce);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+he)}var ja=!1;z&8&&(ke=U.read_shift(4),ke==134695760&&(ke=U.read_shift(4),ja=!0),Ae=U.read_shift(4),Ce=U.read_shift(4)),Ae!=ne&&Je(ja,"Bad compressed size: "+ne+" != "+Ae),Ce!=X&&Je(ja,"Bad uncompressed size: "+X+" != "+Ce),Bn(Q,pt,_t,{unsafe:!0,mt:Me})}function We(U,ne){var X=ne||{},Q=[],re=[],z=qe(1),he=X.compression?8:0,Me=0,ke=0,Ae=0,Ce=0,tt=0,ct=U.FullPaths[0],pt=ct,it=U.FileIndex[0],xt=[],_t=0;for(ke=1;ke<U.FullPaths.length;++ke)if(pt=U.FullPaths[ke].slice(ct.length),it=U.FileIndex[ke],!(!it.size||!it.content||pt=="Sh33tJ5")){var ja=Ce,Sa=qe(pt.length);for(Ae=0;Ae<pt.length;++Ae)Sa.write_shift(1,pt.charCodeAt(Ae)&127);Sa=Sa.slice(0,Sa.l),xt[tt]=q5.buf(it.content,0);var Fa=it.content;he==8&&(Fa=G(Fa)),z=qe(30),z.write_shift(4,67324752),z.write_shift(2,20),z.write_shift(2,Me),z.write_shift(2,he),it.mt?d(z,it.mt):z.write_shift(4,0),z.write_shift(-4,xt[tt]),z.write_shift(4,Fa.length),z.write_shift(4,it.content.length),z.write_shift(2,Sa.length),z.write_shift(2,0),Ce+=z.length,Q.push(z),Ce+=Sa.length,Q.push(Sa),Ce+=Fa.length,Q.push(Fa),z=qe(46),z.write_shift(4,33639248),z.write_shift(2,0),z.write_shift(2,20),z.write_shift(2,Me),z.write_shift(2,he),z.write_shift(4,0),z.write_shift(-4,xt[tt]),z.write_shift(4,Fa.length),z.write_shift(4,it.content.length),z.write_shift(2,Sa.length),z.write_shift(2,0),z.write_shift(2,0),z.write_shift(2,0),z.write_shift(2,0),z.write_shift(4,0),z.write_shift(4,ja),_t+=z.l,re.push(z),_t+=Sa.length,re.push(Sa),++tt}return z=qe(22),z.write_shift(4,101010256),z.write_shift(2,0),z.write_shift(2,0),z.write_shift(2,tt),z.write_shift(2,tt),z.write_shift(4,_t),z.write_shift(4,Ce),z.write_shift(2,0),Lr([Lr(Q),Lr(re),z])}var at={htm:"text/html",xml:"text/xml",gif:"image/gif",jpg:"image/jpeg",png:"image/png",mso:"application/x-mso",thmx:"application/vnd.ms-officetheme",sh33tj5:"application/octet-stream"};function Vt(U,ne){if(U.ctype)return U.ctype;var X=U.name||"",Q=X.match(/\.([^\.]+)$/);return Q&&at[Q[1]]||ne&&(Q=(X=ne).match(/[\.\\]([^\.\\])+$/),Q&&at[Q[1]])?at[Q[1]]:"application/octet-stream"}function aa(U){for(var ne=n0(U),X=[],Q=0;Q<ne.length;Q+=76)X.push(ne.slice(Q,Q+76));return X.join(`\r
|
||
`)+`\r
|
||
`}function Va(U){var ne=U.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(Ae){var Ce=Ae.charCodeAt(0).toString(16).toUpperCase();return"="+(Ce.length==1?"0"+Ce:Ce)});ne=ne.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),ne.charAt(0)==`
|
||
`&&(ne="=0D"+ne.slice(1)),ne=ne.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
|
||
=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var X=[],Q=ne.split(`\r
|
||
`),re=0;re<Q.length;++re){var z=Q[re];if(z.length==0){X.push("");continue}for(var he=0;he<z.length;){var Me=76,ke=z.slice(he,he+Me);ke.charAt(Me-1)=="="?Me--:ke.charAt(Me-2)=="="?Me-=2:ke.charAt(Me-3)=="="&&(Me-=3),ke=z.slice(he,he+Me),he+=Me,he<z.length&&(ke+="="),X.push(ke)}}return X.join(`\r
|
||
`)}function Ma(U){for(var ne=[],X=0;X<U.length;++X){for(var Q=U[X];X<=U.length&&Q.charAt(Q.length-1)=="=";)Q=Q.slice(0,Q.length-1)+U[++X];ne.push(Q)}for(var re=0;re<ne.length;++re)ne[re]=ne[re].replace(/[=][0-9A-Fa-f]{2}/g,function(z){return String.fromCharCode(parseInt(z.slice(1),16))});return bs(ne.join(`\r
|
||
`))}function zn(U,ne,X){for(var Q="",re="",z="",he,Me=0;Me<10;++Me){var ke=ne[Me];if(!ke||ke.match(/^\s*$/))break;var Ae=ke.match(/^(.*?):\s*([^\s].*)$/);if(Ae)switch(Ae[1].toLowerCase()){case"content-location":Q=Ae[2].trim();break;case"content-type":z=Ae[2].trim();break;case"content-transfer-encoding":re=Ae[2].trim();break}}switch(++Me,re.toLowerCase()){case"base64":he=bs(yi(ne.slice(Me).join("")));break;case"quoted-printable":he=Ma(ne.slice(Me));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+re)}var Ce=Bn(U,Q.slice(X.length),he,{unsafe:!0});z&&(Ce.ctype=z)}function Vr(U,ne){if(te(U.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var X=ne&&ne.root||"",Q=(pa&&Buffer.isBuffer(U)?U.toString("binary"):te(U)).split(`\r
|
||
`),re=0,z="";for(re=0;re<Q.length;++re)if(z=Q[re],!!/^Content-Location:/i.test(z)&&(z=z.slice(z.indexOf("file")),X||(X=z.slice(0,z.lastIndexOf("/")+1)),z.slice(0,X.length)!=X))for(;X.length>0&&(X=X.slice(0,X.length-1),X=X.slice(0,X.lastIndexOf("/")+1),z.slice(0,X.length)!=X););var he=(Q[1]||"").match(/boundary="(.*?)"/);if(!he)throw new Error("MAD cannot find boundary");var Me="--"+(he[1]||""),ke=[],Ae=[],Ce={FileIndex:ke,FullPaths:Ae};B(Ce);var tt,ct=0;for(re=0;re<Q.length;++re){var pt=Q[re];pt!==Me&&pt!==Me+"--"||(ct++&&zn(Ce,Q.slice(tt,re),X),tt=re)}return Ce}function ns(U,ne){var X=ne||{},Q=X.boundary||"SheetJS";Q="------="+Q;for(var re=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+Q.slice(2)+'"',"","",""],z=U.FullPaths[0],he=z,Me=U.FileIndex[0],ke=1;ke<U.FullPaths.length;++ke)if(he=U.FullPaths[ke].slice(z.length),Me=U.FileIndex[ke],!(!Me.size||!Me.content||he=="Sh33tJ5")){he=he.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function(_t){return"_x"+_t.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function(_t){return"_u"+_t.charCodeAt(0).toString(16)+"_"});for(var Ae=Me.content,Ce=pa&&Buffer.isBuffer(Ae)?Ae.toString("binary"):te(Ae),tt=0,ct=Math.min(1024,Ce.length),pt=0,it=0;it<=ct;++it)(pt=Ce.charCodeAt(it))>=32&&pt<128&&++tt;var xt=tt>=ct*4/5;re.push(Q),re.push("Content-Location: "+(X.root||"file:///C:/SheetJS/")+he),re.push("Content-Transfer-Encoding: "+(xt?"quoted-printable":"base64")),re.push("Content-Type: "+Vt(Me,he)),re.push(""),re.push(xt?Va(Ce):aa(Ce))}return re.push(Q+`--\r
|
||
`),re.join(`\r
|
||
`)}function bn(U){var ne={};return B(ne,U),ne}function Bn(U,ne,X,Q){var re=Q&&Q.unsafe;re||B(U);var z=!re&&Oa.find(U,ne);if(!z){var he=U.FullPaths[0];ne.slice(0,he.length)==he?he=ne:(he.slice(-1)!="/"&&(he+="/"),he=(he+ne).replace("//","/")),z={name:i(ne),type:2},U.FileIndex.push(z),U.FullPaths.push(he),re||Oa.utils.cfb_gc(U)}return z.content=X,z.size=X?X.length:0,Q&&(Q.CLSID&&(z.clsid=Q.CLSID),Q.mt&&(z.mt=Q.mt),Q.ct&&(z.ct=Q.ct)),z}function js(U,ne){B(U);var X=Oa.find(U,ne);if(X){for(var Q=0;Q<U.FileIndex.length;++Q)if(U.FileIndex[Q]==X)return U.FileIndex.splice(Q,1),U.FullPaths.splice(Q,1),!0}return!1}function er(U,ne,X){B(U);var Q=Oa.find(U,ne);if(Q){for(var re=0;re<U.FileIndex.length;++re)if(U.FileIndex[re]==Q)return U.FileIndex[re].name=i(X),U.FullPaths[re]=X,!0}return!1}function ve(U){Y(U,!0)}return t.find=xe,t.read=ee,t.parse=x,t.write=se,t.writeFile=K,t.utils={cfb_new:bn,cfb_add:Bn,cfb_del:js,cfb_mov:er,cfb_gc:ve,ReadShift:Xd,CheckField:H2,prep_blob:Mn,bconcat:Lr,use_zlib:D,_deflateRaw:ut,_inflateRaw:la,consts:Z},t})();function Y5(e){return typeof e=="string"?Kf(e):Array.isArray(e)?_5(e):e}function w0(e,t,a){if(typeof Deno!="undefined"){if(a&&typeof t=="string")switch(a){case"utf8":t=new TextEncoder(a).encode(t);break;case"binary":t=Kf(t);break;default:throw new Error("Unsupported encoding "+a)}return Deno.writeFileSync(e,t)}var s=a=="utf8"?i0(t):t;if(typeof IE_SaveFile!="undefined")return IE_SaveFile(s,e);if(typeof Blob!="undefined"){var i=new Blob([Y5(s)],{type:"application/octet-stream"});if(typeof navigator!="undefined"&&navigator.msSaveBlob)return navigator.msSaveBlob(i,e);if(typeof saveAs!="undefined")return saveAs(i,e);if(typeof URL!="undefined"&&typeof document!="undefined"&&document.createElement&&URL.createObjectURL){var d=URL.createObjectURL(i);if(typeof chrome=="object"&&typeof(chrome.downloads||{}).download=="function")return URL.revokeObjectURL&&typeof setTimeout!="undefined"&&setTimeout(function(){URL.revokeObjectURL(d)},6e4),chrome.downloads.download({url:d,filename:e,saveAs:!0});var c=document.createElement("a");if(c.download!=null)return c.download=e,c.href=d,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL&&typeof setTimeout!="undefined"&&setTimeout(function(){URL.revokeObjectURL(d)},6e4),d}}if(typeof $!="undefined"&&typeof File!="undefined"&&typeof Folder!="undefined")try{var f=File(e);return f.open("w"),f.encoding="binary",Array.isArray(t)&&(t=_0(t)),f.write(t),f.close(),t}catch(g){if(!g.message||!g.message.match(/onstruct/))throw g}throw new Error("cannot save file "+e)}function Fr(e){for(var t=Object.keys(e),a=[],s=0;s<t.length;++s)Object.prototype.hasOwnProperty.call(e,t[s])&&a.push(t[s]);return a}function hv(e,t){for(var a=[],s=Fr(e),i=0;i!==s.length;++i)a[e[s[i]][t]]==null&&(a[e[s[i]][t]]=s[i]);return a}function _p(e){for(var t=[],a=Fr(e),s=0;s!==a.length;++s)t[e[a[s]]]=a[s];return t}function th(e){for(var t=[],a=Fr(e),s=0;s!==a.length;++s)t[e[a[s]]]=parseInt(a[s],10);return t}function X5(e){for(var t=[],a=Fr(e),s=0;s!==a.length;++s)t[e[a[s]]]==null&&(t[e[a[s]]]=[]),t[e[a[s]]].push(a[s]);return t}var Af=new Date(1899,11,30,0,0,0);function xn(e,t){var a=e.getTime(),s=Af.getTime()+(e.getTimezoneOffset()-Af.getTimezoneOffset())*6e4;return(a-s)/(1440*60*1e3)}var j2=new Date,J5=Af.getTime()+(j2.getTimezoneOffset()-Af.getTimezoneOffset())*6e4,mv=j2.getTimezoneOffset();function S2(e){var t=new Date;return t.setTime(e*24*60*60*1e3+J5),t.getTimezoneOffset()!==mv&&t.setTime(t.getTime()+(t.getTimezoneOffset()-mv)*6e4),t}var gv=new Date("2017-02-19T19:06:09.000Z"),T2=isNaN(gv.getFullYear())?new Date("2/19/17"):gv,K5=T2.getFullYear()==2017;function Kr(e,t){var a=new Date(e);if(K5)return t>0?a.setTime(a.getTime()+a.getTimezoneOffset()*60*1e3):t<0&&a.setTime(a.getTime()-a.getTimezoneOffset()*60*1e3),a;if(e instanceof Date)return e;if(T2.getFullYear()==1917&&!isNaN(a.getFullYear())){var s=a.getFullYear();return e.indexOf(""+s)>-1||a.setFullYear(a.getFullYear()+100),a}var i=e.match(/\d+/g)||["2017","2","19","0","0","0"],d=new Date(+i[0],+i[1]-1,+i[2],+i[3]||0,+i[4]||0,+i[5]||0);return e.indexOf("Z")>-1&&(d=new Date(d.getTime()-d.getTimezoneOffset()*60*1e3)),d}function ah(e,t){if(pa&&Buffer.isBuffer(e))return e.toString("binary");if(typeof TextDecoder!="undefined")try{var a={"€":"","‚":"",ƒ:"","„":"","…":"
","†":"","‡":"","ˆ":"","‰":"",Š:"","‹":"",Œ:"",Ž:"","‘":"","’":"","“":"","”":"","•":"","–":"","—":"","˜":"","™":"",š:"","›":"",œ:"",ž:"",Ÿ:""};return Array.isArray(e)&&(e=new Uint8Array(e)),new TextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g,function(d){return a[d]||d})}catch(d){}for(var s=[],i=0;i!=e.length;++i)s.push(String.fromCharCode(e[i]));return s.join("")}function yn(e){if(typeof JSON!="undefined"&&!Array.isArray(e))return JSON.parse(JSON.stringify(e));if(typeof e!="object"||e==null)return e;if(e instanceof Date)return new Date(e.getTime());var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=yn(e[a]));return t}function Xa(e,t){for(var a="";a.length<t;)a+=e;return a}function mi(e){var t=Number(e);if(!isNaN(t))return isFinite(t)?t:NaN;if(!/\d/.test(e))return t;var a=1,s=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){return a*=100,""});return!isNaN(t=Number(s))||(s=s.replace(/[(](.*)[)]/,function(i,d){return a=-a,d}),!isNaN(t=Number(s)))?t/a:t}var Q5=["january","february","march","april","may","june","july","august","september","october","november","december"];function s0(e){var t=new Date(e),a=new Date(NaN),s=t.getYear(),i=t.getMonth(),d=t.getDate();if(isNaN(d))return a;var c=e.toLowerCase();if(c.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){if(c=c.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""),c.length>3&&Q5.indexOf(c)==-1)return a}else if(c.match(/[a-z]/))return a;return s<0||s>8099?a:(i>0||d>1)&&s!=101?t:e.match(/[^-0-9:,\/\\]/)?a:t}function Kt(e,t,a){if(e.FullPaths){if(typeof a=="string"){var s;return pa?s=wi(a):s=w5(a),Oa.utils.cfb_add(e,t,s)}Oa.utils.cfb_add(e,t,a)}else e.file(t,a)}function wp(){return Oa.utils.cfb_new()}var dr=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
|
||
`,eT={""":'"',"'":"'",">":">","<":"<","&":"&"},kp=_p(eT),Np=/[&<>'"]/g,tT=/[\u0000-\u0008\u000b-\u001f]/g;function wa(e){var t=e+"";return t.replace(Np,function(a){return kp[a]}).replace(tT,function(a){return"_x"+("000"+a.charCodeAt(0).toString(16)).slice(-4)+"_"})}function pv(e){return wa(e).replace(/ /g,"_x0020_")}var E2=/[\u0000-\u001f]/g;function aT(e){var t=e+"";return t.replace(Np,function(a){return kp[a]}).replace(/\n/g,"<br/>").replace(E2,function(a){return"&#x"+("000"+a.charCodeAt(0).toString(16)).slice(-4)+";"})}function rT(e){var t=e+"";return t.replace(Np,function(a){return kp[a]}).replace(E2,function(a){return"&#x"+a.charCodeAt(0).toString(16).toUpperCase()+";"})}function nT(e){return e.replace(/(\r\n|[\r\n])/g," ")}function sT(e){switch(e){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function jg(e){for(var t="",a=0,s=0,i=0,d=0,c=0,f=0;a<e.length;){if(s=e.charCodeAt(a++),s<128){t+=String.fromCharCode(s);continue}if(i=e.charCodeAt(a++),s>191&&s<224){c=(s&31)<<6,c|=i&63,t+=String.fromCharCode(c);continue}if(d=e.charCodeAt(a++),s<240){t+=String.fromCharCode((s&15)<<12|(i&63)<<6|d&63);continue}c=e.charCodeAt(a++),f=((s&7)<<18|(i&63)<<12|(d&63)<<6|c&63)-65536,t+=String.fromCharCode(55296+(f>>>10&1023)),t+=String.fromCharCode(56320+(f&1023))}return t}function xv(e){var t=lo(2*e.length),a,s,i=1,d=0,c=0,f;for(s=0;s<e.length;s+=i)i=1,(f=e.charCodeAt(s))<128?a=f:f<224?(a=(f&31)*64+(e.charCodeAt(s+1)&63),i=2):f<240?(a=(f&15)*4096+(e.charCodeAt(s+1)&63)*64+(e.charCodeAt(s+2)&63),i=3):(i=4,a=(f&7)*262144+(e.charCodeAt(s+1)&63)*4096+(e.charCodeAt(s+2)&63)*64+(e.charCodeAt(s+3)&63),a-=65536,c=55296+(a>>>10&1023),a=56320+(a&1023)),c!==0&&(t[d++]=c&255,t[d++]=c>>>8,c=0),t[d++]=a%256,t[d++]=a>>>8;return t.slice(0,d).toString("ucs2")}function yv(e){return wi(e,"binary").toString("utf8")}var rf="foo bar bazâð£",Yd=pa&&(yv(rf)==jg(rf)&&yv||xv(rf)==jg(rf)&&xv)||jg,i0=pa?function(e){return wi(e,"utf8").toString("binary")}:function(e){for(var t=[],a=0,s=0,i=0;a<e.length;)switch(s=e.charCodeAt(a++),!0){case s<128:t.push(String.fromCharCode(s));break;case s<2048:t.push(String.fromCharCode(192+(s>>6))),t.push(String.fromCharCode(128+(s&63)));break;case(s>=55296&&s<57344):s-=55296,i=e.charCodeAt(a++)-56320+(s<<10),t.push(String.fromCharCode(240+(i>>18&7))),t.push(String.fromCharCode(144+(i>>12&63))),t.push(String.fromCharCode(128+(i>>6&63))),t.push(String.fromCharCode(128+(i&63)));break;default:t.push(String.fromCharCode(224+(s>>12))),t.push(String.fromCharCode(128+(s>>6&63))),t.push(String.fromCharCode(128+(s&63)))}return t.join("")},iT=(function(){var e=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(t){return[new RegExp("&"+t[0]+";","ig"),t[1]]});return function(a){for(var s=a.replace(/^[\t\n\r ]+/,"").replace(/[\t\n\r ]+$/,"").replace(/>\s+/g,">").replace(/\s+</g,"<").replace(/[\t\n\r ]+/g," ").replace(/<\s*[bB][rR]\s*\/?>/g,`
|
||
`).replace(/<[^>]*>/g,""),i=0;i<e.length;++i)s=s.replace(e[i][0],e[i][1]);return s}})(),C2=/(^\s|\s$|\n)/;function Dr(e,t){return"<"+e+(t.match(C2)?' xml:space="preserve"':"")+">"+t+"</"+e+">"}function l0(e){return Fr(e).map(function(t){return" "+t+'="'+e[t]+'"'}).join("")}function ht(e,t,a){return"<"+e+(a!=null?l0(a):"")+(t!=null?(t.match(C2)?' xml:space="preserve"':"")+">"+t+"</"+e:"/")+">"}function Xg(e,t){try{return e.toISOString().replace(/\.\d*/,"")}catch(a){if(t)throw a}return""}function lT(e,t){switch(typeof e){case"string":var a=ht("vt:lpwstr",wa(e));return a=a.replace(/"/g,"_x0022_"),a;case"number":return ht((e|0)==e?"vt:i4":"vt:r8",wa(String(e)));case"boolean":return ht("vt:bool",e?"true":"false")}if(e instanceof Date)return ht("vt:filetime",Xg(e));throw new Error("Unable to serialize "+e)}var br={CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",CT:"http://schemas.openxmlformats.org/package/2006/content-types",RELS:"http://schemas.openxmlformats.org/package/2006/relationships",TCMNT:"http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",xsd:"http://www.w3.org/2001/XMLSchema"},Dc=["http://schemas.openxmlformats.org/spreadsheetml/2006/main","http://purl.oclc.org/ooxml/spreadsheetml/main","http://schemas.microsoft.com/office/excel/2006/main","http://schemas.microsoft.com/office/excel/2006/2"],Ln={o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel",ss:"urn:schemas-microsoft-com:office:spreadsheet",dt:"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882",mv:"http://macVmlSchemaUri",v:"urn:schemas-microsoft-com:vml",html:"http://www.w3.org/TR/REC-html40"};function oT(e,t){for(var a=1-2*(e[t+7]>>>7),s=((e[t+7]&127)<<4)+(e[t+6]>>>4&15),i=e[t+6]&15,d=5;d>=0;--d)i=i*256+e[t+d];return s==2047?i==0?a*(1/0):NaN:(s==0?s=-1022:(s-=1023,i+=Math.pow(2,52)),a*Math.pow(2,s-52)*i)}function cT(e,t,a){var s=(t<0||1/t==-1/0?1:0)<<7,i=0,d=0,c=s?-t:t;isFinite(c)?c==0?i=d=0:(i=Math.floor(Math.log(c)/Math.LN2),d=c*Math.pow(2,52-i),i<=-1023&&(!isFinite(d)||d<Math.pow(2,52))?i=-1022:(d-=Math.pow(2,52),i+=1023)):(i=2047,d=isNaN(t)?26985:0);for(var f=0;f<=5;++f,d/=256)e[a+f]=d&255;e[a+6]=(i&15)<<4|d&15,e[a+7]=i>>4|s}var bv=function(e){for(var t=[],a=10240,s=0;s<e[0].length;++s)if(e[0][s])for(var i=0,d=e[0][s].length;i<d;i+=a)t.push.apply(t,e[0][s].slice(i,i+a));return t},vv=pa?function(e){return e[0].length>0&&Buffer.isBuffer(e[0][0])?Buffer.concat(e[0].map(function(t){return Buffer.isBuffer(t)?t:wi(t)})):bv(e)}:bv,_v=function(e,t,a){for(var s=[],i=t;i<a;i+=2)s.push(String.fromCharCode($d(e,i)));return s.join("").replace(qd,"")},jp=pa?function(e,t,a){return Buffer.isBuffer(e)?e.toString("utf16le",t,a).replace(qd,""):_v(e,t,a)}:_v,wv=function(e,t,a){for(var s=[],i=t;i<t+a;++i)s.push(("0"+e[i].toString(16)).slice(-2));return s.join("")},A2=pa?function(e,t,a){return Buffer.isBuffer(e)?e.toString("hex",t,t+a):wv(e,t,a)}:wv,kv=function(e,t,a){for(var s=[],i=t;i<a;i++)s.push(String.fromCharCode(uc(e,i)));return s.join("")},k0=pa?function(t,a,s){return Buffer.isBuffer(t)?t.toString("utf8",a,s):kv(t,a,s)}:kv,O2=function(e,t){var a=Dn(e,t);return a>0?k0(e,t+4,t+4+a-1):""},M2=O2,L2=function(e,t){var a=Dn(e,t);return a>0?k0(e,t+4,t+4+a-1):""},D2=L2,P2=function(e,t){var a=2*Dn(e,t);return a>0?k0(e,t+4,t+4+a-1):""},R2=P2,F2=function(t,a){var s=Dn(t,a);return s>0?jp(t,a+4,a+4+s):""},I2=F2,z2=function(e,t){var a=Dn(e,t);return a>0?k0(e,t+4,t+4+a):""},B2=z2,U2=function(e,t){return oT(e,t)},Of=U2,Sp=function(t){return Array.isArray(t)||typeof Uint8Array!="undefined"&&t instanceof Uint8Array};pa&&(M2=function(t,a){if(!Buffer.isBuffer(t))return O2(t,a);var s=t.readUInt32LE(a);return s>0?t.toString("utf8",a+4,a+4+s-1):""},D2=function(t,a){if(!Buffer.isBuffer(t))return L2(t,a);var s=t.readUInt32LE(a);return s>0?t.toString("utf8",a+4,a+4+s-1):""},R2=function(t,a){if(!Buffer.isBuffer(t))return P2(t,a);var s=2*t.readUInt32LE(a);return t.toString("utf16le",a+4,a+4+s-1)},I2=function(t,a){if(!Buffer.isBuffer(t))return F2(t,a);var s=t.readUInt32LE(a);return t.toString("utf16le",a+4,a+4+s)},B2=function(t,a){if(!Buffer.isBuffer(t))return z2(t,a);var s=t.readUInt32LE(a);return t.toString("utf8",a+4,a+4+s)},Of=function(t,a){return Buffer.isBuffer(t)?t.readDoubleLE(a):U2(t,a)},Sp=function(t){return Buffer.isBuffer(t)||Array.isArray(t)||typeof Uint8Array!="undefined"&&t instanceof Uint8Array});var uc=function(e,t){return e[t]},$d=function(e,t){return e[t+1]*256+e[t]},dT=function(e,t){var a=e[t+1]*256+e[t];return a<32768?a:(65535-a+1)*-1},Dn=function(e,t){return e[t+3]*(1<<24)+(e[t+2]<<16)+(e[t+1]<<8)+e[t]},Jl=function(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]},uT=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};function Xd(e,t){var a="",s,i,d=[],c,f,g,p;switch(t){case"dbcs":if(p=this.l,pa&&Buffer.isBuffer(this))a=this.slice(this.l,this.l+2*e).toString("utf16le");else for(g=0;g<e;++g)a+=String.fromCharCode($d(this,p)),p+=2;e*=2;break;case"utf8":a=k0(this,this.l,this.l+e);break;case"utf16le":e*=2,a=jp(this,this.l,this.l+e);break;case"wstr":return Xd.call(this,e,"dbcs");case"lpstr-ansi":a=M2(this,this.l),e=4+Dn(this,this.l);break;case"lpstr-cp":a=D2(this,this.l),e=4+Dn(this,this.l);break;case"lpwstr":a=R2(this,this.l),e=4+2*Dn(this,this.l);break;case"lpp4":e=4+Dn(this,this.l),a=I2(this,this.l),e&2&&(e+=2);break;case"8lpp4":e=4+Dn(this,this.l),a=B2(this,this.l),e&3&&(e+=4-(e&3));break;case"cstr":for(e=0,a="";(c=uc(this,this.l+e++))!==0;)d.push(ef(c));a=d.join("");break;case"_wstr":for(e=0,a="";(c=$d(this,this.l+e))!==0;)d.push(ef(c)),e+=2;e+=2,a=d.join("");break;case"dbcs-cont":for(a="",p=this.l,g=0;g<e;++g){if(this.lens&&this.lens.indexOf(p)!==-1)return c=uc(this,p),this.l=p+1,f=Xd.call(this,e-g,c?"dbcs-cont":"sbcs-cont"),d.join("")+f;d.push(ef($d(this,p))),p+=2}a=d.join(""),e*=2;break;case"cpstr":case"sbcs-cont":for(a="",p=this.l,g=0;g!=e;++g){if(this.lens&&this.lens.indexOf(p)!==-1)return c=uc(this,p),this.l=p+1,f=Xd.call(this,e-g,c?"dbcs-cont":"sbcs-cont"),d.join("")+f;d.push(ef(uc(this,p))),p+=1}a=d.join("");break;default:switch(e){case 1:return s=uc(this,this.l),this.l++,s;case 2:return s=(t==="i"?dT:$d)(this,this.l),this.l+=2,s;case 4:case-4:return t==="i"||(this[this.l+3]&128)===0?(s=(e>0?Jl:uT)(this,this.l),this.l+=4,s):(i=Dn(this,this.l),this.l+=4,i);case 8:case-8:if(t==="f")return e==8?i=Of(this,this.l):i=Of([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]],0),this.l+=8,i;e=8;case 16:a=A2(this,this.l,e);break}}return this.l+=e,a}var fT=function(e,t,a){e[a]=t&255,e[a+1]=t>>>8&255,e[a+2]=t>>>16&255,e[a+3]=t>>>24&255},hT=function(e,t,a){e[a]=t&255,e[a+1]=t>>8&255,e[a+2]=t>>16&255,e[a+3]=t>>24&255},mT=function(e,t,a){e[a]=t&255,e[a+1]=t>>>8&255};function gT(e,t,a){var s=0,i=0;if(a==="dbcs"){for(i=0;i!=t.length;++i)mT(this,t.charCodeAt(i),this.l+2*i);s=2*t.length}else if(a==="sbcs"){for(t=t.replace(/[^\x00-\x7F]/g,"_"),i=0;i!=t.length;++i)this[this.l+i]=t.charCodeAt(i)&255;s=t.length}else if(a==="hex"){for(;i<e;++i)this[this.l++]=parseInt(t.slice(2*i,2*i+2),16)||0;return this}else if(a==="utf16le"){var d=Math.min(this.l+e,this.length);for(i=0;i<Math.min(t.length,e);++i){var c=t.charCodeAt(i);this[this.l++]=c&255,this[this.l++]=c>>8}for(;this.l<d;)this[this.l++]=0;return this}else switch(e){case 1:s=1,this[this.l]=t&255;break;case 2:s=2,this[this.l]=t&255,t>>>=8,this[this.l+1]=t&255;break;case 3:s=3,this[this.l]=t&255,t>>>=8,this[this.l+1]=t&255,t>>>=8,this[this.l+2]=t&255;break;case 4:s=4,fT(this,t,this.l);break;case 8:if(s=8,a==="f"){cT(this,t,this.l);break}case 16:break;case-4:s=4,hT(this,t,this.l);break}return this.l+=s,this}function H2(e,t){var a=A2(this,this.l,e.length>>1);if(a!==e)throw new Error(t+"Expected "+e+" saw "+a);this.l+=e.length>>1}function Mn(e,t){e.l=t,e.read_shift=Xd,e.chk=H2,e.write_shift=gT}function Ws(e,t){e.l+=t}function qe(e){var t=lo(e);return Mn(t,0),t}function pn(){var e=[],t=pa?256:2048,a=function(p){var x=qe(p);return Mn(x,0),x},s=a(t),i=function(){s&&(s.length>s.l&&(s=s.slice(0,s.l),s.l=s.length),s.length>0&&e.push(s),s=null)},d=function(p){return s&&p<s.length-s.l?s:(i(),s=a(Math.max(p+1,t)))},c=function(){return i(),Lr(e)},f=function(p){i(),s=p,s.l==null&&(s.l=s.length),d(t)};return{next:d,push:f,end:c,_bufs:e}}function nt(e,t,a,s){var i=+t,d;if(!isNaN(i)){s||(s=o9[i].p||(a||[]).length||0),d=1+(i>=128?1:0)+1,s>=128&&++d,s>=16384&&++d,s>=2097152&&++d;var c=e.next(d);i<=127?c.write_shift(1,i):(c.write_shift(1,(i&127)+128),c.write_shift(1,i>>7));for(var f=0;f!=4;++f)if(s>=128)c.write_shift(1,(s&127)+128),s>>=7;else{c.write_shift(1,s);break}s>0&&Sp(a)&&e.push(a)}}function Jd(e,t,a){var s=yn(e);if(t.s?(s.cRel&&(s.c+=t.s.c),s.rRel&&(s.r+=t.s.r)):(s.cRel&&(s.c+=t.c),s.rRel&&(s.r+=t.r)),!a||a.biff<12){for(;s.c>=256;)s.c-=256;for(;s.r>=65536;)s.r-=65536}return s}function Nv(e,t,a){var s=yn(e);return s.s=Jd(s.s,t.s,a),s.e=Jd(s.e,t.s,a),s}function Kd(e,t){if(e.cRel&&e.c<0)for(e=yn(e);e.c<0;)e.c+=t>8?16384:256;if(e.rRel&&e.r<0)for(e=yn(e);e.r<0;)e.r+=t>8?1048576:t>5?65536:16384;var a=ka(e);return!e.cRel&&e.cRel!=null&&(a=yT(a)),!e.rRel&&e.rRel!=null&&(a=pT(a)),a}function Sg(e,t){return e.s.r==0&&!e.s.rRel&&e.e.r==(t.biff>=12?1048575:t.biff>=8?65536:16384)&&!e.e.rRel?(e.s.cRel?"":"$")+$r(e.s.c)+":"+(e.e.cRel?"":"$")+$r(e.e.c):e.s.c==0&&!e.s.cRel&&e.e.c==(t.biff>=12?16383:255)&&!e.e.cRel?(e.s.rRel?"":"$")+Pr(e.s.r)+":"+(e.e.rRel?"":"$")+Pr(e.e.r):Kd(e.s,t.biff)+":"+Kd(e.e,t.biff)}function Tp(e){return parseInt(xT(e),10)-1}function Pr(e){return""+(e+1)}function pT(e){return e.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function xT(e){return e.replace(/\$(\d+)$/,"$1")}function Ep(e){for(var t=bT(e),a=0,s=0;s!==t.length;++s)a=26*a+t.charCodeAt(s)-64;return a-1}function $r(e){if(e<0)throw new Error("invalid column "+e);var t="";for(++e;e;e=Math.floor((e-1)/26))t=String.fromCharCode((e-1)%26+65)+t;return t}function yT(e){return e.replace(/^([A-Z])/,"$$$1")}function bT(e){return e.replace(/^\$([A-Z])/,"$1")}function vT(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function vr(e){for(var t=0,a=0,s=0;s<e.length;++s){var i=e.charCodeAt(s);i>=48&&i<=57?t=10*t+(i-48):i>=65&&i<=90&&(a=26*a+(i-64))}return{c:a-1,r:t-1}}function ka(e){for(var t=e.c+1,a="";t;t=(t-1)/26|0)a=String.fromCharCode((t-1)%26+65)+a;return a+(e.r+1)}function In(e){var t=e.indexOf(":");return t==-1?{s:vr(e),e:vr(e)}:{s:vr(e.slice(0,t)),e:vr(e.slice(t+1))}}function cr(e,t){return typeof t=="undefined"||typeof t=="number"?cr(e.s,e.e):(typeof e!="string"&&(e=ka(e)),typeof t!="string"&&(t=ka(t)),e==t?e:e+":"+t)}function Ba(e){var t={s:{c:0,r:0},e:{c:0,r:0}},a=0,s=0,i=0,d=e.length;for(a=0;s<d&&!((i=e.charCodeAt(s)-64)<1||i>26);++s)a=26*a+i;for(t.s.c=--a,a=0;s<d&&!((i=e.charCodeAt(s)-48)<0||i>9);++s)a=10*a+i;if(t.s.r=--a,s===d||i!=10)return t.e.c=t.s.c,t.e.r=t.s.r,t;for(++s,a=0;s!=d&&!((i=e.charCodeAt(s)-64)<1||i>26);++s)a=26*a+i;for(t.e.c=--a,a=0;s!=d&&!((i=e.charCodeAt(s)-48)<0||i>9);++s)a=10*a+i;return t.e.r=--a,t}function jv(e,t){var a=e.t=="d"&&t instanceof Date;if(e.z!=null)try{return e.w=ol(e.z,a?xn(t):t)}catch(s){}try{return e.w=ol((e.XF||{}).numFmtId||(a?14:0),a?xn(t):t)}catch(s){return""+t}}function bi(e,t,a){return e==null||e.t==null||e.t=="z"?"":e.w!==void 0?e.w:(e.t=="d"&&!e.z&&a&&a.dateNF&&(e.z=a.dateNF),e.t=="e"?N0[e.v]||e.v:t==null?jv(e,e.v):jv(e,t))}function fo(e,t){var a=t&&t.sheet?t.sheet:"Sheet1",s={};return s[a]=e,{SheetNames:[a],Sheets:s}}function $2(e,t,a){var s=a||{},i=e?Array.isArray(e):s.dense,d=e||(i?[]:{}),c=0,f=0;if(d&&s.origin!=null){if(typeof s.origin=="number")c=s.origin;else{var g=typeof s.origin=="string"?vr(s.origin):s.origin;c=g.r,f=g.c}d["!ref"]||(d["!ref"]="A1:A1")}var p={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(d["!ref"]){var x=Ba(d["!ref"]);p.s.c=x.s.c,p.s.r=x.s.r,p.e.c=Math.max(p.e.c,x.e.c),p.e.r=Math.max(p.e.r,x.e.r),c==-1&&(p.e.r=c=x.e.r+1)}for(var y=0;y!=t.length;++y)if(t[y]){if(!Array.isArray(t[y]))throw new Error("aoa_to_sheet expects an array of arrays");for(var _=0;_!=t[y].length;++_)if(typeof t[y][_]!="undefined"){var k={v:t[y][_]},T=c+y,N=f+_;if(p.s.r>T&&(p.s.r=T),p.s.c>N&&(p.s.c=N),p.e.r<T&&(p.e.r=T),p.e.c<N&&(p.e.c=N),t[y][_]&&typeof t[y][_]=="object"&&!Array.isArray(t[y][_])&&!(t[y][_]instanceof Date))k=t[y][_];else if(Array.isArray(k.v)&&(k.f=t[y][_][1],k.v=k.v[0]),k.v===null)if(k.f)k.t="n";else if(s.nullError)k.t="e",k.v=0;else if(s.sheetStubs)k.t="z";else continue;else typeof k.v=="number"?k.t="n":typeof k.v=="boolean"?k.t="b":k.v instanceof Date?(k.z=s.dateNF||Ka[14],s.cellDates?(k.t="d",k.w=ol(k.z,xn(k.v))):(k.t="n",k.v=xn(k.v),k.w=ol(k.z,k.v))):k.t="s";if(i)d[T]||(d[T]=[]),d[T][N]&&d[T][N].z&&(k.z=d[T][N].z),d[T][N]=k;else{var S=ka({c:N,r:T});d[S]&&d[S].z&&(k.z=d[S].z),d[S]=k}}}return p.s.c<1e7&&(d["!ref"]=cr(p)),d}function Pc(e,t){return $2(null,e,t)}function _T(e){return e.read_shift(4,"i")}function _s(e,t){return t||(t=qe(4)),t.write_shift(4,e),t}function Wr(e){var t=e.read_shift(4);return t===0?"":e.read_shift(t,"dbcs")}function _r(e,t){var a=!1;return t==null&&(a=!0,t=qe(4+2*e.length)),t.write_shift(4,e.length),e.length>0&&t.write_shift(0,e,"dbcs"),a?t.slice(0,t.l):t}function wT(e){return{ich:e.read_shift(2),ifnt:e.read_shift(2)}}function kT(e,t){return t||(t=qe(4)),t.write_shift(2,0),t.write_shift(2,0),t}function Cp(e,t){var a=e.l,s=e.read_shift(1),i=Wr(e),d=[],c={t:i,h:i};if((s&1)!==0){for(var f=e.read_shift(4),g=0;g!=f;++g)d.push(wT(e));c.r=d}else c.r=[{ich:0,ifnt:0}];return e.l=a+t,c}function NT(e,t){var a=!1;return t==null&&(a=!0,t=qe(15+4*e.t.length)),t.write_shift(1,0),_r(e.t,t),a?t.slice(0,t.l):t}var jT=Cp;function ST(e,t){var a=!1;return t==null&&(a=!0,t=qe(23+4*e.t.length)),t.write_shift(1,1),_r(e.t,t),t.write_shift(4,1),kT({},t),a?t.slice(0,t.l):t}function rs(e){var t=e.read_shift(4),a=e.read_shift(2);return a+=e.read_shift(1)<<16,e.l++,{c:t,iStyleRef:a}}function ho(e,t){return t==null&&(t=qe(8)),t.write_shift(-4,e.c),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}function mo(e){var t=e.read_shift(2);return t+=e.read_shift(1)<<16,e.l++,{c:-1,iStyleRef:t}}function go(e,t){return t==null&&(t=qe(4)),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}var TT=Wr,W2=_r;function Ap(e){var t=e.read_shift(4);return t===0||t===4294967295?"":e.read_shift(t,"dbcs")}function Mf(e,t){var a=!1;return t==null&&(a=!0,t=qe(127)),t.write_shift(4,e.length>0?e.length:4294967295),e.length>0&&t.write_shift(0,e,"dbcs"),a?t.slice(0,t.l):t}var ET=Wr,Jg=Ap,Op=Mf;function V2(e){var t=e.slice(e.l,e.l+4),a=t[0]&1,s=t[0]&2;e.l+=4;var i=s===0?Of([0,0,0,0,t[0]&252,t[1],t[2],t[3]],0):Jl(t,0)>>2;return a?i/100:i}function G2(e,t){t==null&&(t=qe(4));var a=0,s=0,i=e*100;if(e==(e|0)&&e>=-536870912&&e<1<<29?s=1:i==(i|0)&&i>=-536870912&&i<1<<29&&(s=1,a=1),s)t.write_shift(-4,((a?i:e)<<2)+(a+2));else throw new Error("unsupported RkNumber "+e)}function Z2(e){var t={s:{},e:{}};return t.s.r=e.read_shift(4),t.e.r=e.read_shift(4),t.s.c=e.read_shift(4),t.e.c=e.read_shift(4),t}function CT(e,t){return t||(t=qe(16)),t.write_shift(4,e.s.r),t.write_shift(4,e.e.r),t.write_shift(4,e.s.c),t.write_shift(4,e.e.c),t}var po=Z2,Rc=CT;function Fc(e){if(e.length-e.l<8)throw"XLS Xnum Buffer underflow";return e.read_shift(8,"f")}function oo(e,t){return(t||qe(8)).write_shift(8,e,"f")}function AT(e){var t={},a=e.read_shift(1),s=a>>>1,i=e.read_shift(1),d=e.read_shift(2,"i"),c=e.read_shift(1),f=e.read_shift(1),g=e.read_shift(1);switch(e.l++,s){case 0:t.auto=1;break;case 1:t.index=i;var p=zT[i];p&&(t.rgb=Rv(p));break;case 2:t.rgb=Rv([c,f,g]);break;case 3:t.theme=i;break}return d!=0&&(t.tint=d>0?d/32767:d/32768),t}function Lf(e,t){if(t||(t=qe(8)),!e||e.auto)return t.write_shift(4,0),t.write_shift(4,0),t;e.index!=null?(t.write_shift(1,2),t.write_shift(1,e.index)):e.theme!=null?(t.write_shift(1,6),t.write_shift(1,e.theme)):(t.write_shift(1,5),t.write_shift(1,0));var a=e.tint||0;if(a>0?a*=32767:a<0&&(a*=32768),t.write_shift(2,a),!e.rgb||e.theme!=null)t.write_shift(2,0),t.write_shift(1,0),t.write_shift(1,0);else{var s=e.rgb||"FFFFFF";typeof s=="number"&&(s=("000000"+s.toString(16)).slice(-6)),t.write_shift(1,parseInt(s.slice(0,2),16)),t.write_shift(1,parseInt(s.slice(2,4),16)),t.write_shift(1,parseInt(s.slice(4,6),16)),t.write_shift(1,255)}return t}function OT(e){var t=e.read_shift(1);e.l++;var a={fBold:t&1,fItalic:t&2,fUnderline:t&4,fStrikeout:t&8,fOutline:t&16,fShadow:t&32,fCondense:t&64,fExtend:t&128};return a}function MT(e,t){t||(t=qe(2));var a=(e.italic?2:0)|(e.strike?8:0)|(e.outline?16:0)|(e.shadow?32:0)|(e.condense?64:0)|(e.extend?128:0);return t.write_shift(1,a),t.write_shift(1,0),t}var q2=2,On=3,nf=11,Df=19,sf=64,LT=65,DT=71,PT=4108,RT=4126,Mr=80,Sv={1:{n:"CodePage",t:q2},2:{n:"Category",t:Mr},3:{n:"PresentationFormat",t:Mr},4:{n:"ByteCount",t:On},5:{n:"LineCount",t:On},6:{n:"ParagraphCount",t:On},7:{n:"SlideCount",t:On},8:{n:"NoteCount",t:On},9:{n:"HiddenCount",t:On},10:{n:"MultimediaClipCount",t:On},11:{n:"ScaleCrop",t:nf},12:{n:"HeadingPairs",t:PT},13:{n:"TitlesOfParts",t:RT},14:{n:"Manager",t:Mr},15:{n:"Company",t:Mr},16:{n:"LinksUpToDate",t:nf},17:{n:"CharacterCount",t:On},19:{n:"SharedDoc",t:nf},22:{n:"HyperlinksChanged",t:nf},23:{n:"AppVersion",t:On,p:"version"},24:{n:"DigSig",t:LT},26:{n:"ContentType",t:Mr},27:{n:"ContentStatus",t:Mr},28:{n:"Language",t:Mr},29:{n:"Version",t:Mr},255:{},2147483648:{n:"Locale",t:Df},2147483651:{n:"Behavior",t:Df},1919054434:{}},Tv={1:{n:"CodePage",t:q2},2:{n:"Title",t:Mr},3:{n:"Subject",t:Mr},4:{n:"Author",t:Mr},5:{n:"Keywords",t:Mr},6:{n:"Comments",t:Mr},7:{n:"Template",t:Mr},8:{n:"LastAuthor",t:Mr},9:{n:"RevNumber",t:Mr},10:{n:"EditTime",t:sf},11:{n:"LastPrinted",t:sf},12:{n:"CreatedDate",t:sf},13:{n:"ModifiedDate",t:sf},14:{n:"PageCount",t:On},15:{n:"WordCount",t:On},16:{n:"CharCount",t:On},17:{n:"Thumbnail",t:DT},18:{n:"Application",t:Mr},19:{n:"DocSecurity",t:On},255:{},2147483648:{n:"Locale",t:Df},2147483651:{n:"Behavior",t:Df},1919054434:{}};function FT(e){return e.map(function(t){return[t>>16&255,t>>8&255,t&255]})}var IT=FT([0,16777215,16711680,65280,255,16776960,16711935,65535,0,16777215,16711680,65280,255,16776960,16711935,65535,8388608,32768,128,8421376,8388736,32896,12632256,8421504,10066431,10040166,16777164,13434879,6684774,16744576,26316,13421823,128,16711935,16776960,65535,8388736,8388608,32896,255,52479,13434879,13434828,16777113,10079487,16751052,13408767,16764057,3368703,3394764,10079232,16763904,16750848,16737792,6710937,9868950,13158,3381606,13056,3355392,10040064,10040166,3355545,3355443,16777215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),zT=yn(IT),N0={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},BT={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":"workbooks","application/vnd.ms-excel.sheet.macroEnabled.main+xml":"workbooks","application/vnd.ms-excel.sheet.binary.macroEnabled.main":"workbooks","application/vnd.ms-excel.addin.macroEnabled.main+xml":"workbooks","application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":"workbooks","application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":"sheets","application/vnd.ms-excel.worksheet":"sheets","application/vnd.ms-excel.binIndexWs":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":"charts","application/vnd.ms-excel.chartsheet":"charts","application/vnd.ms-excel.macrosheet+xml":"macros","application/vnd.ms-excel.macrosheet":"macros","application/vnd.ms-excel.intlmacrosheet":"TODO","application/vnd.ms-excel.binIndexMs":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":"dialogs","application/vnd.ms-excel.dialogsheet":"dialogs","application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml":"strs","application/vnd.ms-excel.sharedStrings":"strs","application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":"styles","application/vnd.ms-excel.styles":"styles","application/vnd.openxmlformats-package.core-properties+xml":"coreprops","application/vnd.openxmlformats-officedocument.custom-properties+xml":"custprops","application/vnd.openxmlformats-officedocument.extended-properties+xml":"extprops","application/vnd.openxmlformats-officedocument.customXmlProperties+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":"comments","application/vnd.ms-excel.comments":"comments","application/vnd.ms-excel.threadedcomments+xml":"threadedcomments","application/vnd.ms-excel.person+xml":"people","application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml":"metadata","application/vnd.ms-excel.sheetMetadata":"metadata","application/vnd.ms-excel.pivotTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.chart+xml":"TODO","application/vnd.ms-office.chartcolorstyle+xml":"TODO","application/vnd.ms-office.chartstyle+xml":"TODO","application/vnd.ms-office.chartex+xml":"TODO","application/vnd.ms-excel.calcChain":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings":"TODO","application/vnd.ms-office.activeX":"TODO","application/vnd.ms-office.activeX+xml":"TODO","application/vnd.ms-excel.attachedToolbars":"TODO","application/vnd.ms-excel.connections":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":"TODO","application/vnd.ms-excel.externalLink":"links","application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml":"links","application/vnd.ms-excel.pivotCacheDefinition":"TODO","application/vnd.ms-excel.pivotCacheRecords":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml":"TODO","application/vnd.ms-excel.queryTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml":"TODO","application/vnd.ms-excel.userNames":"TODO","application/vnd.ms-excel.revisionHeaders":"TODO","application/vnd.ms-excel.revisionLog":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml":"TODO","application/vnd.ms-excel.tableSingleCells":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml":"TODO","application/vnd.ms-excel.slicer":"TODO","application/vnd.ms-excel.slicerCache":"TODO","application/vnd.ms-excel.slicer+xml":"TODO","application/vnd.ms-excel.slicerCache+xml":"TODO","application/vnd.ms-excel.wsSortMap":"TODO","application/vnd.ms-excel.table":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":"TODO","application/vnd.openxmlformats-officedocument.theme+xml":"themes","application/vnd.openxmlformats-officedocument.themeOverride+xml":"TODO","application/vnd.ms-excel.Timeline+xml":"TODO","application/vnd.ms-excel.TimelineCache+xml":"TODO","application/vnd.ms-office.vbaProject":"vba","application/vnd.ms-office.vbaProjectSignature":"TODO","application/vnd.ms-office.volatileDependencies":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml":"TODO","application/vnd.ms-excel.controlproperties+xml":"TODO","application/vnd.openxmlformats-officedocument.model+data":"TODO","application/vnd.ms-excel.Survey+xml":"TODO","application/vnd.openxmlformats-officedocument.drawing+xml":"drawings","application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml":"TODO","application/vnd.openxmlformats-officedocument.vmlDrawing":"TODO","application/vnd.openxmlformats-package.relationships+xml":"rels","application/vnd.openxmlformats-officedocument.oleObject":"TODO","image/png":"TODO",sheet:"js"},lf={workbooks:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.main+xml",xlsb:"application/vnd.ms-excel.sheet.binary.macroEnabled.main",xlam:"application/vnd.ms-excel.addin.macroEnabled.main+xml",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"},strs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",xlsb:"application/vnd.ms-excel.sharedStrings"},comments:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",xlsb:"application/vnd.ms-excel.comments"},sheets:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",xlsb:"application/vnd.ms-excel.worksheet"},charts:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",xlsb:"application/vnd.ms-excel.chartsheet"},dialogs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",xlsb:"application/vnd.ms-excel.dialogsheet"},macros:{xlsx:"application/vnd.ms-excel.macrosheet+xml",xlsb:"application/vnd.ms-excel.macrosheet"},metadata:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",xlsb:"application/vnd.ms-excel.sheetMetadata"},styles:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",xlsb:"application/vnd.ms-excel.styles"}};function Y2(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""}}function X2(e,t){var a=X5(BT),s=[],i;s[s.length]=dr,s[s.length]=ht("Types",null,{xmlns:br.CT,"xmlns:xsd":br.xsd,"xmlns:xsi":br.xsi}),s=s.concat([["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["vml","application/vnd.openxmlformats-officedocument.vmlDrawing"],["data","application/vnd.openxmlformats-officedocument.model+data"],["bmp","image/bmp"],["png","image/png"],["gif","image/gif"],["emf","image/x-emf"],["wmf","image/x-wmf"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["tif","image/tiff"],["tiff","image/tiff"],["pdf","application/pdf"],["rels","application/vnd.openxmlformats-package.relationships+xml"]].map(function(g){return ht("Default",null,{Extension:g[0],ContentType:g[1]})}));var d=function(g){e[g]&&e[g].length>0&&(i=e[g][0],s[s.length]=ht("Override",null,{PartName:(i[0]=="/"?"":"/")+i,ContentType:lf[g][t.bookType]||lf[g].xlsx}))},c=function(g){(e[g]||[]).forEach(function(p){s[s.length]=ht("Override",null,{PartName:(p[0]=="/"?"":"/")+p,ContentType:lf[g][t.bookType]||lf[g].xlsx})})},f=function(g){(e[g]||[]).forEach(function(p){s[s.length]=ht("Override",null,{PartName:(p[0]=="/"?"":"/")+p,ContentType:a[g][0]})})};return d("workbooks"),c("sheets"),c("charts"),f("themes"),["strs","styles"].forEach(d),["coreprops","extprops","custprops"].forEach(f),f("vba"),f("comments"),f("threadedcomments"),f("drawings"),c("metadata"),f("people"),s.length>2&&(s[s.length]="</Types>",s[1]=s[1].replace("/>",">")),s.join("")}var fa={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",XPATH:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",XMISS:"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",CMNT:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",SST:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",STY:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",THEME:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",WS:["http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"],DRAW:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",XLMETA:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",TCMNT:"http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",PEOPLE:"http://schemas.microsoft.com/office/2017/10/relationships/person",VBA:"http://schemas.microsoft.com/office/2006/relationships/vbaProject"};function J2(e){var t=e.lastIndexOf("/");return e.slice(0,t+1)+"_rels/"+e.slice(t+1)+".rels"}function bc(e){var t=[dr,ht("Relationships",null,{xmlns:br.RELS})];return Fr(e["!id"]).forEach(function(a){t[t.length]=ht("Relationship",null,e["!id"][a])}),t.length>2&&(t[t.length]="</Relationships>",t[1]=t[1].replace("/>",">")),t.join("")}function _a(e,t,a,s,i,d){if(i||(i={}),e["!id"]||(e["!id"]={}),e["!idx"]||(e["!idx"]=1),t<0)for(t=e["!idx"];e["!id"]["rId"+t];++t);if(e["!idx"]=t+1,i.Id="rId"+t,i.Type=s,i.Target=a,[fa.HLINK,fa.XPATH,fa.XMISS].indexOf(i.Type)>-1&&(i.TargetMode="External"),e["!id"][i.Id])throw new Error("Cannot rewrite rId "+t);return e["!id"][i.Id]=i,e[("/"+i.Target).replace("//","/")]=i,t}function UT(e){var t=[dr];t.push(`<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">
|
||
`),t.push(` <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.spreadsheet"/>
|
||
`);for(var a=0;a<e.length;++a)t.push(' <manifest:file-entry manifest:full-path="'+e[a][0]+'" manifest:media-type="'+e[a][1]+`"/>
|
||
`);return t.push("</manifest:manifest>"),t.join("")}function Ev(e,t,a){return[' <rdf:Description rdf:about="'+e+`">
|
||
`,' <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/'+(a||"odf")+"#"+t+`"/>
|
||
`,` </rdf:Description>
|
||
`].join("")}function HT(e,t){return[' <rdf:Description rdf:about="'+e+`">
|
||
`,' <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="'+t+`"/>
|
||
`,` </rdf:Description>
|
||
`].join("")}function $T(e){var t=[dr];t.push(`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||
`);for(var a=0;a!=e.length;++a)t.push(Ev(e[a][0],e[a][1])),t.push(HT("",e[a][0]));return t.push(Ev("","Document","pkg")),t.push("</rdf:RDF>"),t.join("")}function K2(){return'<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xlink="http://www.w3.org/1999/xlink" office:version="1.2"><office:meta><meta:generator>SheetJS '+jf.version+"</meta:generator></office:meta></office:document-meta>"}var ao=[["cp:category","Category"],["cp:contentStatus","ContentStatus"],["cp:keywords","Keywords"],["cp:lastModifiedBy","LastAuthor"],["cp:lastPrinted","LastPrinted"],["cp:revision","RevNumber"],["cp:version","Version"],["dc:creator","Author"],["dc:description","Comments"],["dc:identifier","Identifier"],["dc:language","Language"],["dc:subject","Subject"],["dc:title","Title"],["dcterms:created","CreatedDate","date"],["dcterms:modified","ModifiedDate","date"]];function Tg(e,t,a,s,i){i[e]!=null||t==null||t===""||(i[e]=t,t=wa(t),s[s.length]=a?ht(e,t,a):Dr(e,t))}function Q2(e,t){var a=t||{},s=[dr,ht("cp:coreProperties",null,{"xmlns:cp":br.CORE_PROPS,"xmlns:dc":br.dc,"xmlns:dcterms":br.dcterms,"xmlns:dcmitype":br.dcmitype,"xmlns:xsi":br.xsi})],i={};if(!e&&!a.Props)return s.join("");e&&(e.CreatedDate!=null&&Tg("dcterms:created",typeof e.CreatedDate=="string"?e.CreatedDate:Xg(e.CreatedDate,a.WTF),{"xsi:type":"dcterms:W3CDTF"},s,i),e.ModifiedDate!=null&&Tg("dcterms:modified",typeof e.ModifiedDate=="string"?e.ModifiedDate:Xg(e.ModifiedDate,a.WTF),{"xsi:type":"dcterms:W3CDTF"},s,i));for(var d=0;d!=ao.length;++d){var c=ao[d],f=a.Props&&a.Props[c[1]]!=null?a.Props[c[1]]:e?e[c[1]]:null;f===!0?f="1":f===!1?f="0":typeof f=="number"&&(f=String(f)),f!=null&&Tg(c[0],f,null,s,i)}return s.length>2&&(s[s.length]="</cp:coreProperties>",s[1]=s[1].replace("/>",">")),s.join("")}var vc=[["Application","Application","string"],["AppVersion","AppVersion","string"],["Company","Company","string"],["DocSecurity","DocSecurity","string"],["Manager","Manager","string"],["HyperlinksChanged","HyperlinksChanged","bool"],["SharedDoc","SharedDoc","bool"],["LinksUpToDate","LinksUpToDate","bool"],["ScaleCrop","ScaleCrop","bool"],["HeadingPairs","HeadingPairs","raw"],["TitlesOfParts","TitlesOfParts","raw"]],ew=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"];function tw(e){var t=[],a=ht;return e||(e={}),e.Application="SheetJS",t[t.length]=dr,t[t.length]=ht("Properties",null,{xmlns:br.EXT_PROPS,"xmlns:vt":br.vt}),vc.forEach(function(s){if(e[s[1]]!==void 0){var i;switch(s[2]){case"string":i=wa(String(e[s[1]]));break;case"bool":i=e[s[1]]?"true":"false";break}i!==void 0&&(t[t.length]=a(s[0],i))}}),t[t.length]=a("HeadingPairs",a("vt:vector",a("vt:variant","<vt:lpstr>Worksheets</vt:lpstr>")+a("vt:variant",a("vt:i4",String(e.Worksheets))),{size:2,baseType:"variant"})),t[t.length]=a("TitlesOfParts",a("vt:vector",e.SheetNames.map(function(s){return"<vt:lpstr>"+wa(s)+"</vt:lpstr>"}).join(""),{size:e.Worksheets,baseType:"lpstr"})),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}function aw(e){var t=[dr,ht("Properties",null,{xmlns:br.CUST_PROPS,"xmlns:vt":br.vt})];if(!e)return t.join("");var a=1;return Fr(e).forEach(function(i){++a,t[t.length]=ht("property",lT(e[i]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:a,name:wa(i)})}),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var Cv={Title:"Title",Subject:"Subject",Author:"Author",Keywords:"Keywords",Comments:"Description",LastAuthor:"LastAuthor",RevNumber:"Revision",Application:"AppName",LastPrinted:"LastPrinted",CreatedDate:"Created",ModifiedDate:"LastSaved",Category:"Category",Manager:"Manager",Company:"Company",AppVersion:"Version",ContentStatus:"ContentStatus",Identifier:"Identifier",Language:"Language"};function WT(e,t){var a=[];return Fr(Cv).map(function(s){for(var i=0;i<ao.length;++i)if(ao[i][1]==s)return ao[i];for(i=0;i<vc.length;++i)if(vc[i][1]==s)return vc[i];throw s}).forEach(function(s){if(e[s[1]]!=null){var i=t&&t.Props&&t.Props[s[1]]!=null?t.Props[s[1]]:e[s[1]];switch(s[2]){case"date":i=new Date(i).toISOString().replace(/\.\d*Z/,"Z");break}typeof i=="number"?i=String(i):i===!0||i===!1?i=i?"1":"0":i instanceof Date&&(i=new Date(i).toISOString().replace(/\.\d*Z/,"")),a.push(Dr(Cv[s[1]]||s[1],i))}}),ht("DocumentProperties",a.join(""),{xmlns:Ln.o})}function VT(e,t){var a=["Worksheets","SheetNames"],s="CustomDocumentProperties",i=[];return e&&Fr(e).forEach(function(d){if(Object.prototype.hasOwnProperty.call(e,d)){for(var c=0;c<ao.length;++c)if(d==ao[c][1])return;for(c=0;c<vc.length;++c)if(d==vc[c][1])return;for(c=0;c<a.length;++c)if(d==a[c])return;var f=e[d],g="string";typeof f=="number"?(g="float",f=String(f)):f===!0||f===!1?(g="boolean",f=f?"1":"0"):f=String(f),i.push(ht(pv(d),f,{"dt:dt":g}))}}),t&&Fr(t).forEach(function(d){if(Object.prototype.hasOwnProperty.call(t,d)&&!(e&&Object.prototype.hasOwnProperty.call(e,d))){var c=t[d],f="string";typeof c=="number"?(f="float",c=String(c)):c===!0||c===!1?(f="boolean",c=c?"1":"0"):c instanceof Date?(f="dateTime.tz",c=c.toISOString()):c=String(c),i.push(ht(pv(d),c,{"dt:dt":f}))}}),"<"+s+' xmlns="'+Ln.o+'">'+i.join("")+"</"+s+">"}function GT(e){var t=typeof e=="string"?new Date(Date.parse(e)):e,a=t.getTime()/1e3+11644473600,s=a%Math.pow(2,32),i=(a-s)/Math.pow(2,32);s*=1e7,i*=1e7;var d=s/Math.pow(2,32)|0;d>0&&(s=s%Math.pow(2,32),i+=d);var c=qe(8);return c.write_shift(4,s),c.write_shift(4,i),c}function Av(e,t){var a=qe(4),s=qe(4);switch(a.write_shift(4,e==80?31:e),e){case 3:s.write_shift(-4,t);break;case 5:s=qe(8),s.write_shift(8,t,"f");break;case 11:s.write_shift(4,t?1:0);break;case 64:s=GT(t);break;case 31:case 80:for(s=qe(4+2*(t.length+1)+(t.length%2?0:2)),s.write_shift(4,t.length+1),s.write_shift(0,t,"dbcs");s.l!=s.length;)s.write_shift(1,0);break;default:throw new Error("TypedPropertyValue unrecognized type "+e+" "+t)}return Lr([a,s])}var rw=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"];function ZT(e){switch(typeof e){case"boolean":return 11;case"number":return(e|0)==e?3:5;case"string":return 31;case"object":if(e instanceof Date)return 64;break}return-1}function Ov(e,t,a){var s=qe(8),i=[],d=[],c=8,f=0,g=qe(8),p=qe(8);if(g.write_shift(4,2),g.write_shift(4,1200),p.write_shift(4,1),d.push(g),i.push(p),c+=8+g.length,!t){p=qe(8),p.write_shift(4,0),i.unshift(p);var x=[qe(4)];for(x[0].write_shift(4,e.length),f=0;f<e.length;++f){var y=e[f][0];for(g=qe(8+2*(y.length+1)+(y.length%2?0:2)),g.write_shift(4,f+2),g.write_shift(4,y.length+1),g.write_shift(0,y,"dbcs");g.l!=g.length;)g.write_shift(1,0);x.push(g)}g=Lr(x),d.unshift(g),c+=8+g.length}for(f=0;f<e.length;++f)if(!(t&&!t[e[f][0]])&&!(rw.indexOf(e[f][0])>-1||ew.indexOf(e[f][0])>-1)&&e[f][1]!=null){var _=e[f][1],k=0;if(t){k=+t[e[f][0]];var T=a[k];if(T.p=="version"&&typeof _=="string"){var N=_.split(".");_=(+N[0]<<16)+(+N[1]||0)}g=Av(T.t,_)}else{var S=ZT(_);S==-1&&(S=31,_=String(_)),g=Av(S,_)}d.push(g),p=qe(8),p.write_shift(4,t?k:2+f),i.push(p),c+=8+g.length}var O=8*(d.length+1);for(f=0;f<d.length;++f)i[f].write_shift(4,O),O+=d[f].length;return s.write_shift(4,c),s.write_shift(4,d.length),Lr([s].concat(i).concat(d))}function Mv(e,t,a,s,i,d){var c=qe(i?68:48),f=[c];c.write_shift(2,65534),c.write_shift(2,0),c.write_shift(4,842412599),c.write_shift(16,Oa.utils.consts.HEADER_CLSID,"hex"),c.write_shift(4,i?2:1),c.write_shift(16,t,"hex"),c.write_shift(4,i?68:48);var g=Ov(e,a,s);if(f.push(g),i){var p=Ov(i,null,null);c.write_shift(16,d,"hex"),c.write_shift(4,68+g.length),f.push(p)}return Lr(f)}function qT(e,t){t||(t=qe(e));for(var a=0;a<e;++a)t.write_shift(1,0);return t}function YT(e,t){return e.read_shift(t)===1}function Xr(e,t){return t||(t=qe(2)),t.write_shift(2,+!!e),t}function nw(e){return e.read_shift(2,"u")}function es(e,t){return t||(t=qe(2)),t.write_shift(2,e),t}function sw(e,t,a){return a||(a=qe(2)),a.write_shift(1,t=="e"?+e:+!!e),a.write_shift(1,t=="e"?1:0),a}function iw(e,t,a){var s=e.read_shift(a&&a.biff>=12?2:1),i="sbcs-cont";if(a&&a.biff>=8,!a||a.biff==8){var d=e.read_shift(1);d&&(i="dbcs-cont")}else a.biff==12&&(i="wstr");a.biff>=2&&a.biff<=5&&(i="cpstr");var c=s?e.read_shift(s,i):"";return c}function XT(e){var t=e.t||"",a=qe(3);a.write_shift(2,t.length),a.write_shift(1,1);var s=qe(2*t.length);s.write_shift(2*t.length,t,"utf16le");var i=[a,s];return Lr(i)}function JT(e,t,a){var s;if(a){if(a.biff>=2&&a.biff<=5)return e.read_shift(t,"cpstr");if(a.biff>=12)return e.read_shift(t,"dbcs-cont")}var i=e.read_shift(1);return i===0?s=e.read_shift(t,"sbcs-cont"):s=e.read_shift(t,"dbcs-cont"),s}function KT(e,t,a){var s=e.read_shift(a&&a.biff==2?1:2);return s===0?(e.l++,""):JT(e,s,a)}function QT(e,t,a){if(a.biff>5)return KT(e,t,a);var s=e.read_shift(1);return s===0?(e.l++,""):e.read_shift(s,a.biff<=4||!e.lens?"cpstr":"sbcs-cont")}function lw(e,t,a){return a||(a=qe(3+2*e.length)),a.write_shift(2,e.length),a.write_shift(1,1),a.write_shift(31,e,"utf16le"),a}function Lv(e,t){t||(t=qe(6+e.length*2)),t.write_shift(4,1+e.length);for(var a=0;a<e.length;++a)t.write_shift(2,e.charCodeAt(a));return t.write_shift(2,0),t}function eE(e){var t=qe(512),a=0,s=e.Target;s.slice(0,7)=="file://"&&(s=s.slice(7));var i=s.indexOf("#"),d=i>-1?31:23;switch(s.charAt(0)){case"#":d=28;break;case".":d&=-3;break}t.write_shift(4,2),t.write_shift(4,d);var c=[8,6815827,6619237,4849780,83];for(a=0;a<c.length;++a)t.write_shift(4,c[a]);if(d==28)s=s.slice(1),Lv(s,t);else if(d&2){for(c="e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),a=0;a<c.length;++a)t.write_shift(1,parseInt(c[a],16));var f=i>-1?s.slice(0,i):s;for(t.write_shift(4,2*(f.length+1)),a=0;a<f.length;++a)t.write_shift(2,f.charCodeAt(a));t.write_shift(2,0),d&8&&Lv(i>-1?s.slice(i+1):"",t)}else{for(c="03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "),a=0;a<c.length;++a)t.write_shift(1,parseInt(c[a],16));for(var g=0;s.slice(g*3,g*3+3)=="../"||s.slice(g*3,g*3+3)=="..\\";)++g;for(t.write_shift(2,g),t.write_shift(4,s.length-3*g+1),a=0;a<s.length-3*g;++a)t.write_shift(1,s.charCodeAt(a+3*g)&255);for(t.write_shift(1,0),t.write_shift(2,65535),t.write_shift(2,57005),a=0;a<6;++a)t.write_shift(4,0)}return t.slice(0,t.l)}function co(e,t,a,s){return s||(s=qe(6)),s.write_shift(2,e),s.write_shift(2,t),s.write_shift(2,a||0),s}function tE(e,t,a){var s=a.biff>8?4:2,i=e.read_shift(s),d=e.read_shift(s,"i"),c=e.read_shift(s,"i");return[i,d,c]}function aE(e){var t=e.read_shift(2),a=e.read_shift(2),s=e.read_shift(2),i=e.read_shift(2);return{s:{c:s,r:t},e:{c:i,r:a}}}function ow(e,t){return t||(t=qe(8)),t.write_shift(2,e.s.r),t.write_shift(2,e.e.r),t.write_shift(2,e.s.c),t.write_shift(2,e.e.c),t}function Mp(e,t,a){var s=1536,i=16;switch(a.bookType){case"biff8":break;case"biff5":s=1280,i=8;break;case"biff4":s=4,i=6;break;case"biff3":s=3,i=6;break;case"biff2":s=2,i=4;break;case"xla":break;default:throw new Error("unsupported BIFF version")}var d=qe(i);return d.write_shift(2,s),d.write_shift(2,t),i>4&&d.write_shift(2,29282),i>6&&d.write_shift(2,1997),i>8&&(d.write_shift(2,49161),d.write_shift(2,1),d.write_shift(2,1798),d.write_shift(2,0)),d}function rE(e,t){var a=!t||t.biff==8,s=qe(a?112:54);for(s.write_shift(t.biff==8?2:1,7),a&&s.write_shift(1,0),s.write_shift(4,859007059),s.write_shift(4,5458548|(a?0:536870912));s.l<s.length;)s.write_shift(1,a?0:32);return s}function nE(e,t){var a=!t||t.biff>=8?2:1,s=qe(8+a*e.name.length);s.write_shift(4,e.pos),s.write_shift(1,e.hs||0),s.write_shift(1,e.dt),s.write_shift(1,e.name.length),t.biff>=8&&s.write_shift(1,1),s.write_shift(a*e.name.length,e.name,t.biff<8?"sbcs":"utf16le");var i=s.slice(0,s.l);return i.l=s.l,i}function sE(e,t){var a=qe(8);a.write_shift(4,e.Count),a.write_shift(4,e.Unique);for(var s=[],i=0;i<e.length;++i)s[i]=XT(e[i]);var d=Lr([a].concat(s));return d.parts=[a.length].concat(s.map(function(c){return c.length})),d}function iE(){var e=qe(18);return e.write_shift(2,0),e.write_shift(2,0),e.write_shift(2,29280),e.write_shift(2,17600),e.write_shift(2,56),e.write_shift(2,0),e.write_shift(2,0),e.write_shift(2,1),e.write_shift(2,500),e}function lE(e){var t=qe(18),a=1718;return e&&e.RTL&&(a|=64),t.write_shift(2,a),t.write_shift(4,0),t.write_shift(4,64),t.write_shift(4,0),t.write_shift(4,0),t}function oE(e,t){var a=e.name||"Arial",s=t&&t.biff==5,i=s?15+a.length:16+2*a.length,d=qe(i);return d.write_shift(2,e.sz*20),d.write_shift(4,0),d.write_shift(2,400),d.write_shift(4,0),d.write_shift(2,0),d.write_shift(1,a.length),s||d.write_shift(1,1),d.write_shift((s?1:2)*a.length,a,s?"sbcs":"utf16le"),d}function cE(e,t,a,s){var i=qe(10);return co(e,t,s,i),i.write_shift(4,a),i}function dE(e,t,a,s,i){var d=!i||i.biff==8,c=qe(8+ +d+(1+d)*a.length);return co(e,t,s,c),c.write_shift(2,a.length),d&&c.write_shift(1,1),c.write_shift((1+d)*a.length,a,d?"utf16le":"sbcs"),c}function uE(e,t,a,s){var i=a&&a.biff==5;s||(s=qe(i?3+t.length:5+2*t.length)),s.write_shift(2,e),s.write_shift(i?1:2,t.length),i||s.write_shift(1,1),s.write_shift((i?1:2)*t.length,t,i?"sbcs":"utf16le");var d=s.length>s.l?s.slice(0,s.l):s;return d.l==null&&(d.l=d.length),d}function fE(e,t){var a=t.biff==8||!t.biff?4:2,s=qe(2*a+6);return s.write_shift(a,e.s.r),s.write_shift(a,e.e.r+1),s.write_shift(2,e.s.c),s.write_shift(2,e.e.c+1),s.write_shift(2,0),s}function Dv(e,t,a,s){var i=a&&a.biff==5;s||(s=qe(i?16:20)),s.write_shift(2,0),e.style?(s.write_shift(2,e.numFmtId||0),s.write_shift(2,65524)):(s.write_shift(2,e.numFmtId||0),s.write_shift(2,t<<4));var d=0;return e.numFmtId>0&&i&&(d|=1024),s.write_shift(4,d),s.write_shift(4,0),i||s.write_shift(4,0),s.write_shift(2,0),s}function hE(e){var t=qe(8);return t.write_shift(4,0),t.write_shift(2,0),t.write_shift(2,0),t}function mE(e,t,a,s,i,d){var c=qe(8);return co(e,t,s,c),sw(a,d,c),c}function gE(e,t,a,s){var i=qe(14);return co(e,t,s,i),oo(a,i),i}function pE(e,t,a){if(a.biff<8)return xE(e,t,a);for(var s=[],i=e.l+t,d=e.read_shift(a.biff>8?4:2);d--!==0;)s.push(tE(e,a.biff>8?12:6,a));if(e.l!=i)throw new Error("Bad ExternSheet: "+e.l+" != "+i);return s}function xE(e,t,a){e[e.l+1]==3&&e[e.l]++;var s=iw(e,t,a);return s.charCodeAt(0)==3?s.slice(1):s}function yE(e){var t=qe(2+e.length*8);t.write_shift(2,e.length);for(var a=0;a<e.length;++a)ow(e[a],t);return t}function bE(e){var t=qe(24),a=vr(e[0]);t.write_shift(2,a.r),t.write_shift(2,a.r),t.write_shift(2,a.c),t.write_shift(2,a.c);for(var s="d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),i=0;i<16;++i)t.write_shift(1,parseInt(s[i],16));return Lr([t,eE(e[1])])}function vE(e){var t=e[1].Tooltip,a=qe(10+2*(t.length+1));a.write_shift(2,2048);var s=vr(e[0]);a.write_shift(2,s.r),a.write_shift(2,s.r),a.write_shift(2,s.c),a.write_shift(2,s.c);for(var i=0;i<t.length;++i)a.write_shift(2,t.charCodeAt(i));return a.write_shift(2,0),a}function _E(e){return e||(e=qe(4)),e.write_shift(2,1),e.write_shift(2,1),e}function wE(e,t,a){if(!a.cellStyles)return Ws(e,t);var s=a&&a.biff>=12?4:2,i=e.read_shift(s),d=e.read_shift(s),c=e.read_shift(s),f=e.read_shift(s),g=e.read_shift(2);s==2&&(e.l+=2);var p={s:i,e:d,w:c,ixfe:f,flags:g};return(a.biff>=5||!a.biff)&&(p.level=g>>8&7),p}function kE(e,t){var a=qe(12);a.write_shift(2,t),a.write_shift(2,t),a.write_shift(2,e.width*256),a.write_shift(2,0);var s=0;return e.hidden&&(s|=1),a.write_shift(1,s),s=e.level||0,a.write_shift(1,s),a.write_shift(2,0),a}function NE(e){for(var t=qe(2*e),a=0;a<e;++a)t.write_shift(2,a+1);return t}function jE(e,t,a){var s=qe(15);return S0(s,e,t),s.write_shift(8,a,"f"),s}function SE(e,t,a){var s=qe(9);return S0(s,e,t),s.write_shift(2,a),s}var TE=(function(){var e={1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127,8:865,9:437,10:850,11:437,13:437,14:850,15:437,16:850,17:437,18:850,19:932,20:850,21:437,22:850,23:865,24:437,25:437,26:850,27:437,28:863,29:850,31:852,34:852,35:852,36:860,37:850,38:866,55:850,64:852,77:936,78:949,79:950,80:874,87:1252,88:1252,89:1252,108:863,134:737,135:852,136:857,204:1257,255:16969},t=_p({1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127});function a(f,g){var p=[],x=lo(1);switch(g.type){case"base64":x=bs(yi(f));break;case"binary":x=bs(f);break;case"buffer":case"array":x=f;break}Mn(x,0);var y=x.read_shift(1),_=!!(y&136),k=!1,T=!1;switch(y){case 2:break;case 3:break;case 48:k=!0,_=!0;break;case 49:k=!0,_=!0;break;case 131:break;case 139:break;case 140:T=!0;break;case 245:break;default:throw new Error("DBF Unsupported Version: "+y.toString(16))}var N=0,S=521;y==2&&(N=x.read_shift(2)),x.l+=3,y!=2&&(N=x.read_shift(4)),N>1048576&&(N=1e6),y!=2&&(S=x.read_shift(2));var O=x.read_shift(2),C=g.codepage||1252;y!=2&&(x.l+=16,x.read_shift(1),x[x.l]!==0&&(C=e[x[x.l]]),x.l+=1,x.l+=2),T&&(x.l+=36);for(var A=[],P={},I=Math.min(x.length,y==2?521:S-10-(k?264:0)),ee=T?32:11;x.l<I&&x[x.l]!=13;)switch(P={},P.name=Sf.utils.decode(C,x.slice(x.l,x.l+ee)).replace(/[\u0000\r\n].*$/g,""),x.l+=ee,P.type=String.fromCharCode(x.read_shift(1)),y!=2&&!T&&(P.offset=x.read_shift(4)),P.len=x.read_shift(1),y==2&&(P.offset=x.read_shift(2)),P.dec=x.read_shift(1),P.name.length&&A.push(P),y!=2&&(x.l+=T?13:14),P.type){case"B":(!k||P.len!=8)&&g.WTF&&console.log("Skipping "+P.name+":"+P.type);break;case"G":case"P":g.WTF&&console.log("Skipping "+P.name+":"+P.type);break;case"+":case"0":case"@":case"C":case"D":case"F":case"I":case"L":case"M":case"N":case"O":case"T":case"Y":break;default:throw new Error("Unknown Field Type: "+P.type)}if(x[x.l]!==13&&(x.l=S-1),x.read_shift(1)!==13)throw new Error("DBF Terminator not found "+x.l+" "+x[x.l]);x.l=S;var B=0,H=0;for(p[0]=[],H=0;H!=A.length;++H)p[0][H]=A[H].name;for(;N-- >0;){if(x[x.l]===42){x.l+=O;continue}for(++x.l,p[++B]=[],H=0,H=0;H!=A.length;++H){var Y=x.slice(x.l,x.l+A[H].len);x.l+=A[H].len,Mn(Y,0);var ue=Sf.utils.decode(C,Y);switch(A[H].type){case"C":ue.trim().length&&(p[B][H]=ue.replace(/\s+$/,""));break;case"D":ue.length===8?p[B][H]=new Date(+ue.slice(0,4),+ue.slice(4,6)-1,+ue.slice(6,8)):p[B][H]=ue;break;case"F":p[B][H]=parseFloat(ue.trim());break;case"+":case"I":p[B][H]=T?Y.read_shift(-4,"i")^2147483648:Y.read_shift(4,"i");break;case"L":switch(ue.trim().toUpperCase()){case"Y":case"T":p[B][H]=!0;break;case"N":case"F":p[B][H]=!1;break;case"":case"?":break;default:throw new Error("DBF Unrecognized L:|"+ue+"|")}break;case"M":if(!_)throw new Error("DBF Unexpected MEMO for type "+y.toString(16));p[B][H]="##MEMO##"+(T?parseInt(ue.trim(),10):Y.read_shift(4));break;case"N":ue=ue.replace(/\u0000/g,"").trim(),ue&&ue!="."&&(p[B][H]=+ue||0);break;case"@":p[B][H]=new Date(Y.read_shift(-8,"f")-621356832e5);break;case"T":p[B][H]=new Date((Y.read_shift(4)-2440588)*864e5+Y.read_shift(4));break;case"Y":p[B][H]=Y.read_shift(4,"i")/1e4+Y.read_shift(4,"i")/1e4*Math.pow(2,32);break;case"O":p[B][H]=-Y.read_shift(-8,"f");break;case"B":if(k&&A[H].len==8){p[B][H]=Y.read_shift(8,"f");break}case"G":case"P":Y.l+=A[H].len;break;case"0":if(A[H].name==="_NullFlags")break;default:throw new Error("DBF Unsupported data type "+A[H].type)}}}if(y!=2&&x.l<x.length&&x[x.l++]!=26)throw new Error("DBF EOF Marker missing "+(x.l-1)+" of "+x.length+" "+x[x.l-1].toString(16));return g&&g.sheetRows&&(p=p.slice(0,g.sheetRows)),g.DBF=A,p}function s(f,g){var p=g||{};p.dateNF||(p.dateNF="yyyymmdd");var x=Pc(a(f,p),p);return x["!cols"]=p.DBF.map(function(y){return{wch:y.len,DBF:y}}),delete p.DBF,x}function i(f,g){try{return fo(s(f,g),g)}catch(p){if(g&&g.WTF)throw p}return{SheetNames:[],Sheets:{}}}var d={B:8,C:250,L:1,D:8,"?":0,"":0};function c(f,g){var p=g||{};if(+p.codepage>=0&&r0(+p.codepage),p.type=="string")throw new Error("Cannot write DBF to JS string");var x=pn(),y=zf(f,{header:1,raw:!0,cellDates:!0}),_=y[0],k=y.slice(1),T=f["!cols"]||[],N=0,S=0,O=0,C=1;for(N=0;N<_.length;++N){if(((T[N]||{}).DBF||{}).name){_[N]=T[N].DBF.name,++O;continue}if(_[N]!=null){if(++O,typeof _[N]=="number"&&(_[N]=_[N].toString(10)),typeof _[N]!="string")throw new Error("DBF Invalid column name "+_[N]+" |"+typeof _[N]+"|");if(_.indexOf(_[N])!==N){for(S=0;S<1024;++S)if(_.indexOf(_[N]+"_"+S)==-1){_[N]+="_"+S;break}}}}var A=Ba(f["!ref"]),P=[],I=[],ee=[];for(N=0;N<=A.e.c-A.s.c;++N){var B="",H="",Y=0,ue=[];for(S=0;S<k.length;++S)k[S][N]!=null&&ue.push(k[S][N]);if(ue.length==0||_[N]==null){P[N]="?";continue}for(S=0;S<ue.length;++S){switch(typeof ue[S]){case"number":H="B";break;case"string":H="C";break;case"boolean":H="L";break;case"object":H=ue[S]instanceof Date?"D":"C";break;default:H="C"}Y=Math.max(Y,String(ue[S]).length),B=B&&B!=H?"C":H}Y>250&&(Y=250),H=((T[N]||{}).DBF||{}).type,H=="C"&&T[N].DBF.len>Y&&(Y=T[N].DBF.len),B=="B"&&H=="N"&&(B="N",ee[N]=T[N].DBF.dec,Y=T[N].DBF.len),I[N]=B=="C"||H=="N"?Y:d[B]||0,C+=I[N],P[N]=B}var xe=x.next(32);for(xe.write_shift(4,318902576),xe.write_shift(4,k.length),xe.write_shift(2,296+32*O),xe.write_shift(2,C),N=0;N<4;++N)xe.write_shift(4,0);for(xe.write_shift(4,0|(+t[d2]||3)<<8),N=0,S=0;N<_.length;++N)if(_[N]!=null){var le=x.next(32),ge=(_[N].slice(-10)+"\0\0\0\0\0\0\0\0\0\0\0").slice(0,11);le.write_shift(1,ge,"sbcs"),le.write_shift(1,P[N]=="?"?"C":P[N],"sbcs"),le.write_shift(4,S),le.write_shift(1,I[N]||d[P[N]]||0),le.write_shift(1,ee[N]||0),le.write_shift(1,2),le.write_shift(4,0),le.write_shift(1,0),le.write_shift(4,0),le.write_shift(4,0),S+=I[N]||d[P[N]]||0}var be=x.next(264);for(be.write_shift(4,13),N=0;N<65;++N)be.write_shift(4,0);for(N=0;N<k.length;++N){var me=x.next(C);for(me.write_shift(1,0),S=0;S<_.length;++S)if(_[S]!=null)switch(P[S]){case"L":me.write_shift(1,k[N][S]==null?63:k[N][S]?84:70);break;case"B":me.write_shift(8,k[N][S]||0,"f");break;case"N":var ae="0";for(typeof k[N][S]=="number"&&(ae=k[N][S].toFixed(ee[S]||0)),O=0;O<I[S]-ae.length;++O)me.write_shift(1,32);me.write_shift(1,ae,"sbcs");break;case"D":k[N][S]?(me.write_shift(4,("0000"+k[N][S].getFullYear()).slice(-4),"sbcs"),me.write_shift(2,("00"+(k[N][S].getMonth()+1)).slice(-2),"sbcs"),me.write_shift(2,("00"+k[N][S].getDate()).slice(-2),"sbcs")):me.write_shift(8,"00000000","sbcs");break;case"C":var Z=String(k[N][S]!=null?k[N][S]:"").slice(0,I[S]);for(me.write_shift(1,Z,"sbcs"),O=0;O<I[S]-Z.length;++O)me.write_shift(1,32);break}}return x.next(1).write_shift(1,26),x.end()}return{to_workbook:i,to_sheet:s,from_sheet:c}})(),EE=(function(){var e={AA:"À",BA:"Á",CA:"Â",DA:195,HA:"Ä",JA:197,AE:"È",BE:"É",CE:"Ê",HE:"Ë",AI:"Ì",BI:"Í",CI:"Î",HI:"Ï",AO:"Ò",BO:"Ó",CO:"Ô",DO:213,HO:"Ö",AU:"Ù",BU:"Ú",CU:"Û",HU:"Ü",Aa:"à",Ba:"á",Ca:"â",Da:227,Ha:"ä",Ja:229,Ae:"è",Be:"é",Ce:"ê",He:"ë",Ai:"ì",Bi:"í",Ci:"î",Hi:"ï",Ao:"ò",Bo:"ó",Co:"ô",Do:245,Ho:"ö",Au:"ù",Bu:"ú",Cu:"û",Hu:"ü",KC:"Ç",Kc:"ç",q:"æ",z:"œ",a:"Æ",j:"Œ",DN:209,Dn:241,Hy:255,S:169,c:170,R:174,"B ":180,0:176,1:177,2:178,3:179,5:181,6:182,7:183,Q:185,k:186,b:208,i:216,l:222,s:240,y:248,"!":161,'"':162,"#":163,"(":164,"%":165,"'":167,"H ":168,"+":171,";":187,"<":188,"=":189,">":190,"?":191,"{":223},t=new RegExp("\x1BN("+Fr(e).join("|").replace(/\|\|\|/,"|\\||").replace(/([?()+])/g,"\\$1")+"|\\|)","gm"),a=function(_,k){var T=e[k];return typeof T=="number"?nv(T):T},s=function(_,k,T){var N=k.charCodeAt(0)-32<<4|T.charCodeAt(0)-48;return N==59?_:nv(N)};e["|"]=254;function i(_,k){switch(k.type){case"base64":return d(yi(_),k);case"binary":return d(_,k);case"buffer":return d(pa&&Buffer.isBuffer(_)?_.toString("binary"):_0(_),k);case"array":return d(ah(_),k)}throw new Error("Unrecognized type "+k.type)}function d(_,k){var T=_.split(/[\n\r]+/),N=-1,S=-1,O=0,C=0,A=[],P=[],I=null,ee={},B=[],H=[],Y=[],ue=0,xe;for(+k.codepage>=0&&r0(+k.codepage);O!==T.length;++O){ue=0;var le=T[O].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g,s).replace(t,a),ge=le.replace(/;;/g,"\0").split(";").map(function(J){return J.replace(/\u0000/g,";")}),be=ge[0],me;if(le.length>0)switch(be){case"ID":break;case"E":break;case"B":break;case"O":break;case"W":break;case"P":ge[1].charAt(0)=="P"&&P.push(le.slice(3).replace(/;;/g,";"));break;case"C":var ae=!1,Z=!1,K=!1,te=!1,se=-1,F=-1;for(C=1;C<ge.length;++C)switch(ge[C].charAt(0)){case"A":break;case"X":S=parseInt(ge[C].slice(1))-1,Z=!0;break;case"Y":for(N=parseInt(ge[C].slice(1))-1,Z||(S=0),xe=A.length;xe<=N;++xe)A[xe]=[];break;case"K":me=ge[C].slice(1),me.charAt(0)==='"'?me=me.slice(1,me.length-1):me==="TRUE"?me=!0:me==="FALSE"?me=!1:isNaN(mi(me))?isNaN(s0(me).getDate())||(me=Kr(me)):(me=mi(me),I!==null&&w2(I)&&(me=S2(me))),ae=!0;break;case"E":te=!0;var D=SC(ge[C].slice(1),{r:N,c:S});A[N][S]=[A[N][S],D];break;case"S":K=!0,A[N][S]=[A[N][S],"S5S"];break;case"G":break;case"R":se=parseInt(ge[C].slice(1))-1;break;case"C":F=parseInt(ge[C].slice(1))-1;break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+le)}if(ae&&(A[N][S]&&A[N][S].length==2?A[N][S][0]=me:A[N][S]=me,I=null),K){if(te)throw new Error("SYLK shared formula cannot have own formula");var W=se>-1&&A[se][F];if(!W||!W[1])throw new Error("SYLK shared formula cannot find base");A[N][S][1]=TC(W[1],{r:N-se,c:S-F})}break;case"F":var G=0;for(C=1;C<ge.length;++C)switch(ge[C].charAt(0)){case"X":S=parseInt(ge[C].slice(1))-1,++G;break;case"Y":for(N=parseInt(ge[C].slice(1))-1,xe=A.length;xe<=N;++xe)A[xe]=[];break;case"M":ue=parseInt(ge[C].slice(1))/20;break;case"F":break;case"G":break;case"P":I=P[parseInt(ge[C].slice(1))];break;case"S":break;case"D":break;case"N":break;case"W":for(Y=ge[C].slice(1).split(" "),xe=parseInt(Y[0],10);xe<=parseInt(Y[1],10);++xe)ue=parseInt(Y[2],10),H[xe-1]=ue===0?{hidden:!0}:{wch:ue},Lp(H[xe-1]);break;case"C":S=parseInt(ge[C].slice(1))-1,H[S]||(H[S]={});break;case"R":N=parseInt(ge[C].slice(1))-1,B[N]||(B[N]={}),ue>0?(B[N].hpt=ue,B[N].hpx=hw(ue)):ue===0&&(B[N].hidden=!0);break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+le)}G<1&&(I=null);break;default:if(k&&k.WTF)throw new Error("SYLK bad record "+le)}}return B.length>0&&(ee["!rows"]=B),H.length>0&&(ee["!cols"]=H),k&&k.sheetRows&&(A=A.slice(0,k.sheetRows)),[A,ee]}function c(_,k){var T=i(_,k),N=T[0],S=T[1],O=Pc(N,k);return Fr(S).forEach(function(C){O[C]=S[C]}),O}function f(_,k){return fo(c(_,k),k)}function g(_,k,T,N){var S="C;Y"+(T+1)+";X"+(N+1)+";K";switch(_.t){case"n":S+=_.v||0,_.f&&!_.F&&(S+=";E"+Pp(_.f,{r:T,c:N}));break;case"b":S+=_.v?"TRUE":"FALSE";break;case"e":S+=_.w||_.v;break;case"d":S+='"'+(_.w||_.v)+'"';break;case"s":S+='"'+_.v.replace(/"/g,"").replace(/;/g,";;")+'"';break}return S}function p(_,k){k.forEach(function(T,N){var S="F;W"+(N+1)+" "+(N+1)+" ";T.hidden?S+="0":(typeof T.width=="number"&&!T.wpx&&(T.wpx=Pf(T.width)),typeof T.wpx=="number"&&!T.wch&&(T.wch=Rf(T.wpx)),typeof T.wch=="number"&&(S+=Math.round(T.wch))),S.charAt(S.length-1)!=" "&&_.push(S)})}function x(_,k){k.forEach(function(T,N){var S="F;";T.hidden?S+="M0;":T.hpt?S+="M"+20*T.hpt+";":T.hpx&&(S+="M"+20*Ff(T.hpx)+";"),S.length>2&&_.push(S+"R"+(N+1))})}function y(_,k){var T=["ID;PWXL;N;E"],N=[],S=Ba(_["!ref"]),O,C=Array.isArray(_),A=`\r
|
||
`;T.push("P;PGeneral"),T.push("F;P0;DG0G8;M255"),_["!cols"]&&p(T,_["!cols"]),_["!rows"]&&x(T,_["!rows"]),T.push("B;Y"+(S.e.r-S.s.r+1)+";X"+(S.e.c-S.s.c+1)+";D"+[S.s.c,S.s.r,S.e.c,S.e.r].join(" "));for(var P=S.s.r;P<=S.e.r;++P)for(var I=S.s.c;I<=S.e.c;++I){var ee=ka({r:P,c:I});O=C?(_[P]||[])[I]:_[ee],!(!O||O.v==null&&(!O.f||O.F))&&N.push(g(O,_,P,I))}return T.join(A)+A+N.join(A)+A+"E"+A}return{to_workbook:f,to_sheet:c,from_sheet:y}})(),CE=(function(){function e(d,c){switch(c.type){case"base64":return t(yi(d),c);case"binary":return t(d,c);case"buffer":return t(pa&&Buffer.isBuffer(d)?d.toString("binary"):_0(d),c);case"array":return t(ah(d),c)}throw new Error("Unrecognized type "+c.type)}function t(d,c){for(var f=d.split(`
|
||
`),g=-1,p=-1,x=0,y=[];x!==f.length;++x){if(f[x].trim()==="BOT"){y[++g]=[],p=0;continue}if(!(g<0)){var _=f[x].trim().split(","),k=_[0],T=_[1];++x;for(var N=f[x]||"";(N.match(/["]/g)||[]).length&1&&x<f.length-1;)N+=`
|
||
`+f[++x];switch(N=N.trim(),+k){case-1:if(N==="BOT"){y[++g]=[],p=0;continue}else if(N!=="EOD")throw new Error("Unrecognized DIF special command "+N);break;case 0:N==="TRUE"?y[g][p]=!0:N==="FALSE"?y[g][p]=!1:isNaN(mi(T))?isNaN(s0(T).getDate())?y[g][p]=T:y[g][p]=Kr(T):y[g][p]=mi(T),++p;break;case 1:N=N.slice(1,N.length-1),N=N.replace(/""/g,'"'),N&&N.match(/^=".*"$/)&&(N=N.slice(2,-1)),y[g][p++]=N!==""?N:null;break}if(N==="EOD")break}}return c&&c.sheetRows&&(y=y.slice(0,c.sheetRows)),y}function a(d,c){return Pc(e(d,c),c)}function s(d,c){return fo(a(d,c),c)}var i=(function(){var d=function(g,p,x,y,_){g.push(p),g.push(x+","+y),g.push('"'+_.replace(/"/g,'""')+'"')},c=function(g,p,x,y){g.push(p+","+x),g.push(p==1?'"'+y.replace(/"/g,'""')+'"':y)};return function(g){var p=[],x=Ba(g["!ref"]),y,_=Array.isArray(g);d(p,"TABLE",0,1,"sheetjs"),d(p,"VECTORS",0,x.e.r-x.s.r+1,""),d(p,"TUPLES",0,x.e.c-x.s.c+1,""),d(p,"DATA",0,0,"");for(var k=x.s.r;k<=x.e.r;++k){c(p,-1,0,"BOT");for(var T=x.s.c;T<=x.e.c;++T){var N=ka({r:k,c:T});if(y=_?(g[k]||[])[T]:g[N],!y){c(p,1,0,"");continue}switch(y.t){case"n":var S=y.w;!S&&y.v!=null&&(S=y.v),S==null?y.f&&!y.F?c(p,1,0,"="+y.f):c(p,1,0,""):c(p,0,S,"V");break;case"b":c(p,0,y.v?1:0,y.v?"TRUE":"FALSE");break;case"s":c(p,1,0,isNaN(y.v)?y.v:'="'+y.v+'"');break;case"d":y.w||(y.w=ol(y.z||Ka[14],xn(Kr(y.v)))),c(p,0,y.w,"V");break;default:c(p,1,0,"")}}}c(p,-1,0,"EOD");var O=`\r
|
||
`,C=p.join(O);return C}})();return{to_workbook:s,to_sheet:a,from_sheet:i}})(),cw=(function(){function e(y){return y.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,`
|
||
`)}function t(y){return y.replace(/\\/g,"\\b").replace(/:/g,"\\c").replace(/\n/g,"\\n")}function a(y,_){for(var k=y.split(`
|
||
`),T=-1,N=-1,S=0,O=[];S!==k.length;++S){var C=k[S].trim().split(":");if(C[0]==="cell"){var A=vr(C[1]);if(O.length<=A.r)for(T=O.length;T<=A.r;++T)O[T]||(O[T]=[]);switch(T=A.r,N=A.c,C[2]){case"t":O[T][N]=e(C[3]);break;case"v":O[T][N]=+C[3];break;case"vtf":var P=C[C.length-1];case"vtc":switch(C[3]){case"nl":O[T][N]=!!+C[4];break;default:O[T][N]=+C[4];break}C[2]=="vtf"&&(O[T][N]=[O[T][N],P])}}}return _&&_.sheetRows&&(O=O.slice(0,_.sheetRows)),O}function s(y,_){return Pc(a(y,_),_)}function i(y,_){return fo(s(y,_),_)}var d=["socialcalc:version:1.5","MIME-Version: 1.0","Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"].join(`
|
||
`),c=["--SocialCalcSpreadsheetControlSave","Content-type: text/plain; charset=UTF-8"].join(`
|
||
`)+`
|
||
`,f=["# SocialCalc Spreadsheet Control Save","part:sheet"].join(`
|
||
`),g="--SocialCalcSpreadsheetControlSave--";function p(y){if(!y||!y["!ref"])return"";for(var _=[],k=[],T,N="",S=In(y["!ref"]),O=Array.isArray(y),C=S.s.r;C<=S.e.r;++C)for(var A=S.s.c;A<=S.e.c;++A)if(N=ka({r:C,c:A}),T=O?(y[C]||[])[A]:y[N],!(!T||T.v==null||T.t==="z")){switch(k=["cell",N,"t"],T.t){case"s":case"str":k.push(t(T.v));break;case"n":T.f?(k[2]="vtf",k[3]="n",k[4]=T.v,k[5]=t(T.f)):(k[2]="v",k[3]=T.v);break;case"b":k[2]="vt"+(T.f?"f":"c"),k[3]="nl",k[4]=T.v?"1":"0",k[5]=t(T.f||(T.v?"TRUE":"FALSE"));break;case"d":var P=xn(Kr(T.v));k[2]="vtc",k[3]="nd",k[4]=""+P,k[5]=T.w||ol(T.z||Ka[14],P);break;case"e":continue}_.push(k.join(":"))}return _.push("sheet:c:"+(S.e.c-S.s.c+1)+":r:"+(S.e.r-S.s.r+1)+":tvf:1"),_.push("valueformat:1:text-wiki"),_.join(`
|
||
`)}function x(y){return[d,c,f,c,p(y),g].join(`
|
||
`)}return{to_workbook:i,to_sheet:s,from_sheet:x}})(),AE=(function(){function e(x,y,_,k,T){T.raw?y[_][k]=x:x===""||(x==="TRUE"?y[_][k]=!0:x==="FALSE"?y[_][k]=!1:isNaN(mi(x))?isNaN(s0(x).getDate())?y[_][k]=x:y[_][k]=Kr(x):y[_][k]=mi(x))}function t(x,y){var _=y||{},k=[];if(!x||x.length===0)return k;for(var T=x.split(/[\r\n]/),N=T.length-1;N>=0&&T[N].length===0;)--N;for(var S=10,O=0,C=0;C<=N;++C)O=T[C].indexOf(" "),O==-1?O=T[C].length:O++,S=Math.max(S,O);for(C=0;C<=N;++C){k[C]=[];var A=0;for(e(T[C].slice(0,S).trim(),k,C,A,_),A=1;A<=(T[C].length-S)/10+1;++A)e(T[C].slice(S+(A-1)*10,S+A*10).trim(),k,C,A,_)}return _.sheetRows&&(k=k.slice(0,_.sheetRows)),k}var a={44:",",9:" ",59:";",124:"|"},s={44:3,9:2,59:1,124:0};function i(x){for(var y={},_=!1,k=0,T=0;k<x.length;++k)(T=x.charCodeAt(k))==34?_=!_:!_&&T in a&&(y[T]=(y[T]||0)+1);T=[];for(k in y)Object.prototype.hasOwnProperty.call(y,k)&&T.push([y[k],k]);if(!T.length){y=s;for(k in y)Object.prototype.hasOwnProperty.call(y,k)&&T.push([y[k],k])}return T.sort(function(N,S){return N[0]-S[0]||s[N[1]]-s[S[1]]}),a[T.pop()[1]]||44}function d(x,y){var _=y||{},k="",T=_.dense?[]:{},N={s:{c:0,r:0},e:{c:0,r:0}};x.slice(0,4)=="sep="?x.charCodeAt(5)==13&&x.charCodeAt(6)==10?(k=x.charAt(4),x=x.slice(7)):x.charCodeAt(5)==13||x.charCodeAt(5)==10?(k=x.charAt(4),x=x.slice(6)):k=i(x.slice(0,1024)):_&&_.FS?k=_.FS:k=i(x.slice(0,1024));var S=0,O=0,C=0,A=0,P=0,I=k.charCodeAt(0),ee=!1,B=0,H=x.charCodeAt(0);x=x.replace(/\r\n/mg,`
|
||
`);var Y=_.dateNF!=null?G5(_.dateNF):null;function ue(){var xe=x.slice(A,P),le={};if(xe.charAt(0)=='"'&&xe.charAt(xe.length-1)=='"'&&(xe=xe.slice(1,-1).replace(/""/g,'"')),xe.length===0)le.t="z";else if(_.raw)le.t="s",le.v=xe;else if(xe.trim().length===0)le.t="s",le.v=xe;else if(xe.charCodeAt(0)==61)xe.charCodeAt(1)==34&&xe.charCodeAt(xe.length-1)==34?(le.t="s",le.v=xe.slice(2,-1).replace(/""/g,'"')):EC(xe)?(le.t="n",le.f=xe.slice(1)):(le.t="s",le.v=xe);else if(xe=="TRUE")le.t="b",le.v=!0;else if(xe=="FALSE")le.t="b",le.v=!1;else if(!isNaN(C=mi(xe)))le.t="n",_.cellText!==!1&&(le.w=xe),le.v=C;else if(!isNaN(s0(xe).getDate())||Y&&xe.match(Y)){le.z=_.dateNF||Ka[14];var ge=0;Y&&xe.match(Y)&&(xe=Z5(xe,_.dateNF,xe.match(Y)||[]),ge=1),_.cellDates?(le.t="d",le.v=Kr(xe,ge)):(le.t="n",le.v=xn(Kr(xe,ge))),_.cellText!==!1&&(le.w=ol(le.z,le.v instanceof Date?xn(le.v):le.v)),_.cellNF||delete le.z}else le.t="s",le.v=xe;if(le.t=="z"||(_.dense?(T[S]||(T[S]=[]),T[S][O]=le):T[ka({c:O,r:S})]=le),A=P+1,H=x.charCodeAt(A),N.e.c<O&&(N.e.c=O),N.e.r<S&&(N.e.r=S),B==I)++O;else if(O=0,++S,_.sheetRows&&_.sheetRows<=S)return!0}e:for(;P<x.length;++P)switch(B=x.charCodeAt(P)){case 34:H===34&&(ee=!ee);break;case I:case 10:case 13:if(!ee&&ue())break e;break}return P-A>0&&ue(),T["!ref"]=cr(N),T}function c(x,y){return!(y&&y.PRN)||y.FS||x.slice(0,4)=="sep="||x.indexOf(" ")>=0||x.indexOf(",")>=0||x.indexOf(";")>=0?d(x,y):Pc(t(x,y),y)}function f(x,y){var _="",k=y.type=="string"?[0,0,0,0]:H9(x,y);switch(y.type){case"base64":_=yi(x);break;case"binary":_=x;break;case"buffer":y.codepage==65001?_=x.toString("utf8"):y.codepage&&typeof Sf!="undefined"||(_=pa&&Buffer.isBuffer(x)?x.toString("binary"):_0(x));break;case"array":_=ah(x);break;case"string":_=x;break;default:throw new Error("Unrecognized type "+y.type)}return k[0]==239&&k[1]==187&&k[2]==191?_=Yd(_.slice(3)):y.type!="string"&&y.type!="buffer"&&y.codepage==65001?_=Yd(_):y.type=="binary",_.slice(0,19)=="socialcalc:version:"?cw.to_sheet(y.type=="string"?_:Yd(_),y):c(_,y)}function g(x,y){return fo(f(x,y),y)}function p(x){for(var y=[],_=Ba(x["!ref"]),k,T=Array.isArray(x),N=_.s.r;N<=_.e.r;++N){for(var S=[],O=_.s.c;O<=_.e.c;++O){var C=ka({r:N,c:O});if(k=T?(x[N]||[])[O]:x[C],!k||k.v==null){S.push(" ");continue}for(var A=(k.w||(bi(k),k.w)||"").slice(0,10);A.length<10;)A+=" ";S.push(A+(O===0?" ":""))}y.push(S.join(""))}return y.join(`
|
||
`)}return{to_workbook:g,to_sheet:f,from_sheet:p}})(),Pv=(function(){function e(D,W,G){if(D){Mn(D,D.l||0);for(var J=G.Enum||se;D.l<D.length;){var de=D.read_shift(2),De=J[de]||J[65535],Ne=D.read_shift(2),$e=D.l+Ne,Ve=De.f&&De.f(D,Ne,G);if(D.l=$e,W(Ve,De,de))return}}}function t(D,W){switch(W.type){case"base64":return a(bs(yi(D)),W);case"binary":return a(bs(D),W);case"buffer":case"array":return a(D,W)}throw"Unsupported type "+W.type}function a(D,W){if(!D)return D;var G=W||{},J=G.dense?[]:{},de="Sheet1",De="",Ne=0,$e={},Ve=[],st=[],gt={s:{r:0,c:0},e:{r:0,c:0}},zt=G.sheetRows||0;if(D[2]==0&&(D[3]==8||D[3]==9)&&D.length>=16&&D[14]==5&&D[15]===108)throw new Error("Unsupported Works 3 for Mac file");if(D[2]==2)G.Enum=se,e(D,function(Ue,ce,we){switch(we){case 0:G.vers=Ue,Ue>=4096&&(G.qpro=!0);break;case 6:gt=Ue;break;case 204:Ue&&(De=Ue);break;case 222:De=Ue;break;case 15:case 51:G.qpro||(Ue[1].v=Ue[1].v.slice(1));case 13:case 14:case 16:we==14&&(Ue[2]&112)==112&&(Ue[2]&15)>1&&(Ue[2]&15)<15&&(Ue[1].z=G.dateNF||Ka[14],G.cellDates&&(Ue[1].t="d",Ue[1].v=S2(Ue[1].v))),G.qpro&&Ue[3]>Ne&&(J["!ref"]=cr(gt),$e[de]=J,Ve.push(de),J=G.dense?[]:{},gt={s:{r:0,c:0},e:{r:0,c:0}},Ne=Ue[3],de=De||"Sheet"+(Ne+1),De="");var Ie=G.dense?(J[Ue[0].r]||[])[Ue[0].c]:J[ka(Ue[0])];if(Ie){Ie.t=Ue[1].t,Ie.v=Ue[1].v,Ue[1].z!=null&&(Ie.z=Ue[1].z),Ue[1].f!=null&&(Ie.f=Ue[1].f);break}G.dense?(J[Ue[0].r]||(J[Ue[0].r]=[]),J[Ue[0].r][Ue[0].c]=Ue[1]):J[ka(Ue[0])]=Ue[1];break}},G);else if(D[2]==26||D[2]==14)G.Enum=F,D[2]==14&&(G.qpro=!0,D.l=0),e(D,function(Ue,ce,we){switch(we){case 204:de=Ue;break;case 22:Ue[1].v=Ue[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if(Ue[3]>Ne&&(J["!ref"]=cr(gt),$e[de]=J,Ve.push(de),J=G.dense?[]:{},gt={s:{r:0,c:0},e:{r:0,c:0}},Ne=Ue[3],de="Sheet"+(Ne+1)),zt>0&&Ue[0].r>=zt)break;G.dense?(J[Ue[0].r]||(J[Ue[0].r]=[]),J[Ue[0].r][Ue[0].c]=Ue[1]):J[ka(Ue[0])]=Ue[1],gt.e.c<Ue[0].c&&(gt.e.c=Ue[0].c),gt.e.r<Ue[0].r&&(gt.e.r=Ue[0].r);break;case 27:Ue[14e3]&&(st[Ue[14e3][0]]=Ue[14e3][1]);break;case 1537:st[Ue[0]]=Ue[1],Ue[0]==Ne&&(de=Ue[1]);break}},G);else throw new Error("Unrecognized LOTUS BOF "+D[2]);if(J["!ref"]=cr(gt),$e[De||de]=J,Ve.push(De||de),!st.length)return{SheetNames:Ve,Sheets:$e};for(var Ge={},Ct=[],St=0;St<st.length;++St)$e[Ve[St]]?(Ct.push(st[St]||Ve[St]),Ge[st[St]]=$e[st[St]]||$e[Ve[St]]):(Ct.push(st[St]),Ge[st[St]]={"!ref":"A1"});return{SheetNames:Ct,Sheets:Ge}}function s(D,W){var G=W||{};if(+G.codepage>=0&&r0(+G.codepage),G.type=="string")throw new Error("Cannot write WK1 to JS string");var J=pn(),de=Ba(D["!ref"]),De=Array.isArray(D),Ne=[];mt(J,0,d(1030)),mt(J,6,g(de));for(var $e=Math.min(de.e.r,8191),Ve=de.s.r;Ve<=$e;++Ve)for(var st=Pr(Ve),gt=de.s.c;gt<=de.e.c;++gt){Ve===de.s.r&&(Ne[gt]=$r(gt));var zt=Ne[gt]+st,Ge=De?(D[Ve]||[])[gt]:D[zt];if(!(!Ge||Ge.t=="z"))if(Ge.t=="n")(Ge.v|0)==Ge.v&&Ge.v>=-32768&&Ge.v<=32767?mt(J,13,k(Ve,gt,Ge.v)):mt(J,14,N(Ve,gt,Ge.v));else{var Ct=bi(Ge);mt(J,15,y(Ve,gt,Ct.slice(0,239)))}}return mt(J,1),J.end()}function i(D,W){var G=W||{};if(+G.codepage>=0&&r0(+G.codepage),G.type=="string")throw new Error("Cannot write WK3 to JS string");var J=pn();mt(J,0,c(D));for(var de=0,De=0;de<D.SheetNames.length;++de)(D.Sheets[D.SheetNames[de]]||{})["!ref"]&&mt(J,27,te(D.SheetNames[de],De++));var Ne=0;for(de=0;de<D.SheetNames.length;++de){var $e=D.Sheets[D.SheetNames[de]];if(!(!$e||!$e["!ref"])){for(var Ve=Ba($e["!ref"]),st=Array.isArray($e),gt=[],zt=Math.min(Ve.e.r,8191),Ge=Ve.s.r;Ge<=zt;++Ge)for(var Ct=Pr(Ge),St=Ve.s.c;St<=Ve.e.c;++St){Ge===Ve.s.r&&(gt[St]=$r(St));var Ue=gt[St]+Ct,ce=st?($e[Ge]||[])[St]:$e[Ue];if(!(!ce||ce.t=="z"))if(ce.t=="n")mt(J,23,ue(Ge,St,Ne,ce.v));else{var we=bi(ce);mt(J,22,B(Ge,St,Ne,we.slice(0,239)))}}++Ne}}return mt(J,1),J.end()}function d(D){var W=qe(2);return W.write_shift(2,D),W}function c(D){var W=qe(26);W.write_shift(2,4096),W.write_shift(2,4),W.write_shift(4,0);for(var G=0,J=0,de=0,De=0;De<D.SheetNames.length;++De){var Ne=D.SheetNames[De],$e=D.Sheets[Ne];if(!(!$e||!$e["!ref"])){++de;var Ve=In($e["!ref"]);G<Ve.e.r&&(G=Ve.e.r),J<Ve.e.c&&(J=Ve.e.c)}}return G>8191&&(G=8191),W.write_shift(2,G),W.write_shift(1,de),W.write_shift(1,J),W.write_shift(2,0),W.write_shift(2,0),W.write_shift(1,1),W.write_shift(1,2),W.write_shift(4,0),W.write_shift(4,0),W}function f(D,W,G){var J={s:{c:0,r:0},e:{c:0,r:0}};return W==8&&G.qpro?(J.s.c=D.read_shift(1),D.l++,J.s.r=D.read_shift(2),J.e.c=D.read_shift(1),D.l++,J.e.r=D.read_shift(2),J):(J.s.c=D.read_shift(2),J.s.r=D.read_shift(2),W==12&&G.qpro&&(D.l+=2),J.e.c=D.read_shift(2),J.e.r=D.read_shift(2),W==12&&G.qpro&&(D.l+=2),J.s.c==65535&&(J.s.c=J.e.c=J.s.r=J.e.r=0),J)}function g(D){var W=qe(8);return W.write_shift(2,D.s.c),W.write_shift(2,D.s.r),W.write_shift(2,D.e.c),W.write_shift(2,D.e.r),W}function p(D,W,G){var J=[{c:0,r:0},{t:"n",v:0},0,0];return G.qpro&&G.vers!=20768?(J[0].c=D.read_shift(1),J[3]=D.read_shift(1),J[0].r=D.read_shift(2),D.l+=2):(J[2]=D.read_shift(1),J[0].c=D.read_shift(2),J[0].r=D.read_shift(2)),J}function x(D,W,G){var J=D.l+W,de=p(D,W,G);if(de[1].t="s",G.vers==20768){D.l++;var De=D.read_shift(1);return de[1].v=D.read_shift(De,"utf8"),de}return G.qpro&&D.l++,de[1].v=D.read_shift(J-D.l,"cstr"),de}function y(D,W,G){var J=qe(7+G.length);J.write_shift(1,255),J.write_shift(2,W),J.write_shift(2,D),J.write_shift(1,39);for(var de=0;de<J.length;++de){var De=G.charCodeAt(de);J.write_shift(1,De>=128?95:De)}return J.write_shift(1,0),J}function _(D,W,G){var J=p(D,W,G);return J[1].v=D.read_shift(2,"i"),J}function k(D,W,G){var J=qe(7);return J.write_shift(1,255),J.write_shift(2,W),J.write_shift(2,D),J.write_shift(2,G,"i"),J}function T(D,W,G){var J=p(D,W,G);return J[1].v=D.read_shift(8,"f"),J}function N(D,W,G){var J=qe(13);return J.write_shift(1,255),J.write_shift(2,W),J.write_shift(2,D),J.write_shift(8,G,"f"),J}function S(D,W,G){var J=D.l+W,de=p(D,W,G);if(de[1].v=D.read_shift(8,"f"),G.qpro)D.l=J;else{var De=D.read_shift(2);P(D.slice(D.l,D.l+De),de),D.l+=De}return de}function O(D,W,G){var J=W&32768;return W&=-32769,W=(J?D:0)+(W>=8192?W-16384:W),(J?"":"$")+(G?$r(W):Pr(W))}var C={51:["FALSE",0],52:["TRUE",0],70:["LEN",1],80:["SUM",69],81:["AVERAGEA",69],82:["COUNTA",69],83:["MINA",69],84:["MAXA",69],111:["T",1]},A=["","","","","","","","","","+","-","*","/","^","=","<>","<=",">=","<",">","","","","","&","","","","","","",""];function P(D,W){Mn(D,0);for(var G=[],J=0,de="",De="",Ne="",$e="";D.l<D.length;){var Ve=D[D.l++];switch(Ve){case 0:G.push(D.read_shift(8,"f"));break;case 1:De=O(W[0].c,D.read_shift(2),!0),de=O(W[0].r,D.read_shift(2),!1),G.push(De+de);break;case 2:{var st=O(W[0].c,D.read_shift(2),!0),gt=O(W[0].r,D.read_shift(2),!1);De=O(W[0].c,D.read_shift(2),!0),de=O(W[0].r,D.read_shift(2),!1),G.push(st+gt+":"+De+de)}break;case 3:if(D.l<D.length){console.error("WK1 premature formula end");return}break;case 4:G.push("("+G.pop()+")");break;case 5:G.push(D.read_shift(2));break;case 6:{for(var zt="";Ve=D[D.l++];)zt+=String.fromCharCode(Ve);G.push('"'+zt.replace(/"/g,'""')+'"')}break;case 8:G.push("-"+G.pop());break;case 23:G.push("+"+G.pop());break;case 22:G.push("NOT("+G.pop()+")");break;case 20:case 21:$e=G.pop(),Ne=G.pop(),G.push(["AND","OR"][Ve-20]+"("+Ne+","+$e+")");break;default:if(Ve<32&&A[Ve])$e=G.pop(),Ne=G.pop(),G.push(Ne+A[Ve]+$e);else if(C[Ve]){if(J=C[Ve][1],J==69&&(J=D[D.l++]),J>G.length){console.error("WK1 bad formula parse 0x"+Ve.toString(16)+":|"+G.join("|")+"|");return}var Ge=G.slice(-J);G.length-=J,G.push(C[Ve][0]+"("+Ge.join(",")+")")}else return Ve<=7?console.error("WK1 invalid opcode "+Ve.toString(16)):Ve<=24?console.error("WK1 unsupported op "+Ve.toString(16)):Ve<=30?console.error("WK1 invalid opcode "+Ve.toString(16)):Ve<=115?console.error("WK1 unsupported function opcode "+Ve.toString(16)):console.error("WK1 unrecognized opcode "+Ve.toString(16))}}G.length==1?W[1].f=""+G[0]:console.error("WK1 bad formula parse |"+G.join("|")+"|")}function I(D){var W=[{c:0,r:0},{t:"n",v:0},0];return W[0].r=D.read_shift(2),W[3]=D[D.l++],W[0].c=D[D.l++],W}function ee(D,W){var G=I(D);return G[1].t="s",G[1].v=D.read_shift(W-4,"cstr"),G}function B(D,W,G,J){var de=qe(6+J.length);de.write_shift(2,D),de.write_shift(1,G),de.write_shift(1,W),de.write_shift(1,39);for(var De=0;De<J.length;++De){var Ne=J.charCodeAt(De);de.write_shift(1,Ne>=128?95:Ne)}return de.write_shift(1,0),de}function H(D,W){var G=I(D);G[1].v=D.read_shift(2);var J=G[1].v>>1;if(G[1].v&1)switch(J&7){case 0:J=(J>>3)*5e3;break;case 1:J=(J>>3)*500;break;case 2:J=(J>>3)/20;break;case 3:J=(J>>3)/200;break;case 4:J=(J>>3)/2e3;break;case 5:J=(J>>3)/2e4;break;case 6:J=(J>>3)/16;break;case 7:J=(J>>3)/64;break}return G[1].v=J,G}function Y(D,W){var G=I(D),J=D.read_shift(4),de=D.read_shift(4),De=D.read_shift(2);if(De==65535)return J===0&&de===3221225472?(G[1].t="e",G[1].v=15):J===0&&de===3489660928?(G[1].t="e",G[1].v=42):G[1].v=0,G;var Ne=De&32768;return De=(De&32767)-16446,G[1].v=(1-Ne*2)*(de*Math.pow(2,De+32)+J*Math.pow(2,De)),G}function ue(D,W,G,J){var de=qe(14);if(de.write_shift(2,D),de.write_shift(1,G),de.write_shift(1,W),J==0)return de.write_shift(4,0),de.write_shift(4,0),de.write_shift(2,65535),de;var De=0,Ne=0,$e=0,Ve=0;return J<0&&(De=1,J=-J),Ne=Math.log2(J)|0,J/=Math.pow(2,Ne-31),Ve=J>>>0,(Ve&2147483648)==0&&(J/=2,++Ne,Ve=J>>>0),J-=Ve,Ve|=2147483648,Ve>>>=0,J*=Math.pow(2,32),$e=J>>>0,de.write_shift(4,$e),de.write_shift(4,Ve),Ne+=16383+(De?32768:0),de.write_shift(2,Ne),de}function xe(D,W){var G=Y(D);return D.l+=W-14,G}function le(D,W){var G=I(D),J=D.read_shift(4);return G[1].v=J>>6,G}function ge(D,W){var G=I(D),J=D.read_shift(8,"f");return G[1].v=J,G}function be(D,W){var G=ge(D);return D.l+=W-10,G}function me(D,W){return D[D.l+W-1]==0?D.read_shift(W,"cstr"):""}function ae(D,W){var G=D[D.l++];G>W-1&&(G=W-1);for(var J="";J.length<G;)J+=String.fromCharCode(D[D.l++]);return J}function Z(D,W,G){if(!(!G.qpro||W<21)){var J=D.read_shift(1);D.l+=17,D.l+=1,D.l+=2;var de=D.read_shift(W-21,"cstr");return[J,de]}}function K(D,W){for(var G={},J=D.l+W;D.l<J;){var de=D.read_shift(2);if(de==14e3){for(G[de]=[0,""],G[de][0]=D.read_shift(2);D[D.l];)G[de][1]+=String.fromCharCode(D[D.l]),D.l++;D.l++}}return G}function te(D,W){var G=qe(5+D.length);G.write_shift(2,14e3),G.write_shift(2,W);for(var J=0;J<D.length;++J){var de=D.charCodeAt(J);G[G.l++]=de>127?95:de}return G[G.l++]=0,G}var se={0:{n:"BOF",f:nw},1:{n:"EOF"},2:{n:"CALCMODE"},3:{n:"CALCORDER"},4:{n:"SPLIT"},5:{n:"SYNC"},6:{n:"RANGE",f},7:{n:"WINDOW1"},8:{n:"COLW1"},9:{n:"WINTWO"},10:{n:"COLW2"},11:{n:"NAME"},12:{n:"BLANK"},13:{n:"INTEGER",f:_},14:{n:"NUMBER",f:T},15:{n:"LABEL",f:x},16:{n:"FORMULA",f:S},24:{n:"TABLE"},25:{n:"ORANGE"},26:{n:"PRANGE"},27:{n:"SRANGE"},28:{n:"FRANGE"},29:{n:"KRANGE1"},32:{n:"HRANGE"},35:{n:"KRANGE2"},36:{n:"PROTEC"},37:{n:"FOOTER"},38:{n:"HEADER"},39:{n:"SETUP"},40:{n:"MARGINS"},41:{n:"LABELFMT"},42:{n:"TITLES"},43:{n:"SHEETJS"},45:{n:"GRAPH"},46:{n:"NGRAPH"},47:{n:"CALCCOUNT"},48:{n:"UNFORMATTED"},49:{n:"CURSORW12"},50:{n:"WINDOW"},51:{n:"STRING",f:x},55:{n:"PASSWORD"},56:{n:"LOCKED"},60:{n:"QUERY"},61:{n:"QUERYNAME"},62:{n:"PRINT"},63:{n:"PRINTNAME"},64:{n:"GRAPH2"},65:{n:"GRAPHNAME"},66:{n:"ZOOM"},67:{n:"SYMSPLIT"},68:{n:"NSROWS"},69:{n:"NSCOLS"},70:{n:"RULER"},71:{n:"NNAME"},72:{n:"ACOMM"},73:{n:"AMACRO"},74:{n:"PARSE"},102:{n:"PRANGES??"},103:{n:"RRANGES??"},104:{n:"FNAME??"},105:{n:"MRANGES??"},204:{n:"SHEETNAMECS",f:me},222:{n:"SHEETNAMELP",f:ae},65535:{n:""}},F={0:{n:"BOF"},1:{n:"EOF"},2:{n:"PASSWORD"},3:{n:"CALCSET"},4:{n:"WINDOWSET"},5:{n:"SHEETCELLPTR"},6:{n:"SHEETLAYOUT"},7:{n:"COLUMNWIDTH"},8:{n:"HIDDENCOLUMN"},9:{n:"USERRANGE"},10:{n:"SYSTEMRANGE"},11:{n:"ZEROFORCE"},12:{n:"SORTKEYDIR"},13:{n:"FILESEAL"},14:{n:"DATAFILLNUMS"},15:{n:"PRINTMAIN"},16:{n:"PRINTSTRING"},17:{n:"GRAPHMAIN"},18:{n:"GRAPHSTRING"},19:{n:"??"},20:{n:"ERRCELL"},21:{n:"NACELL"},22:{n:"LABEL16",f:ee},23:{n:"NUMBER17",f:Y},24:{n:"NUMBER18",f:H},25:{n:"FORMULA19",f:xe},26:{n:"FORMULA1A"},27:{n:"XFORMAT",f:K},28:{n:"DTLABELMISC"},29:{n:"DTLABELCELL"},30:{n:"GRAPHWINDOW"},31:{n:"CPA"},32:{n:"LPLAUTO"},33:{n:"QUERY"},34:{n:"HIDDENSHEET"},35:{n:"??"},37:{n:"NUMBER25",f:le},38:{n:"??"},39:{n:"NUMBER27",f:ge},40:{n:"FORMULA28",f:be},142:{n:"??"},147:{n:"??"},150:{n:"??"},151:{n:"??"},152:{n:"??"},153:{n:"??"},154:{n:"??"},155:{n:"??"},156:{n:"??"},163:{n:"??"},174:{n:"??"},175:{n:"??"},176:{n:"??"},177:{n:"??"},184:{n:"??"},185:{n:"??"},186:{n:"??"},187:{n:"??"},188:{n:"??"},195:{n:"??"},201:{n:"??"},204:{n:"SHEETNAMECS",f:me},205:{n:"??"},206:{n:"??"},207:{n:"??"},208:{n:"??"},256:{n:"??"},259:{n:"??"},260:{n:"??"},261:{n:"??"},262:{n:"??"},263:{n:"??"},265:{n:"??"},266:{n:"??"},267:{n:"??"},268:{n:"??"},270:{n:"??"},271:{n:"??"},384:{n:"??"},389:{n:"??"},390:{n:"??"},393:{n:"??"},396:{n:"??"},512:{n:"??"},514:{n:"??"},513:{n:"??"},516:{n:"??"},517:{n:"??"},640:{n:"??"},641:{n:"??"},642:{n:"??"},643:{n:"??"},644:{n:"??"},645:{n:"??"},646:{n:"??"},647:{n:"??"},648:{n:"??"},658:{n:"??"},659:{n:"??"},660:{n:"??"},661:{n:"??"},662:{n:"??"},665:{n:"??"},666:{n:"??"},768:{n:"??"},772:{n:"??"},1537:{n:"SHEETINFOQP",f:Z},1600:{n:"??"},1602:{n:"??"},1793:{n:"??"},1794:{n:"??"},1795:{n:"??"},1796:{n:"??"},1920:{n:"??"},2048:{n:"??"},2049:{n:"??"},2052:{n:"??"},2688:{n:"??"},10998:{n:"??"},12849:{n:"??"},28233:{n:"??"},28484:{n:"??"},65535:{n:""}};return{sheet_to_wk1:s,book_to_wk3:i,to_workbook:t}})(),OE=/^\s|\s$|[\t\n\r]/;function dw(e,t){if(!t.bookSST)return"";var a=[dr];a[a.length]=ht("sst",null,{xmlns:Dc[0],count:e.Count,uniqueCount:e.Unique});for(var s=0;s!=e.length;++s)if(e[s]!=null){var i=e[s],d="<si>";i.r?d+=i.r:(d+="<t",i.t||(i.t=""),i.t.match(OE)&&(d+=' xml:space="preserve"'),d+=">"+wa(i.t)+"</t>"),d+="</si>",a[a.length]=d}return a.length>2&&(a[a.length]="</sst>",a[1]=a[1].replace("/>",">")),a.join("")}function ME(e){return[e.read_shift(4),e.read_shift(4)]}function LE(e,t){return t||(t=qe(8)),t.write_shift(4,e.Count),t.write_shift(4,e.Unique),t}var DE=NT;function PE(e){var t=pn();nt(t,159,LE(e));for(var a=0;a<e.length;++a)nt(t,19,DE(e[a]));return nt(t,160),t.end()}function RE(e){for(var t=[],a=e.split(""),s=0;s<a.length;++s)t[s]=a[s].charCodeAt(0);return t}function uw(e){var t=0,a,s=RE(e),i=s.length+1,d,c,f,g,p;for(a=lo(i),a[0]=s.length,d=1;d!=i;++d)a[d]=s[d-1];for(d=i-1;d>=0;--d)c=a[d],f=(t&16384)===0?0:1,g=t<<1&32767,p=f|g,t=p^c;return t^52811}var FE=(function(){function e(i,d){switch(d.type){case"base64":return t(yi(i),d);case"binary":return t(i,d);case"buffer":return t(pa&&Buffer.isBuffer(i)?i.toString("binary"):_0(i),d);case"array":return t(ah(i),d)}throw new Error("Unrecognized type "+d.type)}function t(i,d){var c=d||{},f=c.dense?[]:{},g=i.match(/\\trowd.*?\\row\b/g);if(!g.length)throw new Error("RTF missing table");var p={s:{c:0,r:0},e:{c:0,r:g.length-1}};return g.forEach(function(x,y){Array.isArray(f)&&(f[y]=[]);for(var _=/\\\w+\b/g,k=0,T,N=-1;T=_.exec(x);){switch(T[0]){case"\\cell":var S=x.slice(k,_.lastIndex-T[0].length);if(S[0]==" "&&(S=S.slice(1)),++N,S.length){var O={v:S,t:"s"};Array.isArray(f)?f[y][N]=O:f[ka({r:y,c:N})]=O}break}k=_.lastIndex}N>p.e.c&&(p.e.c=N)}),f["!ref"]=cr(p),f}function a(i,d){return fo(e(i,d),d)}function s(i){for(var d=["{\\rtf1\\ansi"],c=Ba(i["!ref"]),f,g=Array.isArray(i),p=c.s.r;p<=c.e.r;++p){d.push("\\trowd\\trautofit1");for(var x=c.s.c;x<=c.e.c;++x)d.push("\\cellx"+(x+1));for(d.push("\\pard\\intbl"),x=c.s.c;x<=c.e.c;++x){var y=ka({r:p,c:x});f=g?(i[p]||[])[x]:i[y],!(!f||f.v==null&&(!f.f||f.F))&&(d.push(" "+(f.w||(bi(f),f.w))),d.push("\\cell"))}d.push("\\pard\\intbl\\row")}return d.join("")+"}"}return{to_workbook:a,to_sheet:e,from_sheet:s}})();function Rv(e){for(var t=0,a=1;t!=3;++t)a=a*256+(e[t]>255?255:e[t]<0?0:e[t]);return a.toString(16).toUpperCase().slice(1)}var IE=6,gi=IE;function Pf(e){return Math.floor((e+Math.round(128/gi)/256)*gi)}function Rf(e){return Math.floor((e-5)/gi*100+.5)/100}function Kg(e){return Math.round((e*gi+5)/gi*256)/256}function Lp(e){e.width?(e.wpx=Pf(e.width),e.wch=Rf(e.wpx),e.MDW=gi):e.wpx?(e.wch=Rf(e.wpx),e.width=Kg(e.wch),e.MDW=gi):typeof e.wch=="number"&&(e.width=Kg(e.wch),e.wpx=Pf(e.width),e.MDW=gi),e.customWidth&&delete e.customWidth}var zE=96,fw=zE;function Ff(e){return e*96/fw}function hw(e){return e*fw/96}function BE(e){var t=["<numFmts>"];return[[5,8],[23,26],[41,44],[50,392]].forEach(function(a){for(var s=a[0];s<=a[1];++s)e[s]!=null&&(t[t.length]=ht("numFmt",null,{numFmtId:s,formatCode:wa(e[s])}))}),t.length===1?"":(t[t.length]="</numFmts>",t[0]=ht("numFmts",null,{count:t.length-2}).replace("/>",">"),t.join(""))}function UE(e){var t=[];return t[t.length]=ht("cellXfs",null),e.forEach(function(a){t[t.length]=ht("xf",null,a)}),t[t.length]="</cellXfs>",t.length===2?"":(t[0]=ht("cellXfs",null,{count:t.length-2}).replace("/>",">"),t.join(""))}function mw(e,t){var a=[dr,ht("styleSheet",null,{xmlns:Dc[0],"xmlns:vt":br.vt})],s;return e.SSF&&(s=BE(e.SSF))!=null&&(a[a.length]=s),a[a.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>',a[a.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>',a[a.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>',a[a.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>',(s=UE(t.cellXfs))&&(a[a.length]=s),a[a.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>',a[a.length]='<dxfs count="0"/>',a[a.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>',a.length>2&&(a[a.length]="</styleSheet>",a[1]=a[1].replace("/>",">")),a.join("")}function HE(e,t){var a=e.read_shift(2),s=Wr(e);return[a,s]}function $E(e,t,a){a||(a=qe(6+4*t.length)),a.write_shift(2,e),_r(t,a);var s=a.length>a.l?a.slice(0,a.l):a;return a.l==null&&(a.l=a.length),s}function WE(e,t,a){var s={};s.sz=e.read_shift(2)/20;var i=OT(e);i.fItalic&&(s.italic=1),i.fCondense&&(s.condense=1),i.fExtend&&(s.extend=1),i.fShadow&&(s.shadow=1),i.fOutline&&(s.outline=1),i.fStrikeout&&(s.strike=1);var d=e.read_shift(2);switch(d===700&&(s.bold=1),e.read_shift(2)){case 1:s.vertAlign="superscript";break;case 2:s.vertAlign="subscript";break}var c=e.read_shift(1);c!=0&&(s.underline=c);var f=e.read_shift(1);f>0&&(s.family=f);var g=e.read_shift(1);switch(g>0&&(s.charset=g),e.l++,s.color=AT(e),e.read_shift(1)){case 1:s.scheme="major";break;case 2:s.scheme="minor";break}return s.name=Wr(e),s}function VE(e,t){t||(t=qe(153)),t.write_shift(2,e.sz*20),MT(e,t),t.write_shift(2,e.bold?700:400);var a=0;e.vertAlign=="superscript"?a=1:e.vertAlign=="subscript"&&(a=2),t.write_shift(2,a),t.write_shift(1,e.underline||0),t.write_shift(1,e.family||0),t.write_shift(1,e.charset||0),t.write_shift(1,0),Lf(e.color,t);var s=0;return s=2,t.write_shift(1,s),_r(e.name,t),t.length>t.l?t.slice(0,t.l):t}var GE=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],Eg,ZE=Ws;function Fv(e,t){t||(t=qe(84)),Eg||(Eg=_p(GE));var a=Eg[e.patternType];a==null&&(a=40),t.write_shift(4,a);var s=0;if(a!=40)for(Lf({auto:1},t),Lf({auto:1},t);s<12;++s)t.write_shift(4,0);else{for(;s<4;++s)t.write_shift(4,0);for(;s<12;++s)t.write_shift(4,0)}return t.length>t.l?t.slice(0,t.l):t}function qE(e,t){var a=e.l+t,s=e.read_shift(2),i=e.read_shift(2);return e.l=a,{ixfe:s,numFmtId:i}}function gw(e,t,a){a||(a=qe(16)),a.write_shift(2,t||0),a.write_shift(2,e.numFmtId||0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(1,0),a.write_shift(1,0);var s=0;return a.write_shift(1,s),a.write_shift(1,0),a.write_shift(1,0),a.write_shift(1,0),a}function Ud(e,t){return t||(t=qe(10)),t.write_shift(1,0),t.write_shift(1,0),t.write_shift(4,0),t.write_shift(4,0),t}var YE=Ws;function XE(e,t){return t||(t=qe(51)),t.write_shift(1,0),Ud(null,t),Ud(null,t),Ud(null,t),Ud(null,t),Ud(null,t),t.length>t.l?t.slice(0,t.l):t}function JE(e,t){return t||(t=qe(52)),t.write_shift(4,e.xfId),t.write_shift(2,1),t.write_shift(1,0),t.write_shift(1,0),Mf(e.name||"",t),t.length>t.l?t.slice(0,t.l):t}function KE(e,t,a){var s=qe(2052);return s.write_shift(4,e),Mf(t,s),Mf(a,s),s.length>s.l?s.slice(0,s.l):s}function QE(e,t){if(t){var a=0;[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var i=s[0];i<=s[1];++i)t[i]!=null&&++a}),a!=0&&(nt(e,615,_s(a)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var i=s[0];i<=s[1];++i)t[i]!=null&&nt(e,44,$E(i,t[i]))}),nt(e,616))}}function eC(e){var t=1;nt(e,611,_s(t)),nt(e,43,VE({sz:12,color:{theme:1},name:"Calibri",family:2})),nt(e,612)}function tC(e){var t=2;nt(e,603,_s(t)),nt(e,45,Fv({patternType:"none"})),nt(e,45,Fv({patternType:"gray125"})),nt(e,604)}function aC(e){var t=1;nt(e,613,_s(t)),nt(e,46,XE()),nt(e,614)}function rC(e){var t=1;nt(e,626,_s(t)),nt(e,47,gw({numFmtId:0},65535)),nt(e,627)}function nC(e,t){nt(e,617,_s(t.length)),t.forEach(function(a){nt(e,47,gw(a,0))}),nt(e,618)}function sC(e){var t=1;nt(e,619,_s(t)),nt(e,48,JE({xfId:0,name:"Normal"})),nt(e,620)}function iC(e){var t=0;nt(e,505,_s(t)),nt(e,506)}function lC(e){var t=0;nt(e,508,KE(t,"TableStyleMedium9","PivotStyleMedium4")),nt(e,509)}function oC(e,t){var a=pn();return nt(a,278),QE(a,e.SSF),eC(a),tC(a),aC(a),rC(a),nC(a,t.cellXfs),sC(a),iC(a),lC(a),nt(a,279),a.end()}function pw(e,t){if(t&&t.themeXLSX)return t.themeXLSX;if(e&&typeof e.raw=="string")return e.raw;var a=[dr];return a[a.length]='<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">',a[a.length]="<a:themeElements>",a[a.length]='<a:clrScheme name="Office">',a[a.length]='<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>',a[a.length]='<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>',a[a.length]='<a:dk2><a:srgbClr val="1F497D"/></a:dk2>',a[a.length]='<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>',a[a.length]='<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>',a[a.length]='<a:accent2><a:srgbClr val="C0504D"/></a:accent2>',a[a.length]='<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>',a[a.length]='<a:accent4><a:srgbClr val="8064A2"/></a:accent4>',a[a.length]='<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>',a[a.length]='<a:accent6><a:srgbClr val="F79646"/></a:accent6>',a[a.length]='<a:hlink><a:srgbClr val="0000FF"/></a:hlink>',a[a.length]='<a:folHlink><a:srgbClr val="800080"/></a:folHlink>',a[a.length]="</a:clrScheme>",a[a.length]='<a:fontScheme name="Office">',a[a.length]="<a:majorFont>",a[a.length]='<a:latin typeface="Cambria"/>',a[a.length]='<a:ea typeface=""/>',a[a.length]='<a:cs typeface=""/>',a[a.length]='<a:font script="Jpan" typeface="MS Pゴシック"/>',a[a.length]='<a:font script="Hang" typeface="맑은 고딕"/>',a[a.length]='<a:font script="Hans" typeface="宋体"/>',a[a.length]='<a:font script="Hant" typeface="新細明體"/>',a[a.length]='<a:font script="Arab" typeface="Times New Roman"/>',a[a.length]='<a:font script="Hebr" typeface="Times New Roman"/>',a[a.length]='<a:font script="Thai" typeface="Tahoma"/>',a[a.length]='<a:font script="Ethi" typeface="Nyala"/>',a[a.length]='<a:font script="Beng" typeface="Vrinda"/>',a[a.length]='<a:font script="Gujr" typeface="Shruti"/>',a[a.length]='<a:font script="Khmr" typeface="MoolBoran"/>',a[a.length]='<a:font script="Knda" typeface="Tunga"/>',a[a.length]='<a:font script="Guru" typeface="Raavi"/>',a[a.length]='<a:font script="Cans" typeface="Euphemia"/>',a[a.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',a[a.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',a[a.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',a[a.length]='<a:font script="Thaa" typeface="MV Boli"/>',a[a.length]='<a:font script="Deva" typeface="Mangal"/>',a[a.length]='<a:font script="Telu" typeface="Gautami"/>',a[a.length]='<a:font script="Taml" typeface="Latha"/>',a[a.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',a[a.length]='<a:font script="Orya" typeface="Kalinga"/>',a[a.length]='<a:font script="Mlym" typeface="Kartika"/>',a[a.length]='<a:font script="Laoo" typeface="DokChampa"/>',a[a.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',a[a.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',a[a.length]='<a:font script="Viet" typeface="Times New Roman"/>',a[a.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',a[a.length]='<a:font script="Geor" typeface="Sylfaen"/>',a[a.length]="</a:majorFont>",a[a.length]="<a:minorFont>",a[a.length]='<a:latin typeface="Calibri"/>',a[a.length]='<a:ea typeface=""/>',a[a.length]='<a:cs typeface=""/>',a[a.length]='<a:font script="Jpan" typeface="MS Pゴシック"/>',a[a.length]='<a:font script="Hang" typeface="맑은 고딕"/>',a[a.length]='<a:font script="Hans" typeface="宋体"/>',a[a.length]='<a:font script="Hant" typeface="新細明體"/>',a[a.length]='<a:font script="Arab" typeface="Arial"/>',a[a.length]='<a:font script="Hebr" typeface="Arial"/>',a[a.length]='<a:font script="Thai" typeface="Tahoma"/>',a[a.length]='<a:font script="Ethi" typeface="Nyala"/>',a[a.length]='<a:font script="Beng" typeface="Vrinda"/>',a[a.length]='<a:font script="Gujr" typeface="Shruti"/>',a[a.length]='<a:font script="Khmr" typeface="DaunPenh"/>',a[a.length]='<a:font script="Knda" typeface="Tunga"/>',a[a.length]='<a:font script="Guru" typeface="Raavi"/>',a[a.length]='<a:font script="Cans" typeface="Euphemia"/>',a[a.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',a[a.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',a[a.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',a[a.length]='<a:font script="Thaa" typeface="MV Boli"/>',a[a.length]='<a:font script="Deva" typeface="Mangal"/>',a[a.length]='<a:font script="Telu" typeface="Gautami"/>',a[a.length]='<a:font script="Taml" typeface="Latha"/>',a[a.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',a[a.length]='<a:font script="Orya" typeface="Kalinga"/>',a[a.length]='<a:font script="Mlym" typeface="Kartika"/>',a[a.length]='<a:font script="Laoo" typeface="DokChampa"/>',a[a.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',a[a.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',a[a.length]='<a:font script="Viet" typeface="Arial"/>',a[a.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',a[a.length]='<a:font script="Geor" typeface="Sylfaen"/>',a[a.length]="</a:minorFont>",a[a.length]="</a:fontScheme>",a[a.length]='<a:fmtScheme name="Office">',a[a.length]="<a:fillStyleLst>",a[a.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:lin ang="16200000" scaled="1"/>',a[a.length]="</a:gradFill>",a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="100000"/><a:shade val="100000"/><a:satMod val="130000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000"/><a:shade val="100000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:lin ang="16200000" scaled="0"/>',a[a.length]="</a:gradFill>",a[a.length]="</a:fillStyleLst>",a[a.length]="<a:lnStyleLst>",a[a.length]='<a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]='<a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]='<a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>',a[a.length]="</a:lnStyleLst>",a[a.length]="<a:effectStyleLst>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]="</a:effectStyle>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]="</a:effectStyle>",a[a.length]="<a:effectStyle>",a[a.length]="<a:effectLst>",a[a.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',a[a.length]="</a:effectLst>",a[a.length]='<a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d>',a[a.length]='<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>',a[a.length]="</a:effectStyle>",a[a.length]="</a:effectStyleLst>",a[a.length]="<a:bgFillStyleLst>",a[a.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>',a[a.length]="</a:gradFill>",a[a.length]='<a:gradFill rotWithShape="1">',a[a.length]="<a:gsLst>",a[a.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',a[a.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>',a[a.length]="</a:gsLst>",a[a.length]='<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>',a[a.length]="</a:gradFill>",a[a.length]="</a:bgFillStyleLst>",a[a.length]="</a:fmtScheme>",a[a.length]="</a:themeElements>",a[a.length]="<a:objectDefaults>",a[a.length]="<a:spDef>",a[a.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style>',a[a.length]="</a:spDef>",a[a.length]="<a:lnDef>",a[a.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style>',a[a.length]="</a:lnDef>",a[a.length]="</a:objectDefaults>",a[a.length]="<a:extraClrSchemeLst/>",a[a.length]="</a:theme>",a.join("")}function cC(e,t){return{flags:e.read_shift(4),version:e.read_shift(4),name:Wr(e)}}function dC(e){var t=qe(12+2*e.name.length);return t.write_shift(4,e.flags),t.write_shift(4,e.version),_r(e.name,t),t.slice(0,t.l)}function uC(e){for(var t=[],a=e.read_shift(4);a-- >0;)t.push([e.read_shift(4),e.read_shift(4)]);return t}function fC(e){var t=qe(4+8*e.length);t.write_shift(4,e.length);for(var a=0;a<e.length;++a)t.write_shift(4,e[a][0]),t.write_shift(4,e[a][1]);return t}function hC(e,t){var a=qe(8+2*t.length);return a.write_shift(4,e),_r(t,a),a.slice(0,a.l)}function mC(e){return e.l+=4,e.read_shift(4)!=0}function gC(e,t){var a=qe(8);return a.write_shift(4,e),a.write_shift(4,1),a}function pC(){var e=pn();return nt(e,332),nt(e,334,_s(1)),nt(e,335,dC({name:"XLDAPR",version:12e4,flags:3496657072})),nt(e,336),nt(e,339,hC(1,"XLDAPR")),nt(e,52),nt(e,35,_s(514)),nt(e,4096,_s(0)),nt(e,4097,es(1)),nt(e,36),nt(e,53),nt(e,340),nt(e,337,gC(1)),nt(e,51,fC([[1,0]])),nt(e,338),nt(e,333),e.end()}function xw(){var e=[dr];return e.push(`<metadata xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xlrd="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" xmlns:xda="http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray">
|
||
<metadataTypes count="1">
|
||
<metadataType name="XLDAPR" minSupportedVersion="120000" copy="1" pasteAll="1" pasteValues="1" merge="1" splitFirst="1" rowColShift="1" clearFormats="1" clearComments="1" assign="1" coerce="1" cellMeta="1"/>
|
||
</metadataTypes>
|
||
<futureMetadata name="XLDAPR" count="1">
|
||
<bk>
|
||
<extLst>
|
||
<ext uri="{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}">
|
||
<xda:dynamicArrayProperties fDynamic="1" fCollapsed="0"/>
|
||
</ext>
|
||
</extLst>
|
||
</bk>
|
||
</futureMetadata>
|
||
<cellMetadata count="1">
|
||
<bk>
|
||
<rc t="1" v="0"/>
|
||
</bk>
|
||
</cellMetadata>
|
||
</metadata>`),e.join("")}function xC(e){var t={};t.i=e.read_shift(4);var a={};a.r=e.read_shift(4),a.c=e.read_shift(4),t.r=ka(a);var s=e.read_shift(1);return s&2&&(t.l="1"),s&8&&(t.a="1"),t}var mc=1024;function yw(e,t){for(var a=[21600,21600],s=["m0,0l0",a[1],a[0],a[1],a[0],"0xe"].join(","),i=[ht("xml",null,{"xmlns:v":Ln.v,"xmlns:o":Ln.o,"xmlns:x":Ln.x,"xmlns:mv":Ln.mv}).replace(/\/>/,">"),ht("o:shapelayout",ht("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),ht("v:shapetype",[ht("v:stroke",null,{joinstyle:"miter"}),ht("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:a.join(","),path:s})];mc<e*1e3;)mc+=1e3;return t.forEach(function(d){var c=vr(d[0]),f={color2:"#BEFF82",type:"gradient"};f.type=="gradient"&&(f.angle="-180");var g=f.type=="gradient"?ht("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,p=ht("v:fill",g,f),x={on:"t",obscured:"t"};++mc,i=i.concat(["<v:shape"+l0({id:"_x0000_s"+mc,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10"+(d[1].hidden?";visibility:hidden":""),fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",p,ht("v:shadow",null,x),ht("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",Dr("x:Anchor",[c.c+1,0,c.r+1,0,c.c+3,20,c.r+5,20].join(",")),Dr("x:AutoFill","False"),Dr("x:Row",String(c.r)),Dr("x:Column",String(c.c)),d[1].hidden?"":"<x:Visible/>","</x:ClientData>","</v:shape>"])}),i.push("</xml>"),i.join("")}function bw(e){var t=[dr,ht("comments",null,{xmlns:Dc[0]})],a=[];return t.push("<authors>"),e.forEach(function(s){s[1].forEach(function(i){var d=wa(i.a);a.indexOf(d)==-1&&(a.push(d),t.push("<author>"+d+"</author>")),i.T&&i.ID&&a.indexOf("tc="+i.ID)==-1&&(a.push("tc="+i.ID),t.push("<author>tc="+i.ID+"</author>"))})}),a.length==0&&(a.push("SheetJ5"),t.push("<author>SheetJ5</author>")),t.push("</authors>"),t.push("<commentList>"),e.forEach(function(s){var i=0,d=[];if(s[1][0]&&s[1][0].T&&s[1][0].ID?i=a.indexOf("tc="+s[1][0].ID):s[1].forEach(function(g){g.a&&(i=a.indexOf(wa(g.a))),d.push(g.t||"")}),t.push('<comment ref="'+s[0]+'" authorId="'+i+'"><text>'),d.length<=1)t.push(Dr("t",wa(d[0]||"")));else{for(var c=`Comment:
|
||
`+d[0]+`
|
||
`,f=1;f<d.length;++f)c+=`Reply:
|
||
`+d[f]+`
|
||
`;t.push(Dr("t",wa(c)))}t.push("</text></comment>")}),t.push("</commentList>"),t.length>2&&(t[t.length]="</comments>",t[1]=t[1].replace("/>",">")),t.join("")}function yC(e,t,a){var s=[dr,ht("ThreadedComments",null,{xmlns:br.TCMNT}).replace(/[\/]>/,">")];return e.forEach(function(i){var d="";(i[1]||[]).forEach(function(c,f){if(!c.T){delete c.ID;return}c.a&&t.indexOf(c.a)==-1&&t.push(c.a);var g={ref:i[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+a.tcid++).slice(-12)+"}"};f==0?d=g.id:g.parentId=d,c.ID=g.id,c.a&&(g.personId="{54EE7950-7262-4200-6969-"+("000000000000"+t.indexOf(c.a)).slice(-12)+"}"),s.push(ht("threadedComment",Dr("text",c.t||""),g))})}),s.push("</ThreadedComments>"),s.join("")}function bC(e){var t=[dr,ht("personList",null,{xmlns:br.TCMNT,"xmlns:x":Dc[0]}).replace(/[\/]>/,">")];return e.forEach(function(a,s){t.push(ht("person",null,{displayName:a,id:"{54EE7950-7262-4200-6969-"+("000000000000"+s).slice(-12)+"}",userId:a,providerId:"None"}))}),t.push("</personList>"),t.join("")}function vC(e){var t={};t.iauthor=e.read_shift(4);var a=po(e);return t.rfx=a.s,t.ref=ka(a.s),e.l+=16,t}function _C(e,t){return t==null&&(t=qe(36)),t.write_shift(4,e[1].iauthor),Rc(e[0],t),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t}var wC=Wr;function kC(e){return _r(e.slice(0,54))}function NC(e){var t=pn(),a=[];return nt(t,628),nt(t,630),e.forEach(function(s){s[1].forEach(function(i){a.indexOf(i.a)>-1||(a.push(i.a.slice(0,54)),nt(t,632,kC(i.a)))})}),nt(t,631),nt(t,633),e.forEach(function(s){s[1].forEach(function(i){i.iauthor=a.indexOf(i.a);var d={s:vr(s[0]),e:vr(s[0])};nt(t,635,_C([d,i])),i.t&&i.t.length>0&&nt(t,637,ST(i)),nt(t,636),delete i.iauthor})}),nt(t,634),nt(t,629),t.end()}function jC(e,t){t.FullPaths.forEach(function(a,s){if(s!=0){var i=a.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");i.slice(-1)!=="/"&&Oa.utils.cfb_add(e,i,t.FileIndex[s].content)}})}var vw=["xlsb","xlsm","xlam","biff8","xla"],SC=(function(){var e=/(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g,t={r:0,c:0};function a(s,i,d,c){var f=!1,g=!1;d.length==0?g=!0:d.charAt(0)=="["&&(g=!0,d=d.slice(1,-1)),c.length==0?f=!0:c.charAt(0)=="["&&(f=!0,c=c.slice(1,-1));var p=d.length>0?parseInt(d,10)|0:0,x=c.length>0?parseInt(c,10)|0:0;return f?x+=t.c:--x,g?p+=t.r:--p,i+(f?"":"$")+$r(x)+(g?"":"$")+Pr(p)}return function(i,d){return t=d,i.replace(e,a)}})(),Dp=/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g,Pp=(function(){return function(t,a){return t.replace(Dp,function(s,i,d,c,f,g){var p=Ep(c)-(d?0:a.c),x=Tp(g)-(f?0:a.r),y=x==0?"":f?x+1:"["+x+"]",_=p==0?"":d?p+1:"["+p+"]";return i+"R"+y+"C"+_})}})();function TC(e,t){return e.replace(Dp,function(a,s,i,d,c,f){return s+(i=="$"?i+d:$r(Ep(d)+t.c))+(c=="$"?c+f:Pr(Tp(f)+t.r))})}function EC(e){return e.length!=1}function or(e){e.l+=1}function cl(e,t){var a=e.read_shift(2);return[a&16383,a>>14&1,a>>15&1]}function _w(e,t,a){var s=2;if(a){if(a.biff>=2&&a.biff<=5)return ww(e);a.biff==12&&(s=4)}var i=e.read_shift(s),d=e.read_shift(s),c=cl(e),f=cl(e);return{s:{r:i,c:c[0],cRel:c[1],rRel:c[2]},e:{r:d,c:f[0],cRel:f[1],rRel:f[2]}}}function ww(e){var t=cl(e),a=cl(e),s=e.read_shift(1),i=e.read_shift(1);return{s:{r:t[0],c:s,cRel:t[1],rRel:t[2]},e:{r:a[0],c:i,cRel:a[1],rRel:a[2]}}}function CC(e,t,a){if(a.biff<8)return ww(e);var s=e.read_shift(a.biff==12?4:2),i=e.read_shift(a.biff==12?4:2),d=cl(e),c=cl(e);return{s:{r:s,c:d[0],cRel:d[1],rRel:d[2]},e:{r:i,c:c[0],cRel:c[1],rRel:c[2]}}}function kw(e,t,a){if(a&&a.biff>=2&&a.biff<=5)return AC(e);var s=e.read_shift(a&&a.biff==12?4:2),i=cl(e);return{r:s,c:i[0],cRel:i[1],rRel:i[2]}}function AC(e){var t=cl(e),a=e.read_shift(1);return{r:t[0],c:a,cRel:t[1],rRel:t[2]}}function OC(e){var t=e.read_shift(2),a=e.read_shift(2);return{r:t,c:a&255,fQuoted:!!(a&16384),cRel:a>>15,rRel:a>>15}}function MC(e,t,a){var s=a&&a.biff?a.biff:8;if(s>=2&&s<=5)return LC(e);var i=e.read_shift(s>=12?4:2),d=e.read_shift(2),c=(d&16384)>>14,f=(d&32768)>>15;if(d&=16383,f==1)for(;i>524287;)i-=1048576;if(c==1)for(;d>8191;)d=d-16384;return{r:i,c:d,cRel:c,rRel:f}}function LC(e){var t=e.read_shift(2),a=e.read_shift(1),s=(t&32768)>>15,i=(t&16384)>>14;return t&=16383,s==1&&t>=8192&&(t=t-16384),i==1&&a>=128&&(a=a-256),{r:t,c:a,cRel:i,rRel:s}}function DC(e,t,a){var s=(e[e.l++]&96)>>5,i=_w(e,a.biff>=2&&a.biff<=5?6:8,a);return[s,i]}function PC(e,t,a){var s=(e[e.l++]&96)>>5,i=e.read_shift(2,"i"),d=8;if(a)switch(a.biff){case 5:e.l+=12,d=6;break;case 12:d=12;break}var c=_w(e,d,a);return[s,i,c]}function RC(e,t,a){var s=(e[e.l++]&96)>>5;return e.l+=a&&a.biff>8?12:a.biff<8?6:8,[s]}function FC(e,t,a){var s=(e[e.l++]&96)>>5,i=e.read_shift(2),d=8;if(a)switch(a.biff){case 5:e.l+=12,d=6;break;case 12:d=12;break}return e.l+=d,[s,i]}function IC(e,t,a){var s=(e[e.l++]&96)>>5,i=CC(e,t-1,a);return[s,i]}function zC(e,t,a){var s=(e[e.l++]&96)>>5;return e.l+=a.biff==2?6:a.biff==12?14:7,[s]}function Iv(e){var t=e[e.l+1]&1,a=1;return e.l+=4,[t,a]}function BC(e,t,a){e.l+=2;for(var s=e.read_shift(a&&a.biff==2?1:2),i=[],d=0;d<=s;++d)i.push(e.read_shift(a&&a.biff==2?1:2));return i}function UC(e,t,a){var s=e[e.l+1]&255?1:0;return e.l+=2,[s,e.read_shift(a&&a.biff==2?1:2)]}function HC(e,t,a){var s=e[e.l+1]&255?1:0;return e.l+=2,[s,e.read_shift(a&&a.biff==2?1:2)]}function $C(e){var t=e[e.l+1]&255?1:0;return e.l+=2,[t,e.read_shift(2)]}function WC(e,t,a){var s=e[e.l+1]&255?1:0;return e.l+=a&&a.biff==2?3:4,[s]}function Nw(e){var t=e.read_shift(1),a=e.read_shift(1);return[t,a]}function VC(e){return e.read_shift(2),Nw(e)}function GC(e){return e.read_shift(2),Nw(e)}function ZC(e,t,a){var s=(e[e.l]&96)>>5;e.l+=1;var i=kw(e,0,a);return[s,i]}function qC(e,t,a){var s=(e[e.l]&96)>>5;e.l+=1;var i=MC(e,0,a);return[s,i]}function YC(e,t,a){var s=(e[e.l]&96)>>5;e.l+=1;var i=e.read_shift(2);a&&a.biff==5&&(e.l+=12);var d=kw(e,0,a);return[s,i,d]}function XC(e,t,a){var s=(e[e.l]&96)>>5;e.l+=1;var i=e.read_shift(a&&a.biff<=3?1:2);return[X8[i],Tw[i],s]}function JC(e,t,a){var s=e[e.l++],i=e.read_shift(1),d=a&&a.biff<=3?[s==88?-1:0,e.read_shift(1)]:KC(e);return[i,(d[0]===0?Tw:Y8)[d[1]]]}function KC(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function QC(e,t,a){e.l+=a&&a.biff==2?3:4}function e8(e,t,a){if(e.l++,a&&a.biff==12)return[e.read_shift(4,"i"),0];var s=e.read_shift(2),i=e.read_shift(a&&a.biff==2?1:2);return[s,i]}function t8(e){return e.l++,N0[e.read_shift(1)]}function a8(e){return e.l++,e.read_shift(2)}function r8(e){return e.l++,e.read_shift(1)!==0}function n8(e){return e.l++,Fc(e)}function s8(e,t,a){return e.l++,iw(e,t-1,a)}function i8(e,t){var a=[e.read_shift(1)];if(t==12)switch(a[0]){case 2:a[0]=4;break;case 4:a[0]=16;break;case 0:a[0]=1;break;case 1:a[0]=2;break}switch(a[0]){case 4:a[1]=YT(e,1)?"TRUE":"FALSE",t!=12&&(e.l+=7);break;case 37:case 16:a[1]=N0[e[e.l]],e.l+=t==12?4:8;break;case 0:e.l+=8;break;case 1:a[1]=Fc(e);break;case 2:a[1]=QT(e,0,{biff:t>0&&t<8?2:t});break;default:throw new Error("Bad SerAr: "+a[0])}return a}function l8(e,t,a){for(var s=e.read_shift(a.biff==12?4:2),i=[],d=0;d!=s;++d)i.push((a.biff==12?po:aE)(e));return i}function o8(e,t,a){var s=0,i=0;a.biff==12?(s=e.read_shift(4),i=e.read_shift(4)):(i=1+e.read_shift(1),s=1+e.read_shift(2)),a.biff>=2&&a.biff<8&&(--s,--i==0&&(i=256));for(var d=0,c=[];d!=s&&(c[d]=[]);++d)for(var f=0;f!=i;++f)c[d][f]=i8(e,a.biff);return c}function c8(e,t,a){var s=e.read_shift(1)>>>5&3,i=!a||a.biff>=8?4:2,d=e.read_shift(i);switch(a.biff){case 2:e.l+=5;break;case 3:case 4:e.l+=8;break;case 5:e.l+=12;break}return[s,0,d]}function d8(e,t,a){if(a.biff==5)return u8(e);var s=e.read_shift(1)>>>5&3,i=e.read_shift(2),d=e.read_shift(4);return[s,i,d]}function u8(e){var t=e.read_shift(1)>>>5&3,a=e.read_shift(2,"i");e.l+=8;var s=e.read_shift(2);return e.l+=12,[t,a,s]}function f8(e,t,a){var s=e.read_shift(1)>>>5&3;e.l+=a&&a.biff==2?3:4;var i=e.read_shift(a&&a.biff==2?1:2);return[s,i]}function h8(e,t,a){var s=e.read_shift(1)>>>5&3,i=e.read_shift(a&&a.biff==2?1:2);return[s,i]}function m8(e,t,a){var s=e.read_shift(1)>>>5&3;return e.l+=4,a.biff<8&&e.l--,a.biff==12&&(e.l+=2),[s]}function g8(e,t,a){var s=(e[e.l++]&96)>>5,i=e.read_shift(2),d=4;if(a)switch(a.biff){case 5:d=15;break;case 12:d=6;break}return e.l+=d,[s,i]}var p8=Ws,x8=Ws,y8=Ws;function j0(e,t,a){return e.l+=2,[OC(e)]}function Rp(e){return e.l+=6,[]}var b8=j0,v8=Rp,_8=Rp,w8=j0;function jw(e){return e.l+=2,[nw(e),e.read_shift(2)&1]}var k8=j0,N8=jw,j8=Rp,S8=j0,T8=j0,E8=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function C8(e){e.l+=2;var t=e.read_shift(2),a=e.read_shift(2),s=e.read_shift(4),i=e.read_shift(2),d=e.read_shift(2),c=E8[a>>2&31];return{ixti:t,coltype:a&3,rt:c,idx:s,c:i,C:d}}function A8(e){return e.l+=2,[e.read_shift(4)]}function O8(e,t,a){return e.l+=5,e.l+=2,e.l+=a.biff==2?1:4,["PTGSHEET"]}function M8(e,t,a){return e.l+=a.biff==2?4:5,["PTGENDSHEET"]}function L8(e){var t=e.read_shift(1)>>>5&3,a=e.read_shift(2);return[t,a]}function D8(e){var t=e.read_shift(1)>>>5&3,a=e.read_shift(2);return[t,a]}function P8(e){return e.l+=4,[0,0]}var zv={1:{n:"PtgExp",f:e8},2:{n:"PtgTbl",f:y8},3:{n:"PtgAdd",f:or},4:{n:"PtgSub",f:or},5:{n:"PtgMul",f:or},6:{n:"PtgDiv",f:or},7:{n:"PtgPower",f:or},8:{n:"PtgConcat",f:or},9:{n:"PtgLt",f:or},10:{n:"PtgLe",f:or},11:{n:"PtgEq",f:or},12:{n:"PtgGe",f:or},13:{n:"PtgGt",f:or},14:{n:"PtgNe",f:or},15:{n:"PtgIsect",f:or},16:{n:"PtgUnion",f:or},17:{n:"PtgRange",f:or},18:{n:"PtgUplus",f:or},19:{n:"PtgUminus",f:or},20:{n:"PtgPercent",f:or},21:{n:"PtgParen",f:or},22:{n:"PtgMissArg",f:or},23:{n:"PtgStr",f:s8},26:{n:"PtgSheet",f:O8},27:{n:"PtgEndSheet",f:M8},28:{n:"PtgErr",f:t8},29:{n:"PtgBool",f:r8},30:{n:"PtgInt",f:a8},31:{n:"PtgNum",f:n8},32:{n:"PtgArray",f:zC},33:{n:"PtgFunc",f:XC},34:{n:"PtgFuncVar",f:JC},35:{n:"PtgName",f:c8},36:{n:"PtgRef",f:ZC},37:{n:"PtgArea",f:DC},38:{n:"PtgMemArea",f:f8},39:{n:"PtgMemErr",f:p8},40:{n:"PtgMemNoMem",f:x8},41:{n:"PtgMemFunc",f:h8},42:{n:"PtgRefErr",f:m8},43:{n:"PtgAreaErr",f:RC},44:{n:"PtgRefN",f:qC},45:{n:"PtgAreaN",f:IC},46:{n:"PtgMemAreaN",f:L8},47:{n:"PtgMemNoMemN",f:D8},57:{n:"PtgNameX",f:d8},58:{n:"PtgRef3d",f:YC},59:{n:"PtgArea3d",f:PC},60:{n:"PtgRefErr3d",f:g8},61:{n:"PtgAreaErr3d",f:FC},255:{}},R8={64:32,96:32,65:33,97:33,66:34,98:34,67:35,99:35,68:36,100:36,69:37,101:37,70:38,102:38,71:39,103:39,72:40,104:40,73:41,105:41,74:42,106:42,75:43,107:43,76:44,108:44,77:45,109:45,78:46,110:46,79:47,111:47,88:34,120:34,89:57,121:57,90:58,122:58,91:59,123:59,92:60,124:60,93:61,125:61},F8={1:{n:"PtgElfLel",f:jw},2:{n:"PtgElfRw",f:S8},3:{n:"PtgElfCol",f:b8},6:{n:"PtgElfRwV",f:T8},7:{n:"PtgElfColV",f:w8},10:{n:"PtgElfRadical",f:k8},11:{n:"PtgElfRadicalS",f:j8},13:{n:"PtgElfColS",f:v8},15:{n:"PtgElfColSV",f:_8},16:{n:"PtgElfRadicalLel",f:N8},25:{n:"PtgList",f:C8},29:{n:"PtgSxName",f:A8},255:{}},I8={0:{n:"PtgAttrNoop",f:P8},1:{n:"PtgAttrSemi",f:WC},2:{n:"PtgAttrIf",f:HC},4:{n:"PtgAttrChoose",f:BC},8:{n:"PtgAttrGoto",f:UC},16:{n:"PtgAttrSum",f:QC},32:{n:"PtgAttrBaxcel",f:Iv},33:{n:"PtgAttrBaxcel",f:Iv},64:{n:"PtgAttrSpace",f:VC},65:{n:"PtgAttrSpaceSemi",f:GC},128:{n:"PtgAttrIfError",f:$C},255:{}};function z8(e,t,a,s){if(s.biff<8)return Ws(e,t);for(var i=e.l+t,d=[],c=0;c!==a.length;++c)switch(a[c][0]){case"PtgArray":a[c][1]=o8(e,0,s),d.push(a[c][1]);break;case"PtgMemArea":a[c][2]=l8(e,a[c][1],s),d.push(a[c][2]);break;case"PtgExp":s&&s.biff==12&&(a[c][1][1]=e.read_shift(4),d.push(a[c][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+a[c][0]}return t=i-e.l,t!==0&&d.push(Ws(e,t)),d}function B8(e,t,a){for(var s=e.l+t,i,d,c=[];s!=e.l;)t=s-e.l,d=e[e.l],i=zv[d]||zv[R8[d]],(d===24||d===25)&&(i=(d===24?F8:I8)[e[e.l+1]]),!i||!i.f?Ws(e,t):c.push([i.n,i.f(e,t,a)]);return c}function U8(e){for(var t=[],a=0;a<e.length;++a){for(var s=e[a],i=[],d=0;d<s.length;++d){var c=s[d];if(c)switch(c[0]){case 2:i.push('"'+c[1].replace(/"/g,'""')+'"');break;default:i.push(c[1])}else i.push("")}t.push(i.join(","))}return t.join(";")}var H8={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function $8(e,t){if(!e&&!(t&&t.biff<=5&&t.biff>=2))throw new Error("empty sheet name");return/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(e)?"'"+e+"'":e}function Sw(e,t,a){if(!e)return"SH33TJSERR0";if(a.biff>8&&(!e.XTI||!e.XTI[t]))return e.SheetNames[t];if(!e.XTI)return"SH33TJSERR6";var s=e.XTI[t];if(a.biff<8)return t>1e4&&(t-=65536),t<0&&(t=-t),t==0?"":e.XTI[t-1];if(!s)return"SH33TJSERR1";var i="";if(a.biff>8)switch(e[s[0]][0]){case 357:return i=s[1]==-1?"#REF":e.SheetNames[s[1]],s[1]==s[2]?i:i+":"+e.SheetNames[s[2]];case 358:return a.SID!=null?e.SheetNames[a.SID]:"SH33TJSSAME"+e[s[0]][0];case 355:default:return"SH33TJSSRC"+e[s[0]][0]}switch(e[s[0]][0][0]){case 1025:return i=s[1]==-1?"#REF":e.SheetNames[s[1]]||"SH33TJSERR3",s[1]==s[2]?i:i+":"+e.SheetNames[s[2]];case 14849:return e[s[0]].slice(1).map(function(d){return d.Name}).join(";;");default:return e[s[0]][0][3]?(i=s[1]==-1?"#REF":e[s[0]][0][3][s[1]]||"SH33TJSERR4",s[1]==s[2]?i:i+":"+e[s[0]][0][3][s[2]]):"SH33TJSERR2"}}function Bv(e,t,a){var s=Sw(e,t,a);return s=="#REF"?s:$8(s,a)}function Nc(e,t,a,s,i){var d=i&&i.biff||8,c={s:{c:0,r:0}},f=[],g,p,x,y=0,_=0,k,T="";if(!e[0]||!e[0][0])return"";for(var N=-1,S="",O=0,C=e[0].length;O<C;++O){var A=e[0][O];switch(A[0]){case"PtgUminus":f.push("-"+f.pop());break;case"PtgUplus":f.push("+"+f.pop());break;case"PtgPercent":f.push(f.pop()+"%");break;case"PtgAdd":case"PtgConcat":case"PtgDiv":case"PtgEq":case"PtgGe":case"PtgGt":case"PtgLe":case"PtgLt":case"PtgMul":case"PtgNe":case"PtgPower":case"PtgSub":if(g=f.pop(),p=f.pop(),N>=0){switch(e[0][N][1][0]){case 0:S=Xa(" ",e[0][N][1][1]);break;case 1:S=Xa("\r",e[0][N][1][1]);break;default:if(S="",i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][N][1][0])}p=p+S,N=-1}f.push(p+H8[A[0]]+g);break;case"PtgIsect":g=f.pop(),p=f.pop(),f.push(p+" "+g);break;case"PtgUnion":g=f.pop(),p=f.pop(),f.push(p+","+g);break;case"PtgRange":g=f.pop(),p=f.pop(),f.push(p+":"+g);break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgAttrIfError":break;case"PtgRef":x=Jd(A[1][1],c,i),f.push(Kd(x,d));break;case"PtgRefN":x=a?Jd(A[1][1],a,i):A[1][1],f.push(Kd(x,d));break;case"PtgRef3d":y=A[1][1],x=Jd(A[1][2],c,i),T=Bv(s,y,i),f.push(T+"!"+Kd(x,d));break;case"PtgFunc":case"PtgFuncVar":var P=A[1][0],I=A[1][1];P||(P=0),P&=127;var ee=P==0?[]:f.slice(-P);f.length-=P,I==="User"&&(I=ee.shift()),f.push(I+"("+ee.join(",")+")");break;case"PtgBool":f.push(A[1]?"TRUE":"FALSE");break;case"PtgInt":f.push(A[1]);break;case"PtgNum":f.push(String(A[1]));break;case"PtgStr":f.push('"'+A[1].replace(/"/g,'""')+'"');break;case"PtgErr":f.push(A[1]);break;case"PtgAreaN":k=Nv(A[1][1],a?{s:a}:c,i),f.push(Sg(k,i));break;case"PtgArea":k=Nv(A[1][1],c,i),f.push(Sg(k,i));break;case"PtgArea3d":y=A[1][1],k=A[1][2],T=Bv(s,y,i),f.push(T+"!"+Sg(k,i));break;case"PtgAttrSum":f.push("SUM("+f.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":_=A[1][2];var B=(s.names||[])[_-1]||(s[0]||[])[_],H=B?B.Name:"SH33TJSNAME"+String(_);H&&H.slice(0,6)=="_xlfn."&&!i.xlfn&&(H=H.slice(6)),f.push(H);break;case"PtgNameX":var Y=A[1][1];_=A[1][2];var ue;if(i.biff<=5)Y<0&&(Y=-Y),s[Y]&&(ue=s[Y][_]);else{var xe="";if(((s[Y]||[])[0]||[])[0]==14849||(((s[Y]||[])[0]||[])[0]==1025?s[Y][_]&&s[Y][_].itab>0&&(xe=s.SheetNames[s[Y][_].itab-1]+"!"):xe=s.SheetNames[_-1]+"!"),s[Y]&&s[Y][_])xe+=s[Y][_].Name;else if(s[0]&&s[0][_])xe+=s[0][_].Name;else{var le=(Sw(s,Y,i)||"").split(";;");le[_-1]?xe=le[_-1]:xe+="SH33TJSERRX"}f.push(xe);break}ue||(ue={Name:"SH33TJSERRY"}),f.push(ue.Name);break;case"PtgParen":var ge="(",be=")";if(N>=0){switch(S="",e[0][N][1][0]){case 2:ge=Xa(" ",e[0][N][1][1])+ge;break;case 3:ge=Xa("\r",e[0][N][1][1])+ge;break;case 4:be=Xa(" ",e[0][N][1][1])+be;break;case 5:be=Xa("\r",e[0][N][1][1])+be;break;default:if(i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][N][1][0])}N=-1}f.push(ge+f.pop()+be);break;case"PtgRefErr":f.push("#REF!");break;case"PtgRefErr3d":f.push("#REF!");break;case"PtgExp":x={c:A[1][1],r:A[1][0]};var me={c:a.c,r:a.r};if(s.sharedf[ka(x)]){var ae=s.sharedf[ka(x)];f.push(Nc(ae,c,me,s,i))}else{var Z=!1;for(g=0;g!=s.arrayf.length;++g)if(p=s.arrayf[g],!(x.c<p[0].s.c||x.c>p[0].e.c)&&!(x.r<p[0].s.r||x.r>p[0].e.r)){f.push(Nc(p[1],c,me,s,i)),Z=!0;break}Z||f.push(A[1])}break;case"PtgArray":f.push("{"+U8(A[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":N=O;break;case"PtgTbl":break;case"PtgMemErr":break;case"PtgMissArg":f.push("");break;case"PtgAreaErr":f.push("#REF!");break;case"PtgAreaErr3d":f.push("#REF!");break;case"PtgList":f.push("Table"+A[1].idx+"[#"+A[1].rt+"]");break;case"PtgMemAreaN":case"PtgMemNoMemN":case"PtgAttrNoop":case"PtgSheet":case"PtgEndSheet":break;case"PtgMemFunc":break;case"PtgMemNoMem":break;case"PtgElfCol":case"PtgElfColS":case"PtgElfColSV":case"PtgElfColV":case"PtgElfLel":case"PtgElfRadical":case"PtgElfRadicalLel":case"PtgElfRadicalS":case"PtgElfRw":case"PtgElfRwV":throw new Error("Unsupported ELFs");case"PtgSxName":throw new Error("Unrecognized Formula Token: "+String(A));default:throw new Error("Unrecognized Formula Token: "+String(A))}var K=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(i.biff!=3&&N>=0&&K.indexOf(e[0][O][0])==-1){A=e[0][N];var te=!0;switch(A[1][0]){case 4:te=!1;case 0:S=Xa(" ",A[1][1]);break;case 5:te=!1;case 1:S=Xa("\r",A[1][1]);break;default:if(S="",i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+A[1][0])}f.push((te?S:"")+f.pop()+(te?"":S)),N=-1}}if(f.length>1&&i.WTF)throw new Error("bad formula stack");return f[0]}function W8(e){if(e==null){var t=qe(8);return t.write_shift(1,3),t.write_shift(1,0),t.write_shift(2,0),t.write_shift(2,0),t.write_shift(2,65535),t}else if(typeof e=="number")return oo(e);return oo(0)}function V8(e,t,a,s,i){var d=co(t,a,i),c=W8(e.v),f=qe(6),g=33;f.write_shift(2,g),f.write_shift(4,0);for(var p=qe(e.bf.length),x=0;x<e.bf.length;++x)p[x]=e.bf[x];var y=Lr([d,c,f,p]);return y}function rh(e,t,a){var s=e.read_shift(4),i=B8(e,s,a),d=e.read_shift(4),c=d>0?z8(e,d,i,a):null;return[i,c]}var G8=rh,nh=rh,Z8=rh,q8=rh,Y8={0:"BEEP",1:"OPEN",2:"OPEN.LINKS",3:"CLOSE.ALL",4:"SAVE",5:"SAVE.AS",6:"FILE.DELETE",7:"PAGE.SETUP",8:"PRINT",9:"PRINTER.SETUP",10:"QUIT",11:"NEW.WINDOW",12:"ARRANGE.ALL",13:"WINDOW.SIZE",14:"WINDOW.MOVE",15:"FULL",16:"CLOSE",17:"RUN",22:"SET.PRINT.AREA",23:"SET.PRINT.TITLES",24:"SET.PAGE.BREAK",25:"REMOVE.PAGE.BREAK",26:"FONT",27:"DISPLAY",28:"PROTECT.DOCUMENT",29:"PRECISION",30:"A1.R1C1",31:"CALCULATE.NOW",32:"CALCULATION",34:"DATA.FIND",35:"EXTRACT",36:"DATA.DELETE",37:"SET.DATABASE",38:"SET.CRITERIA",39:"SORT",40:"DATA.SERIES",41:"TABLE",42:"FORMAT.NUMBER",43:"ALIGNMENT",44:"STYLE",45:"BORDER",46:"CELL.PROTECTION",47:"COLUMN.WIDTH",48:"UNDO",49:"CUT",50:"COPY",51:"PASTE",52:"CLEAR",53:"PASTE.SPECIAL",54:"EDIT.DELETE",55:"INSERT",56:"FILL.RIGHT",57:"FILL.DOWN",61:"DEFINE.NAME",62:"CREATE.NAMES",63:"FORMULA.GOTO",64:"FORMULA.FIND",65:"SELECT.LAST.CELL",66:"SHOW.ACTIVE.CELL",67:"GALLERY.AREA",68:"GALLERY.BAR",69:"GALLERY.COLUMN",70:"GALLERY.LINE",71:"GALLERY.PIE",72:"GALLERY.SCATTER",73:"COMBINATION",74:"PREFERRED",75:"ADD.OVERLAY",76:"GRIDLINES",77:"SET.PREFERRED",78:"AXES",79:"LEGEND",80:"ATTACH.TEXT",81:"ADD.ARROW",82:"SELECT.CHART",83:"SELECT.PLOT.AREA",84:"PATTERNS",85:"MAIN.CHART",86:"OVERLAY",87:"SCALE",88:"FORMAT.LEGEND",89:"FORMAT.TEXT",90:"EDIT.REPEAT",91:"PARSE",92:"JUSTIFY",93:"HIDE",94:"UNHIDE",95:"WORKSPACE",96:"FORMULA",97:"FORMULA.FILL",98:"FORMULA.ARRAY",99:"DATA.FIND.NEXT",100:"DATA.FIND.PREV",101:"FORMULA.FIND.NEXT",102:"FORMULA.FIND.PREV",103:"ACTIVATE",104:"ACTIVATE.NEXT",105:"ACTIVATE.PREV",106:"UNLOCKED.NEXT",107:"UNLOCKED.PREV",108:"COPY.PICTURE",109:"SELECT",110:"DELETE.NAME",111:"DELETE.FORMAT",112:"VLINE",113:"HLINE",114:"VPAGE",115:"HPAGE",116:"VSCROLL",117:"HSCROLL",118:"ALERT",119:"NEW",120:"CANCEL.COPY",121:"SHOW.CLIPBOARD",122:"MESSAGE",124:"PASTE.LINK",125:"APP.ACTIVATE",126:"DELETE.ARROW",127:"ROW.HEIGHT",128:"FORMAT.MOVE",129:"FORMAT.SIZE",130:"FORMULA.REPLACE",131:"SEND.KEYS",132:"SELECT.SPECIAL",133:"APPLY.NAMES",134:"REPLACE.FONT",135:"FREEZE.PANES",136:"SHOW.INFO",137:"SPLIT",138:"ON.WINDOW",139:"ON.DATA",140:"DISABLE.INPUT",142:"OUTLINE",143:"LIST.NAMES",144:"FILE.CLOSE",145:"SAVE.WORKBOOK",146:"DATA.FORM",147:"COPY.CHART",148:"ON.TIME",149:"WAIT",150:"FORMAT.FONT",151:"FILL.UP",152:"FILL.LEFT",153:"DELETE.OVERLAY",155:"SHORT.MENUS",159:"SET.UPDATE.STATUS",161:"COLOR.PALETTE",162:"DELETE.STYLE",163:"WINDOW.RESTORE",164:"WINDOW.MAXIMIZE",166:"CHANGE.LINK",167:"CALCULATE.DOCUMENT",168:"ON.KEY",169:"APP.RESTORE",170:"APP.MOVE",171:"APP.SIZE",172:"APP.MINIMIZE",173:"APP.MAXIMIZE",174:"BRING.TO.FRONT",175:"SEND.TO.BACK",185:"MAIN.CHART.TYPE",186:"OVERLAY.CHART.TYPE",187:"SELECT.END",188:"OPEN.MAIL",189:"SEND.MAIL",190:"STANDARD.FONT",191:"CONSOLIDATE",192:"SORT.SPECIAL",193:"GALLERY.3D.AREA",194:"GALLERY.3D.COLUMN",195:"GALLERY.3D.LINE",196:"GALLERY.3D.PIE",197:"VIEW.3D",198:"GOAL.SEEK",199:"WORKGROUP",200:"FILL.GROUP",201:"UPDATE.LINK",202:"PROMOTE",203:"DEMOTE",204:"SHOW.DETAIL",206:"UNGROUP",207:"OBJECT.PROPERTIES",208:"SAVE.NEW.OBJECT",209:"SHARE",210:"SHARE.NAME",211:"DUPLICATE",212:"APPLY.STYLE",213:"ASSIGN.TO.OBJECT",214:"OBJECT.PROTECTION",215:"HIDE.OBJECT",216:"SET.EXTRACT",217:"CREATE.PUBLISHER",218:"SUBSCRIBE.TO",219:"ATTRIBUTES",220:"SHOW.TOOLBAR",222:"PRINT.PREVIEW",223:"EDIT.COLOR",224:"SHOW.LEVELS",225:"FORMAT.MAIN",226:"FORMAT.OVERLAY",227:"ON.RECALC",228:"EDIT.SERIES",229:"DEFINE.STYLE",240:"LINE.PRINT",243:"ENTER.DATA",249:"GALLERY.RADAR",250:"MERGE.STYLES",251:"EDITION.OPTIONS",252:"PASTE.PICTURE",253:"PASTE.PICTURE.LINK",254:"SPELLING",256:"ZOOM",259:"INSERT.OBJECT",260:"WINDOW.MINIMIZE",265:"SOUND.NOTE",266:"SOUND.PLAY",267:"FORMAT.SHAPE",268:"EXTEND.POLYGON",269:"FORMAT.AUTO",272:"GALLERY.3D.BAR",273:"GALLERY.3D.SURFACE",274:"FILL.AUTO",276:"CUSTOMIZE.TOOLBAR",277:"ADD.TOOL",278:"EDIT.OBJECT",279:"ON.DOUBLECLICK",280:"ON.ENTRY",281:"WORKBOOK.ADD",282:"WORKBOOK.MOVE",283:"WORKBOOK.COPY",284:"WORKBOOK.OPTIONS",285:"SAVE.WORKSPACE",288:"CHART.WIZARD",289:"DELETE.TOOL",290:"MOVE.TOOL",291:"WORKBOOK.SELECT",292:"WORKBOOK.ACTIVATE",293:"ASSIGN.TO.TOOL",295:"COPY.TOOL",296:"RESET.TOOL",297:"CONSTRAIN.NUMERIC",298:"PASTE.TOOL",302:"WORKBOOK.NEW",305:"SCENARIO.CELLS",306:"SCENARIO.DELETE",307:"SCENARIO.ADD",308:"SCENARIO.EDIT",309:"SCENARIO.SHOW",310:"SCENARIO.SHOW.NEXT",311:"SCENARIO.SUMMARY",312:"PIVOT.TABLE.WIZARD",313:"PIVOT.FIELD.PROPERTIES",314:"PIVOT.FIELD",315:"PIVOT.ITEM",316:"PIVOT.ADD.FIELDS",318:"OPTIONS.CALCULATION",319:"OPTIONS.EDIT",320:"OPTIONS.VIEW",321:"ADDIN.MANAGER",322:"MENU.EDITOR",323:"ATTACH.TOOLBARS",324:"VBAActivate",325:"OPTIONS.CHART",328:"VBA.INSERT.FILE",330:"VBA.PROCEDURE.DEFINITION",336:"ROUTING.SLIP",338:"ROUTE.DOCUMENT",339:"MAIL.LOGON",342:"INSERT.PICTURE",343:"EDIT.TOOL",344:"GALLERY.DOUGHNUT",350:"CHART.TREND",352:"PIVOT.ITEM.PROPERTIES",354:"WORKBOOK.INSERT",355:"OPTIONS.TRANSITION",356:"OPTIONS.GENERAL",370:"FILTER.ADVANCED",373:"MAIL.ADD.MAILER",374:"MAIL.DELETE.MAILER",375:"MAIL.REPLY",376:"MAIL.REPLY.ALL",377:"MAIL.FORWARD",378:"MAIL.NEXT.LETTER",379:"DATA.LABEL",380:"INSERT.TITLE",381:"FONT.PROPERTIES",382:"MACRO.OPTIONS",383:"WORKBOOK.HIDE",384:"WORKBOOK.UNHIDE",385:"WORKBOOK.DELETE",386:"WORKBOOK.NAME",388:"GALLERY.CUSTOM",390:"ADD.CHART.AUTOFORMAT",391:"DELETE.CHART.AUTOFORMAT",392:"CHART.ADD.DATA",393:"AUTO.OUTLINE",394:"TAB.ORDER",395:"SHOW.DIALOG",396:"SELECT.ALL",397:"UNGROUP.SHEETS",398:"SUBTOTAL.CREATE",399:"SUBTOTAL.REMOVE",400:"RENAME.OBJECT",412:"WORKBOOK.SCROLL",413:"WORKBOOK.NEXT",414:"WORKBOOK.PREV",415:"WORKBOOK.TAB.SPLIT",416:"FULL.SCREEN",417:"WORKBOOK.PROTECT",420:"SCROLLBAR.PROPERTIES",421:"PIVOT.SHOW.PAGES",422:"TEXT.TO.COLUMNS",423:"FORMAT.CHARTTYPE",424:"LINK.FORMAT",425:"TRACER.DISPLAY",430:"TRACER.NAVIGATE",431:"TRACER.CLEAR",432:"TRACER.ERROR",433:"PIVOT.FIELD.GROUP",434:"PIVOT.FIELD.UNGROUP",435:"CHECKBOX.PROPERTIES",436:"LABEL.PROPERTIES",437:"LISTBOX.PROPERTIES",438:"EDITBOX.PROPERTIES",439:"PIVOT.REFRESH",440:"LINK.COMBO",441:"OPEN.TEXT",442:"HIDE.DIALOG",443:"SET.DIALOG.FOCUS",444:"ENABLE.OBJECT",445:"PUSHBUTTON.PROPERTIES",446:"SET.DIALOG.DEFAULT",447:"FILTER",448:"FILTER.SHOW.ALL",449:"CLEAR.OUTLINE",450:"FUNCTION.WIZARD",451:"ADD.LIST.ITEM",452:"SET.LIST.ITEM",453:"REMOVE.LIST.ITEM",454:"SELECT.LIST.ITEM",455:"SET.CONTROL.VALUE",456:"SAVE.COPY.AS",458:"OPTIONS.LISTS.ADD",459:"OPTIONS.LISTS.DELETE",460:"SERIES.AXES",461:"SERIES.X",462:"SERIES.Y",463:"ERRORBAR.X",464:"ERRORBAR.Y",465:"FORMAT.CHART",466:"SERIES.ORDER",467:"MAIL.LOGOFF",468:"CLEAR.ROUTING.SLIP",469:"APP.ACTIVATE.MICROSOFT",470:"MAIL.EDIT.MAILER",471:"ON.SHEET",472:"STANDARD.WIDTH",473:"SCENARIO.MERGE",474:"SUMMARY.INFO",475:"FIND.FILE",476:"ACTIVE.CELL.FONT",477:"ENABLE.TIPWIZARD",478:"VBA.MAKE.ADDIN",480:"INSERTDATATABLE",481:"WORKGROUP.OPTIONS",482:"MAIL.SEND.MAILER",485:"AUTOCORRECT",489:"POST.DOCUMENT",491:"PICKLIST",493:"VIEW.SHOW",494:"VIEW.DEFINE",495:"VIEW.DELETE",509:"SHEET.BACKGROUND",510:"INSERT.MAP.OBJECT",511:"OPTIONS.MENONO",517:"MSOCHECKS",518:"NORMAL",519:"LAYOUT",520:"RM.PRINT.AREA",521:"CLEAR.PRINT.AREA",522:"ADD.PRINT.AREA",523:"MOVE.BRK",545:"HIDECURR.NOTE",546:"HIDEALL.NOTES",547:"DELETE.NOTE",548:"TRAVERSE.NOTES",549:"ACTIVATE.NOTES",620:"PROTECT.REVISIONS",621:"UNPROTECT.REVISIONS",647:"OPTIONS.ME",653:"WEB.PUBLISH",667:"NEWWEBQUERY",673:"PIVOT.TABLE.CHART",753:"OPTIONS.SAVE",755:"OPTIONS.SPELL",808:"HIDEALL.INKANNOTS"},Tw={0:"COUNT",1:"IF",2:"ISNA",3:"ISERROR",4:"SUM",5:"AVERAGE",6:"MIN",7:"MAX",8:"ROW",9:"COLUMN",10:"NA",11:"NPV",12:"STDEV",13:"DOLLAR",14:"FIXED",15:"SIN",16:"COS",17:"TAN",18:"ATAN",19:"PI",20:"SQRT",21:"EXP",22:"LN",23:"LOG10",24:"ABS",25:"INT",26:"SIGN",27:"ROUND",28:"LOOKUP",29:"INDEX",30:"REPT",31:"MID",32:"LEN",33:"VALUE",34:"TRUE",35:"FALSE",36:"AND",37:"OR",38:"NOT",39:"MOD",40:"DCOUNT",41:"DSUM",42:"DAVERAGE",43:"DMIN",44:"DMAX",45:"DSTDEV",46:"VAR",47:"DVAR",48:"TEXT",49:"LINEST",50:"TREND",51:"LOGEST",52:"GROWTH",53:"GOTO",54:"HALT",55:"RETURN",56:"PV",57:"FV",58:"NPER",59:"PMT",60:"RATE",61:"MIRR",62:"IRR",63:"RAND",64:"MATCH",65:"DATE",66:"TIME",67:"DAY",68:"MONTH",69:"YEAR",70:"WEEKDAY",71:"HOUR",72:"MINUTE",73:"SECOND",74:"NOW",75:"AREAS",76:"ROWS",77:"COLUMNS",78:"OFFSET",79:"ABSREF",80:"RELREF",81:"ARGUMENT",82:"SEARCH",83:"TRANSPOSE",84:"ERROR",85:"STEP",86:"TYPE",87:"ECHO",88:"SET.NAME",89:"CALLER",90:"DEREF",91:"WINDOWS",92:"SERIES",93:"DOCUMENTS",94:"ACTIVE.CELL",95:"SELECTION",96:"RESULT",97:"ATAN2",98:"ASIN",99:"ACOS",100:"CHOOSE",101:"HLOOKUP",102:"VLOOKUP",103:"LINKS",104:"INPUT",105:"ISREF",106:"GET.FORMULA",107:"GET.NAME",108:"SET.VALUE",109:"LOG",110:"EXEC",111:"CHAR",112:"LOWER",113:"UPPER",114:"PROPER",115:"LEFT",116:"RIGHT",117:"EXACT",118:"TRIM",119:"REPLACE",120:"SUBSTITUTE",121:"CODE",122:"NAMES",123:"DIRECTORY",124:"FIND",125:"CELL",126:"ISERR",127:"ISTEXT",128:"ISNUMBER",129:"ISBLANK",130:"T",131:"N",132:"FOPEN",133:"FCLOSE",134:"FSIZE",135:"FREADLN",136:"FREAD",137:"FWRITELN",138:"FWRITE",139:"FPOS",140:"DATEVALUE",141:"TIMEVALUE",142:"SLN",143:"SYD",144:"DDB",145:"GET.DEF",146:"REFTEXT",147:"TEXTREF",148:"INDIRECT",149:"REGISTER",150:"CALL",151:"ADD.BAR",152:"ADD.MENU",153:"ADD.COMMAND",154:"ENABLE.COMMAND",155:"CHECK.COMMAND",156:"RENAME.COMMAND",157:"SHOW.BAR",158:"DELETE.MENU",159:"DELETE.COMMAND",160:"GET.CHART.ITEM",161:"DIALOG.BOX",162:"CLEAN",163:"MDETERM",164:"MINVERSE",165:"MMULT",166:"FILES",167:"IPMT",168:"PPMT",169:"COUNTA",170:"CANCEL.KEY",171:"FOR",172:"WHILE",173:"BREAK",174:"NEXT",175:"INITIATE",176:"REQUEST",177:"POKE",178:"EXECUTE",179:"TERMINATE",180:"RESTART",181:"HELP",182:"GET.BAR",183:"PRODUCT",184:"FACT",185:"GET.CELL",186:"GET.WORKSPACE",187:"GET.WINDOW",188:"GET.DOCUMENT",189:"DPRODUCT",190:"ISNONTEXT",191:"GET.NOTE",192:"NOTE",193:"STDEVP",194:"VARP",195:"DSTDEVP",196:"DVARP",197:"TRUNC",198:"ISLOGICAL",199:"DCOUNTA",200:"DELETE.BAR",201:"UNREGISTER",204:"USDOLLAR",205:"FINDB",206:"SEARCHB",207:"REPLACEB",208:"LEFTB",209:"RIGHTB",210:"MIDB",211:"LENB",212:"ROUNDUP",213:"ROUNDDOWN",214:"ASC",215:"DBCS",216:"RANK",219:"ADDRESS",220:"DAYS360",221:"TODAY",222:"VDB",223:"ELSE",224:"ELSE.IF",225:"END.IF",226:"FOR.CELL",227:"MEDIAN",228:"SUMPRODUCT",229:"SINH",230:"COSH",231:"TANH",232:"ASINH",233:"ACOSH",234:"ATANH",235:"DGET",236:"CREATE.OBJECT",237:"VOLATILE",238:"LAST.ERROR",239:"CUSTOM.UNDO",240:"CUSTOM.REPEAT",241:"FORMULA.CONVERT",242:"GET.LINK.INFO",243:"TEXT.BOX",244:"INFO",245:"GROUP",246:"GET.OBJECT",247:"DB",248:"PAUSE",251:"RESUME",252:"FREQUENCY",253:"ADD.TOOLBAR",254:"DELETE.TOOLBAR",255:"User",256:"RESET.TOOLBAR",257:"EVALUATE",258:"GET.TOOLBAR",259:"GET.TOOL",260:"SPELLING.CHECK",261:"ERROR.TYPE",262:"APP.TITLE",263:"WINDOW.TITLE",264:"SAVE.TOOLBAR",265:"ENABLE.TOOL",266:"PRESS.TOOL",267:"REGISTER.ID",268:"GET.WORKBOOK",269:"AVEDEV",270:"BETADIST",271:"GAMMALN",272:"BETAINV",273:"BINOMDIST",274:"CHIDIST",275:"CHIINV",276:"COMBIN",277:"CONFIDENCE",278:"CRITBINOM",279:"EVEN",280:"EXPONDIST",281:"FDIST",282:"FINV",283:"FISHER",284:"FISHERINV",285:"FLOOR",286:"GAMMADIST",287:"GAMMAINV",288:"CEILING",289:"HYPGEOMDIST",290:"LOGNORMDIST",291:"LOGINV",292:"NEGBINOMDIST",293:"NORMDIST",294:"NORMSDIST",295:"NORMINV",296:"NORMSINV",297:"STANDARDIZE",298:"ODD",299:"PERMUT",300:"POISSON",301:"TDIST",302:"WEIBULL",303:"SUMXMY2",304:"SUMX2MY2",305:"SUMX2PY2",306:"CHITEST",307:"CORREL",308:"COVAR",309:"FORECAST",310:"FTEST",311:"INTERCEPT",312:"PEARSON",313:"RSQ",314:"STEYX",315:"SLOPE",316:"TTEST",317:"PROB",318:"DEVSQ",319:"GEOMEAN",320:"HARMEAN",321:"SUMSQ",322:"KURT",323:"SKEW",324:"ZTEST",325:"LARGE",326:"SMALL",327:"QUARTILE",328:"PERCENTILE",329:"PERCENTRANK",330:"MODE",331:"TRIMMEAN",332:"TINV",334:"MOVIE.COMMAND",335:"GET.MOVIE",336:"CONCATENATE",337:"POWER",338:"PIVOT.ADD.DATA",339:"GET.PIVOT.TABLE",340:"GET.PIVOT.FIELD",341:"GET.PIVOT.ITEM",342:"RADIANS",343:"DEGREES",344:"SUBTOTAL",345:"SUMIF",346:"COUNTIF",347:"COUNTBLANK",348:"SCENARIO.GET",349:"OPTIONS.LISTS.GET",350:"ISPMT",351:"DATEDIF",352:"DATESTRING",353:"NUMBERSTRING",354:"ROMAN",355:"OPEN.DIALOG",356:"SAVE.DIALOG",357:"VIEW.GET",358:"GETPIVOTDATA",359:"HYPERLINK",360:"PHONETIC",361:"AVERAGEA",362:"MAXA",363:"MINA",364:"STDEVPA",365:"VARPA",366:"STDEVA",367:"VARA",368:"BAHTTEXT",369:"THAIDAYOFWEEK",370:"THAIDIGIT",371:"THAIMONTHOFYEAR",372:"THAINUMSOUND",373:"THAINUMSTRING",374:"THAISTRINGLENGTH",375:"ISTHAIDIGIT",376:"ROUNDBAHTDOWN",377:"ROUNDBAHTUP",378:"THAIYEAR",379:"RTD",380:"CUBEVALUE",381:"CUBEMEMBER",382:"CUBEMEMBERPROPERTY",383:"CUBERANKEDMEMBER",384:"HEX2BIN",385:"HEX2DEC",386:"HEX2OCT",387:"DEC2BIN",388:"DEC2HEX",389:"DEC2OCT",390:"OCT2BIN",391:"OCT2HEX",392:"OCT2DEC",393:"BIN2DEC",394:"BIN2OCT",395:"BIN2HEX",396:"IMSUB",397:"IMDIV",398:"IMPOWER",399:"IMABS",400:"IMSQRT",401:"IMLN",402:"IMLOG2",403:"IMLOG10",404:"IMSIN",405:"IMCOS",406:"IMEXP",407:"IMARGUMENT",408:"IMCONJUGATE",409:"IMAGINARY",410:"IMREAL",411:"COMPLEX",412:"IMSUM",413:"IMPRODUCT",414:"SERIESSUM",415:"FACTDOUBLE",416:"SQRTPI",417:"QUOTIENT",418:"DELTA",419:"GESTEP",420:"ISEVEN",421:"ISODD",422:"MROUND",423:"ERF",424:"ERFC",425:"BESSELJ",426:"BESSELK",427:"BESSELY",428:"BESSELI",429:"XIRR",430:"XNPV",431:"PRICEMAT",432:"YIELDMAT",433:"INTRATE",434:"RECEIVED",435:"DISC",436:"PRICEDISC",437:"YIELDDISC",438:"TBILLEQ",439:"TBILLPRICE",440:"TBILLYIELD",441:"PRICE",442:"YIELD",443:"DOLLARDE",444:"DOLLARFR",445:"NOMINAL",446:"EFFECT",447:"CUMPRINC",448:"CUMIPMT",449:"EDATE",450:"EOMONTH",451:"YEARFRAC",452:"COUPDAYBS",453:"COUPDAYS",454:"COUPDAYSNC",455:"COUPNCD",456:"COUPNUM",457:"COUPPCD",458:"DURATION",459:"MDURATION",460:"ODDLPRICE",461:"ODDLYIELD",462:"ODDFPRICE",463:"ODDFYIELD",464:"RANDBETWEEN",465:"WEEKNUM",466:"AMORDEGRC",467:"AMORLINC",468:"CONVERT",724:"SHEETJS",469:"ACCRINT",470:"ACCRINTM",471:"WORKDAY",472:"NETWORKDAYS",473:"GCD",474:"MULTINOMIAL",475:"LCM",476:"FVSCHEDULE",477:"CUBEKPIMEMBER",478:"CUBESET",479:"CUBESETCOUNT",480:"IFERROR",481:"COUNTIFS",482:"SUMIFS",483:"AVERAGEIF",484:"AVERAGEIFS"},X8={2:1,3:1,10:0,15:1,16:1,17:1,18:1,19:0,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:2,30:2,31:3,32:1,33:1,34:0,35:0,38:1,39:2,40:3,41:3,42:3,43:3,44:3,45:3,47:3,48:2,53:1,61:3,63:0,65:3,66:3,67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:0,75:1,76:1,77:1,79:2,80:2,83:1,85:0,86:1,89:0,90:1,94:0,95:0,97:2,98:1,99:1,101:3,102:3,105:1,106:1,108:2,111:1,112:1,113:1,114:1,117:2,118:1,119:4,121:1,126:1,127:1,128:1,129:1,130:1,131:1,133:1,134:1,135:1,136:2,137:2,138:2,140:1,141:1,142:3,143:4,144:4,161:1,162:1,163:1,164:1,165:2,172:1,175:2,176:2,177:3,178:2,179:1,184:1,186:1,189:3,190:1,195:3,196:3,197:1,198:1,199:3,201:1,207:4,210:3,211:1,212:2,213:2,214:1,215:1,225:0,229:1,230:1,231:1,232:1,233:1,234:1,235:3,244:1,247:4,252:2,257:1,261:1,271:1,273:4,274:2,275:2,276:2,277:3,278:3,279:1,280:3,281:3,282:3,283:1,284:1,285:2,286:4,287:3,288:2,289:4,290:3,291:3,292:3,293:4,294:1,295:3,296:1,297:3,298:1,299:2,300:3,301:3,302:4,303:2,304:2,305:2,306:2,307:2,308:2,309:3,310:2,311:2,312:2,313:2,314:2,315:2,316:4,325:2,326:2,327:2,328:2,331:2,332:2,337:2,342:1,343:1,346:2,347:1,350:4,351:3,352:1,353:2,360:1,368:1,369:1,370:1,371:1,372:1,373:1,374:1,375:1,376:1,377:1,378:1,382:3,385:1,392:1,393:1,396:2,397:2,398:2,399:1,400:1,401:1,402:1,403:1,404:1,405:1,406:1,407:1,408:1,409:1,410:1,414:4,415:1,416:1,417:2,420:1,421:1,422:2,424:1,425:2,426:2,427:2,428:2,430:3,438:3,439:3,440:3,443:2,444:2,445:2,446:2,447:6,448:6,449:2,450:2,464:2,468:3,476:2,479:1,480:2,65535:0};function J8(e){var t="of:="+e.replace(Dp,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return t.replace(/;/g,"|").replace(/,/g,";")}function K8(e){return e.replace(/\./,"!")}var Qd=typeof Map!="undefined";function Fp(e,t,a){var s=0,i=e.length;if(a){if(Qd?a.has(t):Object.prototype.hasOwnProperty.call(a,t)){for(var d=Qd?a.get(t):a[t];s<d.length;++s)if(e[d[s]].t===t)return e.Count++,d[s]}}else for(;s<i;++s)if(e[s].t===t)return e.Count++,s;return e[i]={t},e.Count++,e.Unique++,a&&(Qd?(a.has(t)||a.set(t,[]),a.get(t).push(i)):(Object.prototype.hasOwnProperty.call(a,t)||(a[t]=[]),a[t].push(i))),i}function sh(e,t){var a={min:e+1,max:e+1},s=-1;return t.MDW&&(gi=t.MDW),t.width!=null?a.customWidth=1:t.wpx!=null?s=Rf(t.wpx):t.wch!=null&&(s=t.wch),s>-1?(a.width=Kg(s),a.customWidth=1):t.width!=null&&(a.width=t.width),t.hidden&&(a.hidden=!0),t.level!=null&&(a.outlineLevel=a.level=t.level),a}function Ew(e,t){if(e){var a=[.7,.7,.75,.75,.3,.3];e.left==null&&(e.left=a[0]),e.right==null&&(e.right=a[1]),e.top==null&&(e.top=a[2]),e.bottom==null&&(e.bottom=a[3]),e.header==null&&(e.header=a[4]),e.footer==null&&(e.footer=a[5])}}function ml(e,t,a){var s=a.revssf[t.z!=null?t.z:"General"],i=60,d=e.length;if(s==null&&a.ssf){for(;i<392;++i)if(a.ssf[i]==null){k2(t.z,i),a.ssf[i]=t.z,a.revssf[t.z]=s=i;break}}for(i=0;i!=d;++i)if(e[i].numFmtId===s)return i;return e[d]={numFmtId:s,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},d}function Q8(e,t,a){if(e&&e["!ref"]){var s=Ba(e["!ref"]);if(s.e.c<s.s.c||s.e.r<s.s.r)throw new Error("Bad range ("+a+"): "+e["!ref"])}}function e7(e){if(e.length===0)return"";for(var t='<mergeCells count="'+e.length+'">',a=0;a!=e.length;++a)t+='<mergeCell ref="'+cr(e[a])+'"/>';return t+"</mergeCells>"}function t7(e,t,a,s,i){var d=!1,c={},f=null;if(s.bookType!=="xlsx"&&t.vbaraw){var g=t.SheetNames[a];try{t.Workbook&&(g=t.Workbook.Sheets[a].CodeName||g)}catch(x){}d=!0,c.codeName=i0(wa(g))}if(e&&e["!outline"]){var p={summaryBelow:1,summaryRight:1};e["!outline"].above&&(p.summaryBelow=0),e["!outline"].left&&(p.summaryRight=0),f=(f||"")+ht("outlinePr",null,p)}!d&&!f||(i[i.length]=ht("sheetPr",f,c))}var a7=["objects","scenarios","selectLockedCells","selectUnlockedCells"],r7=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function n7(e){var t={sheet:1};return a7.forEach(function(a){e[a]!=null&&e[a]&&(t[a]="1")}),r7.forEach(function(a){e[a]!=null&&!e[a]&&(t[a]="0")}),e.password&&(t.password=uw(e.password).toString(16).toUpperCase()),ht("sheetProtection",null,t)}function s7(e){return Ew(e),ht("pageMargins",null,e)}function i7(e,t){for(var a=["<cols>"],s,i=0;i!=t.length;++i)(s=t[i])&&(a[a.length]=ht("col",null,sh(i,s)));return a[a.length]="</cols>",a.join("")}function l7(e,t,a,s){var i=typeof e.ref=="string"?e.ref:cr(e.ref);a.Workbook||(a.Workbook={Sheets:[]}),a.Workbook.Names||(a.Workbook.Names=[]);var d=a.Workbook.Names,c=In(i);c.s.r==c.e.r&&(c.e.r=In(t["!ref"]).e.r,i=cr(c));for(var f=0;f<d.length;++f){var g=d[f];if(g.Name=="_xlnm._FilterDatabase"&&g.Sheet==s){g.Ref="'"+a.SheetNames[s]+"'!"+i;break}}return f==d.length&&d.push({Name:"_xlnm._FilterDatabase",Sheet:s,Ref:"'"+a.SheetNames[s]+"'!"+i}),ht("autoFilter",null,{ref:i})}function o7(e,t,a,s){var i={workbookViewId:"0"};return(((s||{}).Workbook||{}).Views||[])[0]&&(i.rightToLeft=s.Workbook.Views[0].RTL?"1":"0"),ht("sheetViews",ht("sheetView",null,i),{})}function c7(e,t,a,s){if(e.c&&a["!comments"].push([t,e.c]),e.v===void 0&&typeof e.f!="string"||e.t==="z"&&!e.f)return"";var i="",d=e.t,c=e.v;if(e.t!=="z")switch(e.t){case"b":i=e.v?"1":"0";break;case"n":i=""+e.v;break;case"e":i=N0[e.v];break;case"d":s&&s.cellDates?i=Kr(e.v,-1).toISOString():(e=yn(e),e.t="n",i=""+(e.v=xn(Kr(e.v)))),typeof e.z=="undefined"&&(e.z=Ka[14]);break;default:i=e.v;break}var f=Dr("v",wa(i)),g={r:t},p=ml(s.cellXfs,e,s);switch(p!==0&&(g.s=p),e.t){case"n":break;case"d":g.t="d";break;case"b":g.t="b";break;case"e":g.t="e";break;case"z":break;default:if(e.v==null){delete e.t;break}if(e.v.length>32767)throw new Error("Text length must not exceed 32767 characters");if(s&&s.bookSST){f=Dr("v",""+Fp(s.Strings,e.v,s.revStrings)),g.t="s";break}g.t="str";break}if(e.t!=d&&(e.t=d,e.v=c),typeof e.f=="string"&&e.f){var x=e.F&&e.F.slice(0,t.length)==t?{t:"array",ref:e.F}:null;f=ht("f",wa(e.f),x)+(e.v!=null?f:"")}return e.l&&a["!links"].push([t,e.l]),e.D&&(g.cm=1),ht("c",f,g)}function d7(e,t,a,s){var i=[],d=[],c=Ba(e["!ref"]),f="",g,p="",x=[],y=0,_=0,k=e["!rows"],T=Array.isArray(e),N={r:p},S,O=-1;for(_=c.s.c;_<=c.e.c;++_)x[_]=$r(_);for(y=c.s.r;y<=c.e.r;++y){for(d=[],p=Pr(y),_=c.s.c;_<=c.e.c;++_){g=x[_]+p;var C=T?(e[y]||[])[_]:e[g];C!==void 0&&(f=c7(C,g,e,t))!=null&&d.push(f)}(d.length>0||k&&k[y])&&(N={r:p},k&&k[y]&&(S=k[y],S.hidden&&(N.hidden=1),O=-1,S.hpx?O=Ff(S.hpx):S.hpt&&(O=S.hpt),O>-1&&(N.ht=O,N.customHeight=1),S.level&&(N.outlineLevel=S.level)),i[i.length]=ht("row",d.join(""),N))}if(k)for(;y<k.length;++y)k&&k[y]&&(N={r:y+1},S=k[y],S.hidden&&(N.hidden=1),O=-1,S.hpx?O=Ff(S.hpx):S.hpt&&(O=S.hpt),O>-1&&(N.ht=O,N.customHeight=1),S.level&&(N.outlineLevel=S.level),i[i.length]=ht("row","",N));return i.join("")}function Cw(e,t,a,s){var i=[dr,ht("worksheet",null,{xmlns:Dc[0],"xmlns:r":br.r})],d=a.SheetNames[e],c=0,f="",g=a.Sheets[d];g==null&&(g={});var p=g["!ref"]||"A1",x=Ba(p);if(x.e.c>16383||x.e.r>1048575){if(t.WTF)throw new Error("Range "+p+" exceeds format limit A1:XFD1048576");x.e.c=Math.min(x.e.c,16383),x.e.r=Math.min(x.e.c,1048575),p=cr(x)}s||(s={}),g["!comments"]=[];var y=[];t7(g,a,e,t,i),i[i.length]=ht("dimension",null,{ref:p}),i[i.length]=o7(g,t,e,a),t.sheetFormat&&(i[i.length]=ht("sheetFormatPr",null,{defaultRowHeight:t.sheetFormat.defaultRowHeight||"16",baseColWidth:t.sheetFormat.baseColWidth||"10",outlineLevelRow:t.sheetFormat.outlineLevelRow||"7"})),g["!cols"]!=null&&g["!cols"].length>0&&(i[i.length]=i7(g,g["!cols"])),i[c=i.length]="<sheetData/>",g["!links"]=[],g["!ref"]!=null&&(f=d7(g,t),f.length>0&&(i[i.length]=f)),i.length>c+1&&(i[i.length]="</sheetData>",i[c]=i[c].replace("/>",">")),g["!protect"]&&(i[i.length]=n7(g["!protect"])),g["!autofilter"]!=null&&(i[i.length]=l7(g["!autofilter"],g,a,e)),g["!merges"]!=null&&g["!merges"].length>0&&(i[i.length]=e7(g["!merges"]));var _=-1,k,T=-1;return g["!links"].length>0&&(i[i.length]="<hyperlinks>",g["!links"].forEach(function(N){N[1].Target&&(k={ref:N[0]},N[1].Target.charAt(0)!="#"&&(T=_a(s,-1,wa(N[1].Target).replace(/#.*$/,""),fa.HLINK),k["r:id"]="rId"+T),(_=N[1].Target.indexOf("#"))>-1&&(k.location=wa(N[1].Target.slice(_+1))),N[1].Tooltip&&(k.tooltip=wa(N[1].Tooltip)),i[i.length]=ht("hyperlink",null,k))}),i[i.length]="</hyperlinks>"),delete g["!links"],g["!margins"]!=null&&(i[i.length]=s7(g["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&(i[i.length]=Dr("ignoredErrors",ht("ignoredError",null,{numberStoredAsText:1,sqref:p}))),y.length>0&&(T=_a(s,-1,"../drawings/drawing"+(e+1)+".xml",fa.DRAW),i[i.length]=ht("drawing",null,{"r:id":"rId"+T}),g["!drawing"]=y),g["!comments"].length>0&&(T=_a(s,-1,"../drawings/vmlDrawing"+(e+1)+".vml",fa.VML),i[i.length]=ht("legacyDrawing",null,{"r:id":"rId"+T}),g["!legacy"]=T),i.length>1&&(i[i.length]="</worksheet>",i[1]=i[1].replace("/>",">")),i.join("")}function u7(e,t){var a={},s=e.l+t;a.r=e.read_shift(4),e.l+=4;var i=e.read_shift(2);e.l+=1;var d=e.read_shift(1);return e.l=s,d&7&&(a.level=d&7),d&16&&(a.hidden=!0),d&32&&(a.hpt=i/20),a}function f7(e,t,a){var s=qe(145),i=(a["!rows"]||[])[e]||{};s.write_shift(4,e),s.write_shift(4,0);var d=320;i.hpx?d=Ff(i.hpx)*20:i.hpt&&(d=i.hpt*20),s.write_shift(2,d),s.write_shift(1,0);var c=0;i.level&&(c|=i.level),i.hidden&&(c|=16),(i.hpx||i.hpt)&&(c|=32),s.write_shift(1,c),s.write_shift(1,0);var f=0,g=s.l;s.l+=4;for(var p={r:e,c:0},x=0;x<16;++x)if(!(t.s.c>x+1<<10||t.e.c<x<<10)){for(var y=-1,_=-1,k=x<<10;k<x+1<<10;++k){p.c=k;var T=Array.isArray(a)?(a[p.r]||[])[p.c]:a[ka(p)];T&&(y<0&&(y=k),_=k)}y<0||(++f,s.write_shift(4,y),s.write_shift(4,_))}var N=s.l;return s.l=g,s.write_shift(4,f),s.l=N,s.length>s.l?s.slice(0,s.l):s}function h7(e,t,a,s){var i=f7(s,a,t);(i.length>17||(t["!rows"]||[])[s])&&nt(e,0,i)}var m7=po,g7=Rc;function p7(){}function x7(e,t){var a={},s=e[e.l];return++e.l,a.above=!(s&64),a.left=!(s&128),e.l+=18,a.name=TT(e),a}function y7(e,t,a){a==null&&(a=qe(84+4*e.length));var s=192;t&&(t.above&&(s&=-65),t.left&&(s&=-129)),a.write_shift(1,s);for(var i=1;i<3;++i)a.write_shift(1,0);return Lf({auto:1},a),a.write_shift(-4,-1),a.write_shift(-4,-1),W2(e,a),a.slice(0,a.l)}function b7(e){var t=rs(e);return[t]}function v7(e,t,a){return a==null&&(a=qe(8)),ho(t,a)}function _7(e){var t=mo(e);return[t]}function w7(e,t,a){return a==null&&(a=qe(4)),go(t,a)}function k7(e){var t=rs(e),a=e.read_shift(1);return[t,a,"b"]}function N7(e,t,a){return a==null&&(a=qe(9)),ho(t,a),a.write_shift(1,e.v?1:0),a}function j7(e){var t=mo(e),a=e.read_shift(1);return[t,a,"b"]}function S7(e,t,a){return a==null&&(a=qe(5)),go(t,a),a.write_shift(1,e.v?1:0),a}function T7(e){var t=rs(e),a=e.read_shift(1);return[t,a,"e"]}function E7(e,t,a){return a==null&&(a=qe(9)),ho(t,a),a.write_shift(1,e.v),a}function C7(e){var t=mo(e),a=e.read_shift(1);return[t,a,"e"]}function A7(e,t,a){return a==null&&(a=qe(8)),go(t,a),a.write_shift(1,e.v),a.write_shift(2,0),a.write_shift(1,0),a}function O7(e){var t=rs(e),a=e.read_shift(4);return[t,a,"s"]}function M7(e,t,a){return a==null&&(a=qe(12)),ho(t,a),a.write_shift(4,t.v),a}function L7(e){var t=mo(e),a=e.read_shift(4);return[t,a,"s"]}function D7(e,t,a){return a==null&&(a=qe(8)),go(t,a),a.write_shift(4,t.v),a}function P7(e){var t=rs(e),a=Fc(e);return[t,a,"n"]}function R7(e,t,a){return a==null&&(a=qe(16)),ho(t,a),oo(e.v,a),a}function F7(e){var t=mo(e),a=Fc(e);return[t,a,"n"]}function I7(e,t,a){return a==null&&(a=qe(12)),go(t,a),oo(e.v,a),a}function z7(e){var t=rs(e),a=V2(e);return[t,a,"n"]}function B7(e,t,a){return a==null&&(a=qe(12)),ho(t,a),G2(e.v,a),a}function U7(e){var t=mo(e),a=V2(e);return[t,a,"n"]}function H7(e,t,a){return a==null&&(a=qe(8)),go(t,a),G2(e.v,a),a}function $7(e){var t=rs(e),a=Cp(e);return[t,a,"is"]}function W7(e){var t=rs(e),a=Wr(e);return[t,a,"str"]}function V7(e,t,a){return a==null&&(a=qe(12+4*e.v.length)),ho(t,a),_r(e.v,a),a.length>a.l?a.slice(0,a.l):a}function G7(e){var t=mo(e),a=Wr(e);return[t,a,"str"]}function Z7(e,t,a){return a==null&&(a=qe(8+4*e.v.length)),go(t,a),_r(e.v,a),a.length>a.l?a.slice(0,a.l):a}function q7(e,t,a){var s=e.l+t,i=rs(e);i.r=a["!row"];var d=e.read_shift(1),c=[i,d,"b"];if(a.cellFormula){e.l+=2;var f=nh(e,s-e.l,a);c[3]=Nc(f,null,i,a.supbooks,a)}else e.l=s;return c}function Y7(e,t,a){var s=e.l+t,i=rs(e);i.r=a["!row"];var d=e.read_shift(1),c=[i,d,"e"];if(a.cellFormula){e.l+=2;var f=nh(e,s-e.l,a);c[3]=Nc(f,null,i,a.supbooks,a)}else e.l=s;return c}function X7(e,t,a){var s=e.l+t,i=rs(e);i.r=a["!row"];var d=Fc(e),c=[i,d,"n"];if(a.cellFormula){e.l+=2;var f=nh(e,s-e.l,a);c[3]=Nc(f,null,i,a.supbooks,a)}else e.l=s;return c}function J7(e,t,a){var s=e.l+t,i=rs(e);i.r=a["!row"];var d=Wr(e),c=[i,d,"str"];if(a.cellFormula){e.l+=2;var f=nh(e,s-e.l,a);c[3]=Nc(f,null,i,a.supbooks,a)}else e.l=s;return c}var K7=po,Q7=Rc;function eA(e,t){return t==null&&(t=qe(4)),t.write_shift(4,e),t}function tA(e,t){var a=e.l+t,s=po(e),i=Ap(e),d=Wr(e),c=Wr(e),f=Wr(e);e.l=a;var g={rfx:s,relId:i,loc:d,display:f};return c&&(g.Tooltip=c),g}function aA(e,t){var a=qe(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));Rc({s:vr(e[0]),e:vr(e[0])},a),Op("rId"+t,a);var s=e[1].Target.indexOf("#"),i=s==-1?"":e[1].Target.slice(s+1);return _r(i||"",a),_r(e[1].Tooltip||"",a),_r("",a),a.slice(0,a.l)}function rA(){}function nA(e,t,a){var s=e.l+t,i=Z2(e),d=e.read_shift(1),c=[i];if(c[2]=d,a.cellFormula){var f=G8(e,s-e.l,a);c[1]=f}else e.l=s;return c}function sA(e,t,a){var s=e.l+t,i=po(e),d=[i];if(a.cellFormula){var c=q8(e,s-e.l,a);d[1]=c,e.l=s}else e.l=s;return d}function iA(e,t,a){a==null&&(a=qe(18));var s=sh(e,t);a.write_shift(-4,e),a.write_shift(-4,e),a.write_shift(4,(s.width||10)*256),a.write_shift(4,0);var i=0;return t.hidden&&(i|=1),typeof s.width=="number"&&(i|=2),t.level&&(i|=t.level<<8),a.write_shift(2,i),a}var Aw=["left","right","top","bottom","header","footer"];function lA(e){var t={};return Aw.forEach(function(a){t[a]=Fc(e)}),t}function oA(e,t){return t==null&&(t=qe(48)),Ew(e),Aw.forEach(function(a){oo(e[a],t)}),t}function cA(e){var t=e.read_shift(2);return e.l+=28,{RTL:t&32}}function dA(e,t,a){a==null&&(a=qe(30));var s=924;return(((t||{}).Views||[])[0]||{}).RTL&&(s|=32),a.write_shift(2,s),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(1,0),a.write_shift(1,0),a.write_shift(2,0),a.write_shift(2,100),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(4,0),a}function uA(e){var t=qe(24);return t.write_shift(4,4),t.write_shift(4,1),Rc(e,t),t}function fA(e,t){return t==null&&(t=qe(66)),t.write_shift(2,e.password?uw(e.password):0),t.write_shift(4,1),[["objects",!1],["scenarios",!1],["formatCells",!0],["formatColumns",!0],["formatRows",!0],["insertColumns",!0],["insertRows",!0],["insertHyperlinks",!0],["deleteColumns",!0],["deleteRows",!0],["selectLockedCells",!1],["sort",!0],["autoFilter",!0],["pivotTables",!0],["selectUnlockedCells",!1]].forEach(function(a){a[1]?t.write_shift(4,e[a[0]]!=null&&!e[a[0]]?1:0):t.write_shift(4,e[a[0]]!=null&&e[a[0]]?0:1)}),t}function hA(){}function mA(){}function gA(e,t,a,s,i,d,c){if(t.v===void 0)return!1;var f="";switch(t.t){case"b":f=t.v?"1":"0";break;case"d":t=yn(t),t.z=t.z||Ka[14],t.v=xn(Kr(t.v)),t.t="n";break;case"n":case"e":f=""+t.v;break;default:f=t.v;break}var g={r:a,c:s};switch(g.s=ml(i.cellXfs,t,i),t.l&&d["!links"].push([ka(g),t.l]),t.c&&d["!comments"].push([ka(g),t.c]),t.t){case"s":case"str":return i.bookSST?(f=Fp(i.Strings,t.v,i.revStrings),g.t="s",g.v=f,c?nt(e,18,D7(t,g)):nt(e,7,M7(t,g))):(g.t="str",c?nt(e,17,Z7(t,g)):nt(e,6,V7(t,g))),!0;case"n":return t.v==(t.v|0)&&t.v>-1e3&&t.v<1e3?c?nt(e,13,H7(t,g)):nt(e,2,B7(t,g)):c?nt(e,16,I7(t,g)):nt(e,5,R7(t,g)),!0;case"b":return g.t="b",c?nt(e,15,S7(t,g)):nt(e,4,N7(t,g)),!0;case"e":return g.t="e",c?nt(e,14,A7(t,g)):nt(e,3,E7(t,g)),!0}return c?nt(e,12,w7(t,g)):nt(e,1,v7(t,g)),!0}function pA(e,t,a,s){var i=Ba(t["!ref"]||"A1"),d,c="",f=[];nt(e,145);var g=Array.isArray(t),p=i.e.r;t["!rows"]&&(p=Math.max(i.e.r,t["!rows"].length-1));for(var x=i.s.r;x<=p;++x){c=Pr(x),h7(e,t,i,x);var y=!1;if(x<=i.e.r)for(var _=i.s.c;_<=i.e.c;++_){x===i.s.r&&(f[_]=$r(_)),d=f[_]+c;var k=g?(t[x]||[])[_]:t[d];if(!k){y=!1;continue}y=gA(e,k,x,_,s,t,y)}}nt(e,146)}function xA(e,t){!t||!t["!merges"]||(nt(e,177,eA(t["!merges"].length)),t["!merges"].forEach(function(a){nt(e,176,Q7(a))}),nt(e,178))}function yA(e,t){!t||!t["!cols"]||(nt(e,390),t["!cols"].forEach(function(a,s){a&&nt(e,60,iA(s,a))}),nt(e,391))}function bA(e,t){!t||!t["!ref"]||(nt(e,648),nt(e,649,uA(Ba(t["!ref"]))),nt(e,650))}function vA(e,t,a){t["!links"].forEach(function(s){if(s[1].Target){var i=_a(a,-1,s[1].Target.replace(/#.*$/,""),fa.HLINK);nt(e,494,aA(s,i))}}),delete t["!links"]}function _A(e,t,a,s){if(t["!comments"].length>0){var i=_a(s,-1,"../drawings/vmlDrawing"+(a+1)+".vml",fa.VML);nt(e,551,Op("rId"+i)),t["!legacy"]=i}}function wA(e,t,a,s){if(t["!autofilter"]){var i=t["!autofilter"],d=typeof i.ref=="string"?i.ref:cr(i.ref);a.Workbook||(a.Workbook={Sheets:[]}),a.Workbook.Names||(a.Workbook.Names=[]);var c=a.Workbook.Names,f=In(d);f.s.r==f.e.r&&(f.e.r=In(t["!ref"]).e.r,d=cr(f));for(var g=0;g<c.length;++g){var p=c[g];if(p.Name=="_xlnm._FilterDatabase"&&p.Sheet==s){p.Ref="'"+a.SheetNames[s]+"'!"+d;break}}g==c.length&&c.push({Name:"_xlnm._FilterDatabase",Sheet:s,Ref:"'"+a.SheetNames[s]+"'!"+d}),nt(e,161,Rc(Ba(d))),nt(e,162)}}function kA(e,t,a){nt(e,133),nt(e,137,dA(t,a)),nt(e,138),nt(e,134)}function NA(e,t){t["!protect"]&&nt(e,535,fA(t["!protect"]))}function jA(e,t,a,s){var i=pn(),d=a.SheetNames[e],c=a.Sheets[d]||{},f=d;try{a&&a.Workbook&&(f=a.Workbook.Sheets[e].CodeName||f)}catch(p){}var g=Ba(c["!ref"]||"A1");if(g.e.c>16383||g.e.r>1048575){if(t.WTF)throw new Error("Range "+(c["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");g.e.c=Math.min(g.e.c,16383),g.e.r=Math.min(g.e.c,1048575)}return c["!links"]=[],c["!comments"]=[],nt(i,129),(a.vbaraw||c["!outline"])&&nt(i,147,y7(f,c["!outline"])),nt(i,148,g7(g)),kA(i,c,a.Workbook),yA(i,c),pA(i,c,e,t),NA(i,c),wA(i,c,a,e),xA(i,c),vA(i,c,s),c["!margins"]&&nt(i,476,oA(c["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&bA(i,c),_A(i,c,e,s),nt(i,130),i.end()}function SA(e,t){e.l+=10;var a=Wr(e);return{name:a}}var TA=[["allowRefreshQuery",!1,"bool"],["autoCompressPictures",!0,"bool"],["backupFile",!1,"bool"],["checkCompatibility",!1,"bool"],["CodeName",""],["date1904",!1,"bool"],["defaultThemeVersion",0,"int"],["filterPrivacy",!1,"bool"],["hidePivotFieldList",!1,"bool"],["promptedSolutions",!1,"bool"],["publishItems",!1,"bool"],["refreshAllConnections",!1,"bool"],["saveExternalLinkValues",!0,"bool"],["showBorderUnselectedTables",!0,"bool"],["showInkAnnotation",!0,"bool"],["showObjects","all"],["showPivotChartFilter",!1,"bool"],["updateLinks","userSet"]];function EA(e){return!e.Workbook||!e.Workbook.WBProps?"false":sT(e.Workbook.WBProps.date1904)?"true":"false"}var CA="][*?/\\".split("");function Ow(e,t){if(e.length>31)throw new Error("Sheet names cannot exceed 31 chars");var a=!0;return CA.forEach(function(s){if(e.indexOf(s)!=-1)throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}),a}function AA(e,t,a){e.forEach(function(s,i){Ow(s);for(var d=0;d<i;++d)if(s==e[d])throw new Error("Duplicate Sheet Name: "+s);if(a){var c=t&&t[i]&&t[i].CodeName||s;if(c.charCodeAt(0)==95&&c.length>22)throw new Error("Bad Code Name: Worksheet"+c)}})}function OA(e){if(!e||!e.SheetNames||!e.Sheets)throw new Error("Invalid Workbook");if(!e.SheetNames.length)throw new Error("Workbook is empty");var t=e.Workbook&&e.Workbook.Sheets||[];AA(e.SheetNames,t,!!e.vbaraw);for(var a=0;a<e.SheetNames.length;++a)Q8(e.Sheets[e.SheetNames[a]],e.SheetNames[a],a)}function Mw(e){var t=[dr];t[t.length]=ht("workbook",null,{xmlns:Dc[0],"xmlns:r":br.r});var a=e.Workbook&&(e.Workbook.Names||[]).length>0,s={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(TA.forEach(function(f){e.Workbook.WBProps[f[0]]!=null&&e.Workbook.WBProps[f[0]]!=f[1]&&(s[f[0]]=e.Workbook.WBProps[f[0]])}),e.Workbook.WBProps.CodeName&&(s.codeName=e.Workbook.WBProps.CodeName,delete s.CodeName)),t[t.length]=ht("workbookPr",null,s);var i=e.Workbook&&e.Workbook.Sheets||[],d=0;if(i&&i[0]&&i[0].Hidden){for(t[t.length]="<bookViews>",d=0;d!=e.SheetNames.length&&!(!i[d]||!i[d].Hidden);++d);d==e.SheetNames.length&&(d=0),t[t.length]='<workbookView firstSheet="'+d+'" activeTab="'+d+'"/>',t[t.length]="</bookViews>"}for(t[t.length]="<sheets>",d=0;d!=e.SheetNames.length;++d){var c={name:wa(e.SheetNames[d].slice(0,31))};if(c.sheetId=""+(d+1),c["r:id"]="rId"+(d+1),i[d])switch(i[d].Hidden){case 1:c.state="hidden";break;case 2:c.state="veryHidden";break}t[t.length]=ht("sheet",null,c)}return t[t.length]="</sheets>",a&&(t[t.length]="<definedNames>",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach(function(f){var g={name:f.Name};f.Comment&&(g.comment=f.Comment),f.Sheet!=null&&(g.localSheetId=""+f.Sheet),f.Hidden&&(g.hidden="1"),f.Ref&&(t[t.length]=ht("definedName",wa(f.Ref),g))}),t[t.length]="</definedNames>"),t.length>2&&(t[t.length]="</workbook>",t[1]=t[1].replace("/>",">")),t.join("")}function MA(e,t){var a={};return a.Hidden=e.read_shift(4),a.iTabID=e.read_shift(4),a.strRelID=Jg(e),a.name=Wr(e),a}function LA(e,t){return t||(t=qe(127)),t.write_shift(4,e.Hidden),t.write_shift(4,e.iTabID),Op(e.strRelID,t),_r(e.name.slice(0,31),t),t.length>t.l?t.slice(0,t.l):t}function DA(e,t){var a={},s=e.read_shift(4);a.defaultThemeVersion=e.read_shift(4);var i=t>8?Wr(e):"";return i.length>0&&(a.CodeName=i),a.autoCompressPictures=!!(s&65536),a.backupFile=!!(s&64),a.checkCompatibility=!!(s&4096),a.date1904=!!(s&1),a.filterPrivacy=!!(s&8),a.hidePivotFieldList=!!(s&1024),a.promptedSolutions=!!(s&16),a.publishItems=!!(s&2048),a.refreshAllConnections=!!(s&262144),a.saveExternalLinkValues=!!(s&128),a.showBorderUnselectedTables=!!(s&4),a.showInkAnnotation=!!(s&32),a.showObjects=["all","placeholders","none"][s>>13&3],a.showPivotChartFilter=!!(s&32768),a.updateLinks=["userSet","never","always"][s>>8&3],a}function PA(e,t){t||(t=qe(72));var a=0;return e&&e.filterPrivacy&&(a|=8),t.write_shift(4,a),t.write_shift(4,0),W2(e&&e.CodeName||"ThisWorkbook",t),t.slice(0,t.l)}function RA(e,t,a){var s=e.l+t;e.l+=4,e.l+=1;var i=e.read_shift(4),d=ET(e),c=Z8(e,0,a),f=Ap(e);e.l=s;var g={Name:d,Ptg:c};return i<268435455&&(g.Sheet=i),f&&(g.Comment=f),g}function FA(e,t){nt(e,143);for(var a=0;a!=t.SheetNames.length;++a){var s=t.Workbook&&t.Workbook.Sheets&&t.Workbook.Sheets[a]&&t.Workbook.Sheets[a].Hidden||0,i={Hidden:s,iTabID:a+1,strRelID:"rId"+(a+1),name:t.SheetNames[a]};nt(e,156,LA(i))}nt(e,144)}function IA(e,t){t||(t=qe(127));for(var a=0;a!=4;++a)t.write_shift(4,0);return _r("SheetJS",t),_r(jf.version,t),_r(jf.version,t),_r("7262",t),t.length>t.l?t.slice(0,t.l):t}function zA(e,t){t||(t=qe(29)),t.write_shift(-4,0),t.write_shift(-4,460),t.write_shift(4,28800),t.write_shift(4,17600),t.write_shift(4,500),t.write_shift(4,e),t.write_shift(4,e);var a=120;return t.write_shift(1,a),t.length>t.l?t.slice(0,t.l):t}function BA(e,t){if(!(!t.Workbook||!t.Workbook.Sheets)){for(var a=t.Workbook.Sheets,s=0,i=-1,d=-1;s<a.length;++s)!a[s]||!a[s].Hidden&&i==-1?i=s:a[s].Hidden==1&&d==-1&&(d=s);d>i||(nt(e,135),nt(e,158,zA(i)),nt(e,136))}}function UA(e,t){var a=pn();return nt(a,131),nt(a,128,IA()),nt(a,153,PA(e.Workbook&&e.Workbook.WBProps||null)),BA(a,e),FA(a,e),nt(a,132),a.end()}function HA(e,t,a){return(t.slice(-4)===".bin"?UA:Mw)(e)}function $A(e,t,a,s,i){return(t.slice(-4)===".bin"?jA:Cw)(e,a,s,i)}function WA(e,t,a){return(t.slice(-4)===".bin"?oC:mw)(e,a)}function VA(e,t,a){return(t.slice(-4)===".bin"?PE:dw)(e,a)}function GA(e,t,a){return(t.slice(-4)===".bin"?NC:bw)(e)}function ZA(e){return(e.slice(-4)===".bin"?pC:xw)()}function qA(e,t){var a=[];return e.Props&&a.push(WT(e.Props,t)),e.Custprops&&a.push(VT(e.Props,e.Custprops)),a.join("")}function YA(){return""}function XA(e,t){var a=['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];return t.cellXfs.forEach(function(s,i){var d=[];d.push(ht("NumberFormat",null,{"ss:Format":wa(Ka[s.numFmtId])}));var c={"ss:ID":"s"+(21+i)};a.push(ht("Style",d.join(""),c))}),ht("Styles",a.join(""))}function Lw(e){return ht("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+Pp(e.Ref,{r:0,c:0})})}function JA(e){if(!((e||{}).Workbook||{}).Names)return"";for(var t=e.Workbook.Names,a=[],s=0;s<t.length;++s){var i=t[s];i.Sheet==null&&(i.Name.match(/^_xlfn\./)||a.push(Lw(i)))}return ht("Names",a.join(""))}function KA(e,t,a,s){if(!e||!((s||{}).Workbook||{}).Names)return"";for(var i=s.Workbook.Names,d=[],c=0;c<i.length;++c){var f=i[c];f.Sheet==a&&(f.Name.match(/^_xlfn\./)||d.push(Lw(f)))}return d.join("")}function QA(e,t,a,s){if(!e)return"";var i=[];if(e["!margins"]&&(i.push("<PageSetup>"),e["!margins"].header&&i.push(ht("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&i.push(ht("Footer",null,{"x:Margin":e["!margins"].footer})),i.push(ht("PageMargins",null,{"x:Bottom":e["!margins"].bottom||"0.75","x:Left":e["!margins"].left||"0.7","x:Right":e["!margins"].right||"0.7","x:Top":e["!margins"].top||"0.75"})),i.push("</PageSetup>")),s&&s.Workbook&&s.Workbook.Sheets&&s.Workbook.Sheets[a])if(s.Workbook.Sheets[a].Hidden)i.push(ht("Visible",s.Workbook.Sheets[a].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var d=0;d<a&&!(s.Workbook.Sheets[d]&&!s.Workbook.Sheets[d].Hidden);++d);d==a&&i.push("<Selected/>")}return((((s||{}).Workbook||{}).Views||[])[0]||{}).RTL&&i.push("<DisplayRightToLeft/>"),e["!protect"]&&(i.push(Dr("ProtectContents","True")),e["!protect"].objects&&i.push(Dr("ProtectObjects","True")),e["!protect"].scenarios&&i.push(Dr("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?i.push(Dr("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&i.push(Dr("EnableSelection","UnlockedCells")),[["formatCells","AllowFormatCells"],["formatColumns","AllowSizeCols"],["formatRows","AllowSizeRows"],["insertColumns","AllowInsertCols"],["insertRows","AllowInsertRows"],["insertHyperlinks","AllowInsertHyperlinks"],["deleteColumns","AllowDeleteCols"],["deleteRows","AllowDeleteRows"],["sort","AllowSort"],["autoFilter","AllowFilter"],["pivotTables","AllowUsePivotTables"]].forEach(function(c){e["!protect"][c[0]]&&i.push("<"+c[1]+"/>")})),i.length==0?"":ht("WorksheetOptions",i.join(""),{xmlns:Ln.x})}function e9(e){return e.map(function(t){var a=nT(t.t||""),s=ht("ss:Data",a,{xmlns:"http://www.w3.org/TR/REC-html40"});return ht("Comment",s,{"ss:Author":t.a})}).join("")}function t9(e,t,a,s,i,d,c){if(!e||e.v==null&&e.f==null)return"";var f={};if(e.f&&(f["ss:Formula"]="="+wa(Pp(e.f,c))),e.F&&e.F.slice(0,t.length)==t){var g=vr(e.F.slice(t.length+1));f["ss:ArrayRange"]="RC:R"+(g.r==c.r?"":"["+(g.r-c.r)+"]")+"C"+(g.c==c.c?"":"["+(g.c-c.c)+"]")}if(e.l&&e.l.Target&&(f["ss:HRef"]=wa(e.l.Target),e.l.Tooltip&&(f["x:HRefScreenTip"]=wa(e.l.Tooltip))),a["!merges"])for(var p=a["!merges"],x=0;x!=p.length;++x)p[x].s.c!=c.c||p[x].s.r!=c.r||(p[x].e.c>p[x].s.c&&(f["ss:MergeAcross"]=p[x].e.c-p[x].s.c),p[x].e.r>p[x].s.r&&(f["ss:MergeDown"]=p[x].e.r-p[x].s.r));var y="",_="";switch(e.t){case"z":if(!s.sheetStubs)return"";break;case"n":y="Number",_=String(e.v);break;case"b":y="Boolean",_=e.v?"1":"0";break;case"e":y="Error",_=N0[e.v];break;case"d":y="DateTime",_=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||Ka[14]);break;case"s":y="String",_=rT(e.v||"");break}var k=ml(s.cellXfs,e,s);f["ss:StyleID"]="s"+(21+k),f["ss:Index"]=c.c+1;var T=e.v!=null?_:"",N=e.t=="z"?"":'<Data ss:Type="'+y+'">'+T+"</Data>";return(e.c||[]).length>0&&(N+=e9(e.c)),ht("Cell",N,f)}function a9(e,t){var a='<Row ss:Index="'+(e+1)+'"';return t&&(t.hpt&&!t.hpx&&(t.hpx=hw(t.hpt)),t.hpx&&(a+=' ss:AutoFitHeight="0" ss:Height="'+t.hpx+'"'),t.hidden&&(a+=' ss:Hidden="1"')),a+">"}function r9(e,t,a,s){if(!e["!ref"])return"";var i=Ba(e["!ref"]),d=e["!merges"]||[],c=0,f=[];e["!cols"]&&e["!cols"].forEach(function(S,O){Lp(S);var C=!!S.width,A=sh(O,S),P={"ss:Index":O+1};C&&(P["ss:Width"]=Pf(A.width)),S.hidden&&(P["ss:Hidden"]="1"),f.push(ht("Column",null,P))});for(var g=Array.isArray(e),p=i.s.r;p<=i.e.r;++p){for(var x=[a9(p,(e["!rows"]||[])[p])],y=i.s.c;y<=i.e.c;++y){var _=!1;for(c=0;c!=d.length;++c)if(!(d[c].s.c>y)&&!(d[c].s.r>p)&&!(d[c].e.c<y)&&!(d[c].e.r<p)){(d[c].s.c!=y||d[c].s.r!=p)&&(_=!0);break}if(!_){var k={r:p,c:y},T=ka(k),N=g?(e[p]||[])[y]:e[T];x.push(t9(N,T,e,t,a,s,k))}}x.push("</Row>"),x.length>2&&f.push(x.join(""))}return f.join("")}function n9(e,t,a){var s=[],i=a.SheetNames[e],d=a.Sheets[i],c=d?KA(d,t,e,a):"";return c.length>0&&s.push("<Names>"+c+"</Names>"),c=d?r9(d,t,e,a):"",c.length>0&&s.push("<Table>"+c+"</Table>"),s.push(QA(d,t,e,a)),s.join("")}function s9(e,t){t||(t={}),e.SSF||(e.SSF=yn(Ka)),e.SSF&&(eh(),Qf(e.SSF),t.revssf=th(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF,t.cellXfs=[],ml(t.cellXfs,{},{revssf:{General:0}}));var a=[];a.push(qA(e,t)),a.push(YA()),a.push(""),a.push("");for(var s=0;s<e.SheetNames.length;++s)a.push(ht("Worksheet",n9(s,t,e),{"ss:Name":wa(e.SheetNames[s])}));return a[2]=XA(e,t),a[3]=JA(e),dr+ht("Workbook",a.join(""),{xmlns:Ln.ss,"xmlns:o":Ln.o,"xmlns:x":Ln.x,"xmlns:ss":Ln.ss,"xmlns:dt":Ln.dt,"xmlns:html":Ln.html})}var Cg={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"};function i9(e,t){var a=[],s=[],i=[],d=0,c,f=hv(Sv,"n"),g=hv(Tv,"n");if(e.Props)for(c=Fr(e.Props),d=0;d<c.length;++d)(Object.prototype.hasOwnProperty.call(f,c[d])?a:Object.prototype.hasOwnProperty.call(g,c[d])?s:i).push([c[d],e.Props[c[d]]]);if(e.Custprops)for(c=Fr(e.Custprops),d=0;d<c.length;++d)Object.prototype.hasOwnProperty.call(e.Props||{},c[d])||(Object.prototype.hasOwnProperty.call(f,c[d])?a:Object.prototype.hasOwnProperty.call(g,c[d])?s:i).push([c[d],e.Custprops[c[d]]]);var p=[];for(d=0;d<i.length;++d)rw.indexOf(i[d][0])>-1||ew.indexOf(i[d][0])>-1||i[d][1]!=null&&p.push(i[d]);s.length&&Oa.utils.cfb_add(t,"/SummaryInformation",Mv(s,Cg.SI,g,Tv)),(a.length||p.length)&&Oa.utils.cfb_add(t,"/DocumentSummaryInformation",Mv(a,Cg.DSI,f,Sv,p.length?p:null,Cg.UDI))}function l9(e,t){var a=t||{},s=Oa.utils.cfb_new({root:"R"}),i="/Workbook";switch(a.bookType||"xls"){case"xls":a.bookType="biff8";case"xla":a.bookType||(a.bookType="xla");case"biff8":i="/Workbook",a.biff=8;break;case"biff5":i="/Book",a.biff=5;break;default:throw new Error("invalid type "+a.bookType+" for XLS CFB")}return Oa.utils.cfb_add(s,i,Dw(e,a)),a.biff==8&&(e.Props||e.Custprops)&&i9(e,s),a.biff==8&&e.vbaraw&&jC(s,Oa.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),s}var o9={0:{f:u7},1:{f:b7},2:{f:z7},3:{f:T7},4:{f:k7},5:{f:P7},6:{f:W7},7:{f:O7},8:{f:J7},9:{f:X7},10:{f:q7},11:{f:Y7},12:{f:_7},13:{f:U7},14:{f:C7},15:{f:j7},16:{f:F7},17:{f:G7},18:{f:L7},19:{f:Cp},20:{},21:{},22:{},23:{},24:{},25:{},26:{},27:{},28:{},29:{},30:{},31:{},32:{},33:{},34:{},35:{T:1},36:{T:-1},37:{T:1},38:{T:-1},39:{f:RA},40:{},42:{},43:{f:WE},44:{f:HE},45:{f:ZE},46:{f:YE},47:{f:qE},48:{},49:{f:_T},50:{},51:{f:uC},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:wE},62:{f:$7},63:{f:xC},64:{f:hA},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:Ws,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:cA},138:{T:-1},139:{T:1},140:{T:-1},141:{T:1},142:{T:-1},143:{T:1},144:{T:-1},145:{T:1},146:{T:-1},147:{f:x7},148:{f:m7,p:16},151:{f:rA},152:{},153:{f:DA},154:{},155:{},156:{f:MA},157:{},158:{},159:{T:1,f:ME},160:{T:-1},161:{T:1,f:po},162:{T:-1},163:{T:1},164:{T:-1},165:{T:1},166:{T:-1},167:{},168:{},169:{},170:{},171:{},172:{T:1},173:{T:-1},174:{},175:{},176:{f:K7},177:{T:1},178:{T:-1},179:{T:1},180:{T:-1},181:{T:1},182:{T:-1},183:{T:1},184:{T:-1},185:{T:1},186:{T:-1},187:{T:1},188:{T:-1},189:{T:1},190:{T:-1},191:{T:1},192:{T:-1},193:{T:1},194:{T:-1},195:{T:1},196:{T:-1},197:{T:1},198:{T:-1},199:{T:1},200:{T:-1},201:{T:1},202:{T:-1},203:{T:1},204:{T:-1},205:{T:1},206:{T:-1},207:{T:1},208:{T:-1},209:{T:1},210:{T:-1},211:{T:1},212:{T:-1},213:{T:1},214:{T:-1},215:{T:1},216:{T:-1},217:{T:1},218:{T:-1},219:{T:1},220:{T:-1},221:{T:1},222:{T:-1},223:{T:1},224:{T:-1},225:{T:1},226:{T:-1},227:{T:1},228:{T:-1},229:{T:1},230:{T:-1},231:{T:1},232:{T:-1},233:{T:1},234:{T:-1},235:{T:1},236:{T:-1},237:{T:1},238:{T:-1},239:{T:1},240:{T:-1},241:{T:1},242:{T:-1},243:{T:1},244:{T:-1},245:{T:1},246:{T:-1},247:{T:1},248:{T:-1},249:{T:1},250:{T:-1},251:{T:1},252:{T:-1},253:{T:1},254:{T:-1},255:{T:1},256:{T:-1},257:{T:1},258:{T:-1},259:{T:1},260:{T:-1},261:{T:1},262:{T:-1},263:{T:1},264:{T:-1},265:{T:1},266:{T:-1},267:{T:1},268:{T:-1},269:{T:1},270:{T:-1},271:{T:1},272:{T:-1},273:{T:1},274:{T:-1},275:{T:1},276:{T:-1},277:{},278:{T:1},279:{T:-1},280:{T:1},281:{T:-1},282:{T:1},283:{T:1},284:{T:-1},285:{T:1},286:{T:-1},287:{T:1},288:{T:-1},289:{T:1},290:{T:-1},291:{T:1},292:{T:-1},293:{T:1},294:{T:-1},295:{T:1},296:{T:-1},297:{T:1},298:{T:-1},299:{T:1},300:{T:-1},301:{T:1},302:{T:-1},303:{T:1},304:{T:-1},305:{T:1},306:{T:-1},307:{T:1},308:{T:-1},309:{T:1},310:{T:-1},311:{T:1},312:{T:-1},313:{T:-1},314:{T:1},315:{T:-1},316:{T:1},317:{T:-1},318:{T:1},319:{T:-1},320:{T:1},321:{T:-1},322:{T:1},323:{T:-1},324:{T:1},325:{T:-1},326:{T:1},327:{T:-1},328:{T:1},329:{T:-1},330:{T:1},331:{T:-1},332:{T:1},333:{T:-1},334:{T:1},335:{f:cC},336:{T:-1},337:{f:mC,T:1},338:{T:-1},339:{T:1},340:{T:-1},341:{T:1},342:{T:-1},343:{T:1},344:{T:-1},345:{T:1},346:{T:-1},347:{T:1},348:{T:-1},349:{T:1},350:{T:-1},351:{},352:{},353:{T:1},354:{T:-1},355:{f:Jg},357:{},358:{},359:{},360:{T:1},361:{},362:{f:pE},363:{},364:{},366:{},367:{},368:{},369:{},370:{},371:{},372:{T:1},373:{T:-1},374:{T:1},375:{T:-1},376:{T:1},377:{T:-1},378:{T:1},379:{T:-1},380:{T:1},381:{T:-1},382:{T:1},383:{T:-1},384:{T:1},385:{T:-1},386:{T:1},387:{T:-1},388:{T:1},389:{T:-1},390:{T:1},391:{T:-1},392:{T:1},393:{T:-1},394:{T:1},395:{T:-1},396:{},397:{},398:{},399:{},400:{},401:{T:1},403:{},404:{},405:{},406:{},407:{},408:{},409:{},410:{},411:{},412:{},413:{},414:{},415:{},416:{},417:{},418:{},419:{},420:{},421:{},422:{T:1},423:{T:1},424:{T:-1},425:{T:-1},426:{f:nA},427:{f:sA},428:{},429:{T:1},430:{T:-1},431:{T:1},432:{T:-1},433:{T:1},434:{T:-1},435:{T:1},436:{T:-1},437:{T:1},438:{T:-1},439:{T:1},440:{T:-1},441:{T:1},442:{T:-1},443:{T:1},444:{T:-1},445:{T:1},446:{T:-1},447:{T:1},448:{T:-1},449:{T:1},450:{T:-1},451:{T:1},452:{T:-1},453:{T:1},454:{T:-1},455:{T:1},456:{T:-1},457:{T:1},458:{T:-1},459:{T:1},460:{T:-1},461:{T:1},462:{T:-1},463:{T:1},464:{T:-1},465:{T:1},466:{T:-1},467:{T:1},468:{T:-1},469:{T:1},470:{T:-1},471:{},472:{},473:{T:1},474:{T:-1},475:{},476:{f:lA},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:p7},486:{T:1},487:{T:-1},488:{T:1},489:{T:-1},490:{T:1},491:{T:-1},492:{T:1},493:{T:-1},494:{f:tA},495:{T:1},496:{T:-1},497:{T:1},498:{T:-1},499:{},500:{T:1},501:{T:-1},502:{T:1},503:{T:-1},504:{},505:{T:1},506:{T:-1},507:{},508:{T:1},509:{T:-1},510:{T:1},511:{T:-1},512:{},513:{},514:{T:1},515:{T:-1},516:{T:1},517:{T:-1},518:{T:1},519:{T:-1},520:{T:1},521:{T:-1},522:{},523:{},524:{},525:{},526:{},527:{},528:{T:1},529:{T:-1},530:{T:1},531:{T:-1},532:{T:1},533:{T:-1},534:{},535:{},536:{},537:{},538:{T:1},539:{T:-1},540:{T:1},541:{T:-1},542:{T:1},548:{},549:{},550:{f:Jg},551:{},552:{},553:{},554:{T:1},555:{T:-1},556:{T:1},557:{T:-1},558:{T:1},559:{T:-1},560:{T:1},561:{T:-1},562:{},564:{},565:{T:1},566:{T:-1},569:{T:1},570:{T:-1},572:{},573:{T:1},574:{T:-1},577:{},578:{},579:{},580:{},581:{},582:{},583:{},584:{},585:{},586:{},587:{},588:{T:-1},589:{},590:{T:1},591:{T:-1},592:{T:1},593:{T:-1},594:{T:1},595:{T:-1},596:{},597:{T:1},598:{T:-1},599:{T:1},600:{T:-1},601:{T:1},602:{T:-1},603:{T:1},604:{T:-1},605:{T:1},606:{T:-1},607:{},608:{T:1},609:{T:-1},610:{},611:{T:1},612:{T:-1},613:{T:1},614:{T:-1},615:{T:1},616:{T:-1},617:{T:1},618:{T:-1},619:{T:1},620:{T:-1},625:{},626:{T:1},627:{T:-1},628:{T:1},629:{T:-1},630:{T:1},631:{T:-1},632:{f:wC},633:{T:1},634:{T:-1},635:{T:1,f:vC},636:{T:-1},637:{f:jT},638:{T:1},639:{},640:{T:-1},641:{T:1},642:{T:-1},643:{T:1},644:{},645:{T:-1},646:{T:1},648:{T:1},649:{},650:{T:-1},651:{f:SA},652:{},653:{T:1},654:{T:-1},655:{T:1},656:{T:-1},657:{T:1},658:{T:-1},659:{},660:{T:1},661:{},662:{T:-1},663:{},664:{T:1},665:{},666:{T:-1},667:{},668:{},669:{},671:{T:1},672:{T:-1},673:{T:1},674:{T:-1},675:{},676:{},677:{},678:{},679:{},680:{},681:{},1024:{},1025:{},1026:{T:1},1027:{T:-1},1028:{T:1},1029:{T:-1},1030:{},1031:{T:1},1032:{T:-1},1033:{T:1},1034:{T:-1},1035:{},1036:{},1037:{},1038:{T:1},1039:{T:-1},1040:{},1041:{T:1},1042:{T:-1},1043:{},1044:{},1045:{},1046:{T:1},1047:{T:-1},1048:{T:1},1049:{T:-1},1050:{},1051:{T:1},1052:{T:1},1053:{f:mA},1054:{T:1},1055:{},1056:{T:1},1057:{T:-1},1058:{T:1},1059:{T:-1},1061:{},1062:{T:1},1063:{T:-1},1064:{T:1},1065:{T:-1},1066:{T:1},1067:{T:-1},1068:{T:1},1069:{T:-1},1070:{T:1},1071:{T:-1},1072:{T:1},1073:{T:-1},1075:{T:1},1076:{T:-1},1077:{T:1},1078:{T:-1},1079:{T:1},1080:{T:-1},1081:{T:1},1082:{T:-1},1083:{T:1},1084:{T:-1},1085:{},1086:{T:1},1087:{T:-1},1088:{T:1},1089:{T:-1},1090:{T:1},1091:{T:-1},1092:{T:1},1093:{T:-1},1094:{T:1},1095:{T:-1},1096:{},1097:{T:1},1098:{},1099:{T:-1},1100:{T:1},1101:{T:-1},1102:{},1103:{},1104:{},1105:{},1111:{},1112:{},1113:{T:1},1114:{T:-1},1115:{T:1},1116:{T:-1},1117:{},1118:{T:1},1119:{T:-1},1120:{T:1},1121:{T:-1},1122:{T:1},1123:{T:-1},1124:{T:1},1125:{T:-1},1126:{},1128:{T:1},1129:{T:-1},1130:{},1131:{T:1},1132:{T:-1},1133:{T:1},1134:{T:-1},1135:{T:1},1136:{T:-1},1137:{T:1},1138:{T:-1},1139:{T:1},1140:{T:-1},1141:{},1142:{T:1},1143:{T:-1},1144:{T:1},1145:{T:-1},1146:{},1147:{T:1},1148:{T:-1},1149:{T:1},1150:{T:-1},1152:{T:1},1153:{T:-1},1154:{T:-1},1155:{T:-1},1156:{T:-1},1157:{T:1},1158:{T:-1},1159:{T:1},1160:{T:-1},1161:{T:1},1162:{T:-1},1163:{T:1},1164:{T:-1},1165:{T:1},1166:{T:-1},1167:{T:1},1168:{T:-1},1169:{T:1},1170:{T:-1},1171:{},1172:{T:1},1173:{T:-1},1177:{},1178:{T:1},1180:{},1181:{},1182:{},2048:{T:1},2049:{T:-1},2050:{},2051:{T:1},2052:{T:-1},2053:{},2054:{},2055:{T:1},2056:{T:-1},2057:{T:1},2058:{T:-1},2060:{},2067:{},2068:{T:1},2069:{T:-1},2070:{},2071:{},2072:{T:1},2073:{T:-1},2075:{},2076:{},2077:{T:1},2078:{T:-1},2079:{},2080:{T:1},2081:{T:-1},2082:{},2083:{T:1},2084:{T:-1},2085:{T:1},2086:{T:-1},2087:{T:1},2088:{T:-1},2089:{T:1},2090:{T:-1},2091:{},2092:{},2093:{T:1},2094:{T:-1},2095:{},2096:{T:1},2097:{T:-1},2098:{T:1},2099:{T:-1},2100:{T:1},2101:{T:-1},2102:{},2103:{T:1},2104:{T:-1},2105:{},2106:{T:1},2107:{T:-1},2108:{},2109:{T:1},2110:{T:-1},2111:{T:1},2112:{T:-1},2113:{T:1},2114:{T:-1},2115:{},2116:{},2117:{},2118:{T:1},2119:{T:-1},2120:{},2121:{T:1},2122:{T:-1},2123:{T:1},2124:{T:-1},2125:{},2126:{T:1},2127:{T:-1},2128:{},2129:{T:1},2130:{T:-1},2131:{T:1},2132:{T:-1},2133:{T:1},2134:{},2135:{},2136:{},2137:{T:1},2138:{T:-1},2139:{T:1},2140:{T:-1},2141:{},3072:{},3073:{},4096:{T:1},4097:{T:-1},5002:{T:1},5003:{T:-1},5081:{T:1},5082:{T:-1},5083:{},5084:{T:1},5085:{T:-1},5086:{T:1},5087:{T:-1},5088:{},5089:{},5090:{},5092:{T:1},5093:{T:-1},5094:{},5095:{T:1},5096:{T:-1},5097:{},5099:{},65535:{n:""}};function mt(e,t,a,s){var i=t;if(!isNaN(i)){var d=s||(a||[]).length||0,c=e.next(4);c.write_shift(2,i),c.write_shift(2,d),d>0&&Sp(a)&&e.push(a)}}function c9(e,t,a,s){var i=(a||[]).length||0;if(i<=8224)return mt(e,t,a,i);var d=t;if(!isNaN(d)){for(var c=a.parts||[],f=0,g=0,p=0;p+(c[f]||8224)<=8224;)p+=c[f]||8224,f++;var x=e.next(4);for(x.write_shift(2,d),x.write_shift(2,p),e.push(a.slice(g,g+p)),g+=p;g<i;){for(x=e.next(4),x.write_shift(2,60),p=0;p+(c[f]||8224)<=8224;)p+=c[f]||8224,f++;x.write_shift(2,p),e.push(a.slice(g,g+p)),g+=p}}}function S0(e,t,a){return e||(e=qe(7)),e.write_shift(2,t),e.write_shift(2,a),e.write_shift(2,0),e.write_shift(1,0),e}function d9(e,t,a,s){var i=qe(9);return S0(i,e,t),sw(a,s||"b",i),i}function u9(e,t,a){var s=qe(8+2*a.length);return S0(s,e,t),s.write_shift(1,a.length),s.write_shift(a.length,a,"sbcs"),s.l<s.length?s.slice(0,s.l):s}function f9(e,t,a,s){if(t.v!=null)switch(t.t){case"d":case"n":var i=t.t=="d"?xn(Kr(t.v)):t.v;i==(i|0)&&i>=0&&i<65536?mt(e,2,SE(a,s,i)):mt(e,3,jE(a,s,i));return;case"b":case"e":mt(e,5,d9(a,s,t.v,t.t));return;case"s":case"str":mt(e,4,u9(a,s,(t.v||"").slice(0,255)));return}mt(e,1,S0(null,a,s))}function h9(e,t,a,s){var i=Array.isArray(t),d=Ba(t["!ref"]||"A1"),c,f="",g=[];if(d.e.c>255||d.e.r>16383){if(s.WTF)throw new Error("Range "+(t["!ref"]||"A1")+" exceeds format limit A1:IV16384");d.e.c=Math.min(d.e.c,255),d.e.r=Math.min(d.e.c,16383),c=cr(d)}for(var p=d.s.r;p<=d.e.r;++p){f=Pr(p);for(var x=d.s.c;x<=d.e.c;++x){p===d.s.r&&(g[x]=$r(x)),c=g[x]+f;var y=i?(t[p]||[])[x]:t[c];y&&f9(e,y,p,x)}}}function m9(e,t){for(var a=t||{},s=pn(),i=0,d=0;d<e.SheetNames.length;++d)e.SheetNames[d]==a.sheet&&(i=d);if(i==0&&a.sheet&&e.SheetNames[0]!=a.sheet)throw new Error("Sheet not found: "+a.sheet);return mt(s,a.biff==4?1033:a.biff==3?521:9,Mp(e,16,a)),h9(s,e.Sheets[e.SheetNames[i]],i,a),mt(s,10),s.end()}function g9(e,t,a){mt(e,49,oE({sz:12,name:"Arial"},a))}function p9(e,t,a){t&&[[5,8],[23,26],[41,44],[50,392]].forEach(function(s){for(var i=s[0];i<=s[1];++i)t[i]!=null&&mt(e,1054,uE(i,t[i],a))})}function x9(e,t){var a=qe(19);a.write_shift(4,2151),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(2,3),a.write_shift(1,1),a.write_shift(4,0),mt(e,2151,a),a=qe(39),a.write_shift(4,2152),a.write_shift(4,0),a.write_shift(4,0),a.write_shift(2,3),a.write_shift(1,0),a.write_shift(4,0),a.write_shift(2,1),a.write_shift(4,4),a.write_shift(2,0),ow(Ba(t["!ref"]||"A1"),a),a.write_shift(4,4),mt(e,2152,a)}function y9(e,t){for(var a=0;a<16;++a)mt(e,224,Dv({numFmtId:0,style:!0},0,t));t.cellXfs.forEach(function(s){mt(e,224,Dv(s,0,t))})}function b9(e,t){for(var a=0;a<t["!links"].length;++a){var s=t["!links"][a];mt(e,440,bE(s)),s[1].Tooltip&&mt(e,2048,vE(s))}delete t["!links"]}function v9(e,t){if(t){var a=0;t.forEach(function(s,i){++a<=256&&s&&mt(e,125,kE(sh(i,s),i))})}}function _9(e,t,a,s,i){var d=16+ml(i.cellXfs,t,i);if(t.v==null&&!t.bf){mt(e,513,co(a,s,d));return}if(t.bf)mt(e,6,V8(t,a,s,i,d));else switch(t.t){case"d":case"n":var c=t.t=="d"?xn(Kr(t.v)):t.v;mt(e,515,gE(a,s,c,d));break;case"b":case"e":mt(e,517,mE(a,s,t.v,d,i,t.t));break;case"s":case"str":if(i.bookSST){var f=Fp(i.Strings,t.v,i.revStrings);mt(e,253,cE(a,s,f,d))}else mt(e,516,dE(a,s,(t.v||"").slice(0,255),d,i));break;default:mt(e,513,co(a,s,d))}}function w9(e,t,a){var s=pn(),i=a.SheetNames[e],d=a.Sheets[i]||{},c=(a||{}).Workbook||{},f=(c.Sheets||[])[e]||{},g=Array.isArray(d),p=t.biff==8,x,y="",_=[],k=Ba(d["!ref"]||"A1"),T=p?65536:16384;if(k.e.c>255||k.e.r>=T){if(t.WTF)throw new Error("Range "+(d["!ref"]||"A1")+" exceeds format limit A1:IV16384");k.e.c=Math.min(k.e.c,255),k.e.r=Math.min(k.e.c,T-1)}mt(s,2057,Mp(a,16,t)),mt(s,13,es(1)),mt(s,12,es(100)),mt(s,15,Xr(!0)),mt(s,17,Xr(!1)),mt(s,16,oo(.001)),mt(s,95,Xr(!0)),mt(s,42,Xr(!1)),mt(s,43,Xr(!1)),mt(s,130,es(1)),mt(s,128,hE()),mt(s,131,Xr(!1)),mt(s,132,Xr(!1)),p&&v9(s,d["!cols"]),mt(s,512,fE(k,t)),p&&(d["!links"]=[]);for(var N=k.s.r;N<=k.e.r;++N){y=Pr(N);for(var S=k.s.c;S<=k.e.c;++S){N===k.s.r&&(_[S]=$r(S)),x=_[S]+y;var O=g?(d[N]||[])[S]:d[x];O&&(_9(s,O,N,S,t),p&&O.l&&d["!links"].push([x,O.l]))}}var C=f.CodeName||f.name||i;return p&&mt(s,574,lE((c.Views||[])[0])),p&&(d["!merges"]||[]).length&&mt(s,229,yE(d["!merges"])),p&&b9(s,d),mt(s,442,lw(C)),p&&x9(s,d),mt(s,10),s.end()}function k9(e,t,a){var s=pn(),i=(e||{}).Workbook||{},d=i.Sheets||[],c=i.WBProps||{},f=a.biff==8,g=a.biff==5;if(mt(s,2057,Mp(e,5,a)),a.bookType=="xla"&&mt(s,135),mt(s,225,f?es(1200):null),mt(s,193,qT(2)),g&&mt(s,191),g&&mt(s,192),mt(s,226),mt(s,92,rE("SheetJS",a)),mt(s,66,es(f?1200:1252)),f&&mt(s,353,es(0)),f&&mt(s,448),mt(s,317,NE(e.SheetNames.length)),f&&e.vbaraw&&mt(s,211),f&&e.vbaraw){var p=c.CodeName||"ThisWorkbook";mt(s,442,lw(p))}mt(s,156,es(17)),mt(s,25,Xr(!1)),mt(s,18,Xr(!1)),mt(s,19,es(0)),f&&mt(s,431,Xr(!1)),f&&mt(s,444,es(0)),mt(s,61,iE()),mt(s,64,Xr(!1)),mt(s,141,es(0)),mt(s,34,Xr(EA(e)=="true")),mt(s,14,Xr(!0)),f&&mt(s,439,Xr(!1)),mt(s,218,es(0)),g9(s,e,a),p9(s,e.SSF,a),y9(s,a),f&&mt(s,352,Xr(!1));var x=s.end(),y=pn();f&&mt(y,140,_E()),f&&a.Strings&&c9(y,252,sE(a.Strings)),mt(y,10);var _=y.end(),k=pn(),T=0,N=0;for(N=0;N<e.SheetNames.length;++N)T+=(f?12:11)+(f?2:1)*e.SheetNames[N].length;var S=x.length+T+_.length;for(N=0;N<e.SheetNames.length;++N){var O=d[N]||{};mt(k,133,nE({pos:S,hs:O.Hidden||0,dt:0,name:e.SheetNames[N]},a)),S+=t[N].length}var C=k.end();if(T!=C.length)throw new Error("BS8 "+T+" != "+C.length);var A=[];return x.length&&A.push(x),C.length&&A.push(C),_.length&&A.push(_),Lr(A)}function N9(e,t){var a=t||{},s=[];e&&!e.SSF&&(e.SSF=yn(Ka)),e&&e.SSF&&(eh(),Qf(e.SSF),a.revssf=th(e.SSF),a.revssf[e.SSF[65535]]=0,a.ssf=e.SSF),a.Strings=[],a.Strings.Count=0,a.Strings.Unique=0,Ip(a),a.cellXfs=[],ml(a.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={});for(var i=0;i<e.SheetNames.length;++i)s[s.length]=w9(i,a,e);return s.unshift(k9(e,s,a)),Lr(s)}function Dw(e,t){for(var a=0;a<=e.SheetNames.length;++a){var s=e.Sheets[e.SheetNames[a]];if(!(!s||!s["!ref"])){var i=In(s["!ref"]);i.e.c>255&&typeof console!="undefined"&&console.error&&console.error("Worksheet '"+e.SheetNames[a]+"' extends beyond column IV (255). Data may be lost.")}}var d=t||{};switch(d.biff||2){case 8:case 5:return N9(e,t);case 4:case 3:case 2:return m9(e,t)}throw new Error("invalid type "+d.bookType+" for BIFF")}function j9(e,t,a,s){for(var i=e["!merges"]||[],d=[],c=t.s.c;c<=t.e.c;++c){for(var f=0,g=0,p=0;p<i.length;++p)if(!(i[p].s.r>a||i[p].s.c>c)&&!(i[p].e.r<a||i[p].e.c<c)){if(i[p].s.r<a||i[p].s.c<c){f=-1;break}f=i[p].e.r-i[p].s.r+1,g=i[p].e.c-i[p].s.c+1;break}if(!(f<0)){var x=ka({r:a,c}),y=s.dense?(e[a]||[])[c]:e[x],_=y&&y.v!=null&&(y.h||aT(y.w||(bi(y),y.w)||""))||"",k={};f>1&&(k.rowspan=f),g>1&&(k.colspan=g),s.editable?_='<span contenteditable="true">'+_+"</span>":y&&(k["data-t"]=y&&y.t||"z",y.v!=null&&(k["data-v"]=y.v),y.z!=null&&(k["data-z"]=y.z),y.l&&(y.l.Target||"#").charAt(0)!="#"&&(_='<a href="'+y.l.Target+'">'+_+"</a>")),k.id=(s.id||"sjs")+"-"+x,d.push(ht("td",_,k))}}var T="<tr>";return T+d.join("")+"</tr>"}var S9='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>',T9="</body></html>";function E9(e,t,a){var s=[];return s.join("")+"<table"+(a&&a.id?' id="'+a.id+'"':"")+">"}function Pw(e,t){var a=t||{},s=a.header!=null?a.header:S9,i=a.footer!=null?a.footer:T9,d=[s],c=In(e["!ref"]);a.dense=Array.isArray(e),d.push(E9(e,c,a));for(var f=c.s.r;f<=c.e.r;++f)d.push(j9(e,c,f,a));return d.push("</table>"+i),d.join("")}function Rw(e,t,a){var s=a||{},i=0,d=0;if(s.origin!=null)if(typeof s.origin=="number")i=s.origin;else{var c=typeof s.origin=="string"?vr(s.origin):s.origin;i=c.r,d=c.c}var f=t.getElementsByTagName("tr"),g=Math.min(s.sheetRows||1e7,f.length),p={s:{r:0,c:0},e:{r:i,c:d}};if(e["!ref"]){var x=In(e["!ref"]);p.s.r=Math.min(p.s.r,x.s.r),p.s.c=Math.min(p.s.c,x.s.c),p.e.r=Math.max(p.e.r,x.e.r),p.e.c=Math.max(p.e.c,x.e.c),i==-1&&(p.e.r=i=x.e.r+1)}var y=[],_=0,k=e["!rows"]||(e["!rows"]=[]),T=0,N=0,S=0,O=0,C=0,A=0;for(e["!cols"]||(e["!cols"]=[]);T<f.length&&N<g;++T){var P=f[T];if(Uv(P)){if(s.display)continue;k[N]={hidden:!0}}var I=P.children;for(S=O=0;S<I.length;++S){var ee=I[S];if(!(s.display&&Uv(ee))){var B=ee.hasAttribute("data-v")?ee.getAttribute("data-v"):ee.hasAttribute("v")?ee.getAttribute("v"):iT(ee.innerHTML),H=ee.getAttribute("data-z")||ee.getAttribute("z");for(_=0;_<y.length;++_){var Y=y[_];Y.s.c==O+d&&Y.s.r<N+i&&N+i<=Y.e.r&&(O=Y.e.c+1-d,_=-1)}A=+ee.getAttribute("colspan")||1,((C=+ee.getAttribute("rowspan")||1)>1||A>1)&&y.push({s:{r:N+i,c:O+d},e:{r:N+i+(C||1)-1,c:O+d+(A||1)-1}});var ue={t:"s",v:B},xe=ee.getAttribute("data-t")||ee.getAttribute("t")||"";B!=null&&(B.length==0?ue.t=xe||"z":s.raw||B.trim().length==0||xe=="s"||(B==="TRUE"?ue={t:"b",v:!0}:B==="FALSE"?ue={t:"b",v:!1}:isNaN(mi(B))?isNaN(s0(B).getDate())||(ue={t:"d",v:Kr(B)},s.cellDates||(ue={t:"n",v:xn(ue.v)}),ue.z=s.dateNF||Ka[14]):ue={t:"n",v:mi(B)})),ue.z===void 0&&H!=null&&(ue.z=H);var le="",ge=ee.getElementsByTagName("A");if(ge&&ge.length)for(var be=0;be<ge.length&&!(ge[be].hasAttribute("href")&&(le=ge[be].getAttribute("href"),le.charAt(0)!="#"));++be);le&&le.charAt(0)!="#"&&(ue.l={Target:le}),s.dense?(e[N+i]||(e[N+i]=[]),e[N+i][O+d]=ue):e[ka({c:O+d,r:N+i})]=ue,p.e.c<O+d&&(p.e.c=O+d),O+=A}}++N}return y.length&&(e["!merges"]=(e["!merges"]||[]).concat(y)),p.e.r=Math.max(p.e.r,N-1+i),e["!ref"]=cr(p),N>=g&&(e["!fullref"]=cr((p.e.r=f.length-T+N-1+i,p))),e}function Fw(e,t){var a=t||{},s=a.dense?[]:{};return Rw(s,e,t)}function C9(e,t){return fo(Fw(e,t),t)}function Uv(e){var t="",a=A9(e);return a&&(t=a(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),t==="none"}function A9(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}var O9=(function(){var e=["<office:master-styles>",'<style:master-page style:name="mp1" style:page-layout-name="mp1">',"<style:header/>",'<style:header-left style:display="false"/>',"<style:footer/>",'<style:footer-left style:display="false"/>',"</style:master-page>","</office:master-styles>"].join(""),t="<office:document-styles "+l0({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","office:version":"1.2"})+">"+e+"</office:document-styles>";return function(){return dr+t}})(),Hv=(function(){var e=function(d){return wa(d).replace(/ +/g,function(c){return'<text:s text:c="'+c.length+'"/>'}).replace(/\t/g,"<text:tab/>").replace(/\n/g,"</text:p><text:p>").replace(/^ /,"<text:s/>").replace(/ $/,"<text:s/>")},t=` <table:table-cell />
|
||
`,a=` <table:covered-table-cell/>
|
||
`,s=function(d,c,f){var g=[];g.push(' <table:table table:name="'+wa(c.SheetNames[f])+`" table:style-name="ta1">
|
||
`);var p=0,x=0,y=In(d["!ref"]||"A1"),_=d["!merges"]||[],k=0,T=Array.isArray(d);if(d["!cols"])for(x=0;x<=y.e.c;++x)g.push(" <table:table-column"+(d["!cols"][x]?' table:style-name="co'+d["!cols"][x].ods+'"':"")+`></table:table-column>
|
||
`);var N="",S=d["!rows"]||[];for(p=0;p<y.s.r;++p)N=S[p]?' table:style-name="ro'+S[p].ods+'"':"",g.push(" <table:table-row"+N+`></table:table-row>
|
||
`);for(;p<=y.e.r;++p){for(N=S[p]?' table:style-name="ro'+S[p].ods+'"':"",g.push(" <table:table-row"+N+`>
|
||
`),x=0;x<y.s.c;++x)g.push(t);for(;x<=y.e.c;++x){var O=!1,C={},A="";for(k=0;k!=_.length;++k)if(!(_[k].s.c>x)&&!(_[k].s.r>p)&&!(_[k].e.c<x)&&!(_[k].e.r<p)){(_[k].s.c!=x||_[k].s.r!=p)&&(O=!0),C["table:number-columns-spanned"]=_[k].e.c-_[k].s.c+1,C["table:number-rows-spanned"]=_[k].e.r-_[k].s.r+1;break}if(O){g.push(a);continue}var P=ka({r:p,c:x}),I=T?(d[p]||[])[x]:d[P];if(I&&I.f&&(C["table:formula"]=wa(J8(I.f)),I.F&&I.F.slice(0,P.length)==P)){var ee=In(I.F);C["table:number-matrix-columns-spanned"]=ee.e.c-ee.s.c+1,C["table:number-matrix-rows-spanned"]=ee.e.r-ee.s.r+1}if(!I){g.push(t);continue}switch(I.t){case"b":A=I.v?"TRUE":"FALSE",C["office:value-type"]="boolean",C["office:boolean-value"]=I.v?"true":"false";break;case"n":A=I.w||String(I.v||0),C["office:value-type"]="float",C["office:value"]=I.v||0;break;case"s":case"str":A=I.v==null?"":I.v,C["office:value-type"]="string";break;case"d":A=I.w||Kr(I.v).toISOString(),C["office:value-type"]="date",C["office:date-value"]=Kr(I.v).toISOString(),C["table:style-name"]="ce1";break;default:g.push(t);continue}var B=e(A);if(I.l&&I.l.Target){var H=I.l.Target;H=H.charAt(0)=="#"?"#"+K8(H.slice(1)):H,H.charAt(0)!="#"&&!H.match(/^\w+:/)&&(H="../"+H),B=ht("text:a",B,{"xlink:href":H.replace(/&/g,"&")})}g.push(" "+ht("table:table-cell",ht("text:p",B,{}),C)+`
|
||
`)}g.push(` </table:table-row>
|
||
`)}return g.push(` </table:table>
|
||
`),g.join("")},i=function(d,c){d.push(` <office:automatic-styles>
|
||
`),d.push(` <number:date-style style:name="N37" number:automatic-order="true">
|
||
`),d.push(` <number:month number:style="long"/>
|
||
`),d.push(` <number:text>/</number:text>
|
||
`),d.push(` <number:day number:style="long"/>
|
||
`),d.push(` <number:text>/</number:text>
|
||
`),d.push(` <number:year/>
|
||
`),d.push(` </number:date-style>
|
||
`);var f=0;c.SheetNames.map(function(p){return c.Sheets[p]}).forEach(function(p){if(p&&p["!cols"]){for(var x=0;x<p["!cols"].length;++x)if(p["!cols"][x]){var y=p["!cols"][x];if(y.width==null&&y.wpx==null&&y.wch==null)continue;Lp(y),y.ods=f;var _=p["!cols"][x].wpx+"px";d.push(' <style:style style:name="co'+f+`" style:family="table-column">
|
||
`),d.push(' <style:table-column-properties fo:break-before="auto" style:column-width="'+_+`"/>
|
||
`),d.push(` </style:style>
|
||
`),++f}}});var g=0;c.SheetNames.map(function(p){return c.Sheets[p]}).forEach(function(p){if(p&&p["!rows"]){for(var x=0;x<p["!rows"].length;++x)if(p["!rows"][x]){p["!rows"][x].ods=g;var y=p["!rows"][x].hpx+"px";d.push(' <style:style style:name="ro'+g+`" style:family="table-row">
|
||
`),d.push(' <style:table-row-properties fo:break-before="auto" style:row-height="'+y+`"/>
|
||
`),d.push(` </style:style>
|
||
`),++g}}}),d.push(` <style:style style:name="ta1" style:family="table" style:master-page-name="mp1">
|
||
`),d.push(` <style:table-properties table:display="true" style:writing-mode="lr-tb"/>
|
||
`),d.push(` </style:style>
|
||
`),d.push(` <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>
|
||
`),d.push(` </office:automatic-styles>
|
||
`)};return function(c,f){var g=[dr],p=l0({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:meta":"urn:oasis:names:tc:opendocument:xmlns:meta:1.0","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:presentation":"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:chart":"urn:oasis:names:tc:opendocument:xmlns:chart:1.0","xmlns:dr3d":"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0","xmlns:math":"http://www.w3.org/1998/Math/MathML","xmlns:form":"urn:oasis:names:tc:opendocument:xmlns:form:1.0","xmlns:script":"urn:oasis:names:tc:opendocument:xmlns:script:1.0","xmlns:ooo":"http://openoffice.org/2004/office","xmlns:ooow":"http://openoffice.org/2004/writer","xmlns:oooc":"http://openoffice.org/2004/calc","xmlns:dom":"http://www.w3.org/2001/xml-events","xmlns:xforms":"http://www.w3.org/2002/xforms","xmlns:xsd":"http://www.w3.org/2001/XMLSchema","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:sheet":"urn:oasis:names:tc:opendocument:sh33tjs:1.0","xmlns:rpt":"http://openoffice.org/2005/report","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","xmlns:xhtml":"http://www.w3.org/1999/xhtml","xmlns:grddl":"http://www.w3.org/2003/g/data-view#","xmlns:tableooo":"http://openoffice.org/2009/table","xmlns:drawooo":"http://openoffice.org/2010/draw","xmlns:calcext":"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0","xmlns:loext":"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0","xmlns:field":"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0","xmlns:formx":"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0","xmlns:css3t":"http://www.w3.org/TR/css3-text/","office:version":"1.2"}),x=l0({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});f.bookType=="fods"?(g.push("<office:document"+p+x+`>
|
||
`),g.push(K2().replace(/office:document-meta/g,"office:meta"))):g.push("<office:document-content"+p+`>
|
||
`),i(g,c),g.push(` <office:body>
|
||
`),g.push(` <office:spreadsheet>
|
||
`);for(var y=0;y!=c.SheetNames.length;++y)g.push(s(c.Sheets[c.SheetNames[y]],c,y));return g.push(` </office:spreadsheet>
|
||
`),g.push(` </office:body>
|
||
`),f.bookType=="fods"?g.push("</office:document>"):g.push("</office:document-content>"),g.join("")}})();function Iw(e,t){if(t.bookType=="fods")return Hv(e,t);var a=wp(),s="",i=[],d=[];return s="mimetype",Kt(a,s,"application/vnd.oasis.opendocument.spreadsheet"),s="content.xml",Kt(a,s,Hv(e,t)),i.push([s,"text/xml"]),d.push([s,"ContentFile"]),s="styles.xml",Kt(a,s,O9(e,t)),i.push([s,"text/xml"]),d.push([s,"StylesFile"]),s="meta.xml",Kt(a,s,dr+K2()),i.push([s,"text/xml"]),d.push([s,"MetadataFile"]),s="manifest.rdf",Kt(a,s,$T(d)),i.push([s,"application/rdf+xml"]),s="META-INF/manifest.xml",Kt(a,s,UT(i)),a}function If(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function M9(e){return typeof TextEncoder!="undefined"?new TextEncoder().encode(e):bs(i0(e))}function L9(e,t){e:for(var a=0;a<=e.length-t.length;++a){for(var s=0;s<t.length;++s)if(e[a+s]!=t[s])continue e;return!0}return!1}function dl(e){var t=e.reduce(function(i,d){return i+d.length},0),a=new Uint8Array(t),s=0;return e.forEach(function(i){a.set(i,s),s+=i.length}),a}function D9(e,t,a){var s=Math.floor(a==0?0:Math.LOG10E*Math.log(Math.abs(a)))+6176-20,i=a/Math.pow(10,s-6176);e[t+15]|=s>>7,e[t+14]|=(s&127)<<1;for(var d=0;i>=1;++d,i/=256)e[t+d]=i&255;e[t+15]|=a>=0?0:128}function o0(e,t){var a=t?t[0]:0,s=e[a]&127;e:if(e[a++]>=128&&(s|=(e[a]&127)<<7,e[a++]<128||(s|=(e[a]&127)<<14,e[a++]<128)||(s|=(e[a]&127)<<21,e[a++]<128)||(s+=(e[a]&127)*Math.pow(2,28),++a,e[a++]<128)||(s+=(e[a]&127)*Math.pow(2,35),++a,e[a++]<128)||(s+=(e[a]&127)*Math.pow(2,42),++a,e[a++]<128)))break e;return t&&(t[0]=a),s}function va(e){var t=new Uint8Array(7);t[0]=e&127;var a=1;e:if(e>127){if(t[a-1]|=128,t[a]=e>>7&127,++a,e<=16383||(t[a-1]|=128,t[a]=e>>14&127,++a,e<=2097151)||(t[a-1]|=128,t[a]=e>>21&127,++a,e<=268435455)||(t[a-1]|=128,t[a]=e/256>>>21&127,++a,e<=34359738367)||(t[a-1]|=128,t[a]=e/65536>>>21&127,++a,e<=4398046511103))break e;t[a-1]|=128,t[a]=e/16777216>>>21&127,++a}return t.slice(0,a)}function _c(e){var t=0,a=e[t]&127;e:if(e[t++]>=128){if(a|=(e[t]&127)<<7,e[t++]<128||(a|=(e[t]&127)<<14,e[t++]<128)||(a|=(e[t]&127)<<21,e[t++]<128))break e;a|=(e[t]&127)<<28}return a}function mr(e){for(var t=[],a=[0];a[0]<e.length;){var s=a[0],i=o0(e,a),d=i&7;i=Math.floor(i/8);var c=0,f;if(i==0)break;switch(d){case 0:{for(var g=a[0];e[a[0]++]>=128;);f=e.slice(g,a[0])}break;case 5:c=4,f=e.slice(a[0],a[0]+c),a[0]+=c;break;case 1:c=8,f=e.slice(a[0],a[0]+c),a[0]+=c;break;case 2:c=o0(e,a),f=e.slice(a[0],a[0]+c),a[0]+=c;break;case 3:case 4:default:throw new Error("PB Type ".concat(d," for Field ").concat(i," at offset ").concat(s))}var p={data:f,type:d};t[i]==null?t[i]=[p]:t[i].push(p)}return t}function Or(e){var t=[];return e.forEach(function(a,s){a.forEach(function(i){i.data&&(t.push(va(s*8+i.type)),i.type==2&&t.push(va(i.data.length)),t.push(i.data))})}),dl(t)}function xs(e){for(var t,a=[],s=[0];s[0]<e.length;){var i=o0(e,s),d=mr(e.slice(s[0],s[0]+i));s[0]+=i;var c={id:_c(d[1][0].data),messages:[]};d[2].forEach(function(f){var g=mr(f.data),p=_c(g[3][0].data);c.messages.push({meta:g,data:e.slice(s[0],s[0]+p)}),s[0]+=p}),(t=d[3])!=null&&t[0]&&(c.merge=_c(d[3][0].data)>>>0>0),a.push(c)}return a}function cc(e){var t=[];return e.forEach(function(a){var s=[];s[1]=[{data:va(a.id),type:0}],s[2]=[],a.merge!=null&&(s[3]=[{data:va(+!!a.merge),type:0}]);var i=[];a.messages.forEach(function(c){i.push(c.data),c.meta[3]=[{type:0,data:va(c.data.length)}],s[2].push({data:Or(c.meta),type:2})});var d=Or(s);t.push(va(d.length)),t.push(d),i.forEach(function(c){return t.push(c)})}),dl(t)}function P9(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var a=[0],s=o0(t,a),i=[];a[0]<t.length;){var d=t[a[0]]&3;if(d==0){var c=t[a[0]++]>>2;if(c<60)++c;else{var f=c-59;c=t[a[0]],f>1&&(c|=t[a[0]+1]<<8),f>2&&(c|=t[a[0]+2]<<16),f>3&&(c|=t[a[0]+3]<<24),c>>>=0,c++,a[0]+=f}i.push(t.slice(a[0],a[0]+c)),a[0]+=c;continue}else{var g=0,p=0;if(d==1?(p=(t[a[0]]>>2&7)+4,g=(t[a[0]++]&224)<<3,g|=t[a[0]++]):(p=(t[a[0]++]>>2)+1,d==2?(g=t[a[0]]|t[a[0]+1]<<8,a[0]+=2):(g=(t[a[0]]|t[a[0]+1]<<8|t[a[0]+2]<<16|t[a[0]+3]<<24)>>>0,a[0]+=4)),i=[dl(i)],g==0)throw new Error("Invalid offset 0");if(g>i[0].length)throw new Error("Invalid offset beyond length");if(p>=g)for(i.push(i[0].slice(-g)),p-=g;p>=i[i.length-1].length;)i.push(i[i.length-1]),p-=i[i.length-1].length;i.push(i[0].slice(-g,-g+p))}}var x=dl(i);if(x.length!=s)throw new Error("Unexpected length: ".concat(x.length," != ").concat(s));return x}function ys(e){for(var t=[],a=0;a<e.length;){var s=e[a++],i=e[a]|e[a+1]<<8|e[a+2]<<16;a+=3,t.push(P9(s,e.slice(a,a+i))),a+=i}if(a!==e.length)throw new Error("data is not a valid framed stream!");return dl(t)}function dc(e){for(var t=[],a=0;a<e.length;){var s=Math.min(e.length-a,268435455),i=new Uint8Array(4);t.push(i);var d=va(s),c=d.length;t.push(d),s<=60?(c++,t.push(new Uint8Array([s-1<<2]))):s<=256?(c+=2,t.push(new Uint8Array([240,s-1&255]))):s<=65536?(c+=3,t.push(new Uint8Array([244,s-1&255,s-1>>8&255]))):s<=16777216?(c+=4,t.push(new Uint8Array([248,s-1&255,s-1>>8&255,s-1>>16&255]))):s<=4294967296&&(c+=5,t.push(new Uint8Array([252,s-1&255,s-1>>8&255,s-1>>16&255,s-1>>>24&255]))),t.push(e.slice(a,a+s)),c+=s,i[0]=0,i[1]=c&255,i[2]=c>>8&255,i[3]=c>>16&255,a+=s}return dl(t)}function Ag(e,t){var a=new Uint8Array(32),s=If(a),i=12,d=0;switch(a[0]=5,e.t){case"n":a[1]=2,D9(a,i,e.v),d|=1,i+=16;break;case"b":a[1]=6,s.setFloat64(i,e.v?1:0,!0),d|=2,i+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));a[1]=3,s.setUint32(i,t.indexOf(e.v),!0),d|=8,i+=4;break;default:throw"unsupported cell type "+e.t}return s.setUint32(8,d,!0),a.slice(0,i)}function Og(e,t){var a=new Uint8Array(32),s=If(a),i=12,d=0;switch(a[0]=3,e.t){case"n":a[2]=2,s.setFloat64(i,e.v,!0),d|=32,i+=8;break;case"b":a[2]=6,s.setFloat64(i,e.v?1:0,!0),d|=32,i+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));a[2]=3,s.setUint32(i,t.indexOf(e.v),!0),d|=16,i+=4;break;default:throw"unsupported cell type "+e.t}return s.setUint32(4,d,!0),a.slice(0,i)}function nl(e){var t=mr(e);return o0(t[1][0].data)}function R9(e,t,a){var s,i,d,c;if(!((s=e[6])!=null&&s[0])||!((i=e[7])!=null&&i[0]))throw"Mutation only works on post-BNC storages!";var f=((c=(d=e[8])==null?void 0:d[0])==null?void 0:c.data)&&_c(e[8][0].data)>0||!1;if(f)throw"Math only works with normal offsets";for(var g=0,p=If(e[7][0].data),x=0,y=[],_=If(e[4][0].data),k=0,T=[],N=0;N<t.length;++N){if(t[N]==null){p.setUint16(N*2,65535,!0),_.setUint16(N*2,65535);continue}p.setUint16(N*2,x,!0),_.setUint16(N*2,k,!0);var S,O;switch(typeof t[N]){case"string":S=Ag({t:"s",v:t[N]},a),O=Og({t:"s",v:t[N]},a);break;case"number":S=Ag({t:"n",v:t[N]},a),O=Og({t:"n",v:t[N]},a);break;case"boolean":S=Ag({t:"b",v:t[N]},a),O=Og({t:"b",v:t[N]},a);break;default:throw new Error("Unsupported value "+t[N])}y.push(S),x+=S.length,T.push(O),k+=O.length,++g}for(e[2][0].data=va(g);N<e[7][0].data.length/2;++N)p.setUint16(N*2,65535,!0),_.setUint16(N*2,65535,!0);return e[6][0].data=dl(y),e[3][0].data=dl(T),g}function F9(e,t){if(!t||!t.numbers)throw new Error("Must pass a `numbers` option -- check the README");var a=e.Sheets[e.SheetNames[0]];e.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var s=In(a["!ref"]);s.s.r=s.s.c=0;var i=!1;s.e.c>9&&(i=!0,s.e.c=9),s.e.r>49&&(i=!0,s.e.r=49),i&&console.error("The Numbers writer is currently limited to ".concat(cr(s)));var d=zf(a,{range:s,header:1}),c=["~Sh33tJ5~"];d.forEach(function(W){return W.forEach(function(G){typeof G=="string"&&c.push(G)})});var f={},g=[],p=Oa.read(t.numbers,{type:"base64"});p.FileIndex.map(function(W,G){return[W,p.FullPaths[G]]}).forEach(function(W){var G=W[0],J=W[1];if(G.type==2&&G.name.match(/\.iwa/)){var de=G.content,De=ys(de),Ne=xs(De);Ne.forEach(function($e){g.push($e.id),f[$e.id]={deps:[],location:J,type:_c($e.messages[0].meta[1][0].data)}})}}),g.sort(function(W,G){return W-G});var x=g.filter(function(W){return W>1}).map(function(W){return[W,va(W)]});p.FileIndex.map(function(W,G){return[W,p.FullPaths[G]]}).forEach(function(W){var G=W[0];if(W[1],!!G.name.match(/\.iwa/)){var J=xs(ys(G.content));J.forEach(function(de){de.messages.forEach(function(De){x.forEach(function(Ne){de.messages.some(function($e){return _c($e.meta[1][0].data)!=11006&&L9($e.data,Ne[1])})&&f[Ne[0]].deps.push(de.id)})})})}});for(var y=Oa.find(p,f[1].location),_=xs(ys(y.content)),k,T=0;T<_.length;++T){var N=_[T];N.id==1&&(k=N)}var S=nl(mr(k.messages[0].data)[1][0].data);for(y=Oa.find(p,f[S].location),_=xs(ys(y.content)),T=0;T<_.length;++T)N=_[T],N.id==S&&(k=N);for(S=nl(mr(k.messages[0].data)[2][0].data),y=Oa.find(p,f[S].location),_=xs(ys(y.content)),T=0;T<_.length;++T)N=_[T],N.id==S&&(k=N);for(S=nl(mr(k.messages[0].data)[2][0].data),y=Oa.find(p,f[S].location),_=xs(ys(y.content)),T=0;T<_.length;++T)N=_[T],N.id==S&&(k=N);var O=mr(k.messages[0].data);{O[6][0].data=va(s.e.r+1),O[7][0].data=va(s.e.c+1);var C=nl(O[46][0].data),A=Oa.find(p,f[C].location),P=xs(ys(A.content));{for(var I=0;I<P.length&&P[I].id!=C;++I);if(P[I].id!=C)throw"Bad ColumnRowUIDMapArchive";var ee=mr(P[I].messages[0].data);ee[1]=[],ee[2]=[],ee[3]=[];for(var B=0;B<=s.e.c;++B){var H=[];H[1]=H[2]=[{type:0,data:va(B+420690)}],ee[1].push({type:2,data:Or(H)}),ee[2].push({type:0,data:va(B)}),ee[3].push({type:0,data:va(B)})}ee[4]=[],ee[5]=[],ee[6]=[];for(var Y=0;Y<=s.e.r;++Y)H=[],H[1]=H[2]=[{type:0,data:va(Y+726270)}],ee[4].push({type:2,data:Or(H)}),ee[5].push({type:0,data:va(Y)}),ee[6].push({type:0,data:va(Y)});P[I].messages[0].data=Or(ee)}A.content=dc(cc(P)),A.size=A.content.length,delete O[46];var ue=mr(O[4][0].data);{ue[7][0].data=va(s.e.r+1);var xe=mr(ue[1][0].data),le=nl(xe[2][0].data);A=Oa.find(p,f[le].location),P=xs(ys(A.content));{if(P[0].id!=le)throw"Bad HeaderStorageBucket";var ge=mr(P[0].messages[0].data);for(Y=0;Y<d.length;++Y){var be=mr(ge[2][0].data);be[1][0].data=va(Y),be[4][0].data=va(d[Y].length),ge[2][Y]={type:ge[2][0].type,data:Or(be)}}P[0].messages[0].data=Or(ge)}A.content=dc(cc(P)),A.size=A.content.length;var me=nl(ue[2][0].data);A=Oa.find(p,f[me].location),P=xs(ys(A.content));{if(P[0].id!=me)throw"Bad HeaderStorageBucket";for(ge=mr(P[0].messages[0].data),B=0;B<=s.e.c;++B)be=mr(ge[2][0].data),be[1][0].data=va(B),be[4][0].data=va(s.e.r+1),ge[2][B]={type:ge[2][0].type,data:Or(be)};P[0].messages[0].data=Or(ge)}A.content=dc(cc(P)),A.size=A.content.length;var ae=nl(ue[4][0].data);(function(){for(var W=Oa.find(p,f[ae].location),G=xs(ys(W.content)),J,de=0;de<G.length;++de){var De=G[de];De.id==ae&&(J=De)}var Ne=mr(J.messages[0].data);{Ne[3]=[];var $e=[];c.forEach(function(gt,zt){$e[1]=[{type:0,data:va(zt)}],$e[2]=[{type:0,data:va(1)}],$e[3]=[{type:2,data:M9(gt)}],Ne[3].push({type:2,data:Or($e)})})}J.messages[0].data=Or(Ne);var Ve=cc(G),st=dc(Ve);W.content=st,W.size=W.content.length})();var Z=mr(ue[3][0].data);{var K=Z[1][0];delete Z[2];var te=mr(K.data);{var se=nl(te[2][0].data);(function(){for(var W=Oa.find(p,f[se].location),G=xs(ys(W.content)),J,de=0;de<G.length;++de){var De=G[de];De.id==se&&(J=De)}var Ne=mr(J.messages[0].data);{delete Ne[6],delete Z[7];var $e=new Uint8Array(Ne[5][0].data);Ne[5]=[];for(var Ve=0,st=0;st<=s.e.r;++st){var gt=mr($e);Ve+=R9(gt,d[st],c),gt[1][0].data=va(st),Ne[5].push({data:Or(gt),type:2})}Ne[1]=[{type:0,data:va(s.e.c+1)}],Ne[2]=[{type:0,data:va(s.e.r+1)}],Ne[3]=[{type:0,data:va(Ve)}],Ne[4]=[{type:0,data:va(s.e.r+1)}]}J.messages[0].data=Or(Ne);var zt=cc(G),Ge=dc(zt);W.content=Ge,W.size=W.content.length})()}K.data=Or(te)}ue[3][0].data=Or(Z)}O[4][0].data=Or(ue)}k.messages[0].data=Or(O);var F=cc(_),D=dc(F);return y.content=D,y.size=y.content.length,p}function I9(e){return function(a){for(var s=0;s!=e.length;++s){var i=e[s];a[i[0]]===void 0&&(a[i[0]]=i[1]),i[2]==="n"&&(a[i[0]]=Number(a[i[0]]))}}}function Ip(e){I9([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function z9(e,t){return t.bookType=="ods"?Iw(e,t):t.bookType=="numbers"?F9(e,t):t.bookType=="xlsb"?B9(e,t):U9(e,t)}function B9(e,t){mc=1024,e&&!e.SSF&&(e.SSF=yn(Ka)),e&&e.SSF&&(eh(),Qf(e.SSF),t.revssf=th(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,Qd?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var a=t.bookType=="xlsb"?"bin":"xml",s=vw.indexOf(t.bookType)>-1,i=Y2();Ip(t=t||{});var d=wp(),c="",f=0;if(t.cellXfs=[],ml(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),c="docProps/core.xml",Kt(d,c,Q2(e.Props,t)),i.coreprops.push(c),_a(t.rels,2,c,fa.CORE_PROPS),c="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var g=[],p=0;p<e.SheetNames.length;++p)(e.Workbook.Sheets[p]||{}).Hidden!=2&&g.push(e.SheetNames[p]);e.Props.SheetNames=g}for(e.Props.Worksheets=e.Props.SheetNames.length,Kt(d,c,tw(e.Props)),i.extprops.push(c),_a(t.rels,3,c,fa.EXT_PROPS),e.Custprops!==e.Props&&Fr(e.Custprops||{}).length>0&&(c="docProps/custom.xml",Kt(d,c,aw(e.Custprops)),i.custprops.push(c),_a(t.rels,4,c,fa.CUST_PROPS)),f=1;f<=e.SheetNames.length;++f){var x={"!id":{}},y=e.Sheets[e.SheetNames[f-1]],_=(y||{})["!type"]||"sheet";switch(_){case"chart":default:c="xl/worksheets/sheet"+f+"."+a,Kt(d,c,$A(f-1,c,t,e,x)),i.sheets.push(c),_a(t.wbrels,-1,"worksheets/sheet"+f+"."+a,fa.WS[0])}if(y){var k=y["!comments"],T=!1,N="";k&&k.length>0&&(N="xl/comments"+f+"."+a,Kt(d,N,GA(k,N)),i.comments.push(N),_a(x,-1,"../comments"+f+"."+a,fa.CMNT),T=!0),y["!legacy"]&&T&&Kt(d,"xl/drawings/vmlDrawing"+f+".vml",yw(f,y["!comments"])),delete y["!comments"],delete y["!legacy"]}x["!id"].rId1&&Kt(d,J2(c),bc(x))}return t.Strings!=null&&t.Strings.length>0&&(c="xl/sharedStrings."+a,Kt(d,c,VA(t.Strings,c,t)),i.strs.push(c),_a(t.wbrels,-1,"sharedStrings."+a,fa.SST)),c="xl/workbook."+a,Kt(d,c,HA(e,c)),i.workbooks.push(c),_a(t.rels,1,c,fa.WB),c="xl/theme/theme1.xml",Kt(d,c,pw(e.Themes,t)),i.themes.push(c),_a(t.wbrels,-1,"theme/theme1.xml",fa.THEME),c="xl/styles."+a,Kt(d,c,WA(e,c,t)),i.styles.push(c),_a(t.wbrels,-1,"styles."+a,fa.STY),e.vbaraw&&s&&(c="xl/vbaProject.bin",Kt(d,c,e.vbaraw),i.vba.push(c),_a(t.wbrels,-1,"vbaProject.bin",fa.VBA)),c="xl/metadata."+a,Kt(d,c,ZA(c)),i.metadata.push(c),_a(t.wbrels,-1,"metadata."+a,fa.XLMETA),Kt(d,"[Content_Types].xml",X2(i,t)),Kt(d,"_rels/.rels",bc(t.rels)),Kt(d,"xl/_rels/workbook."+a+".rels",bc(t.wbrels)),delete t.revssf,delete t.ssf,d}function U9(e,t){mc=1024,e&&!e.SSF&&(e.SSF=yn(Ka)),e&&e.SSF&&(eh(),Qf(e.SSF),t.revssf=th(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,Qd?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var a="xml",s=vw.indexOf(t.bookType)>-1,i=Y2();Ip(t=t||{});var d=wp(),c="",f=0;if(t.cellXfs=[],ml(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),c="docProps/core.xml",Kt(d,c,Q2(e.Props,t)),i.coreprops.push(c),_a(t.rels,2,c,fa.CORE_PROPS),c="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var g=[],p=0;p<e.SheetNames.length;++p)(e.Workbook.Sheets[p]||{}).Hidden!=2&&g.push(e.SheetNames[p]);e.Props.SheetNames=g}e.Props.Worksheets=e.Props.SheetNames.length,Kt(d,c,tw(e.Props)),i.extprops.push(c),_a(t.rels,3,c,fa.EXT_PROPS),e.Custprops!==e.Props&&Fr(e.Custprops||{}).length>0&&(c="docProps/custom.xml",Kt(d,c,aw(e.Custprops)),i.custprops.push(c),_a(t.rels,4,c,fa.CUST_PROPS));var x=["SheetJ5"];for(t.tcid=0,f=1;f<=e.SheetNames.length;++f){var y={"!id":{}},_=e.Sheets[e.SheetNames[f-1]],k=(_||{})["!type"]||"sheet";switch(k){case"chart":default:c="xl/worksheets/sheet"+f+"."+a,Kt(d,c,Cw(f-1,t,e,y)),i.sheets.push(c),_a(t.wbrels,-1,"worksheets/sheet"+f+"."+a,fa.WS[0])}if(_){var T=_["!comments"],N=!1,S="";if(T&&T.length>0){var O=!1;T.forEach(function(C){C[1].forEach(function(A){A.T==!0&&(O=!0)})}),O&&(S="xl/threadedComments/threadedComment"+f+"."+a,Kt(d,S,yC(T,x,t)),i.threadedcomments.push(S),_a(y,-1,"../threadedComments/threadedComment"+f+"."+a,fa.TCMNT)),S="xl/comments"+f+"."+a,Kt(d,S,bw(T)),i.comments.push(S),_a(y,-1,"../comments"+f+"."+a,fa.CMNT),N=!0}_["!legacy"]&&N&&Kt(d,"xl/drawings/vmlDrawing"+f+".vml",yw(f,_["!comments"])),delete _["!comments"],delete _["!legacy"]}y["!id"].rId1&&Kt(d,J2(c),bc(y))}return t.Strings!=null&&t.Strings.length>0&&(c="xl/sharedStrings."+a,Kt(d,c,dw(t.Strings,t)),i.strs.push(c),_a(t.wbrels,-1,"sharedStrings."+a,fa.SST)),c="xl/workbook."+a,Kt(d,c,Mw(e)),i.workbooks.push(c),_a(t.rels,1,c,fa.WB),c="xl/theme/theme1.xml",Kt(d,c,pw(e.Themes,t)),i.themes.push(c),_a(t.wbrels,-1,"theme/theme1.xml",fa.THEME),c="xl/styles."+a,Kt(d,c,mw(e,t)),i.styles.push(c),_a(t.wbrels,-1,"styles."+a,fa.STY),e.vbaraw&&s&&(c="xl/vbaProject.bin",Kt(d,c,e.vbaraw),i.vba.push(c),_a(t.wbrels,-1,"vbaProject.bin",fa.VBA)),c="xl/metadata."+a,Kt(d,c,xw()),i.metadata.push(c),_a(t.wbrels,-1,"metadata."+a,fa.XLMETA),x.length>1&&(c="xl/persons/person.xml",Kt(d,c,bC(x)),i.people.push(c),_a(t.wbrels,-1,"persons/person.xml",fa.PEOPLE)),Kt(d,"[Content_Types].xml",X2(i,t)),Kt(d,"_rels/.rels",bc(t.rels)),Kt(d,"xl/_rels/workbook."+a+".rels",bc(t.wbrels)),delete t.revssf,delete t.ssf,d}function H9(e,t){var a="";switch((t||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":a=yi(e.slice(0,12));break;case"binary":a=e;break;case"array":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];default:throw new Error("Unrecognized type "+(t&&t.type||"undefined"))}return[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3),a.charCodeAt(4),a.charCodeAt(5),a.charCodeAt(6),a.charCodeAt(7)]}function zw(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return w0(t.file,Oa.write(e,{type:pa?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return Oa.write(e,t)}function $9(e,t){var a=yn(t||{}),s=z9(e,a);return W9(s,a)}function W9(e,t){var a={},s=pa?"nodebuffer":typeof Uint8Array!="undefined"?"array":"string";if(t.compression&&(a.compression="DEFLATE"),t.password)a.type=s;else switch(t.type){case"base64":a.type="base64";break;case"binary":a.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":a.type=s;break;default:throw new Error("Unrecognized type "+t.type)}var i=e.FullPaths?Oa.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[a.type]||a.type,compression:!!t.compression}):e.generate(a);if(typeof Deno!="undefined"&&typeof i=="string"){if(t.type=="binary"||t.type=="base64")return i;i=new Uint8Array(Kf(i))}return t.password&&typeof encrypt_agile!="undefined"?zw(encrypt_agile(i,t.password),t):t.type==="file"?w0(t.file,i):t.type=="string"?Yd(i):i}function V9(e,t){var a=t||{},s=l9(e,a);return zw(s,a)}function Us(e,t,a){a||(a="");var s=a+e;switch(t.type){case"base64":return n0(i0(s));case"binary":return i0(s);case"string":return e;case"file":return w0(t.file,s,"utf8");case"buffer":return pa?wi(s,"utf8"):typeof TextEncoder!="undefined"?new TextEncoder().encode(s):Us(s,{type:"binary"}).split("").map(function(i){return i.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function G9(e,t){switch(t.type){case"base64":return n0(e);case"binary":return e;case"string":return e;case"file":return w0(t.file,e,"binary");case"buffer":return pa?wi(e,"binary"):e.split("").map(function(a){return a.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function of(e,t){switch(t.type){case"string":case"base64":case"binary":for(var a="",s=0;s<e.length;++s)a+=String.fromCharCode(e[s]);return t.type=="base64"?n0(a):t.type=="string"?Yd(a):a;case"file":return w0(t.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+t.type)}}function Bw(e,t){v5(),OA(e);var a=yn(t||{});if(a.cellStyles&&(a.cellNF=!0,a.sheetStubs=!0),a.type=="array"){a.type="binary";var s=Bw(e,a);return a.type="array",Kf(s)}var i=0;if(a.sheet&&(typeof a.sheet=="number"?i=a.sheet:i=e.SheetNames.indexOf(a.sheet),!e.SheetNames[i]))throw new Error("Sheet not found: "+a.sheet+" : "+typeof a.sheet);switch(a.bookType||"xlsb"){case"xml":case"xlml":return Us(s9(e,a),a);case"slk":case"sylk":return Us(EE.from_sheet(e.Sheets[e.SheetNames[i]],a),a);case"htm":case"html":return Us(Pw(e.Sheets[e.SheetNames[i]],a),a);case"txt":return G9(Uw(e.Sheets[e.SheetNames[i]],a),a);case"csv":return Us(zp(e.Sheets[e.SheetNames[i]],a),a,"\uFEFF");case"dif":return Us(CE.from_sheet(e.Sheets[e.SheetNames[i]],a),a);case"dbf":return of(TE.from_sheet(e.Sheets[e.SheetNames[i]],a),a);case"prn":return Us(AE.from_sheet(e.Sheets[e.SheetNames[i]],a),a);case"rtf":return Us(FE.from_sheet(e.Sheets[e.SheetNames[i]],a),a);case"eth":return Us(cw.from_sheet(e.Sheets[e.SheetNames[i]],a),a);case"fods":return Us(Iw(e,a),a);case"wk1":return of(Pv.sheet_to_wk1(e.Sheets[e.SheetNames[i]],a),a);case"wk3":return of(Pv.book_to_wk3(e,a),a);case"biff2":a.biff||(a.biff=2);case"biff3":a.biff||(a.biff=3);case"biff4":return a.biff||(a.biff=4),of(Dw(e,a),a);case"biff5":a.biff||(a.biff=5);case"biff8":case"xla":case"xls":return a.biff||(a.biff=8),V9(e,a);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return $9(e,a);default:throw new Error("Unrecognized bookType |"+a.bookType+"|")}}function Z9(e){if(!e.bookType){var t={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"},a=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();a.match(/^\.[a-z]+$/)&&(e.bookType=a.slice(1)),e.bookType=t[e.bookType]||e.bookType}}function Ic(e,t,a){var s={};return s.type="file",s.file=t,Z9(s),Bw(e,s)}function q9(e,t,a,s,i,d,c,f){var g=Pr(a),p=f.defval,x=f.raw||!Object.prototype.hasOwnProperty.call(f,"raw"),y=!0,_=i===1?[]:{};if(i!==1)if(Object.defineProperty)try{Object.defineProperty(_,"__rowNum__",{value:a,enumerable:!1})}catch(S){_.__rowNum__=a}else _.__rowNum__=a;if(!c||e[a])for(var k=t.s.c;k<=t.e.c;++k){var T=c?e[a][k]:e[s[k]+g];if(T===void 0||T.t===void 0){if(p===void 0)continue;d[k]!=null&&(_[d[k]]=p);continue}var N=T.v;switch(T.t){case"z":if(N==null)break;continue;case"e":N=N==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+T.t)}if(d[k]!=null){if(N==null)if(T.t=="e"&&N===null)_[d[k]]=null;else if(p!==void 0)_[d[k]]=p;else if(x&&N===null)_[d[k]]=null;else continue;else _[d[k]]=x&&(T.t!=="n"||T.t==="n"&&f.rawNumbers!==!1)?N:bi(T,N,f);N!=null&&(y=!1)}}return{row:_,isempty:y}}function zf(e,t){if(e==null||e["!ref"]==null)return[];var a={t:"n",v:0},s=0,i=1,d=[],c=0,f="",g={s:{r:0,c:0},e:{r:0,c:0}},p=t||{},x=p.range!=null?p.range:e["!ref"];switch(p.header===1?s=1:p.header==="A"?s=2:Array.isArray(p.header)?s=3:p.header==null&&(s=0),typeof x){case"string":g=Ba(x);break;case"number":g=Ba(e["!ref"]),g.s.r=x;break;default:g=x}s>0&&(i=0);var y=Pr(g.s.r),_=[],k=[],T=0,N=0,S=Array.isArray(e),O=g.s.r,C=0,A={};S&&!e[O]&&(e[O]=[]);var P=p.skipHidden&&e["!cols"]||[],I=p.skipHidden&&e["!rows"]||[];for(C=g.s.c;C<=g.e.c;++C)if(!(P[C]||{}).hidden)switch(_[C]=$r(C),a=S?e[O][C]:e[_[C]+y],s){case 1:d[C]=C-g.s.c;break;case 2:d[C]=_[C];break;case 3:d[C]=p.header[C-g.s.c];break;default:if(a==null&&(a={w:"__EMPTY",t:"s"}),f=c=bi(a,null,p),N=A[c]||0,!N)A[c]=1;else{do f=c+"_"+N++;while(A[f]);A[c]=N,A[f]=1}d[C]=f}for(O=g.s.r+i;O<=g.e.r;++O)if(!(I[O]||{}).hidden){var ee=q9(e,g,O,_,s,d,S,p);(ee.isempty===!1||(s===1?p.blankrows!==!1:p.blankrows))&&(k[T++]=ee.row)}return k.length=T,k}var $v=/"/g;function Y9(e,t,a,s,i,d,c,f){for(var g=!0,p=[],x="",y=Pr(a),_=t.s.c;_<=t.e.c;++_)if(s[_]){var k=f.dense?(e[a]||[])[_]:e[s[_]+y];if(k==null)x="";else if(k.v!=null){g=!1,x=""+(f.rawNumbers&&k.t=="n"?k.v:bi(k,null,f));for(var T=0,N=0;T!==x.length;++T)if((N=x.charCodeAt(T))===i||N===d||N===34||f.forceQuotes){x='"'+x.replace($v,'""')+'"';break}x=="ID"&&(x='"ID"')}else k.f!=null&&!k.F?(g=!1,x="="+k.f,x.indexOf(",")>=0&&(x='"'+x.replace($v,'""')+'"')):x="";p.push(x)}return f.blankrows===!1&&g?null:p.join(c)}function zp(e,t){var a=[],s=t==null?{}:t;if(e==null||e["!ref"]==null)return"";var i=Ba(e["!ref"]),d=s.FS!==void 0?s.FS:",",c=d.charCodeAt(0),f=s.RS!==void 0?s.RS:`
|
||
`,g=f.charCodeAt(0),p=new RegExp((d=="|"?"\\|":d)+"+$"),x="",y=[];s.dense=Array.isArray(e);for(var _=s.skipHidden&&e["!cols"]||[],k=s.skipHidden&&e["!rows"]||[],T=i.s.c;T<=i.e.c;++T)(_[T]||{}).hidden||(y[T]=$r(T));for(var N=0,S=i.s.r;S<=i.e.r;++S)(k[S]||{}).hidden||(x=Y9(e,i,S,y,c,g,d,s),x!=null&&(s.strip&&(x=x.replace(p,"")),(x||s.blankrows!==!1)&&a.push((N++?f:"")+x)));return delete s.dense,a.join("")}function Uw(e,t){t||(t={}),t.FS=" ",t.RS=`
|
||
`;var a=zp(e,t);return a}function X9(e){var t="",a,s="";if(e==null||e["!ref"]==null)return[];var i=Ba(e["!ref"]),d="",c=[],f,g=[],p=Array.isArray(e);for(f=i.s.c;f<=i.e.c;++f)c[f]=$r(f);for(var x=i.s.r;x<=i.e.r;++x)for(d=Pr(x),f=i.s.c;f<=i.e.c;++f)if(t=c[f]+d,a=p?(e[x]||[])[f]:e[t],s="",a!==void 0){if(a.F!=null){if(t=a.F,!a.f)continue;s=a.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(a.f!=null)s=a.f;else{if(a.t=="z")continue;if(a.t=="n"&&a.v!=null)s=""+a.v;else if(a.t=="b")s=a.v?"TRUE":"FALSE";else if(a.w!==void 0)s="'"+a.w;else{if(a.v===void 0)continue;a.t=="s"?s="'"+a.v:s=""+a.v}}g[g.length]=t+"="+s}return g}function Hw(e,t,a){var s=a||{},i=+!s.skipHeader,d=e||{},c=0,f=0;if(d&&s.origin!=null)if(typeof s.origin=="number")c=s.origin;else{var g=typeof s.origin=="string"?vr(s.origin):s.origin;c=g.r,f=g.c}var p,x={s:{c:0,r:0},e:{c:f,r:c+t.length-1+i}};if(d["!ref"]){var y=Ba(d["!ref"]);x.e.c=Math.max(x.e.c,y.e.c),x.e.r=Math.max(x.e.r,y.e.r),c==-1&&(c=y.e.r+1,x.e.r=c+t.length-1+i)}else c==-1&&(c=0,x.e.r=t.length-1+i);var _=s.header||[],k=0;t.forEach(function(N,S){Fr(N).forEach(function(O){(k=_.indexOf(O))==-1&&(_[k=_.length]=O);var C=N[O],A="z",P="",I=ka({c:f+k,r:c+S+i});p=c0(d,I),C&&typeof C=="object"&&!(C instanceof Date)?d[I]=C:(typeof C=="number"?A="n":typeof C=="boolean"?A="b":typeof C=="string"?A="s":C instanceof Date?(A="d",s.cellDates||(A="n",C=xn(C)),P=s.dateNF||Ka[14]):C===null&&s.nullError&&(A="e",C=0),p?(p.t=A,p.v=C,delete p.w,delete p.R,P&&(p.z=P)):d[I]=p={t:A,v:C},P&&(p.z=P))})}),x.e.c=Math.max(x.e.c,f+_.length-1);var T=Pr(c);if(i)for(k=0;k<_.length;++k)d[$r(k+f)+T]={t:"s",v:_[k]};return d["!ref"]=cr(x),d}function J9(e,t){return Hw(null,e,t)}function c0(e,t,a){if(typeof t=="string"){if(Array.isArray(e)){var s=vr(t);return e[s.r]||(e[s.r]=[]),e[s.r][s.c]||(e[s.r][s.c]={t:"z"})}return e[t]||(e[t]={t:"z"})}return typeof t!="number"?c0(e,ka(t)):c0(e,ka({r:t,c:a||0}))}function K9(e,t){if(typeof t=="number"){if(t>=0&&e.SheetNames.length>t)return t;throw new Error("Cannot find sheet # "+t)}else if(typeof t=="string"){var a=e.SheetNames.indexOf(t);if(a>-1)return a;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function Q9(){return{SheetNames:[],Sheets:{}}}function eO(e,t,a,s){var i=1;if(!a)for(;i<=65535&&e.SheetNames.indexOf(a="Sheet"+i)!=-1;++i,a=void 0);if(!a||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(s&&e.SheetNames.indexOf(a)>=0){var d=a.match(/(^.*?)(\d+)$/);i=d&&+d[2]||0;var c=d&&d[1]||a;for(++i;i<=65535&&e.SheetNames.indexOf(a=c+i)!=-1;++i);}if(Ow(a),e.SheetNames.indexOf(a)>=0)throw new Error("Worksheet with name |"+a+"| already exists!");return e.SheetNames.push(a),e.Sheets[a]=t,a}function tO(e,t,a){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var s=K9(e,t);switch(e.Workbook.Sheets[s]||(e.Workbook.Sheets[s]={}),a){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+a)}e.Workbook.Sheets[s].Hidden=a}function aO(e,t){return e.z=t,e}function $w(e,t,a){return t?(e.l={Target:t},a&&(e.l.Tooltip=a)):delete e.l,e}function rO(e,t,a){return $w(e,"#"+t,a)}function nO(e,t,a){e.c||(e.c=[]),e.c.push({t,a:a||"SheetJS"})}function sO(e,t,a,s){for(var i=typeof t!="string"?t:Ba(t),d=typeof t=="string"?t:cr(t),c=i.s.r;c<=i.e.r;++c)for(var f=i.s.c;f<=i.e.c;++f){var g=c0(e,c,f);g.t="n",g.F=d,delete g.v,c==i.s.r&&f==i.s.c&&(g.f=a,s&&(g.D=!0))}return e}var kr={encode_col:$r,encode_row:Pr,encode_cell:ka,encode_range:cr,decode_col:Ep,decode_row:Tp,split_cell:vT,decode_cell:vr,decode_range:In,format_cell:bi,sheet_add_aoa:$2,sheet_add_json:Hw,sheet_add_dom:Rw,aoa_to_sheet:Pc,json_to_sheet:J9,table_to_sheet:Fw,table_to_book:C9,sheet_to_csv:zp,sheet_to_txt:Uw,sheet_to_json:zf,sheet_to_html:Pw,sheet_to_formulae:X9,sheet_to_row_object_array:zf,sheet_get_cell:c0,book_new:Q9,book_append_sheet:eO,book_set_sheet_visibility:tO,cell_set_number_format:aO,cell_set_hyperlink:$w,cell_set_internal_link:rO,cell_add_comment:nO,sheet_set_array_formula:sO,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};const iO={},kt=({label:e,doctype:t,value:a,onChange:s,placeholder:i,disabled:d=!1,filters:c,compact:f=!1,usePortal:g=!1})=>{const[p,x]=j.useState([]),[y,_]=j.useState(""),[k,T]=j.useState(!1),[N,S]=j.useState(!1),[O,C]=j.useState({top:0,left:0,width:0}),A=j.useRef(null),P=j.useRef(null),I=j.useRef(null),ee=j.useRef(null),B=j.useRef(""),H=j.useRef(!1),Y=c||iO,ue=j.useMemo(()=>JSON.stringify(Y),[Y]),xe=j.useCallback((Z="",K=!1)=>oe(null,null,function*(){const te=`${Z}-${ue}`;if(!(!K&&B.current===te)){B.current=te,S(!0);try{const se=new URLSearchParams({doctype:t,txt:Z});Y&&Object.keys(Y).length>0&&se.append("filters",JSON.stringify(Y));const F=yield rt.apiCall(`/api/method/frappe.desk.search.search_link?${se.toString()}`);x(F||[])}catch(se){console.error(`Error fetching ${t} links:`,se),x([])}finally{S(!1)}}}),[t,ue,Y]),le=j.useCallback(Z=>{ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{xe(Z)},300)},[xe]);j.useEffect(()=>{k&&!H.current&&(H.current=!0,xe(y||"",!0)),k||(H.current=!1,B.current="")},[k]),j.useEffect(()=>()=>{ee.current&&clearTimeout(ee.current)},[]);const ge=j.useCallback(()=>{if(g&&P.current){const Z=P.current.getBoundingClientRect();C({top:Z.bottom+window.scrollY,left:Z.left+window.scrollX,width:Z.width})}},[g]);j.useEffect(()=>{if(k&&g){ge();const Z=()=>ge();return window.addEventListener("scroll",Z,!0),window.addEventListener("resize",Z),()=>{window.removeEventListener("scroll",Z,!0),window.removeEventListener("resize",Z)}}},[k,g,ge]),j.useEffect(()=>{const Z=K=>{const te=K.target,se=A.current&&!A.current.contains(te),F=g&&I.current&&!I.current.contains(te);g?se&&F&&(T(!1),_("")):se&&(T(!1),_(""))};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[g]);const be=Z=>{s(Z),_(""),T(!1)},me=()=>{s(""),_(""),T(!1)},ae=()=>{const Z=`bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600
|
||
rounded-md w-full shadow-lg ${f?"mt-0.5":"mt-1"}`,K=g?{position:"fixed",top:`${O.top}px`,left:`${O.left}px`,width:`${O.width}px`,zIndex:1050,marginTop:f?"2px":"4px"}:{};if(!k||d)return null;const te=r.jsxs("div",{ref:I,children:[N&&r.jsxs("div",{className:`${g?"":"absolute z-[1050]"} ${Z} text-center text-gray-500 dark:text-gray-400
|
||
${f?"p-1.5 text-[10px]":"p-3 text-sm"}`,style:K,children:[r.jsx("span",{className:"inline-block animate-spin mr-2",children:"⏳"}),"Loading..."]}),!N&&p.length>0&&r.jsx("ul",{className:`${g?"":"absolute z-[1050]"} ${Z} overflow-auto
|
||
${f?"max-h-36":"max-h-48"}`,style:K,children:p.map((se,F)=>r.jsxs("li",{onClick:()=>be(se.value),className:`cursor-pointer text-gray-900 dark:text-gray-100
|
||
hover:bg-blue-500 dark:hover:bg-blue-600 hover:text-white
|
||
${f?"px-2 py-1 text-xs":"px-3 py-2 text-sm"}
|
||
${a===se.value?"bg-blue-50 dark:bg-blue-700 font-semibold":""}`,children:[se.value,se.description&&r.jsx("span",{className:`text-gray-600 dark:text-gray-300 ml-2
|
||
${f?"text-[9px] ml-1":"text-xs ml-2"}`,children:se.description})]},F))}),!N&&p.length===0&&r.jsx("div",{className:`${g?"":"absolute z-[1050]"} ${Z} text-center text-gray-500 dark:text-gray-400
|
||
${f?"p-1.5 text-[10px]":"p-3 text-sm"}`,style:K,children:"No results found"})]});return g?w_.createPortal(te,document.body):te};return r.jsxs("div",{ref:A,className:`relative w-full ${f?"mb-2":"mb-4"}`,children:[r.jsx("label",{className:`block font-medium text-gray-700 dark:text-gray-300 ${f?"text-[10px] mb-0.5":"text-sm mb-1"}`,children:e}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{ref:P,type:"text",value:k?y:a,placeholder:i||`Select ${e}`,disabled:d,className:`w-full border border-gray-300 dark:border-gray-600 rounded-md
|
||
focus:outline-none disabled:bg-gray-100 dark:disabled:bg-gray-700
|
||
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
||
${f?"px-2 py-1 text-xs focus:ring-1 focus:ring-blue-500 rounded":"px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500"}
|
||
${a?f?"pr-5":"pr-8":""}`,onFocus:()=>{d||(T(!0),_(""),g&&ge())},onChange:Z=>{const K=Z.target.value;_(K),le(K)}}),a&&!d&&!k&&r.jsx("button",{type:"button",onClick:me,className:`absolute top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300
|
||
${f?"right-1 text-xs":"right-2 text-sm"}`,children:"✕"})]}),ae()]})},Ww=(e="Asset")=>{const[t,a]=j.useState({isAdmin:!1,restrictions:{},permissionFilters:{},targetDoctype:e,loading:!0,error:null}),s=j.useCallback(p=>oe(null,null,function*(){const x=p||e;try{a(_=>Ee(ie({},_),{loading:!0,error:null,targetDoctype:x}));const y=yield rt.getPermissionFilters(x);return a({isAdmin:y.is_admin,restrictions:y.restrictions||{},permissionFilters:y.filters||{},targetDoctype:x,loading:!1,error:null}),y}catch(y){return console.error(`Error fetching permissions for ${x}:`,y),a(_=>Ee(ie({},_),{loading:!1,error:y instanceof Error?y.message:"Failed to fetch permissions"})),null}}),[e]);j.useEffect(()=>{s()},[s]);const i=j.useCallback(p=>{var x;return((x=t.restrictions[p])==null?void 0:x.values)||[]},[t.restrictions]),d=j.useCallback(p=>t.isAdmin?!1:!!t.restrictions[p],[t.isAdmin,t.restrictions]),c=j.useMemo(()=>!t.isAdmin&&Object.keys(t.restrictions).length>0,[t.isAdmin,t.restrictions]),f=j.useCallback(p=>{if(t.isAdmin)return p;const x=ie({},p);for(const[y,_]of Object.entries(t.permissionFilters))if(!x[y])x[y]=_;else if(Array.isArray(_)&&_[0]==="in"){const k=_[1];typeof x[y]=="string"&&!k.includes(x[y])&&(x[y]=["in",[]])}return x},[t.isAdmin,t.permissionFilters]),g=j.useMemo(()=>Object.entries(t.restrictions).map(([p,x])=>({type:p,field:x.field,values:x.values,count:x.count})),[t.restrictions]);return Ee(ie({},t),{refetch:s,switchDoctype:s,getAllowedValues:i,hasRestriction:d,hasAnyRestrictions:c,mergeFilters:f,restrictionsList:g})},lO=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const{t:g}=Qa(),[p,x]=j.useState(a>0?"selected":"all_with_filters"),[y,_]=j.useState("csv"),[k,T]=j.useState(f.filter(C=>C.default).map(C=>C.key));j.useEffect(()=>{a>0?x("selected"):x("all_with_filters")},[a]);const N=C=>{T(A=>A.includes(C)?A.filter(P=>P!==C):[...A,C])},S=()=>{T(f.map(C=>C.key))},O=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qr,{className:"text-white text-xl"}),r.jsxs("h3",{className:"text-lg font-semibold text-white",children:[g("listPages.export")," ",g("assets.title")]})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(vt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:g("listPages.exportFormat")}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>x("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected asset",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:p==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," asset",i!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[i," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:p==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," asset",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:g("listPages.exportFormat")}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${y==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:y==="csv",onChange:()=>_("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Ac,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:g("listPages.csv")}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${y==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:y==="excel",onChange:()=>_("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Oc,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:g("listPages.excel")}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:O,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(C=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${k.includes(C.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[p==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,p==="all_on_page"&&`Exporting ${i} row${i!==1?"s":""} from current page`,p==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>d(p,y,k),disabled:k.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_i,{}),"Export"]})})]})]})]})}):null},oO=()=>{const{t:e}=Qa(),t=Na(),[a,s]=j.useState(0),[i,d]=j.useState(""),[c,f]=j.useState(null),[g,p]=j.useState(null),x=j.useRef(null),y=20,_=[{key:"name",label:e("commonFields.assetId"),default:!0},{key:"asset_name",label:e("commonFields.assetName"),default:!0},{key:"custom_serial_number",label:e("commonFields.serialNumber"),default:!0},{key:"company",label:e("commonFields.company"),default:!0},{key:"location",label:e("commonFields.location"),default:!0},{key:"department",label:e("commonFields.department"),default:!1},{key:"custom_device_status",label:e("commonFields.deviceStatus"),default:!0},{key:"custom_modality",label:e("commonFields.modality"),default:!1},{key:"custom_manufacturer",label:e("commonFields.manufacturer"),default:!1},{key:"supplier",label:e("commonFields.supplier"),default:!1},{key:"asset_category",label:e("commonFields.assetCategory"),default:!1},{key:"purchase_date",label:e("commonFields.purchaseDate"),default:!1},{key:"gross_purchase_amount",label:e("commonFields.purchaseAmount"),default:!1},{key:"available_for_use_date",label:e("commonFields.availableForUseDate"),default:!1},{key:"creation",label:e("commonFields.createdOn"),default:!1},{key:"modified",label:e("commonFields.modifiedOn"),default:!0},{key:"owner",label:e("commonFields.createdBy"),default:!1},{key:"modified_by",label:e("commonFields.modifiedBy"),default:!1}],[k,T]=j.useState(!1),[N,S]=j.useState(new Set),[O,C]=j.useState(!1),[A,P]=j.useState(!1),{permissionFilters:I,loading:ee,error:B,hasAnyRestrictions:H}=Ww("Asset"),[Y,ue]=j.useState(!1),xe=["Maintenance Manager","Maintenance User","System Manager"];j.useEffect(()=>{oe(null,null,function*(){try{console.log("🔍 [Role Check] Starting role check...");const Me=yield(yield fetch("/api/method/asset_lite.api.user_roles.check_has_role",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({roles:xe.join(",")})})).json();console.log("🔍 [Role Check] API Response:",Me),Me.message?(console.log("🔍 [Role Check] User roles:",Me.message.user_roles),console.log("🔍 [Role Check] Matching roles:",Me.message.matching_roles),console.log("✅ [Role Check] Has allowed role:",Me.message.has_role),ue(Me.message.has_role)):(console.error("❌ [Role Check] Invalid response:",Me),ue(!1))}catch(he){console.error("❌ [Role Check] Error:",he),ue(!1)}})},[]);const[le,ge]=j.useState(""),[be,me]=j.useState(""),[ae,Z]=j.useState(""),[K,te]=j.useState(""),[se,F]=j.useState(""),[D,W]=j.useState(""),[G,J]=j.useState(""),[de,De]=j.useState(""),[Ne,$e]=j.useState(""),[Ve,st]=j.useState(""),[gt,zt]=j.useState(!0),[Ge,Ct]=j.useState(0),[St,Ue]=j.useState([]),[ce,we]=j.useState(!1),[Ie,lt]=j.useState(""),[ft,Ze]=j.useState(""),[ze,bt]=j.useState(""),Nt=j.useRef(null),Ot=j.useRef(null);j.useEffect(()=>{const z=localStorage.getItem("assetFilterPresets");z&&Ue(JSON.parse(z))},[]),j.useEffect(()=>{const z=[le,be,se,D,G,ae,K,de,Ne,Ve,i].filter(Boolean).length;Ct(z)},[le,be,se,D,G,ae,K,de,Ne,Ve,i]);const Pt={};le&&(Pt.name=le),be&&(Pt.company=be),ae&&(Pt.custom_manufacturer=ae),K&&(Pt.supplier=K),se&&(Pt.location=se),D&&(Pt.department=D),G&&(Pt.custom_modality=G),de&&(Pt.custom_device_status=de),Ne&&(Pt.asset_name=["like",`%${Ne}%`]),Ve&&(Pt.custom_serial_number=["like",`%${Ve}%`]),i&&(Pt.asset_name=["like",`%${i}%`]);const{assets:je,totalCount:ut,hasMore:jt,loading:$t,error:Fe,refetch:ot}=A_(Pt,y,a*y,"creation desc",I),{deleteAsset:dt,loading:wt}=O_();j.useEffect(()=>{!$t&&!k&&!ee&&T(!0)},[$t,k,ee]),j.useEffect(()=>{a!==0&&s(0)},[le,be,ae,K,se,D,G,de,Ne,Ve,i]),j.useEffect(()=>{S(new Set)},[le,be,ae,K,se,D,G,de,Ne,Ve,i,a]);const Ft=z=>{Ze(z),Nt.current&&clearTimeout(Nt.current),Nt.current=window.setTimeout(()=>{$e(z)},800)},la=z=>{bt(z),Ot.current&&clearTimeout(Ot.current),Ot.current=window.setTimeout(()=>{st(z)},800)},Je=(z,he)=>{z.key==="Enter"&&(z.preventDefault(),he==="assetName"?(Nt.current&&clearTimeout(Nt.current),$e(ft)):he==="serialNumber"&&(Ot.current&&clearTimeout(Ot.current),st(ze)))},Lt=()=>{if(!Ie.trim()){alert("Please enter a filter name");return}const z={id:Date.now(),name:Ie,filters:{filterAssetId:le,filterCompany:be,filterLocation:se,filterDepartment:D,filterModality:G,filterManufacturer:ae,filterSupplier:K,filterDeviceStatus:de,filterAssetName:Ne,filterSerialNumber:Ve,searchTerm:i}},he=[...St,z];Ue(he),lt(""),we(!1),localStorage.setItem("assetFilterPresets",JSON.stringify(he))},ye=z=>{const he=z.filters;ge(he.filterAssetId||""),me(he.filterCompany||""),F(he.filterLocation||""),W(he.filterDepartment||""),J(he.filterModality||""),Z(he.filterManufacturer||""),te(he.filterSupplier||""),De(he.filterDeviceStatus||""),$e(he.filterAssetName||""),Ze(he.filterAssetName||""),st(he.filterSerialNumber||""),bt(he.filterSerialNumber||""),d(he.searchTerm||"")},We=z=>{const he=St.filter(Me=>Me.id!==z);Ue(he),localStorage.setItem("assetFilterPresets",JSON.stringify(he))};j.useEffect(()=>()=>{Nt.current&&clearTimeout(Nt.current),Ot.current&&clearTimeout(Ot.current)},[]);const at=z=>z?new Date(z).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-";j.useEffect(()=>{const z=he=>{x.current&&!x.current.contains(he.target)&&p(null)};return g&&document.addEventListener("mousedown",z),()=>{document.removeEventListener("mousedown",z)}},[g]);const Vt=z=>{S(he=>{const Me=new Set(he);return Me.has(z)?Me.delete(z):Me.add(z),Me})},aa=()=>{N.size===je.length?S(new Set):S(new Set(je.map(z=>z.name)))},Va=je.length>0&&N.size===je.length,Ma=N.size>0&&N.size<je.length,zn=j.useCallback(()=>oe(null,null,function*(){const z=[];let he=0;const Me=100;let ke=!0;for(;ke;)try{const tt=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Asset",filters:ie(ie({},Pt),I),fields:["*"],limit_start:he*Me,limit_page_length:Me,order_by:"creation desc"})})).json()).message||[];z.push(...tt),tt.length<Me?ke=!1:he++,he>100&&(console.warn("Export safety limit reached"),ke=!1)}catch(Ae){throw console.error("Error fetching assets for export:",Ae),Ae}return z}),[Pt,I]),Vr=(z,he,Me)=>oe(null,null,function*(){P(!0);try{let ke=[];switch(z){case"selected":ke=je.filter(Ce=>N.has(Ce.name));break;case"all_on_page":ke=je;break;case"all_with_filters":ke=yield zn();break}if(ke.length===0){alert("No data to export");return}const Ae=Me.map(Ce=>{const tt=_.find(ct=>ct.key===Ce);return(tt==null?void 0:tt.label)||Ce});if(he==="csv"){const Ce=[Ae.join(","),...ke.map(it=>Me.map(xt=>{let _t=it[xt]||"";return typeof _t=="string"&&(_t.includes(",")||_t.includes('"')||_t.includes(`
|
||
`))&&(_t=`"${_t.replace(/"/g,'""')}"`),_t}).join(","))].join(`
|
||
`),tt=new Blob(["\uFEFF"+Ce],{type:"text/csv;charset=utf-8;"}),ct=URL.createObjectURL(tt),pt=document.createElement("a");pt.href=ct,pt.download=`assets_export_${new Date().toISOString().split("T")[0]}.csv`,pt.click(),URL.revokeObjectURL(ct)}else if(he==="excel"){const Ce=[Ae,...ke.map(pt=>Me.map(it=>pt[it]||""))],tt=kr.aoa_to_sheet(Ce),ct=kr.book_new();kr.book_append_sheet(ct,tt,"Assets"),Ic(ct,`assets_export_${new Date().toISOString().split("T")[0]}.xlsx`)}C(!1),S(new Set)}catch(ke){console.error("Export failed:",ke),alert(`Export failed: ${ke instanceof Error?ke.message:"Unknown error"}`)}finally{P(!1)}}),ns=()=>t("/assets/new"),bn=z=>t(`/assets/${z}`),Bn=z=>t(`/assets/${z}`),js=z=>t(`/assets/new?duplicate=${z}`),er=z=>{const he=new URLSearchParams;z.name&&he.append("asset",z.name),z.asset_name&&he.append("asset_name",z.asset_name),z.custom_asset_type&&he.append("asset_type",z.custom_asset_type),z.custom_manufacturer&&he.append("manufacturer",z.custom_manufacturer),z.custom_serial_number&&he.append("serial_number",z.custom_serial_number),z.department&&he.append("department",z.department),z.custom_site_contractor&&he.append("site_contractor",z.custom_site_contractor),z.custom_subcontractor&&he.append("subcontractor",z.custom_subcontractor),z.company&&he.append("company",z.company),z.custom_service_agreement&&he.append("custom_service_agreement",z.custom_service_agreement),z.custom_service_coverage&&he.append("custom_service_coverage",z.custom_service_coverage),z.custom_site&&he.append("site_name",z.custom_site),t(`/work-orders/new?${he.toString()}`)},ve=z=>{t(`/work-orders?asset=${encodeURIComponent(z)}`)},U=z=>oe(null,null,function*(){try{yield dt(z),f(null),ot(),alert("Asset deleted successfully!")}catch(he){alert(`Failed to delete asset: ${he instanceof Error?he.message:"Unknown error"}`)}}),ne=z=>{const he=JSON.stringify(z,null,2),Me=new Blob([he],{type:"application/json"}),ke=URL.createObjectURL(Me),Ae=document.createElement("a");Ae.href=ke,Ae.download=`asset_${z.name}.json`,Ae.click(),URL.revokeObjectURL(ke)},X=z=>{window.open(`/assets/${z}?print=true`,"_blank")},Q=()=>{ge(""),me(""),Z(""),te(""),F(""),W(""),J(""),De(""),$e(""),st(""),Ze(""),bt(""),d(""),Nt.current&&clearTimeout(Nt.current),Ot.current&&clearTimeout(Ot.current)},re=le||be||ae||K||se||D||G||de||Ne||Ve||i;return ee&&!k?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading permissions..."})]})}):B?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Permission Error"}),r.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"Unable to load user permissions."})}),r.jsx("p",{children:B}),r.jsx("button",{onClick:()=>window.location.reload(),className:"mt-2 bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded",children:"Retry"})]})]})}):$t&&!k?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]})}):Fe?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Asset API Not Available"}),r.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"The Asset API endpoint is not deployed yet."})}),r.jsx("button",{onClick:()=>t("/assets/new"),className:"mt-2 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Creating a New Asset (Demo)"}),r.jsx("button",{onClick:ot,className:"mt-2 ml-2 bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("assets.title")}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",ut," asset",ut!==1?"s":"",N.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",N.size," selected"]}),$t&&k&&r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[r.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:()=>C(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:ut===0,children:[r.jsx(Qr,{}),r.jsx("span",{className:"font-medium",children:e("listPages.export")}),N.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:N.size})]}),Y&&r.jsxs("button",{onClick:ns,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(ts,{}),r.jsx("span",{className:"font-medium",children:e("assets.addAsset")})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[r.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 dark:from-blue-600 dark:to-blue-700 px-4 py-3 rounded-t-lg",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[r.jsx("button",{onClick:()=>zt(!gt),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:gt?r.jsx(m0,{size:14}):r.jsx(Ec,{size:14})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"text-white",size:16}),r.jsx("h3",{className:"text-white font-semibold text-sm",children:e("listPages.filters")})]}),Ge>0&&r.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:Ge})]}),re&&r.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:r.jsxs("div",{className:"flex items-center gap-2 py-1",children:[le&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-blue-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Asset ID:"})," ",le,r.jsx("button",{onClick:z=>{z.stopPropagation(),ge("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),be&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-green-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",be,r.jsx("button",{onClick:z=>{z.stopPropagation(),me("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),Ne&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-cyan-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Name:"})," ",Ne,r.jsx("button",{onClick:z=>{z.stopPropagation(),$e(""),Ze("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),Ve&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-lime-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Serial:"})," ",Ve,r.jsx("button",{onClick:z=>{z.stopPropagation(),st(""),bt("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),de&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-orange-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Status:"})," ",de,r.jsx("button",{onClick:z=>{z.stopPropagation(),De("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),se&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-purple-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Location:"})," ",se,r.jsx("button",{onClick:z=>{z.stopPropagation(),F("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),D&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-yellow-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Dept:"})," ",D,r.jsx("button",{onClick:z=>{z.stopPropagation(),W("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),G&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-pink-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Modality:"})," ",G,r.jsx("button",{onClick:z=>{z.stopPropagation(),J("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),ae&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-indigo-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Mfr:"})," ",ae,r.jsx("button",{onClick:z=>{z.stopPropagation(),Z("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),K&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-teal-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Supplier:"})," ",K,r.jsx("button",{onClick:z=>{z.stopPropagation(),te("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[Ge>0&&r.jsxs("button",{onClick:()=>we(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(jr,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),re&&r.jsxs("button",{onClick:Q,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(vt,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),gt&&r.jsxs("div",{className:"p-4",children:[St.length>0&&r.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[r.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:St.map(z=>r.jsxs("div",{className:"group relative inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-100 to-blue-100 dark:from-purple-900/30 dark:to-blue-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:shadow-md transition-all",children:[r.jsx("button",{onClick:()=>ye(z),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:z.name}),r.jsx("button",{onClick:()=>We(z.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:r.jsx(ha,{size:10})})]},z.id))})]}),r.jsx("div",{className:"space-y-5",children:r.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(kt,{label:"Asset ID",doctype:"Asset",value:le,onChange:z=>ge(z),placeholder:"Select Asset ID",disabled:!1,compact:!0}),le&&r.jsx("button",{onClick:()=>ge(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Asset Name"}),r.jsx("input",{type:"text",value:ft,onChange:z=>Ft(z.target.value),onKeyDown:z=>Je(z,"assetName"),placeholder:"Type to search...",className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),ft&&ft!==Ne&&r.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),Ne&&r.jsx("button",{onClick:()=>{$e(""),Ze("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Serial Number"}),r.jsx("input",{type:"text",value:ze,onChange:z=>la(z.target.value),onKeyDown:z=>Je(z,"serialNumber"),placeholder:"Type to search...",className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),ze&&ze!==Ve&&r.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),Ve&&r.jsx("button",{onClick:()=>{st(""),bt("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[59]",children:[r.jsx(kt,{label:"Hospital",doctype:"Company",value:be,onChange:z=>me(z),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),be&&r.jsx("button",{onClick:()=>me(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Device Status"}),r.jsxs("select",{value:de,onChange:z=>De(z.target.value),className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Status"}),r.jsx("option",{value:"Up",children:"✓ Up"}),r.jsx("option",{value:"Down",children:"⚠ Down"})]}),de&&r.jsx("button",{onClick:()=>De(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[58]",children:[r.jsx(kt,{label:"Location",doctype:"Location",value:se,onChange:z=>F(z),placeholder:"Select Location",disabled:!1,compact:!0}),se&&r.jsx("button",{onClick:()=>F(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[57]",children:[r.jsx(kt,{label:"Department",doctype:"Department",value:D,onChange:z=>W(z),placeholder:"Select Department",disabled:!1,compact:!0}),D&&r.jsx("button",{onClick:()=>W(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[56]",children:[r.jsx(kt,{label:"Modality",doctype:"Modality",value:G,onChange:z=>J(z),placeholder:"Select Modality",disabled:!1,compact:!0}),G&&r.jsx("button",{onClick:()=>J(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[55]",children:[r.jsx(kt,{label:"Manufacturer",doctype:"Manufacturer",value:ae,onChange:z=>Z(z),placeholder:"Select Manufacturer",disabled:!1,compact:!0}),ae&&r.jsx("button",{onClick:()=>Z(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[54]",children:[r.jsx(kt,{label:"Supplier",doctype:"Supplier",value:K,onChange:z=>te(z),placeholder:"Select Supplier",disabled:!1,compact:!0}),K&&r.jsx("button",{onClick:()=>te(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]})]})})})]})]}),ce&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),r.jsx("input",{type:"text",value:Ie,onChange:z=>lt(z.target.value),onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),Lt())},placeholder:"Enter filter name (e.g., 'My Active Assets')",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{we(!1),lt("")},className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:Lt,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors flex items-center gap-2",children:[r.jsx(jr,{size:12}),"Save Filter"]})]})]})}),r.jsx(lO,{isOpen:O,onClose:()=>C(!1),selectedCount:N.size,totalCount:ut,pageCount:je.length,onExport:Vr,isExporting:A,exportColumns:_}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[$t&&k&&r.jsx("div",{className:"absolute inset-0 bg-white/60 dark:bg-gray-800/60 flex items-center justify-center z-10 backdrop-blur-[1px]",children:r.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:aa,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:Va?"Deselect all":"Select all",children:Va?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):Ma?r.jsxs("div",{className:"relative",children:[r.jsx(wr,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(wr,{size:18})})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset Name"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Serial No"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Company"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Location"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Updated on"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:je.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx($s,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No assets found"}),re?r.jsx("button",{onClick:Q,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):Y?r.jsx("button",{onClick:ns,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first asset"}):null]})})}):je.map(z=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${N.has(z.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>bn(z.name),children:[r.jsx("td",{className:"px-4 py-4",onClick:he=>he.stopPropagation(),children:r.jsx("button",{onClick:()=>Vt(z.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:N.has(z.name)?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):r.jsx(wr,{size:18})})}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:z.asset_name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:z.name})]}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:z.custom_serial_number||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:z.company||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:z.location||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:z.custom_device_status||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:at(z.modified)}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:he=>he.stopPropagation(),children:[r.jsx("button",{onClick:()=>bn(z.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:r.jsx(hl,{})}),r.jsx("button",{onClick:()=>Bn(z.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Asset",children:r.jsx(Rr,{})}),r.jsx("button",{onClick:()=>js(z.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate Asset",children:r.jsx(Cc,{})}),r.jsx("button",{onClick:()=>er(z),className:"text-orange-600 dark:text-orange-400 hover:text-orange-900 dark:hover:text-orange-300 p-2 hover:bg-orange-50 dark:hover:bg-orange-900/30 rounded transition-colors",title:"Create Work Order",children:r.jsx(z1,{})}),r.jsx("button",{onClick:()=>ve(z.name),className:"text-cyan-600 dark:text-cyan-400 hover:text-cyan-900 dark:hover:text-cyan-300 p-2 hover:bg-cyan-50 dark:hover:bg-cyan-900/30 rounded transition-colors",title:"View Linked Work Orders",children:r.jsx(F1,{})}),r.jsx("button",{onClick:()=>f(z.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete Asset",disabled:wt,children:r.jsx(ha,{})}),r.jsxs("div",{className:"relative",ref:g===z.name?x:null,children:[r.jsx("button",{onClick:()=>p(g===z.name?null:z.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded transition-colors",title:"More Actions",children:r.jsx(g0,{})}),g===z.name&&r.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:[r.jsxs("button",{onClick:()=>{er(z),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-t-lg",children:[r.jsx(z1,{className:"text-orange-500"}),"Create Work Order"]}),r.jsxs("button",{onClick:()=>{ve(z.name),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(F1,{className:"text-cyan-500"}),"View Linked WOs"]}),r.jsxs("button",{onClick:()=>{ne(z),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(_i,{className:"text-blue-500"}),"Export as JSON"]}),r.jsxs("button",{onClick:()=>{X(z.name),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-b-lg",children:[r.jsx(so,{className:"text-purple-500"}),"Print Asset"]})]})]})]})})]},z.name))})]})}),je.length>0&&r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-4 flex items-center justify-between border-t border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",r.jsx("span",{className:"font-medium",children:a*y+1})," to"," ",r.jsx("span",{className:"font-medium",children:Math.min((a+1)*y,ut)})," ","of ",r.jsx("span",{className:"font-medium",children:ut})," results",H&&r.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(filtered)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{disabled:a===0,onClick:()=>s(a-1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),r.jsx("button",{disabled:!jt,onClick:()=>s(a+1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]}),c&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(ha,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Asset"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this asset? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Asset ID:"})," ",c]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>f(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:wt,children:"Cancel"}),r.jsx("button",{onClick:()=>U(c),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",disabled:wt,children:wt?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ha,{}),"Delete Asset"]})})]})]})]})})}),r.jsx("style",{children:`
|
||
@keyframes scale-in {
|
||
from {
|
||
transform: scale(0.95);
|
||
opacity: 0;
|
||
}
|
||
to {
|
||
transform: scale(1);
|
||
opacity: 1;
|
||
}
|
||
}
|
||
.animate-scale-in {
|
||
animation: scale-in 0.2s ease-out;
|
||
}
|
||
|
||
.scrollbar-hide {
|
||
-ms-overflow-style: none;
|
||
scrollbar-width: none;
|
||
}
|
||
.scrollbar-hide::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
`})]})},cO=e=>{const[t,a]=j.useState([]),[s,i]=j.useState(new Set),[d,c]=j.useState(!0),[f,g]=j.useState(null);return j.useEffect(()=>{oe(null,null,function*(){try{c(!0);const y=yield rt.apiCall(`/api/resource/DocType/${e}`),k=(y.data||y).fields||[],T=new Set;k.forEach(N=>{N.allow_on_submit===1&&T.add(N.fieldname)}),a(k),i(T),g(null)}catch(y){console.error(`[DocTypeMeta] Error fetching DocType meta for ${e}:`,y),g(y instanceof Error?y.message:"Unknown error"),a([]),i(new Set)}finally{c(!1)}})},[e]),{fields:t,allowOnSubmitFields:s,isAllowedOnSubmit:x=>s.has(x),loading:d,error:f}};function Mg(e,t){if(!e||(e=e.trim(),!e))return!1;if(!e.startsWith("eval:"))return!!t[e];const a=e.substring(5).trim();try{return new Function("doc",`
|
||
try {
|
||
return Boolean(${a});
|
||
} catch (e) {
|
||
console.warn('Expression evaluation error:', e);
|
||
return false;
|
||
}
|
||
`)(t)}catch(s){return console.warn(`Failed to evaluate expression: ${e}`,s),!1}}function dO(e){if(!e)return null;const t=e.split(".");return t.length!==2?null:{linkField:t[0],targetField:t[1]}}const Lg={};function Vw(e,t){const[a,s]=j.useState([]),[i,d]=j.useState(!0),[c,f]=j.useState(null);j.useEffect(()=>{if(!e){d(!1);return}if(Lg[e]){s(Lg[e]),d(!1);return}oe(null,null,function*(){var C;d(!0);try{const A=yield rt.apiCall(`/api/method/frappe.client.get_doc?doctype=DocType&name=${encodeURIComponent(e)}`,{credentials:"include"});if((C=A==null?void 0:A.message)!=null&&C.fields){const P=A.message.fields.map(I=>({fieldname:I.fieldname,label:I.label,fieldtype:I.fieldtype,options:I.options,reqd:I.reqd,hidden:I.hidden,read_only:I.read_only,depends_on:I.depends_on,mandatory_depends_on:I.mandatory_depends_on,read_only_depends_on:I.read_only_depends_on,fetch_from:I.fetch_from,fetch_if_empty:I.fetch_if_empty,default:I.default,description:I.description,in_list_view:I.in_list_view,permlevel:I.permlevel,allow_on_submit:I.allow_on_submit}));Lg[e]=P,s(P)}}catch(A){console.warn(`Could not fetch DocType meta for ${e}:`,A.message),f(A.message)}finally{d(!1)}})},[e]);const g=j.useMemo(()=>{const O={};return a.forEach(C=>{O[C.fieldname]=C}),O},[a]),p=j.useCallback(O=>{const C=g[O];if(!C)return{isVisible:!0,isReadOnly:!1,isMandatory:!1};let A=!(C.hidden===1||C.hidden===!0);C.depends_on&&A&&(A=Mg(C.depends_on,t));let P=C.read_only===1||C.read_only===!0;C.read_only_depends_on&&(P=P||Mg(C.read_only_depends_on,t));let I=C.reqd===1||C.reqd===!0;return C.mandatory_depends_on&&(I=I||Mg(C.mandatory_depends_on,t)),{isVisible:A,isReadOnly:P,isMandatory:I}},[g,t]),x=j.useCallback(O=>p(O).isVisible,[p]),y=j.useCallback(O=>{const C=p(O);return C.isVisible&&C.isMandatory},[p]),_=j.useCallback(O=>p(O).isReadOnly,[p]),k=j.useCallback(O=>{const C=g[O];return(C==null?void 0:C.label)||O},[g]),T=j.useCallback(O=>{const C=g[O];return C!=null&&C.options?C.fieldtype==="Select"?C.options.split(`
|
||
`).filter(A=>A.trim()!==""):[]:[]},[g]),N=j.useCallback((O,C)=>{const A=g[O];if(!(A!=null&&A.fetch_from)||!C)return;const P=dO(A.fetch_from);if(P)return C[P.targetField]},[g]),S=j.useCallback(()=>{const O={};return a.forEach(C=>{const A=p(C.fieldname);if(A.isVisible&&A.isMandatory){const P=t[C.fieldname];(P==null||P==="")&&(O[C.fieldname]=`${C.label||C.fieldname} is required`)}}),{valid:Object.keys(O).length===0,errors:O}},[a,t,p]);return{loading:i,error:c,fields:a,getFieldState:p,shouldShowField:x,isMandatory:y,isReadOnly:_,getFieldLabel:k,getFieldOptions:T,getFetchFromValue:N,validateMandatory:S}}const uO=()=>{var Ue;const{assetName:e}=ul(),t=Na(),[a]=fl(),s=a.get("duplicate"),i=e==="new",d=i&&!!s,{isAllowedOnSubmit:c}=cO("Asset"),[f,g]=j.useState({asset_name:"",company:"",custom_serial_number:"",location:"",custom_manufacturer:"",department:"",custom_asset_type:"",custom_manufacturing_year:"",custom_model:"",custom_class:"",custom_device_status:"",custom_down_time:0,asset_owner_company:"",custom_up_time:0,custom_total_hours:0,custom_modality:"",custom_attach_image:"",custom_site_contractor:"",custom_site:"",custom_total_amount:0,calculate_depreciation:!1,available_for_use_date:void 0,finance_books:[],custom_service_agreement:"",custom_service_coverage:"",custom_start_date:"",custom_end_date:"",custom_warranty:!1,custom_extended_warranty:!1,custom__service_contract:!1,custom_covering_spare_parts:!1,custom_spare_parts_labour:!1,custom_covering_labour:!1,custom_ppm_only:!1,custom_support_plan:"",custom_spare_parts:[],custom_total_spare_parts_amount:0,is_existing_asset:!0,__islocal:!1}),{shouldShowField:p,isMandatory:x,isReadOnly:y}=Vw("Asset",f),{asset:_,loading:k,error:T,refetch:N}=dS(d?s:i?null:e||null),{createAsset:S,updateAsset:O,submitAsset:C,loading:A}=O_(),[P,I]=j.useState(i),ee=(Ue=_==null?void 0:_.docstatus)!=null?Ue:0,B=ee===1,H=ee===2,Y=ee===0,[ue,xe]=j.useState(!1),le=j.useRef(null);j.useEffect(()=>{const ce=we=>{le.current&&!le.current.contains(we.target)&&xe(!1)};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[]),j.useEffect(()=>{},[_,ee,Y,B,H,P]);const ge=j.useCallback(ce=>!P||H||y(ce)?!0:B?!c(ce):!Y,[P,H,B,Y,c,y]),be=j.useCallback(ce=>p(ce),[p]);j.useCallback(ce=>x(ce),[x]);const[me,ae]=j.useState(""),[Z,K]=j.useState({});j.useEffect(()=>{i&&!f.available_for_use_date&&g(ce=>Ee(ie({},ce),{available_for_use_date:new Date().toISOString().split("T")[0],__islocal:!0}))},[i]),j.useEffect(()=>{function ce(){return oe(this,null,function*(){try{const we=yield rt.getUserDetails();ae(we.custom_site_name||""),g(Ie=>{const lt={};return(i||!Ie.company)&&we.custom_site_name&&(lt.company=we.custom_site_name,lt.asset_owner_company=we.custom_site_name),!Ie.custom_site&&we.custom_phcc_site_name&&(lt.custom_site=we.custom_phcc_site_name),ie(ie({},Ie),lt)})}catch(we){console.error("Error loading user details",we)}})}ce()},[i]);const te=()=>{const we={finance_book:"Depreciation Entries",depreciation_method:"Straight Line",total_number_of_depreciations:10,frequency_of_depreciation:12,depreciation_start_date:new Date().toISOString().split("T")[0]};g(Ie=>Ee(ie({},Ie),{finance_books:[...Ie.finance_books||[],we]}))},se=ce=>{g(we=>{const Ie=[...we.finance_books||[]];return Ie.splice(ce,1),Ee(ie({},we),{finance_books:Ie})})},F=(ce,we)=>{g(Ie=>{const lt=[...Ie.finance_books||[]];return lt[ce]=ie(ie({},lt[ce]||{}),we),Ee(ie({},Ie),{finance_books:lt})})};j.useEffect(()=>{if(f.calculate_depreciation&&(!f.finance_books||f.finance_books.length===0)){const we={finance_book:"Depreciation Entries",depreciation_method:"Straight Line",total_number_of_depreciations:10,frequency_of_depreciation:12,depreciation_start_date:new Date().toISOString().split("T")[0]};g(Ie=>Ee(ie({},Ie),{finance_books:[we]}))}},[f.calculate_depreciation]);const D=(ce,we,Ie)=>{g(lt=>{const ft=[...lt.custom_spare_parts||[]],Ze=ie({},ft[ce]);we==="qty"||we==="rate"?(Ze[we]=Ie,Ze.amount=(Ze.qty||0)*(Ze.rate||0)):Ze[we]=Ie,ft[ce]=Ze;const ze=ft.reduce((bt,Nt)=>bt+(Nt.amount||0),0);return Ee(ie({},lt),{custom_spare_parts:ft,custom_total_spare_parts_amount:ze})})},W=()=>{g(ce=>Ee(ie({},ce),{custom_spare_parts:[...ce.custom_spare_parts||[],{qty:0,rate:0,amount:0}]}))},G=ce=>{g(we=>{const Ie=[...we.custom_spare_parts||[]];Ie.splice(ce,1);const lt=Ie.reduce((ft,Ze)=>ft+(Ze.amount||0),0);return Ee(ie({},we),{custom_spare_parts:Ie,custom_total_spare_parts_amount:lt})})};j.useEffect(()=>{if(f.available_for_use_date){const ce=new Date(f.available_for_use_date),Ie=new Date().getTime()-ce.getTime(),ft=Math.floor(Ie/(1e3*60*60*24))*24,Ze=ft-(f.custom_down_time||0);g(ze=>Ee(ie({},ze),{custom_total_hours:ft,custom_up_time:Ze}))}},[f.available_for_use_date,f.custom_down_time]);const J=j.useRef("");j.useEffect(()=>{if(!P){J.current=f.custom_asset_type||"";return}const ce=(f.custom_asset_type||"").toString().trim().toLowerCase(),we=(J.current||"").toString().trim().toLowerCase();ce!==we&&(J.current=f.custom_asset_type||"",ce==="biomedical"?f.custom_site_contractor!=="SAMAMA"&&g(Ie=>Ee(ie({},Ie),{custom_site_contractor:"SAMAMA"})):we==="biomedical"&&f.custom_site_contractor==="SAMAMA"&&g(Ie=>Ee(ie({},Ie),{custom_site_contractor:""})))},[f.custom_asset_type,P]),j.useEffect(()=>{const ce={};f.company&&(ce.company=f.company);const we=me&&me.startsWith("Mobile")||f.company&&f.company.startsWith("Mobile");(me||f.company)&&(we?ce.department_name=["not like","Non Bio%"]:ce.department_name=["not like","Non Bio%"]),K(ce)},[f.company,me]),j.useEffect(()=>{_&&(J.current=_.custom_asset_type||"",g({asset_name:d?`${_.asset_name} (Copy)`:_.asset_name||"",company:_.company||"",custom_serial_number:d?"":_.custom_serial_number||"",location:_.location||"",custom_manufacturer:_.custom_manufacturer||"",department:_.department||"",custom_asset_type:_.custom_asset_type||"",custom_manufacturing_year:_.custom_manufacturing_year||"",custom_model:_.custom_model||"",custom_class:_.custom_class||"",custom_device_status:_.custom_device_status||"",custom_down_time:_.custom_down_time||0,asset_owner_company:_.asset_owner_company||"",custom_up_time:_.custom_up_time||0,custom_total_hours:_.custom_total_hours||0,custom_modality:_.custom_modality||"",custom_attach_image:_.custom_attach_image||"",custom_site_contractor:_.custom_site_contractor||"",custom_site:_.custom_site||"",custom_total_amount:_.custom_total_amount||0,gross_purchase_amount:_.gross_purchase_amount||0,available_for_use_date:_.available_for_use_date||"",calculate_depreciation:_.calculate_depreciation||!1,finance_books:_.finance_books||[],custom_service_agreement:_.custom_service_agreement||"",custom_service_coverage:_.custom_service_coverage||"",custom_start_date:_.custom_start_date?_.custom_start_date.split(" ")[0]:"",custom_end_date:_.custom_end_date?_.custom_end_date.split(" ")[0]:"",custom_warranty:_.custom_warranty||!1,custom_extended_warranty:_.custom_extended_warranty||!1,custom__service_contract:_.custom__service_contract||!1,custom_covering_spare_parts:_.custom_covering_spare_parts||!1,custom_spare_parts_labour:_.custom_spare_parts_labour||!1,custom_covering_labour:_.custom_covering_labour||!1,custom_ppm_only:_.custom_ppm_only||!1,custom_support_plan:_.custom_support_plan||"",custom_spare_parts:_.custom_spare_parts||[],custom_total_spare_parts_amount:_.custom_total_spare_parts_amount||0}))},[_,d]);const[de,De]=j.useState(null);j.useEffect(()=>{if(!e||e==="new")return;oe(null,null,function*(){var we;try{const Ie=`/files/${e}-qr.png`;if((yield fetch(Ie,{method:"HEAD"})).ok){De(Ie);return}const ft=yield rt.apiCall(`/api/resource/File?filters=[["File","attached_to_name","=","${e}"]]`);((we=ft==null?void 0:ft.data)==null?void 0:we.length)>0&&De(ft.data[0].file_url)}catch(Ie){console.error("Error loading QR code:",Ie)}})},[e,_]);const Ne=ce=>{const{name:we,value:Ie}=ce.target;g(lt=>Ee(ie({},lt),{[we]:Ie}))},$e=ce=>oe(null,null,function*(){if(ce.preventDefault(),!f.asset_name){alert("Please enter an Asset Name");return}if(!f.custom_asset_type){alert("Please select a Category");return}console.log("Submitting asset data:",f);try{if(i||d){const we=yield S(f);if(we.name){const lt=`/files/${we.name}-qr.png`;De(lt)}alert(d?"Asset duplicated successfully!":"Asset created successfully!"),t(`/assets/${we.name}`)}else e&&(yield O(e,f),alert("Asset updated successfully!"),I(!1),N())}catch(we){console.error("Asset save error:",we);const Ie=we instanceof Error?we.message:"Unknown error";Ie.includes("404")||Ie.includes("not found")||Ie.includes("has no attribute")||Ie.includes("417")?alert(`⚠️ Asset API Not Deployed
|
||
|
||
The Asset API endpoint (asset_api.py) is not deployed on your Frappe server yet.
|
||
|
||
To fix this:
|
||
1. SSH into your Frappe server
|
||
2. Navigate to: frappe-bench/apps/asset_lite/asset_lite/api/
|
||
3. Create the file: asset_api.py
|
||
4. Copy the content from frappe_asset_api.py in this project
|
||
5. Restart Frappe: bench restart
|
||
|
||
Error: `+Ie):alert(`Failed to save asset:
|
||
|
||
`+Ie)}}),Ve=()=>oe(null,null,function*(){if(!e||i){alert("Cannot submit: Asset not saved yet");return}if(window.confirm('Are you sure you want to submit this asset? Once submitted, only fields marked as "Allow on Submit" can be edited.'))try{yield C(e),alert("Asset submitted successfully!"),N(),I(!1)}catch(ce){console.error("Asset submit error:",ce);const we=ce instanceof Error?ce.message:"Unknown error";alert(`Failed to submit asset:
|
||
|
||
`+we)}});if(k)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading asset details..."})]})});if(T&&!i&&!d)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",T]}),r.jsx("button",{onClick:()=>t("/assets"),className:"mt-2 text-red-700 dark:text-red-400 underline hover:text-red-800 dark:hover:text-red-300",children:"Back to assets list"})]})});if(T&&d)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-yellow-800 dark:text-yellow-300 mb-2",children:"Source Asset Not Found"}),r.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:"The asset you're trying to duplicate could not be found."}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:()=>t("/assets/new"),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:"Create New Asset"}),r.jsx("button",{onClick:()=>t("/assets"),className:"px-4 py-2 bg-gray-600 hover:bg-gray-700 text-white rounded-lg transition-colors",children:"Back to Assets List"})]})]})});const st=()=>{if(!de||!_)return;const ce=window.open("","_blank");ce&&(ce.document.write(`
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>Print QR Code - ${_.name}</title>
|
||
<style>
|
||
@page {
|
||
margin: 0.5in;
|
||
size: auto;
|
||
}
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
}
|
||
body {
|
||
font-family: Arial, sans-serif;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 100vh;
|
||
padding: 0;
|
||
}
|
||
.qr-container {
|
||
text-align: center;
|
||
border: 2px solid #333;
|
||
padding: 20px;
|
||
border-radius: 8px;
|
||
background: white;
|
||
max-width: 400px;
|
||
}
|
||
.qr-image {
|
||
width: 300px;
|
||
height: 300px;
|
||
margin: 15px 0;
|
||
display: block;
|
||
margin-left: auto;
|
||
margin-right: auto;
|
||
}
|
||
h1 {
|
||
font-size: 20px;
|
||
margin-bottom: 10px;
|
||
}
|
||
.asset-info {
|
||
margin: 10px 0;
|
||
font-size: 14px;
|
||
line-height: 1.5;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="qr-container">
|
||
<h1>Asset QR Code</h1>
|
||
<div class="asset-info">
|
||
<strong>Asset ID:</strong> ${_.name}<br/>
|
||
<strong>Asset Name:</strong> ${_.asset_name||"N/A"}
|
||
</div>
|
||
<img src="${de}" alt="QR Code" class="qr-image" onload="window.print();" />
|
||
</div>
|
||
</body>
|
||
</html>
|
||
`),ce.document.close())},gt=()=>{const ce=window.open("","_blank");ce&&(ce.document.write(`
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>Stay Plugged</title>
|
||
<style>
|
||
@page {
|
||
margin: 0.5in;
|
||
size: auto;
|
||
}
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
}
|
||
body {
|
||
font-family: Arial, sans-serif;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 100vh;
|
||
padding: 0;
|
||
}
|
||
.image-container {
|
||
text-align: center;
|
||
padding: 40px;
|
||
max-width: 100%;
|
||
}
|
||
.stay-plugged-image {
|
||
max-width: 100%;
|
||
height: auto;
|
||
display: block;
|
||
margin: 0 auto;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="image-container">
|
||
<img src="/files/Stay Plugged.jpg" alt="Stay Plugged" class="stay-plugged-image" onload="window.print();" />
|
||
</div>
|
||
</body>
|
||
</html>
|
||
`),ce.document.close())},zt=()=>oe(null,null,function*(){if(!e||i){alert("Please save the asset first to view PPM Plan");return}try{const ce=yield rt.apiCall(`/api/resource/Asset Maintenance Log?filters=[["asset_name","=","${e}"],["maintenance_status","=","Planned"]]&fields=["name","due_date","periodicity","custom_asset_names","asset_name","maintenance_type","assign_to_name"]`),we=(ce==null?void 0:ce.data)||[],Ie=(je,ut)=>{const jt=new Date(je);return jt.setDate(jt.getDate()+ut),jt},lt=(je,ut)=>{const jt=new Date(je);return jt.setMonth(jt.getMonth()+ut),jt},ft=(je,ut)=>{const jt=new Date(je);return jt.setFullYear(jt.getFullYear()+ut),jt},Ze=(je,ut)=>{switch(ut){case"Daily":return Ie(je,1);case"Weekly":return Ie(je,7);case"Monthly":return lt(je,1);case"Quarterly":return lt(je,3);case"Half-yearly":return lt(je,6);case"Yearly":return ft(je,1);case"2 Yearly":return ft(je,2);case"3 Yearly":return ft(je,3);default:return lt(je,1)}},ze=je=>je.toISOString().split("T")[0],bt=ft(new Date,5),Nt=[];for(const je of we){let ut=new Date(je.due_date);const jt=je.periodicity||"Monthly";for(let $t=0;$t<60&&(Nt.push({asset_name:je.asset_name||"",custom_asset_names:je.custom_asset_names||"",serial_number:f.custom_serial_number||"N/A",due_date:ze(ut),periodicity:jt,maintenance_type:je.maintenance_type||"",assign_to_name:je.assign_to_name||"",status:"Planned"}),ut=Ze(ut,jt),!(ut>bt));$t++);}Nt.sort((je,ut)=>new Date(je.due_date).getTime()-new Date(ut.due_date).getTime());const Ot=window.open("","_blank");if(!Ot)return;const Pt=Nt.length>0?Nt.map((je,ut)=>`
|
||
<tr class="${ut%2===0?"bg-white":"bg-gray-50"}">
|
||
<td class="border px-3 py-2">${je.asset_name}</td>
|
||
<td class="border px-3 py-2">${je.custom_asset_names}</td>
|
||
<td class="border px-3 py-2">${je.serial_number}</td>
|
||
<td class="border px-3 py-2">${je.due_date}</td>
|
||
<td class="border px-3 py-2">${je.periodicity}</td>
|
||
<td class="border px-3 py-2">${je.maintenance_type}</td>
|
||
<td class="border px-3 py-2">${je.assign_to_name}</td>
|
||
<td class="border px-3 py-2">
|
||
<span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded text-xs">${je.status}</span>
|
||
</td>
|
||
</tr>
|
||
`).join(""):'<tr><td colspan="8" class="border px-3 py-4 text-center text-gray-500">No planned maintenance found for this asset</td></tr>';Ot.document.write(`
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>PPM Plan - ${e}</title>
|
||
<style>
|
||
@page {
|
||
margin: 0.5in;
|
||
size: landscape;
|
||
}
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
}
|
||
body {
|
||
font-family: Arial, sans-serif;
|
||
padding: 20px;
|
||
background: #f5f5f5;
|
||
}
|
||
.container {
|
||
max-width: 1400px;
|
||
margin: 0 auto;
|
||
background: white;
|
||
padding: 20px;
|
||
border-radius: 8px;
|
||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||
}
|
||
.header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 20px;
|
||
padding-bottom: 15px;
|
||
border-bottom: 2px solid #3b82f6;
|
||
}
|
||
h1 {
|
||
font-size: 24px;
|
||
color: #1f2937;
|
||
}
|
||
.asset-info {
|
||
font-size: 14px;
|
||
color: #6b7280;
|
||
}
|
||
.btn {
|
||
padding: 10px 20px;
|
||
font-size: 14px;
|
||
border: none;
|
||
border-radius: 5px;
|
||
cursor: pointer;
|
||
margin-left: 10px;
|
||
}
|
||
.btn-print {
|
||
background: #3b82f6;
|
||
color: white;
|
||
}
|
||
.btn-print:hover {
|
||
background: #2563eb;
|
||
}
|
||
.btn-close {
|
||
background: #6b7280;
|
||
color: white;
|
||
}
|
||
.btn-close:hover {
|
||
background: #4b5563;
|
||
}
|
||
.table-container {
|
||
overflow-x: auto;
|
||
margin-top: 20px;
|
||
}
|
||
table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
font-size: 13px;
|
||
}
|
||
th {
|
||
background: #3b82f6;
|
||
color: white;
|
||
padding: 12px 8px;
|
||
text-align: left;
|
||
border: 1px solid #2563eb;
|
||
font-weight: 600;
|
||
}
|
||
td {
|
||
border: 1px solid #e5e7eb;
|
||
padding: 8px;
|
||
}
|
||
.bg-white { background: white; }
|
||
.bg-gray-50 { background: #f9fafb; }
|
||
.summary {
|
||
margin-top: 20px;
|
||
padding: 15px;
|
||
background: #f0f9ff;
|
||
border-radius: 5px;
|
||
font-size: 14px;
|
||
color: #1e40af;
|
||
}
|
||
@media print {
|
||
.no-print { display: none; }
|
||
body { background: white; padding: 0; }
|
||
.container { box-shadow: none; padding: 0; }
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<div class="header">
|
||
<div>
|
||
<h1>PPM Planner Report</h1>
|
||
<div class="asset-info">
|
||
<strong>Asset ID:</strong> ${e} |
|
||
<strong>Asset Name:</strong> ${f.asset_name||"N/A"} |
|
||
<strong>Generated:</strong> ${new Date().toLocaleDateString()}
|
||
</div>
|
||
</div>
|
||
<div class="no-print">
|
||
<button class="btn btn-print" onclick="window.print()">Print / Save PDF</button>
|
||
<button class="btn btn-close" onclick="window.close()">Close</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="table-container">
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Asset ID</th>
|
||
<th>Asset Name</th>
|
||
<th>Serial Number</th>
|
||
<th>Due Date</th>
|
||
<th>Periodicity</th>
|
||
<th>Maintenance Type</th>
|
||
<th>Assigned To</th>
|
||
<th>Status</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
${Pt}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="summary">
|
||
<strong>Summary:</strong> ${Nt.length} planned maintenance entries for the next 5 years
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>
|
||
`),Ot.document.close()}catch(ce){console.error("Error fetching PPM Plan:",ce),alert("Failed to load PPM Plan. Please try again.")}}),Ge=()=>oe(null,null,function*(){if(!e||i){alert("Please save the asset first to view Asset History");return}try{const ce=yield rt.apiCall(`/api/resource/Asset/${e}`),we=(ce==null?void 0:ce.data)||{},Ie=yield rt.apiCall(`/api/resource/Work_Order?filters=[["asset","=","${e}"]]&fields=["name","work_order_type","repair_status","creation","total_repair_cost"]`),lt=(Ie==null?void 0:Ie.data)||[],ft=yield rt.apiCall(`/api/resource/Asset Maintenance?filters=[["asset_name","=","${e}"]]&fields=["name","maintenance_team","custom_type_of_maintenance"]`),Ze=(ft==null?void 0:ft.data)||[];let ze=[],bt=[];for(const Je of Ze){const Lt=yield rt.apiCall(`/api/resource/Asset Maintenance/${Je.name}`),ye=(Lt==null?void 0:Lt.data)||{};ye.asset_maintenance_tasks&&(bt=[...bt,...ye.asset_maintenance_tasks.map(at=>Ee(ie({},at),{maintenance_id:Je.name}))]);const We=yield rt.apiCall(`/api/resource/Asset Maintenance Log?filters=[["asset_maintenance","=","${Je.name}"]]&fields=["name","maintenance_status","assign_to_name","maintenance_type","due_date","completion_date","periodicity","actions_performed"]&order_by=completion_date desc`);ze=[...ze,...(We==null?void 0:We.data)||[]]}const Nt=ze.filter(Je=>Je.maintenance_status==="Completed"),Ot=ze.filter(Je=>Je.maintenance_status!=="Completed"),Pt={};ze.forEach(Je=>{Pt[Je.maintenance_status]=(Pt[Je.maintenance_status]||0)+1});const je=we.custom_spare_parts||[],ut={};je.forEach(Je=>{const Lt=Je.work_order||"Unassigned";ut[Lt]||(ut[Lt]=[]),ut[Lt].push(Je)});const jt=window.open("","_blank");if(!jt)return;const $t=lt.length>0?lt.map((Je,Lt)=>{const ye=Je.repair_status==="Completed"?"bg-green-100 text-green-800":Je.repair_status==="Work In Progress"?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800";return`
|
||
<tr class="${Lt%2===0?"bg-white":"bg-gray-50"}">
|
||
<td class="px-4 py-3 font-medium text-blue-600">${Je.name}</td>
|
||
<td class="px-4 py-3">${Je.work_order_type||"-"}</td>
|
||
<td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs font-medium ${ye}">${Je.repair_status||"-"}</span></td>
|
||
<td class="px-4 py-3 font-semibold">${parseFloat(Je.total_repair_cost||0).toFixed(2)} ر.س</td>
|
||
<td class="px-4 py-3 text-gray-500">${Je.creation?new Date(Je.creation).toLocaleDateString():"-"}</td>
|
||
</tr>
|
||
`}).join(""):'<tr><td colspan="5" class="px-4 py-8 text-center text-gray-500">No Work Orders Found</td></tr>';let Fe="";Object.keys(ut).length>0?Object.keys(ut).forEach(Je=>{Fe+=`
|
||
<div class="mb-4">
|
||
<div class="bg-amber-50 border-l-4 border-amber-400 px-4 py-2 mb-2">
|
||
<span class="font-medium">Work Order: </span>
|
||
<span class="text-blue-600 font-medium">${Je}</span>
|
||
</div>
|
||
<table class="w-full">
|
||
<thead>
|
||
<tr class="bg-gray-100">
|
||
<th class="px-4 py-2 text-left text-xs font-semibold text-gray-600">Item Name</th>
|
||
<th class="px-4 py-2 text-left text-xs font-semibold text-gray-600">Quantity</th>
|
||
<th class="px-4 py-2 text-left text-xs font-semibold text-gray-600">Cost</th>
|
||
<th class="px-4 py-2 text-left text-xs font-semibold text-gray-600">Amount</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
${ut[Je].map((Lt,ye)=>`
|
||
<tr class="${ye%2===0?"bg-white":"bg-gray-50"}">
|
||
<td class="px-4 py-2">${Lt.item_code||"-"}</td>
|
||
<td class="px-4 py-2">${Lt.qty||0}</td>
|
||
<td class="px-4 py-2">${Lt.rate||0} ر.س</td>
|
||
<td class="px-4 py-2 font-medium">${Lt.amount||0} ر.س</td>
|
||
</tr>
|
||
`).join("")}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
`}):Fe='<p class="text-gray-500 text-center py-8">No Spare Parts Used</p>';const ot=Ze.length>0?Ze.map(Je=>`
|
||
<div class="bg-white border rounded-lg p-4 mb-3 shadow-sm">
|
||
<div class="flex justify-between items-start">
|
||
<div>
|
||
<p class="text-sm text-gray-500">Maintenance ID</p>
|
||
<p class="font-medium text-blue-600">${Je.name}</p>
|
||
</div>
|
||
<div class="text-right">
|
||
<p class="text-sm text-gray-500">Type</p>
|
||
<p class="font-medium">${Je.custom_type_of_maintenance||"-"}</p>
|
||
</div>
|
||
</div>
|
||
<div class="mt-2">
|
||
<p class="text-sm text-gray-500">Maintenance Team</p>
|
||
<p class="font-medium">${Je.maintenance_team||"-"}</p>
|
||
</div>
|
||
</div>
|
||
`).join(""):'<p class="text-gray-500 text-center py-8">No Maintenance Records Found</p>',dt=bt.length>0?bt.map((Je,Lt)=>`
|
||
<tr class="${Lt%2===0?"bg-white":"bg-gray-50"}">
|
||
<td class="px-4 py-3">${Je.assign_to_name||"-"}</td>
|
||
<td class="px-4 py-3">${Je.periodicity||"-"}</td>
|
||
<td class="px-4 py-3">${Je.next_due_date||"-"}</td>
|
||
<td class="px-4 py-3 text-blue-600 text-sm">${Je.maintenance_id||"-"}</td>
|
||
</tr>
|
||
`).join(""):'<tr><td colspan="4" class="px-4 py-8 text-center text-gray-500">No Maintenance Tasks Found</td></tr>',wt=Object.keys(Pt).length>0?Object.entries(Pt).map(([Je,Lt])=>`
|
||
<div class="flex items-center justify-between p-3 rounded-lg border ${Je==="Completed"?"bg-green-100 text-green-800 border-green-200":Je==="Planned"?"bg-blue-100 text-blue-800 border-blue-200":"bg-yellow-100 text-yellow-800 border-yellow-200"}">
|
||
<span class="font-medium">${Je}</span>
|
||
<span class="text-2xl font-bold">${Lt}</span>
|
||
</div>
|
||
`).join(""):'<p class="text-gray-500 text-center">No Data</p>',Ft=Nt.length>0?Nt.map((Je,Lt)=>`
|
||
<tr class="${Lt%2===0?"bg-white":"bg-gray-50"}">
|
||
<td class="px-3 py-2 text-blue-600 font-medium">${Je.name}</td>
|
||
<td class="px-3 py-2">${Je.assign_to_name||"-"}</td>
|
||
<td class="px-3 py-2">${Je.maintenance_type||"-"}</td>
|
||
<td class="px-3 py-2">${Je.due_date||"-"}</td>
|
||
<td class="px-3 py-2 text-green-600 font-medium">${Je.completion_date||"-"}</td>
|
||
<td class="px-3 py-2">${Je.periodicity||"-"}</td>
|
||
<td class="px-3 py-2 text-sm text-gray-600">${Je.actions_performed||"-"}</td>
|
||
</tr>
|
||
`).join(""):'<tr><td colspan="7" class="px-4 py-8 text-center text-gray-500">No Completed Maintenance Logs</td></tr>',la=Ot.length>0?Ot.map((Je,Lt)=>{const ye=Je.maintenance_status==="Planned"?"bg-blue-100 text-blue-800":"bg-yellow-100 text-yellow-800";return`
|
||
<tr class="${Lt%2===0?"bg-white":"bg-gray-50"}">
|
||
<td class="px-3 py-2 text-blue-600 font-medium">${Je.name}</td>
|
||
<td class="px-3 py-2">${Je.assign_to_name||"-"}</td>
|
||
<td class="px-3 py-2">${Je.maintenance_type||"-"}</td>
|
||
<td class="px-3 py-2">${Je.due_date||"-"}</td>
|
||
<td class="px-3 py-2">${Je.periodicity||"-"}</td>
|
||
<td class="px-3 py-2"><span class="px-2 py-1 rounded-full text-xs font-medium ${ye}">${Je.maintenance_status||"-"}</span></td>
|
||
<td class="px-3 py-2 text-sm text-gray-600">${Je.actions_performed||"-"}</td>
|
||
</tr>
|
||
`}).join(""):'<tr><td colspan="7" class="px-4 py-8 text-center text-gray-500">No Pending/Planned Maintenance Logs</td></tr>';jt.document.write(`
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>Asset History - ${e}</title>
|
||
<script src="https://cdn.tailwindcss.com"><\/script>
|
||
<style>
|
||
@page { margin: 0.5in; size: landscape; }
|
||
@media print {
|
||
.no-print { display: none !important; }
|
||
.page-break { page-break-before: always; }
|
||
}
|
||
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
|
||
.section-card {
|
||
background: white;
|
||
border-radius: 12px;
|
||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||
margin-bottom: 24px;
|
||
overflow: hidden;
|
||
}
|
||
.section-header {
|
||
padding: 16px 20px;
|
||
font-weight: 600;
|
||
font-size: 16px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
}
|
||
.section-content {
|
||
padding: 16px 20px;
|
||
}
|
||
table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
}
|
||
th {
|
||
text-align: left;
|
||
padding: 12px 16px;
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.5px;
|
||
}
|
||
td {
|
||
border-top: 1px solid #e5e7eb;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body class="bg-gray-100 min-h-screen">
|
||
<!-- Header -->
|
||
<div class="bg-gradient-to-r from-blue-600 to-blue-800 text-white py-6 px-8 no-print">
|
||
<div class="max-w-7xl mx-auto flex justify-between items-center">
|
||
<div>
|
||
<h1 class="text-2xl font-bold">Asset History</h1>
|
||
<p class="text-blue-200 mt-1">Complete history and maintenance records</p>
|
||
</div>
|
||
<div class="flex gap-3">
|
||
<button onclick="window.print()" class="bg-white text-blue-600 px-4 py-2 rounded-lg font-medium hover:bg-blue-50 transition">
|
||
🖨️ Print / Save PDF
|
||
</button>
|
||
<button onclick="window.close()" class="bg-blue-700 text-white px-4 py-2 rounded-lg font-medium hover:bg-blue-600 transition">
|
||
✕ Close
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="max-w-7xl mx-auto py-6 px-8">
|
||
<!-- Asset Details Card -->
|
||
<div class="section-card">
|
||
<div class="section-header bg-gradient-to-r from-blue-500 to-blue-600 text-white">
|
||
<span>🔍</span> Asset Details
|
||
</div>
|
||
<div class="section-content">
|
||
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4">
|
||
<div class="bg-gray-50 rounded-lg p-4">
|
||
<p class="text-xs text-gray-500 uppercase tracking-wide">Asset ID</p>
|
||
<p class="font-semibold text-blue-600 mt-1">${e}</p>
|
||
</div>
|
||
<div class="bg-gray-50 rounded-lg p-4">
|
||
<p class="text-xs text-gray-500 uppercase tracking-wide">Asset Name</p>
|
||
<p class="font-semibold mt-1">${we.asset_name||"-"}</p>
|
||
</div>
|
||
<div class="bg-gray-50 rounded-lg p-4">
|
||
<p class="text-xs text-gray-500 uppercase tracking-wide">🏥 Hospital</p>
|
||
<p class="font-semibold mt-1">${we.company||"-"}</p>
|
||
</div>
|
||
<div class="bg-gray-50 rounded-lg p-4">
|
||
<p class="text-xs text-gray-500 uppercase tracking-wide">📍 Location</p>
|
||
<p class="font-semibold mt-1">${we.location||"-"}</p>
|
||
</div>
|
||
<div class="bg-gray-50 rounded-lg p-4">
|
||
<p class="text-xs text-gray-500 uppercase tracking-wide">🚛 Supplier</p>
|
||
<p class="font-semibold mt-1">${we.supplier||"-"}</p>
|
||
</div>
|
||
<div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
|
||
<p class="text-xs text-amber-600 uppercase tracking-wide">💰 Total Repair Cost</p>
|
||
<p class="font-bold text-amber-700 mt-1 text-lg">${we.custom_total_spare_parts_amount||0} ر.س</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Two Column Layout -->
|
||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||
<!-- Work Orders -->
|
||
<div class="section-card">
|
||
<div class="section-header bg-gradient-to-r from-indigo-500 to-indigo-600 text-white">
|
||
<span>🔗</span> Linked Work Orders
|
||
</div>
|
||
<div class="overflow-x-auto">
|
||
<table>
|
||
<thead class="bg-gray-50">
|
||
<tr>
|
||
<th class="text-gray-600">Work Order No</th>
|
||
<th class="text-gray-600">Type</th>
|
||
<th class="text-gray-600">Status</th>
|
||
<th class="text-gray-600">Repair Cost</th>
|
||
<th class="text-gray-600">Created</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
${$t}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Spare Parts -->
|
||
<div class="section-card">
|
||
<div class="section-header bg-gradient-to-r from-orange-500 to-orange-600 text-white">
|
||
<span>🛠️</span> Items Used for Repair
|
||
</div>
|
||
<div class="section-content max-h-96 overflow-y-auto">
|
||
${Fe}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Maintenance Section -->
|
||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mt-6">
|
||
<!-- Maintenance Records -->
|
||
<div class="section-card">
|
||
<div class="section-header bg-gradient-to-r from-teal-500 to-teal-600 text-white">
|
||
<span>🛠️</span> Maintenance Records
|
||
</div>
|
||
<div class="section-content max-h-80 overflow-y-auto">
|
||
${ot}
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Maintenance Tasks -->
|
||
<div class="section-card lg:col-span-2">
|
||
<div class="section-header bg-gradient-to-r from-purple-500 to-purple-600 text-white">
|
||
<span>📋</span> Maintenance Tasks
|
||
</div>
|
||
<div class="overflow-x-auto">
|
||
<table>
|
||
<thead class="bg-gray-50">
|
||
<tr>
|
||
<th class="text-gray-600">Assigned To</th>
|
||
<th class="text-gray-600">Periodicity</th>
|
||
<th class="text-gray-600">Next Due Date</th>
|
||
<th class="text-gray-600">Maintenance ID</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
${dt}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Periodic Maintenance Summary -->
|
||
<div class="section-card mt-6">
|
||
<div class="section-header bg-gradient-to-r from-cyan-500 to-cyan-600 text-white">
|
||
<span>📜</span> Periodic Maintenance Summary
|
||
</div>
|
||
<div class="section-content">
|
||
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||
${wt}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Completed Maintenance Logs -->
|
||
<div class="section-card mt-6">
|
||
<div class="section-header bg-gradient-to-r from-green-500 to-green-600 text-white">
|
||
<span>✅</span> Completed Maintenance Logs
|
||
</div>
|
||
<div class="overflow-x-auto">
|
||
<table>
|
||
<thead class="bg-gray-50">
|
||
<tr>
|
||
<th class="text-gray-600">Log ID</th>
|
||
<th class="text-gray-600">Assigned To</th>
|
||
<th class="text-gray-600">Type</th>
|
||
<th class="text-gray-600">Due Date</th>
|
||
<th class="text-gray-600">Completed</th>
|
||
<th class="text-gray-600">Periodicity</th>
|
||
<th class="text-gray-600">Actions</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
${Ft}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Pending/Planned Maintenance Logs -->
|
||
<div class="section-card mt-6">
|
||
<div class="section-header bg-gradient-to-r from-amber-500 to-amber-600 text-white">
|
||
<span>⏳</span> Pending/Planned Maintenance Logs
|
||
</div>
|
||
<div class="overflow-x-auto">
|
||
<table>
|
||
<thead class="bg-gray-50">
|
||
<tr>
|
||
<th class="text-gray-600">Log ID</th>
|
||
<th class="text-gray-600">Assigned To</th>
|
||
<th class="text-gray-600">Type</th>
|
||
<th class="text-gray-600">Due Date</th>
|
||
<th class="text-gray-600">Periodicity</th>
|
||
<th class="text-gray-600">Status</th>
|
||
<th class="text-gray-600">Actions</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
${la}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Footer -->
|
||
<div class="text-center text-gray-500 text-sm mt-8 pb-8">
|
||
Generated on ${new Date().toLocaleString()} | Asset: ${e}
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>
|
||
`),jt.document.close()}catch(ce){console.error("Error fetching Asset History:",ce),alert("Failed to load Asset History. Please try again.")}}),Ct=()=>{if(!e||i){alert("Please save the asset first to view Installation Report");return}const ce=window.open("","_blank");if(!ce)return;const we=new Date,Ie=ze=>{const bt=String(ze.getDate()).padStart(2,"0"),Nt=String(ze.getMonth()+1).padStart(2,"0"),Ot=ze.getFullYear();return`${bt}/${Nt}/${Ot}`},lt=(_==null?void 0:_.custom_spare_parts)||[];let ft="";const Ze=3;if(lt.length>0){lt.forEach((ze,bt)=>{ft+=`
|
||
<tr>
|
||
<td>${bt+1}</td>
|
||
<td>${ze.item_name||""}</td>
|
||
<td>${ze.item_code||""}</td>
|
||
<td>${ze.uom||""}</td>
|
||
<td>${ze.qty||""}</td>
|
||
</tr>
|
||
`});for(let ze=lt.length;ze<Ze;ze++)ft+=`
|
||
<tr>
|
||
<td>${ze+1}</td>
|
||
<td> </td>
|
||
<td> </td>
|
||
<td> </td>
|
||
<td> </td>
|
||
</tr>
|
||
`}else for(let ze=0;ze<Ze;ze++)ft+=`
|
||
<tr>
|
||
<td>${ze+1}</td>
|
||
<td> </td>
|
||
<td> </td>
|
||
<td> </td>
|
||
<td> </td>
|
||
</tr>
|
||
`;ce.document.write(`
|
||
<!DOCTYPE html>
|
||
<html lang="ar" dir="rtl">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Installation Report - ${e}</title>
|
||
<style>
|
||
@page {
|
||
margin: 0.5in;
|
||
size: A4;
|
||
}
|
||
body {
|
||
font-family: 'Times New Roman', serif;
|
||
margin: 0;
|
||
padding: 20px;
|
||
font-size: 12px;
|
||
line-height: 1.3;
|
||
direction: rtl;
|
||
text-align: right;
|
||
}
|
||
|
||
.header-line {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 5px;
|
||
}
|
||
|
||
.header-right {
|
||
font-weight: bold;
|
||
}
|
||
|
||
.header-center {
|
||
font-weight: bold;
|
||
text-align: center;
|
||
flex-grow: 1;
|
||
}
|
||
|
||
.header-left {
|
||
font-weight: bold;
|
||
}
|
||
|
||
.dotted-line {
|
||
border-bottom: 1px dotted #000;
|
||
display: inline-block;
|
||
min-width: 100px;
|
||
}
|
||
|
||
.main-content {
|
||
margin: 15px 0;
|
||
text-align: justify;
|
||
}
|
||
|
||
.equipment-section {
|
||
margin: 15px 0;
|
||
}
|
||
|
||
.equipment-line {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
margin: 8px 0;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.equipment-item {
|
||
display: flex;
|
||
align-items: center;
|
||
direction: ltr;
|
||
text-align: left;
|
||
width: 48%;
|
||
}
|
||
|
||
.arabic-label {
|
||
direction: rtl;
|
||
text-align: right;
|
||
margin-left: 10px;
|
||
}
|
||
|
||
.colon {
|
||
margin: 0 5px;
|
||
}
|
||
|
||
.field-value {
|
||
border-bottom: 1px solid #000;
|
||
min-width: 120px;
|
||
display: inline-block;
|
||
height: 18px;
|
||
}
|
||
|
||
.location-line {
|
||
margin: 10px 0;
|
||
font-weight: bold;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
width: 100%;
|
||
}
|
||
|
||
.location-arabic {
|
||
direction: rtl;
|
||
text-align: right;
|
||
}
|
||
|
||
.location-english {
|
||
direction: ltr;
|
||
text-align: left;
|
||
}
|
||
|
||
.parts-table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
margin: 15px 0;
|
||
border: 2px solid #000;
|
||
}
|
||
|
||
.parts-table th,
|
||
.parts-table td {
|
||
border: 1px solid #000;
|
||
padding: 6px;
|
||
text-align: center;
|
||
font-weight: bold;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
.parts-table th {
|
||
background-color: #f8f8f8;
|
||
font-size: 11px;
|
||
}
|
||
|
||
.parts-table .row-number {
|
||
width: 8%;
|
||
}
|
||
|
||
.parts-table .description {
|
||
width: 35%;
|
||
}
|
||
|
||
.parts-table .part-number {
|
||
width: 25%;
|
||
}
|
||
|
||
.parts-table .unit {
|
||
width: 16%;
|
||
}
|
||
|
||
.parts-table .quantity {
|
||
width: 16%;
|
||
}
|
||
|
||
.footer-text {
|
||
margin: 20px 0;
|
||
text-align: justify;
|
||
}
|
||
|
||
.signatures-section {
|
||
margin-top: 40px;
|
||
}
|
||
|
||
.signature-row {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
margin: 30px 0;
|
||
}
|
||
|
||
.signature-block-right {
|
||
text-align: left;
|
||
width: 45%;
|
||
float: right;
|
||
}
|
||
|
||
.signature-block-left {
|
||
text-align: left;
|
||
width: 45%;
|
||
float: left;
|
||
}
|
||
|
||
.signature-title {
|
||
font-weight: bold;
|
||
margin-bottom: 3px;
|
||
font-size: 11px;
|
||
}
|
||
|
||
.signature-line {
|
||
border-bottom: 1px solid #000;
|
||
height: 25px;
|
||
margin: 8px 0;
|
||
display: inline-block;
|
||
width: 120px;
|
||
margin-left: 10px;
|
||
}
|
||
|
||
.signature-label {
|
||
font-size: 10px;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.seal-section {
|
||
text-align: center;
|
||
margin-top: 30px;
|
||
font-weight: bold;
|
||
font-size: 12px;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<!-- Header Section -->
|
||
<div class="header-line">
|
||
<div class="header-right">المملكة العربية السعودية</div>
|
||
<div class="header-center"></div>
|
||
<div class="header-left">الرقم: <span class="dotted-line">${e||""}</span></div>
|
||
</div>
|
||
|
||
<div class="header-line">
|
||
<div class="header-right">تجمع الجوف الصحي</div>
|
||
<div class="header-center">محضر تركيب</div>
|
||
<div class="header-left">التاريخ: <span class="dotted-line">${Ie(we)}</span> هـ</div>
|
||
</div>
|
||
|
||
<div class="header-line">
|
||
<div class="header-right">الصيانة الطبية</div>
|
||
<div class="header-center">INSTALLATION REPORT</div>
|
||
<div class="header-left">الموافق: <span class="dotted-line">${Ie(we)}</span> م</div>
|
||
</div>
|
||
|
||
<div style="margin: 15px 0; font-weight: bold;">
|
||
مستشفى <span class="dotted-line" style="min-width: 200px;">${f.company||""}</span>
|
||
</div>
|
||
|
||
<!-- Main Content -->
|
||
<div class="main-content">
|
||
تشهد مستشفى <span class="dotted-line" style="min-width: 180px;">${f.company||""}</span> بأن <span class="dotted-line" style="min-width: 180px;">${f.supplier||""}</span> قامت بتركيب و توريد قطع الغيار الخاصة التالية والتابعة:
|
||
</div>
|
||
|
||
<!-- Equipment Information -->
|
||
<div class="equipment-section">
|
||
<div class="equipment-line">
|
||
<div class="equipment-item">
|
||
<span>EQUIPMENT NAME</span>
|
||
<span class="colon">:</span>
|
||
<span class="field-value">${f.asset_name||""}</span>
|
||
<span class="arabic-label">اسم الجهاز:</span>
|
||
</div>
|
||
<div class="equipment-item">
|
||
<span>MFR</span>
|
||
<span class="colon">:</span>
|
||
<span class="field-value">${f.custom_manufacturer||""}</span>
|
||
<span class="arabic-label">صناعة:</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="equipment-line">
|
||
<div class="equipment-item">
|
||
<span>SERIAL NO</span>
|
||
<span class="colon">:</span>
|
||
<span class="field-value">${f.custom_serial_number||""}</span>
|
||
<span class="arabic-label">مسلسل:</span>
|
||
</div>
|
||
<div class="equipment-item">
|
||
<span>MODEL</span>
|
||
<span class="colon">:</span>
|
||
<span class="field-value">${f.custom_model||""}</span>
|
||
<span class="arabic-label">موديل:</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="location-line">
|
||
<span class="location-arabic">
|
||
التابع لقسم:
|
||
</span>
|
||
<span class="field-value" style="min-width: 300px; flex-grow: 1; margin: 0 10px; text-align: left;">${f.location||""}</span>
|
||
<span class="location-english">
|
||
LOCATION:
|
||
</span>
|
||
</div>
|
||
|
||
<!-- Parts Table -->
|
||
<table class="parts-table">
|
||
<thead>
|
||
<tr>
|
||
<th class="row-number">م</th>
|
||
<th class="description">وصف القطعة<br>DESCRIPTION</th>
|
||
<th class="part-number">رقم القطعة<br>PART NO.</th>
|
||
<th class="unit">الوحدة<br>UNIT</th>
|
||
<th class="quantity">الكمية<br>QTY.</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
${ft}
|
||
</tbody>
|
||
</table>
|
||
|
||
<!-- Footer Text -->
|
||
<div class="footer-text">
|
||
وذلك طبقا لعقد صيانة وإصلاح الأجهزة الطبية بمستشفى <span class="dotted-line" style="min-width: 150px;">${f.company||""}</span> والجهاز يعمل بحالة جيدة.
|
||
<br><br>
|
||
وﷲ الموفق .....
|
||
</div>
|
||
|
||
<!-- Signatures Section -->
|
||
<div class="signatures-section">
|
||
<!-- First Row -->
|
||
<div class="signature-row">
|
||
<div class="signature-block-right">
|
||
<div class="signature-title">المسئول في القسم Dept. Responsible</div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
|
||
</div>
|
||
|
||
<div class="signature-block-left">
|
||
<div class="signature-title">مدير شركة سمامة Site Manager</div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Installation Engineer - Right aligned -->
|
||
<div style="text-align: left; margin: 25px 0; width: 45%; float: right; clear: both;">
|
||
<div class="signature-title">مهندس/ فني التركيب Installation Eng</div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
|
||
</div>
|
||
<div style="clear: both;"></div>
|
||
|
||
<!-- Second Row -->
|
||
<div class="signature-row">
|
||
<div class="signature-block-right">
|
||
<div class="signature-title">مشرف الوزارة بالمستشفى Hospital Supervisor</div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
|
||
</div>
|
||
|
||
<div class="signature-block-left">
|
||
<div class="signature-title">مدير المستشفى/ المركز Hospital Manager</div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Name</span></div>
|
||
<div><span class="signature-line"></span><span class="signature-label">Sign</span></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Official Seal -->
|
||
<div class="seal-section">
|
||
الختم الرسمي
|
||
</div>
|
||
|
||
<script>
|
||
window.onload = function() {
|
||
window.print();
|
||
};
|
||
<\/script>
|
||
</body>
|
||
</html>
|
||
`),ce.document.close()},St=()=>{if(!e||i){alert("Please save the asset first to view Dismantling Report");return}const ce=window.open("","_blank");if(!ce)return;const we=new Date,Ie=Ze=>{const ze=String(Ze.getDate()).padStart(2,"0"),bt=String(Ze.getMonth()+1).padStart(2,"0"),Nt=Ze.getFullYear();return`${ze}/${bt}/${Nt}`},lt=_!=null&&_.creation?new Date(_.creation):null;let ft="";if(lt){const Ze=Math.floor((we.getTime()-lt.getTime())/31536e6),ze=Math.floor((we.getTime()-lt.getTime())%(1e3*60*60*24*365)/(1e3*60*60*24*30));ft=`${Ze} سنة و ${ze} شهر`}ce.document.write(`
|
||
<!DOCTYPE html>
|
||
<html lang="ar" dir="rtl">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Dismantling Report - ${e}</title>
|
||
<style>
|
||
@page {
|
||
margin: 0.5in;
|
||
size: A4;
|
||
}
|
||
body {
|
||
font-family: 'Times New Roman', serif;
|
||
margin: 0;
|
||
padding: 20px;
|
||
font-size: 12px;
|
||
line-height: 1.4;
|
||
direction: rtl;
|
||
text-align: right;
|
||
}
|
||
|
||
.header {
|
||
text-align: left;
|
||
margin-bottom: 30px;
|
||
}
|
||
|
||
.title {
|
||
text-align: center;
|
||
font-size: 14px;
|
||
font-weight: bold;
|
||
margin: 20px 0;
|
||
}
|
||
|
||
.department-line {
|
||
margin: 15px 0;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.section-title {
|
||
font-weight: bold;
|
||
margin: 20px 0 10px 0;
|
||
}
|
||
|
||
.reasons-section {
|
||
margin: 20px 0;
|
||
}
|
||
|
||
.reasons-table {
|
||
width: 60%;
|
||
border-collapse: collapse;
|
||
margin: 10px 0;
|
||
}
|
||
|
||
.reasons-table td {
|
||
border: 2px solid #000;
|
||
padding: 8px;
|
||
text-align: center;
|
||
font-weight: bold;
|
||
width: 16.66%;
|
||
height: 30px;
|
||
}
|
||
|
||
.reason-text {
|
||
margin: 8px 0;
|
||
text-align: right;
|
||
font-size: 11px;
|
||
direction: rtl;
|
||
word-wrap: break-word;
|
||
overflow-wrap: break-word;
|
||
}
|
||
|
||
.committee-opinion {
|
||
margin: 20px 0;
|
||
padding: 10px;
|
||
border: 1px solid #ccc;
|
||
text-align: justify;
|
||
}
|
||
|
||
.signatures-table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
margin: 20px 0;
|
||
}
|
||
|
||
.signatures-table td {
|
||
padding: 8px;
|
||
text-align: right;
|
||
vertical-align: top;
|
||
font-weight: bold;
|
||
direction: rtl;
|
||
word-wrap: break-word;
|
||
overflow-wrap: break-word;
|
||
}
|
||
|
||
.signature-title {
|
||
font-size: 11px;
|
||
height: 30px;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.signature-field {
|
||
height: 25px;
|
||
font-size: 10px;
|
||
}
|
||
|
||
.hospital-manager {
|
||
text-align: right;
|
||
margin: 20px 0;
|
||
}
|
||
|
||
.hospital-manager-table {
|
||
width: 100%;
|
||
margin: 0;
|
||
border-collapse: collapse;
|
||
float: right;
|
||
}
|
||
|
||
.hospital-manager-table td {
|
||
padding: 8px;
|
||
text-align: right;
|
||
font-weight: bold;
|
||
direction: rtl;
|
||
word-wrap: break-word;
|
||
overflow-wrap: break-word;
|
||
}
|
||
|
||
.seal-section {
|
||
text-align: center;
|
||
margin: 30px 0;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.footer {
|
||
margin-top: 40px;
|
||
text-align: right;
|
||
}
|
||
|
||
.footer-title {
|
||
font-weight: bold;
|
||
margin-bottom: 5px;
|
||
color: #0066cc;
|
||
}
|
||
|
||
.footer-name {
|
||
font-size: 11px;
|
||
color: #0066cc;
|
||
}
|
||
|
||
.logo {
|
||
width: 100px;
|
||
height: 60px;
|
||
margin: 0;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.logo img {
|
||
max-width: 100%;
|
||
max-height: 100%;
|
||
object-fit: contain;
|
||
}
|
||
|
||
.equipment-table {
|
||
width: 100%;
|
||
border: 1px solid black;
|
||
border-collapse: collapse;
|
||
}
|
||
|
||
.equipment-table td {
|
||
width: 25%;
|
||
border: 1px solid black;
|
||
padding: 8px;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<!-- Header Section -->
|
||
<div class="header">
|
||
<div class="logo"><img src='/files/SEMH!.png' onerror="this.style.display='none'"></div>
|
||
</div>
|
||
|
||
<!-- Title -->
|
||
<div class="title">
|
||
محضر تكهين / إبعاد عن الخدمة
|
||
</div>
|
||
|
||
<!-- Department -->
|
||
<div class="department-line">
|
||
القسم : <span style="border-bottom: 1px solid #000; min-width: 200px; display: inline-block;">${f.department||""}</span>
|
||
</div>
|
||
|
||
<!-- Equipment Data Section -->
|
||
<div class="section-title">0-1 بيانات الجهاز المطلوب تكهينه :</div>
|
||
|
||
<table class="equipment-table">
|
||
<tr>
|
||
<td>اسم الجهاز</td>
|
||
<td>${f.asset_name||""}</td>
|
||
<td>الرقم التسلسلي</td>
|
||
<td>${f.custom_serial_number||""}</td>
|
||
</tr>
|
||
<tr>
|
||
<td>الشركة الصانعة</td>
|
||
<td>${f.custom_manufacturer||""}</td>
|
||
<td>تاريخ التوريد</td>
|
||
<td>${lt?Ie(lt):""}</td>
|
||
</tr>
|
||
<tr>
|
||
<td>الطراز/الموديل</td>
|
||
<td>${f.custom_model||""}</td>
|
||
<td>مدة استخدام الجهاز</td>
|
||
<td>${ft}</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- Reasons Section -->
|
||
<div class="section-title">2- أسباب طلب التكهين / إبعاد عن الخدمة :</div>
|
||
|
||
<table class="reasons-table">
|
||
<tr>
|
||
<td>أ</td>
|
||
<td>ب</td>
|
||
<td>ج</td>
|
||
<td>د</td>
|
||
<td>هـ</td>
|
||
<td>و</td>
|
||
</tr>
|
||
<tr>
|
||
<td> </td>
|
||
<td> </td>
|
||
<td> </td>
|
||
<td> </td>
|
||
<td> </td>
|
||
<td> </td>
|
||
</tr>
|
||
</table>
|
||
|
||
<div class="reason-text">
|
||
أ) تكاليف قطع الغيار المطلوبة للإصلاح أكثر من نصف قيمة الجهاز (مرفق عرض أسعار قطع الغيار اللازمة للإصلاح).
|
||
</div>
|
||
<div class="reason-text">
|
||
ب) توقف انتاج الجهاز وقطع الغيار من الشركة الصانعة حسب تقرير المورد.
|
||
</div>
|
||
<div class="reason-text">
|
||
ج) جهاز قديم وتم استخدامه أكثر من عشر سنوات.
|
||
</div>
|
||
<div class="reason-text">
|
||
د) ليس للجهاز وكيل معروف بالمملكة في الوقت الحالي ولا يمكن توفير قطع غيار للجهاز.
|
||
</div>
|
||
<div class="reason-text">
|
||
ه) تكرار أعطال الجهاز وإصلاحه على فترات متقاربة.
|
||
</div>
|
||
<div class="reason-text">
|
||
و) أخرى : <span style="border-bottom: 1px solid #000; min-width: 300px; display: inline-block;"></span>
|
||
</div>
|
||
|
||
<!-- Committee Opinion -->
|
||
<div class="section-title">3- مرئيات اللجنة:</div>
|
||
<div class="reason-text">
|
||
بناءاً على الفقرة أ. ج. و. يتم تكهين الجهاز وادراجه ضمن بنود الإحلال المطلوبة للمستشفى.
|
||
</div>
|
||
|
||
<!-- Signatures Section -->
|
||
<div class="section-title">توقيع اللجنة :</div>
|
||
|
||
<table class="signatures-table">
|
||
<tr>
|
||
<td class="signature-title">المقاول</td>
|
||
<td class="signature-title">رئيس القسم</td>
|
||
<td class="signature-title">مدير الصيانة الطبية</td>
|
||
<td class="signature-title">مدير مراقبة المخزون</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="signature-field">الإسم :</td>
|
||
<td class="signature-field">الإسم :</td>
|
||
<td class="signature-field">الإسم :</td>
|
||
<td class="signature-field">الإسم :</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="signature-field">التوقيع :</td>
|
||
<td class="signature-field">التوقيع :</td>
|
||
<td class="signature-field">التوقيع :</td>
|
||
<td class="signature-field">التوقيع :</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="signature-field">التاريخ :</td>
|
||
<td class="signature-field">التاريخ :</td>
|
||
<td class="signature-field">التاريخ :</td>
|
||
<td class="signature-field">التاريخ :</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- Hospital Manager Section -->
|
||
<div class="hospital-manager">
|
||
<table class="hospital-manager-table">
|
||
<tr>
|
||
<td class="signature-title">مدير مستشفى</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="signature-field">الإسم :</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="signature-field">التوقيع :</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="signature-field">التاريخ :</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="signature-field">الختم :</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<!-- Arabic text after last table -->
|
||
<div style="clear: both; text-align: left; margin: 20px 0;">
|
||
<div style="font-weight: bold; margin-bottom: 5px;">الصيانة الطبية بتجمع الجوف الصحي</div>
|
||
<div>المهندس/عبد العزيز زايد الخمعلي</div>
|
||
</div>
|
||
|
||
<!-- Footer -->
|
||
<div class="footer">
|
||
<div style="color: #0066cc; font-weight: bold;">تجمع الجوف الصحي</div>
|
||
<div style="color: #0066cc;">Aljouf Health Cluster</div>
|
||
</div>
|
||
|
||
<script>
|
||
window.onload = function() {
|
||
window.print();
|
||
};
|
||
<\/script>
|
||
</body>
|
||
</html>
|
||
`),ce.document.close()};return r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("button",{onClick:()=>t("/assets"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(Gs,{}),r.jsx("span",{className:"text-gray-900 dark:text-white font-medium",children:d?"Duplicate Asset":i?"New Asset Details":"Asset Details"})]}),_&&r.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${ee===0?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300":ee===1?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300":"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300"}`,children:ee===0?"Draft":ee===1?"Submitted":"Cancelled"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[!i&&!P&&!H&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",ref:le,children:[r.jsxs("button",{onClick:()=>xe(!ue),className:"bg-blue-600 hover:bg-blue-700 text-white px-2 py-1 rounded-lg flex items-center gap-2",children:["Actions",r.jsx(Ec,{size:12,className:`transition-transform ${ue?"rotate-180":""}`})]}),ue&&r.jsx("div",{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-gray-800 rounded-md shadow-lg z-50 border border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"py-1",children:[de&&r.jsxs("button",{onClick:()=>{st(),xe(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(Xu,{size:14}),"Print QR"]}),r.jsxs("button",{onClick:()=>{gt(),xe(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(Xu,{size:14}),"Stay Plugged"]}),r.jsxs("button",{onClick:()=>{zt(),xe(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(xi,{size:14}),"PPM Plan"]}),r.jsxs("button",{onClick:()=>{Ge(),xe(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx($g,{size:14}),"Asset History"]}),r.jsxs("button",{onClick:()=>{Ct(),xe(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(SS,{size:14}),"Installation Report"]}),(_==null?void 0:_.status)==="Scrapped"&&r.jsxs("button",{onClick:()=>{St(),xe(!1)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center gap-2 text-red-600 dark:text-red-400 border-t border-gray-200 dark:border-gray-700",children:[r.jsx(OS,{size:14}),"Dismantling Report"]})]})})]}),r.jsxs("button",{onClick:()=>I(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-2 py-1 rounded-lg flex items-center gap-2",children:[r.jsx(Rr,{}),"Edit"]}),Y&&r.jsxs("button",{onClick:Ve,disabled:A,className:"bg-purple-600 hover:bg-purple-700 text-white px-2 py-1 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(P_,{}),A?"Submitting...":"Submit"]})]}),H&&r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 italic",children:"Cancelled documents cannot be edited"}),P&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{i?t("/assets"):I(!1)},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 dark:text-gray-800 px-2 py-1 rounded-lg",disabled:A,children:"Cancel"}),r.jsxs("button",{onClick:$e,disabled:A,className:"bg-green-600 hover:bg-green-700 text-white px-2 py-1 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(jr,{}),A?"Saving...":"Save Changes"]})]})]})]}),r.jsxs("form",{onSubmit:$e,children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Asset Information"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Asset Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"asset_name",value:f.asset_name,onChange:Ne,placeholder:"e.g. Laptop Model X",required:!0,disabled:ge("asset_name"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx(kt,{label:"Category",doctype:"Asset Type",value:f.custom_asset_type||"",onChange:ce=>g(Ee(ie({},f),{custom_asset_type:ce})),disabled:ge("custom_asset_type")}),r.jsx(kt,{label:"Modality",doctype:"Modality",value:f.custom_modality||"",onChange:ce=>g(Ee(ie({},f),{custom_modality:ce})),disabled:ge("custom_modality")}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Class"}),r.jsxs("select",{name:"custom_class",value:f.custom_class,onChange:Ne,disabled:ge("custom_class"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select class"}),r.jsx("option",{value:"Class A",children:"Class A"}),r.jsx("option",{value:"Class B",children:"Class B"}),r.jsx("option",{value:"Class C",children:"Class C"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset ID"}),r.jsx("input",{type:"text",value:i||d?"Auto-generated":_==null?void 0:_.name,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"}),d&&r.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["💡 Duplicating from: ",s]})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Device Status ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsxs("select",{name:"custom_device_status",value:f.custom_device_status,onChange:Ne,disabled:!P,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Up",children:"Up"}),r.jsx("option",{value:"Down",children:"Down"})]})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Technical Specs"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Serial Code"}),r.jsx("input",{type:"text",name:"custom_serial_number",value:f.custom_serial_number,onChange:Ne,placeholder:"e.g. SN-12345",disabled:ge("custom_serial_number"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx(kt,{label:"Manufacturer",doctype:"Manufacturer",value:f.custom_manufacturer||"",onChange:ce=>g(Ee(ie({},f),{custom_manufacturer:ce})),disabled:ge("custom_manufacturer")}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Model"}),r.jsx("input",{type:"text",name:"custom_model",value:f.custom_model,onChange:Ne,placeholder:"Model number",disabled:ge("custom_model"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Hours"}),r.jsx("input",{type:"number",name:"custom_total_hours",value:f.custom_total_hours||0,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Calculated from Available For Use Date"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Down Time (Hours)"}),r.jsx("input",{type:"number",name:"custom_down_time",value:f.custom_down_time||0,onChange:Ne,placeholder:"0",disabled:ge("custom_down_time"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Up Time (Hours)"}),r.jsx("input",{type:"number",name:"custom_up_time",value:f.custom_up_time||0,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Calculated: Total Hours - Down Time"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Location"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(kt,{label:"Hospital",doctype:"Company",value:f.company||"",onChange:ce=>{g(Ee(ie({},f),{company:ce,asset_owner_company:ce,department:""}))},disabled:ge("company"),filters:{domain:"Healthcare"}}),be("custom_site")&&r.jsx("div",{children:r.jsx(kt,{label:"Site name",doctype:"Mobile Team Site",value:f.custom_site||"",onChange:ce=>g(Ee(ie({},f),{custom_site:ce})),disabled:ge("custom_site"),placeholder:"Select Site"})}),r.jsx(kt,{label:"Department",doctype:"Department",value:f.department||"",onChange:ce=>g(Ee(ie({},f),{department:ce})),disabled:ge("department"),filters:Z}),r.jsx(kt,{label:"Location",doctype:"Location",value:f.location||"",onChange:ce=>g(Ee(ie({},f),{location:ce})),disabled:ge("location")}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Building"}),r.jsx("input",{type:"text",placeholder:"Building name",disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Room Number"}),r.jsx("input",{type:"text",placeholder:"e.g. Room 001-002",disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"More Details"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col items-center my-4",children:[r.jsx("div",{className:"border-2 border-gray-300 dark:border-gray-600 p-3 rounded-lg bg-white dark:bg-gray-700",children:de?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:de,alt:`QR Code for ${(_==null?void 0:_.name)||"Asset"}`,className:"w-[120px] h-[120px] object-contain",onError:ce=>{const we=ce.target;we.style.display="none";const Ie=we.nextElementSibling;Ie&&(Ie.style.display="flex")}}),r.jsx("div",{className:"w-[120px] h-[120px] hidden items-center justify-center bg-gray-100 dark:bg-gray-700 rounded",children:r.jsx(Xu,{size:80,className:"text-gray-400 dark:text-gray-500"})})]}):r.jsx("div",{className:"w-[120px] h-[120px] flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded",children:r.jsx(Xu,{size:80,className:"text-gray-400 dark:text-gray-500"})})}),(_==null?void 0:_.name)&&r.jsxs("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-center",children:["Asset ID: ",_.name]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description"}),r.jsx("textarea",{rows:4,placeholder:"Brief description of the asset",disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mt-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Coverage"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Site Contractor"}),r.jsx("input",{type:"text",name:"custom_site_contractor",value:f.custom_site_contractor,onChange:Ne,disabled:ge("custom_site_contractor"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Contract Number"}),r.jsx("input",{type:"text",disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Agreement"}),r.jsxs("select",{name:"custom_service_agreement",value:f.custom_service_agreement||"",onChange:Ne,disabled:ge("custom_service_agreement"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Service Agreement"}),r.jsx("option",{value:"Warranty",children:"Warranty"}),r.jsx("option",{value:"Contract",children:"Contract"}),r.jsx("option",{value:"Frame Work",children:"Frame Work"}),r.jsx("option",{value:"Main Contractor",children:"Main Contractor"}),r.jsx("option",{value:"Out of warranty",children:"Out of warranty"}),r.jsx("option",{value:"Under Dismantle",children:"Under Dismantle"}),r.jsx("option",{value:"Under Installation",children:"Under Installation"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Coverage"}),r.jsxs("select",{name:"custom_service_coverage",value:f.custom_service_coverage||"",onChange:Ne,disabled:ge("custom_service_coverage"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Service Coverage"}),r.jsx("option",{value:"PM Only",children:"PM Only"}),r.jsx("option",{value:"Labour",children:"Labour"}),r.jsx("option",{value:"Labour & Parts",children:"Labour & Parts"}),r.jsx("option",{value:"Comprehensive",children:"Comprehensive"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Start Date"}),r.jsx("input",{type:"date",name:"custom_start_date",value:f.custom_start_date||"",onChange:Ne,disabled:ge("custom_start_date"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"End Date"}),r.jsx("input",{type:"date",name:"custom_end_date",value:f.custom_end_date||"",onChange:Ne,disabled:ge("custom_end_date"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Amount"}),r.jsx("input",{type:"number",name:"custom_total_amount",value:f.custom_total_amount,onChange:Ne,disabled:ge("custom_total_amount"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Comments"}),r.jsx("textarea",{rows:2,disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Acquisition Details"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Purchase Order Number"}),r.jsx("input",{type:"text",placeholder:"PO number",disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx(kt,{label:"Supplier/Vendor",doctype:"Supplier",value:f.supplier||"",onChange:ce=>g(Ee(ie({},f),{supplier:ce})),disabled:ge("supplier")}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Gross Purchase Amount"}),r.jsx("input",{type:"number",name:"gross_purchase_amount",value:f.gross_purchase_amount||0,onChange:Ne,disabled:ge("gross_purchase_amount"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Purchase Date"}),r.jsx("input",{type:"date",disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Installation Date"}),r.jsx("input",{type:"date",disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Available For Use Date"}),r.jsx("input",{type:"date",name:"available_for_use_date",value:f.available_for_use_date||"",onChange:ce=>g(we=>Ee(ie({},we),{available_for_use_date:ce.target.value})),disabled:ge("available_for_use_date"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Financial Details"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"The depreciation method is an accounting method used to allocate the cost of a tangible asset over its useful life."}),r.jsxs("div",{className:"flex items-center mb-6",children:[r.jsx("input",{id:"calculate_depreciation",type:"checkbox",checked:f.calculate_depreciation,onChange:ce=>g(Ee(ie({},f),{calculate_depreciation:ce.target.checked})),disabled:!P,className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"}),r.jsx("label",{htmlFor:"calculate_depreciation",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Calculate Depreciation"})]}),f.calculate_depreciation&&r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h3",{className:"text-md font-semibold text-gray-800 dark:text-white",children:"Asset Finance Books"}),P&&r.jsxs("button",{type:"button",onClick:te,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 flex items-center gap-2",children:[r.jsx("span",{children:"+"})," Add Row"]})]}),(!f.finance_books||f.finance_books.length===0)&&r.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-900 rounded-lg",children:'No finance books added yet. Click "Add Row" to add one.'}),f.finance_books&&f.finance_books.length>0&&r.jsx("div",{className:"overflow-visible",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-300 dark:border-gray-600",children:[r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[200px]",children:"Finance Book"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[200px]",children:"Depreciation Method*"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[180px]",children:"Total Depreciations*"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[180px]",children:"Frequency (Months)*"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[200px]",children:"Depreciation Posting Date*"}),P&&r.jsx("th",{className:"text-center px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300 min-w-[120px]",children:"Action"})]})}),r.jsx("tbody",{children:f.finance_books.map((ce,we)=>{var Ie,lt;return r.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750",children:[r.jsx("td",{className:"px-4 py-3 relative",style:{overflow:"visible"},children:r.jsx("div",{className:"relative z-20",children:r.jsx(kt,{label:"",doctype:"Finance Book",value:ce.finance_book||"",onChange:ft=>F(we,{finance_book:ft}),disabled:!P})})}),r.jsx("td",{className:"px-4 py-3",children:r.jsxs("select",{value:ce.depreciation_method||"",onChange:ft=>F(we,{depreciation_method:ft.target.value}),disabled:!P,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Method"}),r.jsx("option",{value:"Straight Line",children:"Straight Line"}),r.jsx("option",{value:"Double Declining Balance",children:"Double Declining Balance"}),r.jsx("option",{value:"Written Down Value",children:"Written Down Value"}),r.jsx("option",{value:"Manual",children:"Manual"})]})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:(Ie=ce.total_number_of_depreciations)!=null?Ie:"",onChange:ft=>F(we,{total_number_of_depreciations:Number(ft.target.value)}),disabled:!P,placeholder:"0",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:(lt=ce.frequency_of_depreciation)!=null?lt:"",onChange:ft=>F(we,{frequency_of_depreciation:Number(ft.target.value)}),disabled:!P,placeholder:"0",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"date",value:ce.depreciation_start_date||"",onChange:ft=>F(we,{depreciation_start_date:ft.target.value}),disabled:!P,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),P&&r.jsx("td",{className:"px-4 py-3 text-center",children:r.jsx("button",{type:"button",onClick:()=>se(we),className:"px-3 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors",children:"Remove"})})]},we)})})]})})})]})]})}),r.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 mt-6",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"End-of-Life Details"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Expected End-of-Life Date"}),r.jsx("input",{type:"date",disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Disposal Method"}),r.jsxs("select",{disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Recycling"}),r.jsx("option",{value:"Donation",children:"Donation"}),r.jsx("option",{value:"Sale",children:"Sale"})]})]})]})]})}),r.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Warranty & Service Contract"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_warranty",type:"checkbox",checked:f.custom_warranty||!1,onChange:ce=>{g(Ee(ie({},f),{custom_warranty:ce.target.checked}))},disabled:ge("custom_warranty"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_warranty?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_warranty",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Warranty"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_extended_warranty",type:"checkbox",checked:f.custom_extended_warranty||!1,onChange:ce=>{g(Ee(ie({},f),{custom_extended_warranty:ce.target.checked}))},disabled:ge("custom_extended_warranty"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_extended_warranty?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_extended_warranty",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Extended Warranty"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom__service_contract",type:"checkbox",checked:f.custom__service_contract||!1,onChange:ce=>{g(Ee(ie({},f),{custom__service_contract:ce.target.checked}))},disabled:ge("custom__service_contract"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom__service_contract?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom__service_contract",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Service Contract"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_covering_spare_parts",type:"checkbox",checked:f.custom_covering_spare_parts||!1,onChange:ce=>{g(Ee(ie({},f),{custom_covering_spare_parts:ce.target.checked}))},disabled:ge("custom_covering_spare_parts"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_covering_spare_parts?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_covering_spare_parts",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Covering Spare Parts"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_spare_parts_labour",type:"checkbox",checked:f.custom_spare_parts_labour||!1,onChange:ce=>{g(Ee(ie({},f),{custom_spare_parts_labour:ce.target.checked}))},disabled:ge("custom_spare_parts_labour"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_spare_parts_labour?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_spare_parts_labour",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Spare Parts Labour"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_covering_labour",type:"checkbox",checked:f.custom_covering_labour||!1,onChange:ce=>{g(Ee(ie({},f),{custom_covering_labour:ce.target.checked}))},disabled:ge("custom_covering_labour"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_covering_labour?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_covering_labour",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Covering Labour"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{id:"custom_ppm_only",type:"checkbox",checked:f.custom_ppm_only||!1,onChange:ce=>{g(Ee(ie({},f),{custom_ppm_only:ce.target.checked}))},disabled:ge("custom_ppm_only"),className:`h-5 w-5 rounded border-2 border-black focus:ring-2 focus:ring-blue-500 ${f.custom_ppm_only?"bg-green-500 border-black":"bg-red-500 border-black"}`}),r.jsx("label",{htmlFor:"custom_ppm_only",className:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:"PPM Only"})]})]}),r.jsxs("div",{className:"mt-4",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Support Plan"}),r.jsx("input",{type:"text",name:"custom_support_plan",value:f.custom_support_plan||"",onChange:Ne,disabled:ge("custom_support_plan"),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]}),r.jsxs("div",{className:"mt-6 bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Spare Parts"}),P&&r.jsxs("button",{type:"button",onClick:W,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 flex items-center gap-2 text-sm",children:[r.jsx("span",{children:"+"})," Add Row"]})]}),(!f.custom_spare_parts||f.custom_spare_parts.length===0)&&r.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-900 rounded-lg",children:'No spare parts added yet. Click "Add Row" to add one.'}),f.custom_spare_parts&&f.custom_spare_parts.length>0&&r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-300 dark:border-gray-600",children:[r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Item Code"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Item Name"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Qty"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Rate"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Amount"}),r.jsx("th",{className:"text-left px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"UOM"}),P&&r.jsx("th",{className:"text-center px-4 py-3 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Action"})]})}),r.jsx("tbody",{children:f.custom_spare_parts.map((ce,we)=>r.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750",children:[r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"text",value:ce.item_code||"",onChange:Ie=>D(we,"item_code",Ie.target.value),disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"text",value:ce.item_name||"",onChange:Ie=>D(we,"item_name",Ie.target.value),disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:ce.qty||0,onChange:Ie=>D(we,"qty",Number(Ie.target.value)),disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:ce.rate||0,onChange:Ie=>D(we,"rate",Number(Ie.target.value)),disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"number",value:ce.amount||0,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("input",{type:"text",value:ce.uom||"",onChange:Ie=>D(we,"uom",Ie.target.value),disabled:!P,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),P&&r.jsx("td",{className:"px-4 py-3 text-center",children:r.jsx("button",{type:"button",onClick:()=>G(we),className:"px-3 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors text-sm",children:"Remove"})})]},we))}),r.jsx("tfoot",{children:r.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700 font-semibold",children:[r.jsx("td",{colSpan:4,className:"px-4 py-3 text-right text-sm text-gray-700 dark:text-gray-300",children:"Total Amount:"}),r.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-white",children:f.custom_total_spare_parts_amount||0}),r.jsx("td",{colSpan:P?2:1})]})})]})})]})]})]})},fO=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const{t:g}=Qa(),[p,x]=j.useState(a>0?"selected":"all_with_filters"),[y,_]=j.useState("csv"),[k,T]=j.useState(f.filter(C=>C.default).map(C=>C.key));j.useEffect(()=>{a>0?x("selected"):x("all_with_filters")},[a]);const N=C=>{T(A=>A.includes(C)?A.filter(P=>P!==C):[...A,C])},S=()=>{T(f.map(C=>C.key))},O=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qr,{className:"text-white text-xl"}),r.jsxs("h3",{className:"text-lg font-semibold text-white",children:[g("listPages.export")," ",g("workOrders.title")]})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(vt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"What to Export"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>x("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected work order",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:p==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," work order",i!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[i," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:p==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," work order",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${y==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:y==="csv",onChange:()=>_("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Ac,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${y==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:y==="excel",onChange:()=>_("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Oc,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:O,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(C=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${k.includes(C.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[p==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,p==="all_on_page"&&`Exporting ${i} row${i!==1?"s":""} from current page`,p==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>d(p,y,k),disabled:k.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_i,{}),"Export"]})})]})]})]})}):null},hO=()=>{const{t:e}=Qa(),t=Na(),[a,s]=fl(),[i,d]=j.useState(0),[c,f]=j.useState(null),[g,p]=j.useState(null),x=j.useRef(null),y=20,_=[{key:"name",label:e("commonFields.workOrderId"),default:!0},{key:"asset",label:e("commonFields.assetId"),default:!0},{key:"asset_name",label:e("commonFields.assetName"),default:!0},{key:"work_order_type",label:e("commonFields.workOrderType"),default:!0},{key:"company",label:e("commonFields.company"),default:!0},{key:"department",label:e("commonFields.department"),default:!0},{key:"repair_status",label:e("commonFields.status"),default:!0},{key:"custom_priority_",label:e("commonFields.priority"),default:!0},{key:"custom_serial_number",label:e("commonFields.serialNumber"),default:!1},{key:"custom_manufacturer",label:e("commonFields.manufacturer"),default:!1},{key:"supplier",label:e("commonFields.supplier"),default:!1},{key:"description",label:e("commonFields.description"),default:!1},{key:"assigned_to",label:e("commonFields.assignedTo"),default:!1},{key:"scheduled_date",label:e("commonFields.scheduledDate"),default:!1},{key:"completed_date",label:e("commonFields.completedDate"),default:!1},{key:"creation",label:e("commonFields.createdOn"),default:!0},{key:"modified",label:e("commonFields.modifiedOn"),default:!1},{key:"owner",label:e("commonFields.createdBy"),default:!1}],k=a.get("asset"),[T,N]=j.useState(!1),[S,O]=j.useState(new Set),[C,A]=j.useState(!1),[P,I]=j.useState(!1),{permissionFilters:ee,loading:B,error:H,hasAnyRestrictions:Y}=Ww("Work_Order"),[ue,xe]=j.useState(""),[le,ge]=j.useState(""),[be,me]=j.useState(""),[ae,Z]=j.useState(""),[K,te]=j.useState(""),[se,F]=j.useState(""),[D,W]=j.useState(""),[G,J]=j.useState(""),[de,De]=j.useState(""),[Ne,$e]=j.useState(""),[Ve,st]=j.useState(!0),[gt,zt]=j.useState(0),[Ge,Ct]=j.useState([]),[St,Ue]=j.useState(!1),[ce,we]=j.useState(""),[Ie,lt]=j.useState(""),ft=j.useRef(null);j.useEffect(()=>{const ve=a.get("company"),U=a.get("priority"),ne=a.get("status");ve&&Z(ve),U&&$e(U),ne&&te(ne)},[a]),j.useEffect(()=>{k&&ge(k)},[k]),j.useEffect(()=>{const ve=localStorage.getItem("workOrderFilterPresets");ve&&Ct(JSON.parse(ve))},[]),j.useEffect(()=>{const ve=[ue,le,be,ae,K,se,D,G,de,Ne].filter(Boolean).length;zt(ve)},[ue,le,be,ae,K,se,D,G,de,Ne]);const Ze={};ue&&(Ze.name=ue),le&&(Ze.asset=le),be&&(Ze.work_order_type=be),ae&&(Ze.company=ae),K&&(Ze.repair_status=K),se&&(Ze.custom_serial_number=["like",`%${se}%`]),D&&(Ze.custom_manufacturer=D),G&&(Ze.supplier=G),de&&(Ze.department=de),Ne&&(Ze.custom_priority_=Ne);const{workOrders:ze,totalCount:bt,hasMore:Nt,loading:Ot,error:Pt,refetch:je}=T_(Ze,y,i*y,"creation desc",ee),{deleteWorkOrder:ut,loading:jt}=E_();j.useEffect(()=>{!Ot&&!T&&!B&&N(!0)},[Ot,T,B]),j.useEffect(()=>{i!==0&&d(0)},[ue,le,be,ae,K,se,D,G,de,Ne]),j.useEffect(()=>{O(new Set)},[ue,le,be,ae,K,se,D,G,de,Ne,i]);const $t=ve=>{lt(ve),ft.current&&clearTimeout(ft.current),ft.current=window.setTimeout(()=>{F(ve)},800)},Fe=ve=>{ve.key==="Enter"&&(ve.preventDefault(),ft.current&&clearTimeout(ft.current),F(Ie))},ot=()=>{if(!ce.trim()){alert("Please enter a filter name");return}const ve={id:Date.now(),name:ce,filters:{filterWorkOrderId:ue,filterAsset:le,filterType:be,filterCompany:ae,filterStatus:K,filterSerialNumber:se,filterManufacturer:D,filterSupplier:G,filterDepartment:de,filterPriority:Ne}},U=[...Ge,ve];Ct(U),we(""),Ue(!1),localStorage.setItem("workOrderFilterPresets",JSON.stringify(U))},dt=ve=>{const U=ve.filters;xe(U.filterWorkOrderId||""),ge(U.filterAsset||""),me(U.filterType||""),Z(U.filterCompany||""),te(U.filterStatus||""),F(U.filterSerialNumber||""),lt(U.filterSerialNumber||""),W(U.filterManufacturer||""),J(U.filterSupplier||""),De(U.filterDepartment||""),$e(U.filterPriority||"")},wt=ve=>{const U=Ge.filter(ne=>ne.id!==ve);Ct(U),localStorage.setItem("workOrderFilterPresets",JSON.stringify(U))};j.useEffect(()=>()=>{ft.current&&clearTimeout(ft.current)},[]),j.useEffect(()=>{const ve=U=>{x.current&&!x.current.contains(U.target)&&p(null)};return g&&document.addEventListener("mousedown",ve),()=>{document.removeEventListener("mousedown",ve)}},[g]);const Ft=ve=>{O(U=>{const ne=new Set(U);return ne.has(ve)?ne.delete(ve):ne.add(ve),ne})},la=()=>{S.size===ze.length?O(new Set):O(new Set(ze.map(ve=>ve.name)))},Je=ze.length>0&&S.size===ze.length,Lt=S.size>0&&S.size<ze.length,ye=j.useCallback(()=>oe(null,null,function*(){const ve=[];let U=0;const ne=100;let X=!0;for(;X;)try{const z=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Work_Order",filters:ie(ie({},Ze),ee),fields:["*"],limit_start:U*ne,limit_page_length:ne,order_by:"creation desc"})})).json()).message||[];ve.push(...z),z.length<ne?X=!1:U++,U>100&&(console.warn("Export safety limit reached"),X=!1)}catch(Q){throw console.error("Error fetching work orders for export:",Q),Q}return ve}),[Ze,ee]),We=(ve,U,ne)=>oe(null,null,function*(){I(!0);try{let X=[];switch(ve){case"selected":X=ze.filter(re=>S.has(re.name));break;case"all_on_page":X=ze;break;case"all_with_filters":X=yield ye();break}if(X.length===0){alert("No data to export");return}const Q=ne.map(re=>{const z=_.find(he=>he.key===re);return(z==null?void 0:z.label)||re});if(U==="csv"){const re=[Q.join(","),...X.map(ke=>ne.map(Ae=>{let Ce=ke[Ae]||"";return typeof Ce=="string"&&(Ce.includes(",")||Ce.includes('"')||Ce.includes(`
|
||
`))&&(Ce=`"${Ce.replace(/"/g,'""')}"`),Ce}).join(","))].join(`
|
||
`),z=new Blob(["\uFEFF"+re],{type:"text/csv;charset=utf-8;"}),he=URL.createObjectURL(z),Me=document.createElement("a");Me.href=he,Me.download=`work_orders_export_${new Date().toISOString().split("T")[0]}.csv`,Me.click(),URL.revokeObjectURL(he)}else if(U==="excel"){const re=[Q,...X.map(Me=>ne.map(ke=>Me[ke]||""))],z=kr.aoa_to_sheet(re),he=kr.book_new();kr.book_append_sheet(he,z,"Work Orders"),Ic(he,`work_orders_export_${new Date().toISOString().split("T")[0]}.xlsx`)}A(!1),O(new Set)}catch(X){console.error("Export failed:",X),alert(`Export failed: ${X instanceof Error?X.message:"Unknown error"}`)}finally{I(!1)}}),at=()=>t("/work-orders/new"),Vt=ve=>t(`/work-orders/${ve}`),aa=ve=>t(`/work-orders/${ve}`),Va=ve=>t(`/work-orders/new?duplicate=${ve}`),Ma=ve=>oe(null,null,function*(){try{yield ut(ve),f(null),je(),alert("Work order deleted successfully!")}catch(U){alert(`Failed to delete work order: ${U instanceof Error?U.message:"Unknown error"}`)}}),zn=ve=>{const U=JSON.stringify(ve,null,2),ne=new Blob([U],{type:"application/json"}),X=URL.createObjectURL(ne),Q=document.createElement("a");Q.href=X,Q.download=`work_order_${ve.name}.json`,Q.click(),URL.revokeObjectURL(X)},Vr=ve=>{window.open(`/work-orders/${ve}?print=true`,"_blank")},ns=()=>{xe(""),ge(""),me(""),Z(""),te(""),F(""),lt(""),W(""),J(""),De(""),$e(""),a.has("asset")&&(a.delete("asset"),s(a)),ft.current&&clearTimeout(ft.current)},bn=ue||le||be||ae||K||se||D||G||de||Ne,Bn=ve=>{switch(ve==null?void 0:ve.toLowerCase()){case"completed":return r.jsx(Ja,{className:"text-green-500"});case"in progress":return r.jsx(ll,{className:"text-blue-500"});case"pending":return r.jsx(yr,{className:"text-yellow-500"});default:return r.jsx(ll,{className:"text-gray-400"})}},js=ve=>{switch(ve==null?void 0:ve.toLowerCase()){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300";case"in progress":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300";case"pending":case"open":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300";case"cancelled":return"bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300";default:return"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300"}},er=ve=>{switch(ve==null?void 0:ve.toLowerCase()){case"high":case"urgent":return"bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300";case"medium":return"bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300";case"low":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300";default:return"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300"}};return B&&!T?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading permissions..."})]})}):H?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Permission Error"}),r.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"Unable to load user permissions."})}),r.jsx("p",{children:H}),r.jsx("button",{onClick:()=>window.location.reload(),className:"mt-2 bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded",children:"Retry"})]})]})}):Ot&&!T?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading work orders..."})]})}):Pt?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Work Order API Not Available"}),r.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"The Work Order API endpoint is not deployed yet."})}),r.jsx("button",{onClick:()=>t("/work-orders/new"),className:"mt-2 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Creating a New Work Order (Demo)"}),r.jsx("button",{onClick:je,className:"mt-2 ml-2 bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("workOrders.title")}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",bt," work order",bt!==1?"s":"",S.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",S.size," selected"]}),Ot&&T&&r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[r.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:()=>A(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:bt===0,children:[r.jsx(Qr,{}),r.jsx("span",{className:"font-medium",children:e("listPages.export")}),S.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:S.size})]}),r.jsxs("button",{onClick:at,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(ts,{}),r.jsx("span",{className:"font-medium",children:e("workOrders.addWorkOrder")})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[r.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 dark:from-blue-600 dark:to-blue-700 px-4 py-3 rounded-t-lg",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[r.jsx("button",{onClick:()=>st(!Ve),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:Ve?r.jsx(m0,{size:14}):r.jsx(Ec,{size:14})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"text-white",size:16}),r.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"})]}),gt>0&&r.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:gt})]}),bn&&r.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:r.jsxs("div",{className:"flex items-center gap-2 py-1",children:[ue&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-blue-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"WO ID:"})," ",ue,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),xe("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),le&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-cyan-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Asset:"})," ",le,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),ge(""),a.delete("asset"),s(a)},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),be&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-purple-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Type:"})," ",be,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),me("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),ae&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-green-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",ae,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),Z("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),K&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-orange-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Status:"})," ",K,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),te("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),se&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-lime-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Serial:"})," ",se,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),F(""),lt("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),D&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-indigo-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Mfr:"})," ",D,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),W("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),G&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-teal-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Supplier:"})," ",G,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),J("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),de&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-yellow-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Dept:"})," ",de,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),De("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),Ne&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-red-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Priority:"})," ",Ne,r.jsx("button",{onClick:ve=>{ve.stopPropagation(),$e("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[gt>0&&r.jsxs("button",{onClick:()=>Ue(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(jr,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),bn&&r.jsxs("button",{onClick:ns,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(vt,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),Ve&&r.jsxs("div",{className:"p-4",children:[Ge.length>0&&r.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[r.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Ge.map(ve=>r.jsxs("div",{className:"group relative inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-100 to-blue-100 dark:from-purple-900/30 dark:to-blue-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:shadow-md transition-all",children:[r.jsx("button",{onClick:()=>dt(ve),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:ve.name}),r.jsx("button",{onClick:()=>wt(ve.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:r.jsx(ha,{size:10})})]},ve.id))})]}),r.jsx("div",{className:"space-y-5",children:r.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(kt,{label:"Work Order ID",doctype:"Work_Order",value:ue,onChange:ve=>xe(ve),placeholder:"Select WO ID",disabled:!1,compact:!0}),ue&&r.jsx("button",{onClick:()=>xe(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[59]",children:[r.jsx(kt,{label:"Asset",doctype:"Asset",value:le,onChange:ve=>ge(ve),placeholder:"Select Asset",disabled:!1,compact:!0}),le&&r.jsx("button",{onClick:()=>{ge(""),a.delete("asset"),s(a)},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[58]",children:[r.jsx(kt,{label:"Type",doctype:"Issue Type",value:be,onChange:ve=>me(ve),placeholder:"Select Type",disabled:!1,compact:!0}),be&&r.jsx("button",{onClick:()=>me(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[57]",children:[r.jsx(kt,{label:"Hospital",doctype:"Company",value:ae,onChange:ve=>Z(ve),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),ae&&r.jsx("button",{onClick:()=>Z(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Status"}),r.jsxs("select",{value:K,onChange:ve=>te(ve.target.value),className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Status"}),r.jsx("option",{value:"Open",children:"Open"}),r.jsx("option",{value:"Work In Progress",children:"Work In Progress"}),r.jsx("option",{value:"Pending Review",children:"Pending Review"}),r.jsx("option",{value:"Completed",children:"Completed"}),r.jsx("option",{value:"Cancelled",children:"Cancelled"}),r.jsx("option",{value:"Closed",children:"Closed"})]}),K&&r.jsx("button",{onClick:()=>te(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Serial Number"}),r.jsx("input",{type:"text",value:Ie,onChange:ve=>$t(ve.target.value),onKeyDown:Fe,placeholder:"Type to search...",className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),Ie&&Ie!==se&&r.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),se&&r.jsx("button",{onClick:()=>{F(""),lt("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[56]",children:[r.jsx(kt,{label:"Manufacturer",doctype:"Manufacturer",value:D,onChange:ve=>W(ve),placeholder:"Select Manufacturer",disabled:!1,compact:!0}),D&&r.jsx("button",{onClick:()=>W(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[55]",children:[r.jsx(kt,{label:"Supplier",doctype:"Supplier",value:G,onChange:ve=>J(ve),placeholder:"Select Supplier",disabled:!1,compact:!0}),G&&r.jsx("button",{onClick:()=>J(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[54]",children:[r.jsx(kt,{label:"Department",doctype:"Department",value:de,onChange:ve=>De(ve),placeholder:"Select Department",disabled:!1,compact:!0}),de&&r.jsx("button",{onClick:()=>De(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Priority"}),r.jsxs("select",{value:Ne,onChange:ve=>$e(ve.target.value),className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Priorities"}),r.jsx("option",{value:"Normal",children:"Normal"}),r.jsx("option",{value:"Urgent",children:"Urgent"})]}),Ne&&r.jsx("button",{onClick:()=>$e(""),className:"absolute right-8 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(vt,{size:10})})]})]})})})]})]}),St&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),r.jsx("input",{type:"text",value:ce,onChange:ve=>we(ve.target.value),onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),ot())},placeholder:"Enter filter name (e.g., 'Pending High Priority')",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{Ue(!1),we("")},className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:ot,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors flex items-center gap-2",children:[r.jsx(jr,{size:12}),"Save Filter"]})]})]})}),r.jsx(fO,{isOpen:C,onClose:()=>A(!1),selectedCount:S.size,totalCount:bt,pageCount:ze.length,onExport:We,isExporting:P,exportColumns:_}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[Ot&&T&&r.jsx("div",{className:"absolute inset-0 bg-white/60 dark:bg-gray-800/60 flex items-center justify-center z-10 backdrop-blur-[1px]",children:r.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:la,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:Je?"Deselect all":"Select all",children:Je?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):Lt?r.jsxs("div",{className:"relative",children:[r.jsx(wr,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(wr,{size:18})})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Work Order ID"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Department"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Priority"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:ze.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx($s,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No work orders found"}),bn?r.jsx("button",{onClick:ns,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):r.jsx("button",{onClick:at,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first work order"})]})})}):ze.map(ve=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${S.has(ve.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>Vt(ve.name),children:[r.jsx("td",{className:"px-4 py-4",onClick:U=>U.stopPropagation(),children:r.jsx("button",{onClick:()=>Ft(ve.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:S.has(ve.name)?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):r.jsx(wr,{size:18})})}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:ve.name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:ve.creation?new Date(ve.creation).toLocaleDateString():""})]}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:ve.asset_name||"-"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:ve.asset||""})]}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:ve.work_order_type||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:ve.department||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Bn(ve.repair_status||""),r.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${js(ve.repair_status||"")}`,children:ve.repair_status||"Unknown"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${er(ve.custom_priority_||"")}`,children:ve.custom_priority_||"Normal"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:U=>U.stopPropagation(),children:[r.jsx("button",{onClick:()=>Vt(ve.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:r.jsx(hl,{})}),r.jsx("button",{onClick:()=>aa(ve.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Work Order",children:r.jsx(Rr,{})}),r.jsx("button",{onClick:()=>Va(ve.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate Work Order",children:r.jsx(Cc,{})}),r.jsx("button",{onClick:()=>f(ve.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete Work Order",disabled:jt,children:r.jsx(ha,{})}),r.jsxs("div",{className:"relative",ref:g===ve.name?x:null,children:[r.jsx("button",{onClick:()=>p(g===ve.name?null:ve.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded transition-colors",title:"More Actions",children:r.jsx(g0,{})}),g===ve.name&&r.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:[r.jsxs("button",{onClick:()=>{zn(ve),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-t-lg",children:[r.jsx(_i,{className:"text-blue-500"}),"Export as JSON"]}),r.jsxs("button",{onClick:()=>{Vr(ve.name),p(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-b-lg",children:[r.jsx(so,{className:"text-purple-500"}),"Print Work Order"]})]})]})]})})]},ve.name))})]})}),ze.length>0&&r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-4 flex items-center justify-between border-t border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",r.jsx("span",{className:"font-medium",children:i*y+1})," to"," ",r.jsx("span",{className:"font-medium",children:Math.min((i+1)*y,bt)})," ","of ",r.jsx("span",{className:"font-medium",children:bt})," results",Y&&r.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(filtered)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{disabled:i===0,onClick:()=>d(i-1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),r.jsx("button",{disabled:!Nt,onClick:()=>d(i+1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]}),c&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(ha,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Work Order"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this work order? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Work Order ID:"})," ",c]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>f(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:jt,children:"Cancel"}),r.jsx("button",{onClick:()=>Ma(c),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",disabled:jt,children:jt?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ha,{}),"Delete Work Order"]})})]})]})]})})}),r.jsx("style",{children:`
|
||
@keyframes scale-in {
|
||
from {
|
||
transform: scale(0.95);
|
||
opacity: 0;
|
||
}
|
||
to {
|
||
transform: scale(1);
|
||
opacity: 1;
|
||
}
|
||
}
|
||
.animate-scale-in {
|
||
animation: scale-in 0.2s ease-out;
|
||
}
|
||
|
||
.scrollbar-hide {
|
||
-ms-overflow-style: none;
|
||
scrollbar-width: none;
|
||
}
|
||
.scrollbar-hide::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
`})]})};let gc=null,pc=null;const mO=(e,t)=>{gc=e,t&&(pc=t),console.log("[Workflow] User set manually:",e,"Roles:",t)},gO=()=>{gc=null,pc=null},Bp=()=>oe(null,null,function*(){try{if(gc&&pc)return console.log("[Workflow] Using cached user:",gc,"roles:",pc),{user:gc,roles:pc};const e=yield rt.getUserDetails();if(e&&e.email){const t=e.email||e.user_id,a=e.roles||[];return gc=t,pc=a,console.log("[Workflow] User from getUserDetails():",t),console.log("[Workflow] Roles from getUserDetails():",a),{user:t,roles:a}}return console.warn("[Workflow] getUserDetails() returned no user"),{user:"",roles:[]}}catch(e){return console.error("[Workflow] Error getting user details:",e),{user:"",roles:[]}}}),pO=()=>oe(null,null,function*(){const{user:e}=yield Bp();return e}),ih=()=>oe(null,null,function*(){const{roles:e}=yield Bp();return e}),lh=()=>oe(null,null,function*(){try{const e=yield ih(),t=e.includes("System Manager");return console.log("[Workflow] Is System Manager:",t,"Roles:",e),t}catch(e){return console.error("[Workflow] Error checking System Manager role:",e),!1}}),Up=(e,t)=>{if(!e||e.trim()==="")return!0;try{console.log("[Workflow] Evaluating condition:",e),console.log("[Workflow] Document data for condition:",{asset_type:t.asset_type,site_name:t.site_name,need_procurement:t.need_procurement,custom_assign_to_contractor:t.custom_assign_to_contractor,docstatus:t.docstatus});let a=e;a=a.replace(/\band\b/g,"&&"),a=a.replace(/\bor\b/g,"||"),a=a.replace(/\bnot\s+/g,"!"),a=a.replace(/\bTrue\b/g,"true"),a=a.replace(/\bFalse\b/g,"false"),a=a.replace(/\bNone\b/g,"null"),a=a.replace(/doc\.(\w+)/g,(i,d)=>{const c=t[d];return c==null||c===""?"false":typeof c=="string"?`"${c.replace(/"/g,'\\"')}"`:typeof c=="boolean"?c?"true":"false":typeof c=="number"?String(c):JSON.stringify(c)}),a=a.replace(/== 1/g,"=== 1"),a=a.replace(/== 0/g,"=== 0"),a=a.replace(/!= 1/g,"!== 1"),a=a.replace(/!= 0/g,"!== 0"),console.log("[Workflow] Transformed condition:",a);const s=new Function(`return (${a})`)();return console.log("[Workflow] Condition result:",s),!!s}catch(a){return console.error("[Workflow] Error evaluating condition:",e,a),!1}},oh=e=>oe(null,null,function*(){var t,a,s,i;try{console.log("[Workflow] Getting workflow info for doctype:",e);const d=yield rt.apiCall(`/api/resource/Workflow?filters=[["document_type","=","${e}"],["is_active","=",1]]&fields=["name","workflow_state_field"]&limit=1`);if(console.log("[Workflow] Workflow response:",d),!(d!=null&&d.data)||d.data.length===0)return console.warn("[Workflow] No active workflow found for doctype:",e),null;const c=d.data[0].name;console.log("[Workflow] Found workflow:",c);const f=yield rt.apiCall(`/api/resource/Workflow/${encodeURIComponent(c)}`);return console.log("[Workflow] Full workflow data:",f==null?void 0:f.data),console.log("[Workflow] Transitions count:",(a=(t=f==null?void 0:f.data)==null?void 0:t.transitions)==null?void 0:a.length),console.log("[Workflow] States count:",(i=(s=f==null?void 0:f.data)==null?void 0:s.states)==null?void 0:i.length),{workflow_name:f.data.name,workflow_state:"",workflow_state_field:f.data.workflow_state_field,transitions:f.data.transitions||[],states:f.data.states||[]}}catch(d){return console.error("[Workflow] Error fetching workflow info:",d),null}}),Gw=(e,t,a)=>oe(null,null,function*(){try{console.log("[Workflow] Getting all transitions for state:",t);const s=yield oh(e);if(!s)return console.warn("[Workflow] No workflow info found"),[];console.log("[Workflow] All transitions from workflow:",s.transitions.length);let i=s.transitions.filter(f=>f.state===t);console.log("[Workflow] Transitions for state",t,":",i.length),a&&(i=i.filter(f=>{const g=Up(f.condition,a);return console.log(`[Workflow] Transition "${f.action}" (allowed: ${f.allowed}) condition "${f.condition||"none"}" = ${g}`),g}),console.log("[Workflow] Transitions after condition evaluation:",i.length));const d=new Set,c=[];for(const f of i){const g=`${f.action}::${f.next_state}`;d.has(g)?console.log(`[Workflow] Skipping duplicate: ${f.action} → ${f.next_state} (allowed: ${f.allowed})`):(d.add(g),c.push(f))}return console.log("[Workflow] Unique transitions after deduplication:",c.length),c}catch(s){return console.error("[Workflow] Error fetching all transitions:",s),[]}}),xO=(e,t,a,s)=>oe(null,null,function*(){var i;try{console.log("[Workflow] getWorkflowTransitions called with:",{doctype:e,docname:t,currentState:a});const d=yield lh(),c=yield ih();if(console.log("[Workflow] User is System Manager:",d),console.log("[Workflow] User roles:",c),d&&a){console.log("[Workflow] System Manager detected, getting all transitions for state:",a);const p=yield Gw(e,a,s);return console.log("[Workflow] Final transitions for System Manager:",p.map(x=>`${x.action} → ${x.next_state}`)),p}console.log("[Workflow] Non-System Manager, using Frappe API");const f=yield rt.apiCall("/api/method/frappe.model.workflow.get_transitions",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:t})})});console.log("[Workflow] Frappe transitions raw response:",f);let g=[];if(Array.isArray(f)?g=f:f!=null&&f.message&&Array.isArray(f.message)?g=f.message:f!=null&&f.data&&Array.isArray(f.data)?g=f.data:(i=f==null?void 0:f.data)!=null&&i.message&&Array.isArray(f.data.message)&&(g=f.data.message),console.log("[Workflow] Parsed transitions:",g),console.log("[Workflow] Transitions count:",g.length),g.length===0&&a&&s){console.log("[Workflow] Frappe API returned no transitions, trying local filtering");const p=yield oh(e);if(p){const x=p.transitions.filter(k=>!(k.state!==a||!c.includes(k.allowed)||!Up(k.condition,s))),y=new Set,_=[];for(const k of x){const T=`${k.action}::${k.next_state}`;y.has(T)||(y.add(T),_.push(k))}return console.log("[Workflow] Local filtered transitions:",_),_}}return g}catch(d){return console.error("[Workflow] Error fetching workflow transitions:",d),[]}}),yO=(e,t,a,s)=>oe(null,null,function*(){try{if(console.log("[Workflow] Applying action:",{doctype:e,docname:t,action:a,nextState:s}),(yield lh())&&s)try{const c=yield rt.apiCall("/api/method/frappe.model.workflow.apply_workflow",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:t}),action:a})});return console.log("[Workflow] Action applied successfully via workflow API"),c==null?void 0:c.message}catch(c){console.log("[Workflow] Normal workflow failed, System Manager forcing state change...");const f=yield rt.apiCall(`/api/resource/${e}/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({workflow_state:s})});return console.log("[Workflow] Force update response:",f),f==null?void 0:f.data}const d=yield rt.apiCall("/api/method/frappe.model.workflow.apply_workflow",{method:"POST",body:JSON.stringify({doc:JSON.stringify({doctype:e,name:t}),action:a})});return console.log("[Workflow] Action applied successfully"),d==null?void 0:d.message}catch(i){throw console.error("[Workflow] Error applying workflow action:",i),i}}),bO=(e,t,a)=>oe(null,null,function*(){try{if(yield lh())return console.log("[Workflow] System Manager can always edit"),!0;const i=yield oh(e);if(!i)return!0;const d=yield ih(),c=i.states.filter(g=>g.state===a);if(c.length===0)return!0;const f=c.some(g=>d.includes(g.allow_edit));return console.log("[Workflow] Can user edit:",f,"User roles:",d,"Allowed roles:",c.map(g=>g.allow_edit)),f}catch(s){return console.error("[Workflow] Error checking edit permission:",s),!1}}),Zw=e=>{const t={Draft:{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-800 dark:text-gray-200",border:"border-gray-300 dark:border-gray-600"},"Sent To Maintenance manger":{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-800 dark:text-blue-200",border:"border-blue-300 dark:border-blue-600"},"Sent to Team Leader":{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-800 dark:text-blue-200",border:"border-blue-300 dark:border-blue-600"},"Sent to General WOA":{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-800 dark:text-blue-200",border:"border-blue-300 dark:border-blue-600"},"Repair InProgress":{bg:"bg-yellow-100 dark:bg-yellow-900/30",text:"text-yellow-800 dark:text-yellow-200",border:"border-yellow-300 dark:border-yellow-600"},"Pending Purchase":{bg:"bg-orange-100 dark:bg-orange-900/30",text:"text-orange-800 dark:text-orange-200",border:"border-orange-300 dark:border-orange-600"},"Pending Approval":{bg:"bg-purple-100 dark:bg-purple-900/30",text:"text-purple-800 dark:text-purple-200",border:"border-purple-300 dark:border-purple-600"},Completed:{bg:"bg-green-100 dark:bg-green-900/30",text:"text-green-800 dark:text-green-200",border:"border-green-300 dark:border-green-600"},Rejected:{bg:"bg-red-100 dark:bg-red-900/30",text:"text-red-800 dark:text-red-200",border:"border-red-300 dark:border-red-600"},Cancelled:{bg:"bg-red-100 dark:bg-red-900/30",text:"text-red-800 dark:text-red-200",border:"border-red-300 dark:border-red-600"},Closed:{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-800 dark:text-gray-200",border:"border-gray-300 dark:border-gray-600"},Applied:{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-800 dark:text-blue-200",border:"border-blue-300 dark:border-blue-600"}};return t[e]||t.Draft},qw=e=>({Apply:"bg-blue-600 hover:bg-blue-700 text-white","Send For Repair":"bg-yellow-600 hover:bg-yellow-700 text-white","Send For Approval":"bg-purple-600 hover:bg-purple-700 text-white","Material Request":"bg-orange-600 hover:bg-orange-700 text-white",Accept:"bg-green-600 hover:bg-green-700 text-white",Reject:"bg-red-600 hover:bg-red-700 text-white",Close:"bg-gray-600 hover:bg-gray-700 text-white","Re-Open":"bg-blue-600 hover:bg-blue-700 text-white",Cancel:"bg-red-600 hover:bg-red-700 text-white",Approve:"bg-green-600 hover:bg-green-700 text-white"})[e]||"bg-blue-600 hover:bg-blue-700 text-white",Yw=e=>({Apply:"📤","Send For Repair":"🔧","Send For Approval":"📋","Material Request":"📦",Accept:"✅",Reject:"❌",Close:"🔒","Re-Open":"🔓",Cancel:"🚫",Approve:"✅"})[e]||"▶️",ql={getWorkflowTransitions:xO,applyWorkflowAction:yO,getWorkflowInfo:oh,getCurrentUserRoles:ih,getCurrentUser:pO,getCurrentUserAndRoles:Bp,setCurrentUser:mO,clearCurrentUser:gO,canUserEditDocument:bO,getWorkflowStateStyle:Zw,getActionButtonStyle:qw,getActionIcon:Yw,isSystemManager:lh,getAllTransitionsForState:Gw,evaluateCondition:Up},Xw=({doctype:e,docname:t,workflowState:a,enabled:s=!0,docData:i})=>{const[d,c]=j.useState([]),[f,g]=j.useState(null),[p,x]=j.useState([]),[y,_]=j.useState(""),[k,T]=j.useState(!1),[N,S]=j.useState(!1),[O,C]=j.useState(!1),[A,P]=j.useState(null),[I,ee]=j.useState(!0);j.useEffect(()=>{if(!s)return;oe(null,null,function*(){try{const ue=yield ql.getWorkflowInfo(e);g(ue)}catch(ue){console.error("Error fetching workflow info:",ue)}})},[e,s]),j.useEffect(()=>{if(!s)return;oe(null,null,function*(){try{const[ue,xe,le]=yield Promise.all([ql.getCurrentUserRoles(),ql.getCurrentUser(),ql.isSystemManager()]);x(ue),_(xe),T(le),le&&ee(!0)}catch(ue){console.error("Error fetching user info:",ue)}})},[s]);const B=j.useCallback(()=>oe(null,null,function*(){if(!t||!s){c([]);return}S(!0),P(null);try{const Y=yield ql.getWorkflowTransitions(e,t,a,i);if(console.log("[useWorkflow] Available transitions:",Y),c(Y),a){const ue=yield ql.canUserEditDocument(e,t,a);ee(ue)}}catch(Y){console.error("Error fetching transitions:",Y),P("Failed to load workflow actions"),c([])}finally{S(!1)}}),[e,t,a,s,i]);j.useEffect(()=>{B()},[B]);const H=j.useCallback((Y,ue)=>oe(null,null,function*(){if(!t)return P("Document not saved yet"),!1;C(!0),P(null);try{return yield ql.applyWorkflowAction(e,t,Y,ue),yield B(),!0}catch(xe){console.error("Error applying workflow action:",xe);let le="Failed to apply action";if(xe.message)le=xe.message;else if(xe._server_messages)try{le=JSON.parse(xe._server_messages).map(be=>{try{return JSON.parse(be).message}catch(me){return be}}).join(`
|
||
`)}catch(ge){le=xe._server_messages}return P(le),!1}finally{C(!1)}}),[e,t,B]);return{transitions:d,workflowInfo:f,userRoles:p,currentUser:y,isSystemManager:k,loading:N,actionLoading:O,error:A,canEdit:I,applyAction:H,refreshTransitions:B,getStateStyle:Zw,getButtonStyle:qw,getIcon:Yw}};function Jw(e){var t,a,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(a=Jw(e[t]))&&(s&&(s+=" "),s+=a)}else for(a in e)e[a]&&(s&&(s+=" "),s+=a);return s}function ro(){for(var e,t,a=0,s="",i=arguments.length;a<i;a++)(e=arguments[a])&&(t=Jw(e))&&(s&&(s+=" "),s+=t);return s}function vO(e){if(typeof document=="undefined")return;let t=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",t.firstChild?t.insertBefore(a,t.firstChild):t.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}vO(`:root{--toastify-color-light: #fff;--toastify-color-dark: #121212;--toastify-color-info: #3498db;--toastify-color-success: #07bc0c;--toastify-color-warning: #f1c40f;--toastify-color-error: hsl(6, 78%, 57%);--toastify-color-transparent: rgba(255, 255, 255, .7);--toastify-icon-color-info: var(--toastify-color-info);--toastify-icon-color-success: var(--toastify-color-success);--toastify-icon-color-warning: var(--toastify-color-warning);--toastify-icon-color-error: var(--toastify-color-error);--toastify-container-width: fit-content;--toastify-toast-width: 320px;--toastify-toast-offset: 16px;--toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));--toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));--toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));--toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));--toastify-toast-background: #fff;--toastify-toast-padding: 14px;--toastify-toast-min-height: 64px;--toastify-toast-max-height: 800px;--toastify-toast-bd-radius: 6px;--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toastify-font-family: sans-serif;--toastify-z-index: 9999;--toastify-text-color-light: #757575;--toastify-text-color-dark: #fff;--toastify-text-color-info: #fff;--toastify-text-color-success: #fff;--toastify-text-color-warning: #fff;--toastify-text-color-error: #fff;--toastify-spinner-color: #616161;--toastify-spinner-color-empty-area: #e0e0e0;--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);--toastify-color-progress-dark: #bb86fc;--toastify-color-progress-info: var(--toastify-color-info);--toastify-color-progress-success: var(--toastify-color-success);--toastify-color-progress-warning: var(--toastify-color-warning);--toastify-color-progress-error: var(--toastify-color-error);--toastify-color-progress-bgo: .2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translate3d(0,0,var(--toastify-z-index));position:fixed;width:var(--toastify-container-width);box-sizing:border-box;color:#fff;display:flex;flex-direction:column}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right);align-items:end}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right);align-items:end}.Toastify__toast{--y: 0;position:relative;touch-action:none;width:var(--toastify-toast-width);min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:var(--toastify-toast-padding);border-radius:var(--toastify-toast-bd-radius);box-shadow:var(--toastify-toast-shadow);max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);z-index:0;display:flex;flex:1 auto;align-items:center;word-break:break-word}@media only screen and (max-width: 480px){.Toastify__toast-container{width:100vw;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-left,.Toastify__toast-container--top-center,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translate(0)}.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translate(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:initial}.Toastify__toast{--toastify-toast-width: 100%;margin-bottom:0;border-radius:0}}.Toastify__toast-container[data-stacked=true]{width:var(--toastify-toast-width)}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,.Toastify__toast--stacked[data-collapsed] .Toastify__close-button{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-icon{margin-inline-end:10px;width:22px;flex-shrink:0;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--light,.Toastify__toast-theme--colored.Toastify__toast--default{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;position:absolute;top:6px;right:6px;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;z-index:1}.Toastify__toast--rtl .Toastify__close-button{left:6px;right:unset}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:hover,.Toastify__close-button:focus{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:1;opacity:.7;transform-origin:left}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:initial;transform-origin:right;border-bottom-left-radius:initial}.Toastify__progress-bar--wrp{position:absolute;overflow:hidden;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius);border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--top-left,.Toastify__bounce-enter--bottom-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--top-right,.Toastify__bounce-enter--bottom-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--top-left,.Toastify__bounce-exit--bottom-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--top-right,.Toastify__bounce-exit--bottom-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--top-left,.Toastify__slide-enter--bottom-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--top-right,.Toastify__slide-enter--bottom-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--top-left,.Toastify__slide-exit--bottom-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-right,.Toastify__slide-exit--bottom-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
||
`);var T0=e=>typeof e=="number"&&!isNaN(e),uo=e=>typeof e=="string",vi=e=>typeof e=="function",_O=e=>uo(e)||T0(e),Qg=e=>uo(e)||vi(e)?e:null,wO=(e,t)=>e===!1||T0(e)&&e>0?e:t,ep=e=>j.isValidElement(e)||uo(e)||vi(e)||T0(e);function kO(e,t,a=300){let{scrollHeight:s,style:i}=e;requestAnimationFrame(()=>{i.minHeight="initial",i.height=s+"px",i.transition=`all ${a}ms`,requestAnimationFrame(()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(t,a)})})}function NO({enter:e,exit:t,appendPosition:a=!1,collapse:s=!0,collapseDuration:i=300}){return function({children:d,position:c,preventExitTransition:f,done:g,nodeRef:p,isIn:x,playToast:y}){let _=a?`${e}--${c}`:e,k=a?`${t}--${c}`:t,T=j.useRef(0);return j.useLayoutEffect(()=>{let N=p.current,S=_.split(" "),O=C=>{C.target===p.current&&(y(),N.removeEventListener("animationend",O),N.removeEventListener("animationcancel",O),T.current===0&&C.type!=="animationcancel"&&N.classList.remove(...S))};N.classList.add(...S),N.addEventListener("animationend",O),N.addEventListener("animationcancel",O)},[]),j.useEffect(()=>{let N=p.current,S=()=>{N.removeEventListener("animationend",S),s?kO(N,g,i):g()};x||(f?S():(T.current=1,N.className+=` ${k}`,N.addEventListener("animationend",S)))},[x]),ia.createElement(ia.Fragment,null,d)}}function Wv(e,t){return{content:Kw(e.content,e.props),containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,reason:e.removalReason,status:t}}function Kw(e,t,a=!1){return j.isValidElement(e)&&!uo(e.type)?j.cloneElement(e,{closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:a}):vi(e)?e({closeToast:t.closeToast,toastProps:t,data:t.data,isPaused:a}):e}function jO({closeToast:e,theme:t,ariaLabel:a="close"}){return ia.createElement("button",{className:`Toastify__close-button Toastify__close-button--${t}`,type:"button",onClick:s=>{s.stopPropagation(),e(!0)},"aria-label":a},ia.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},ia.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function SO({delay:e,isRunning:t,closeToast:a,type:s="default",hide:i,className:d,controlledProgress:c,progress:f,rtl:g,isIn:p,theme:x}){let y=i||c&&f===0,_={animationDuration:`${e}ms`,animationPlayState:t?"running":"paused"};c&&(_.transform=`scaleX(${f})`);let k=ro("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${x}`,`Toastify__progress-bar--${s}`,{"Toastify__progress-bar--rtl":g}),T=vi(d)?d({rtl:g,type:s,defaultClassName:k}):ro(k,d),N={[c&&f>=1?"onTransitionEnd":"onAnimationEnd"]:c&&f<1?null:()=>{p&&a()}};return ia.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":y},ia.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${x} Toastify__progress-bar--${s}`}),ia.createElement("div",ie({role:"progressbar","aria-hidden":y?"true":"false","aria-label":"notification timer",className:T,style:_},N)))}var TO=1,Qw=()=>`${TO++}`;function EO(e,t,a){let s=1,i=0,d=[],c=[],f=t,g=new Map,p=new Set,x=C=>(p.add(C),()=>p.delete(C)),y=()=>{c=Array.from(g.values()),p.forEach(C=>C())},_=({containerId:C,toastId:A,updateId:P})=>{let I=C?C!==e:e!==1,ee=g.has(A)&&P==null;return I||ee},k=(C,A)=>{g.forEach(P=>{var I;(A==null||A===P.props.toastId)&&((I=P.toggle)==null||I.call(P,C))})},T=C=>{var A,P;(P=(A=C.props)==null?void 0:A.onClose)==null||P.call(A,C.removalReason),C.isActive=!1},N=C=>{if(C==null)g.forEach(T);else{let A=g.get(C);A&&T(A)}y()},S=()=>{i-=d.length,d=[]},O=C=>{var A,P;let{toastId:I,updateId:ee}=C.props,B=ee==null;C.staleId&&g.delete(C.staleId),C.isActive=!0,g.set(I,C),y(),a(Wv(C,B?"added":"updated")),B&&((P=(A=C.props).onOpen)==null||P.call(A))};return{id:e,props:f,observe:x,toggle:k,removeToast:N,toasts:g,clearQueue:S,buildToast:(C,A)=>{if(_(A))return;let{toastId:P,updateId:I,data:ee,staleId:B,delay:H}=A,Y=I==null;Y&&i++;let ue=Ee(ie(Ee(ie({},f),{style:f.toastStyle,key:s++}),Object.fromEntries(Object.entries(A).filter(([le,ge])=>ge!=null))),{toastId:P,updateId:I,data:ee,isIn:!1,className:Qg(A.className||f.toastClassName),progressClassName:Qg(A.progressClassName||f.progressClassName),autoClose:A.isLoading?!1:wO(A.autoClose,f.autoClose),closeToast(le){g.get(P).removalReason=le,N(P)},deleteToast(){let le=g.get(P);if(le!=null){if(a(Wv(le,"removed")),g.delete(P),i--,i<0&&(i=0),d.length>0){O(d.shift());return}y()}}});ue.closeButton=f.closeButton,A.closeButton===!1||ep(A.closeButton)?ue.closeButton=A.closeButton:A.closeButton===!0&&(ue.closeButton=ep(f.closeButton)?f.closeButton:!0);let xe={content:C,props:ue,staleId:B};f.limit&&f.limit>0&&i>f.limit&&Y?d.push(xe):T0(H)?setTimeout(()=>{O(xe)},H):O(xe)},setProps(C){f=C},setToggle:(C,A)=>{let P=g.get(C);P&&(P.toggle=A)},isToastActive:C=>{var A;return(A=g.get(C))==null?void 0:A.isActive},getSnapshot:()=>c}}var Jr=new Map,d0=[],tp=new Set,CO=e=>tp.forEach(t=>t(e)),ek=()=>Jr.size>0;function AO(){d0.forEach(e=>ak(e.content,e.options)),d0=[]}var OO=(e,{containerId:t})=>{var a;return(a=Jr.get(t||1))==null?void 0:a.toasts.get(e)};function tk(e,t){var a;if(t)return!!((a=Jr.get(t))!=null&&a.isToastActive(e));let s=!1;return Jr.forEach(i=>{i.isToastActive(e)&&(s=!0)}),s}function MO(e){if(!ek()){d0=d0.filter(t=>e!=null&&t.options.toastId!==e);return}if(e==null||_O(e))Jr.forEach(t=>{t.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){let t=Jr.get(e.containerId);t?t.removeToast(e.id):Jr.forEach(a=>{a.removeToast(e.id)})}}var LO=(e={})=>{Jr.forEach(t=>{t.props.limit&&(!e.containerId||t.id===e.containerId)&&t.clearQueue()})};function ak(e,t){ep(e)&&(ek()||d0.push({content:e,options:t}),Jr.forEach(a=>{a.buildToast(e,t)}))}function DO(e){var t;(t=Jr.get(e.containerId||1))==null||t.setToggle(e.id,e.fn)}function rk(e,t){Jr.forEach(a=>{(t==null||!(t!=null&&t.containerId)||(t==null?void 0:t.containerId)===a.id)&&a.toggle(e,t==null?void 0:t.id)})}function PO(e){let t=e.containerId||1;return{subscribe(a){let s=EO(t,e,CO);Jr.set(t,s);let i=s.observe(a);return AO(),()=>{i(),Jr.delete(t)}},setProps(a){var s;(s=Jr.get(t))==null||s.setProps(a)},getSnapshot(){var a;return(a=Jr.get(t))==null?void 0:a.getSnapshot()}}}function RO(e){return tp.add(e),()=>{tp.delete(e)}}function FO(e){return e&&(uo(e.toastId)||T0(e.toastId))?e.toastId:Qw()}function E0(e,t){return ak(e,t),t.toastId}function ch(e,t){return Ee(ie({},t),{type:t&&t.type||e,toastId:FO(t)})}function dh(e){return(t,a)=>E0(t,ch(e,a))}function Et(e,t){return E0(e,ch("default",t))}Et.loading=(e,t)=>E0(e,ch("default",ie({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},t)));function IO(e,{pending:t,error:a,success:s},i){let d;t&&(d=uo(t)?Et.loading(t,i):Et.loading(t.render,ie(ie({},i),t)));let c={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},f=(p,x,y)=>{if(x==null){Et.dismiss(d);return}let _=Ee(ie(ie({type:p},c),i),{data:y}),k=uo(x)?{render:x}:x;return d?Et.update(d,ie(ie({},_),k)):Et(k.render,ie(ie({},_),k)),y},g=vi(e)?e():e;return g.then(p=>f("success",s,p)).catch(p=>f("error",a,p)),g}Et.promise=IO;Et.success=dh("success");Et.info=dh("info");Et.error=dh("error");Et.warning=dh("warning");Et.warn=Et.warning;Et.dark=(e,t)=>E0(e,ch("default",ie({theme:"dark"},t)));function zO(e){MO(e)}Et.dismiss=zO;Et.clearWaitingQueue=LO;Et.isActive=tk;Et.update=(e,t={})=>{let a=OO(e,t);if(a){let{props:s,content:i}=a,d=Ee(ie(ie({delay:100},s),t),{toastId:t.toastId||e,updateId:Qw()});d.toastId!==e&&(d.staleId=e);let c=d.render||i;delete d.render,E0(c,d)}};Et.done=e=>{Et.update(e,{progress:1})};Et.onChange=RO;Et.play=e=>rk(!0,e);Et.pause=e=>rk(!1,e);function BO(e){var t;let{subscribe:a,getSnapshot:s,setProps:i}=j.useRef(PO(e)).current;i(e);let d=(t=j.useSyncExternalStore(a,s,s))==null?void 0:t.slice();function c(f){if(!d)return[];let g=new Map;return e.newestOnTop&&d.reverse(),d.forEach(p=>{let{position:x}=p.props;g.has(x)||g.set(x,[]),g.get(x).push(p)}),Array.from(g,p=>f(p[0],p[1]))}return{getToastToRender:c,isToastActive:tk,count:d==null?void 0:d.length}}function UO(e){let[t,a]=j.useState(!1),[s,i]=j.useState(!1),d=j.useRef(null),c=j.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:f,pauseOnHover:g,closeToast:p,onClick:x,closeOnClick:y}=e;DO({id:e.toastId,containerId:e.containerId,fn:a}),j.useEffect(()=>{if(e.pauseOnFocusLoss)return _(),()=>{k()}},[e.pauseOnFocusLoss]);function _(){document.hasFocus()||O(),window.addEventListener("focus",S),window.addEventListener("blur",O)}function k(){window.removeEventListener("focus",S),window.removeEventListener("blur",O)}function T(B){if(e.draggable===!0||e.draggable===B.pointerType){C();let H=d.current;c.canCloseOnClick=!0,c.canDrag=!0,H.style.transition="none",e.draggableDirection==="x"?(c.start=B.clientX,c.removalDistance=H.offsetWidth*(e.draggablePercent/100)):(c.start=B.clientY,c.removalDistance=H.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent)/100)}}function N(B){let{top:H,bottom:Y,left:ue,right:xe}=d.current.getBoundingClientRect();B.nativeEvent.type!=="touchend"&&e.pauseOnHover&&B.clientX>=ue&&B.clientX<=xe&&B.clientY>=H&&B.clientY<=Y?O():S()}function S(){a(!0)}function O(){a(!1)}function C(){c.didMove=!1,document.addEventListener("pointermove",P),document.addEventListener("pointerup",I)}function A(){document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",I)}function P(B){let H=d.current;if(c.canDrag&&H){c.didMove=!0,t&&O(),e.draggableDirection==="x"?c.delta=B.clientX-c.start:c.delta=B.clientY-c.start,c.start!==B.clientX&&(c.canCloseOnClick=!1);let Y=e.draggableDirection==="x"?`${c.delta}px, var(--y)`:`0, calc(${c.delta}px + var(--y))`;H.style.transform=`translate3d(${Y},0)`,H.style.opacity=`${1-Math.abs(c.delta/c.removalDistance)}`}}function I(){A();let B=d.current;if(c.canDrag&&c.didMove&&B){if(c.canDrag=!1,Math.abs(c.delta)>c.removalDistance){i(!0),e.closeToast(!0),e.collapseAll();return}B.style.transition="transform 0.2s, opacity 0.2s",B.style.removeProperty("transform"),B.style.removeProperty("opacity")}}let ee={onPointerDown:T,onPointerUp:N};return f&&g&&(ee.onMouseEnter=O,e.stacked||(ee.onMouseLeave=S)),y&&(ee.onClick=B=>{x&&x(B),c.canCloseOnClick&&p(!0)}),{playToast:S,pauseToast:O,isRunning:t,preventExitTransition:s,toastRef:d,eventHandlers:ee}}var HO=typeof window!="undefined"?j.useLayoutEffect:j.useEffect,uh=i=>{var d=i,{theme:e,type:t,isLoading:a}=d,s=fn(d,["theme","type","isLoading"]);return ia.createElement("svg",ie({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`},s))};function $O(e){return ia.createElement(uh,ie({},e),ia.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function WO(e){return ia.createElement(uh,ie({},e),ia.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function VO(e){return ia.createElement(uh,ie({},e),ia.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function GO(e){return ia.createElement(uh,ie({},e),ia.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function ZO(){return ia.createElement("div",{className:"Toastify__spinner"})}var ap={info:WO,warning:$O,success:VO,error:GO,spinner:ZO},qO=e=>e in ap;function YO({theme:e,type:t,isLoading:a,icon:s}){let i=null,d={theme:e,type:t};return s===!1||(vi(s)?i=s(Ee(ie({},d),{isLoading:a})):j.isValidElement(s)?i=j.cloneElement(s,d):a?i=ap.spinner():qO(t)&&(i=ap[t](d))),i}var XO=e=>{let{isRunning:t,preventExitTransition:a,toastRef:s,eventHandlers:i,playToast:d}=UO(e),{closeButton:c,children:f,autoClose:g,onClick:p,type:x,hideProgressBar:y,closeToast:_,transition:k,position:T,className:N,style:S,progressClassName:O,updateId:C,role:A,progress:P,rtl:I,toastId:ee,deleteToast:B,isIn:H,isLoading:Y,closeOnClick:ue,theme:xe,ariaLabel:le}=e,ge=ro("Toastify__toast",`Toastify__toast-theme--${xe}`,`Toastify__toast--${x}`,{"Toastify__toast--rtl":I},{"Toastify__toast--close-on-click":ue}),be=vi(N)?N({rtl:I,position:T,type:x,defaultClassName:ge}):ro(ge,N),me=YO(e),ae=!!P||!g,Z={closeToast:_,type:x,theme:xe},K=null;return c===!1||(vi(c)?K=c(Z):j.isValidElement(c)?K=j.cloneElement(c,Z):K=jO(Z)),ia.createElement(k,{isIn:H,done:B,position:T,preventExitTransition:a,nodeRef:s,playToast:d},ia.createElement("div",ie(Ee(ie({id:ee,tabIndex:0,onClick:p,"data-in":H,className:be},i),{style:S,ref:s}),H&&{role:A,"aria-label":le}),me!=null&&ia.createElement("div",{className:ro("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!Y})},me),Kw(f,e,!t),K,!e.customProgressBar&&ia.createElement(SO,Ee(ie({},C&&!ae?{key:`p-${C}`}:{}),{rtl:I,theme:xe,delay:g,isRunning:t,isIn:H,closeToast:_,hide:y,type:x,className:O,controlledProgress:ae,progress:P||0}))))},JO=(e,t=!1)=>({enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}),fh=NO(JO("bounce",!0)),KO={position:"top-right",transition:fh,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light","aria-label":"Notifications Alt+T",hotKeys:e=>e.altKey&&e.code==="KeyT"};function Hp(e){let t=ie(ie({},KO),e),a=e.stacked,[s,i]=j.useState(!0),d=j.useRef(null),{getToastToRender:c,isToastActive:f,count:g}=BO(t),{className:p,style:x,rtl:y,containerId:_,hotKeys:k}=t;function T(S){let O=ro("Toastify__toast-container",`Toastify__toast-container--${S}`,{"Toastify__toast-container--rtl":y});return vi(p)?p({position:S,rtl:y,defaultClassName:O}):ro(O,Qg(p))}function N(){a&&(i(!0),Et.play())}return HO(()=>{var S;if(a){let O=d.current.querySelectorAll('[data-in="true"]'),C=12,A=(S=t.position)==null?void 0:S.includes("top"),P=0,I=0;Array.from(O).reverse().forEach((ee,B)=>{let H=ee;H.classList.add("Toastify__toast--stacked"),B>0&&(H.dataset.collapsed=`${s}`),H.dataset.pos||(H.dataset.pos=A?"top":"bot");let Y=P*(s?.2:1)+(s?0:C*B);H.style.setProperty("--y",`${A?Y:Y*-1}px`),H.style.setProperty("--g",`${C}`),H.style.setProperty("--s",`${1-(s?I:0)}`),P+=H.offsetHeight,I+=.025})}},[s,g,a]),j.useEffect(()=>{function S(O){var C;let A=d.current;k(O)&&((C=A.querySelector('[tabIndex="0"]'))==null||C.focus(),i(!1),Et.pause()),O.key==="Escape"&&(document.activeElement===A||A!=null&&A.contains(document.activeElement))&&(i(!0),Et.play())}return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[k]),ia.createElement("section",{ref:d,className:"Toastify",id:_,onMouseEnter:()=>{a&&(i(!1),Et.pause())},onMouseLeave:N,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":t["aria-label"]},c((S,O)=>{let C=O.length?ie({},x):Ee(ie({},x),{pointerEvents:"none"});return ia.createElement("div",{tabIndex:-1,className:T(S),"data-stacked":a,style:C,key:`c-${S}`},O.map(({content:A,props:P})=>ia.createElement(XO,Ee(ie({},P),{stacked:a,collapseAll:N,isIn:f(P.toastId,P.containerId),key:`t-${P.key}`}),A)))}))}const QO=({doctype:e,docname:t,workflowState:a,onActionComplete:s,onStateChange:i,showStateInfo:d=!0,className:c=""})=>{const{transitions:f,loading:g,actionLoading:p,error:x,applyAction:y,getStateStyle:_,getButtonStyle:k,getIcon:T}=Xw({doctype:e,docname:t,workflowState:a,enabled:!!t}),[N,S]=j.useState(null),O=["Reject","Cancel","Close"],C=I=>oe(null,null,function*(){if(O.includes(I)&&N!==I){S(I);return}S(null);const ee=yield y(I);s&&s(I,ee),ee&&i&&i()}),A=()=>{S(null)};if(!t)return null;const P=_(a||"Draft");return r.jsxs("div",{className:`space-y-4 ${c}`,children:[d&&a&&r.jsx("div",{className:`p-4 rounded-lg border ${P.bg} ${P.border}`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Workflow State"}),r.jsx("p",{className:`text-lg font-semibold ${P.text}`,children:a})]}),r.jsx("div",{className:`w-3 h-3 rounded-full ${P.bg.replace("100","500").replace("900/30","500")}`})]})}),g&&r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[r.jsx(Pn,{className:"animate-spin"}),r.jsx("span",{className:"text-sm",children:"Loading workflow actions..."})]}),x&&r.jsx("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(yr,{className:"text-red-500 mt-0.5"}),r.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:x})]})}),N&&r.jsxs("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:[r.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[r.jsx(yr,{className:"text-yellow-500 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200",children:"Confirm Action"}),r.jsxs("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mt-1",children:["Are you sure you want to ",r.jsx("strong",{children:N})," this work order?"]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>C(N),disabled:p,className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm rounded-md disabled:opacity-50",children:p?r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Pn,{className:"animate-spin",size:12}),"Processing..."]}):`Yes, ${N}`}),r.jsx("button",{onClick:A,disabled:p,className:"px-3 py-1.5 bg-gray-300 hover:bg-gray-400 text-gray-700 text-sm rounded-md disabled:opacity-50",children:"Cancel"})]})]}),!g&&f.length>0&&!N&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[r.jsx(Hd,{size:12}),"Available Actions"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((I,ee)=>r.jsxs("button",{onClick:()=>C(I.action),disabled:p,className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-50 flex items-center gap-2 ${k(I.action)}`,title:`Move to: ${I.next_state}`,children:[p?r.jsx(Pn,{className:"animate-spin",size:14}):r.jsx("span",{children:T(I.action)}),I.action]},`${I.action}-${ee}`))}),r.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:f.map((I,ee)=>r.jsxs("span",{className:"inline-block mr-3",children:[I.action," → ",r.jsx("span",{className:"font-medium",children:I.next_state})]},ee))})]}),!g&&f.length===0&&t&&r.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center",children:"No workflow actions available for your role"})})]})},eM="Service Report",Vv=()=>new Date().toISOString().split("T")[0],tM=(e,t)=>{if(!e)return"";const a=new Date(e);return a.setDate(a.getDate()+t),a.toISOString().split("T")[0]},aM=()=>{var la,Je,Lt;const{workOrderName:e}=ul(),t=Na(),[a]=fl(),s=a.get("duplicate"),i=a.get("asset"),d=!!i,c=e==="new",f=c&&!!s,g=()=>{if(!e||c)return;const We=`${Bt.BASE_URL}/printview?doctype=Work_Order&name=${encodeURIComponent(e)}&format=${encodeURIComponent(eM)}&trigger_print=1`;window.open(We,"_blank")||Et.warning("Please allow popups for this site to print the Service Report.",{position:"top-right",autoClose:5e3,icon:r.jsx(yr,{})})},[p,x]=j.useState(!1),{workOrder:y,loading:_,error:k,refetch:T}=sS(f?s:c?null:e||null),{createWorkOrder:N,updateWorkOrder:S,loading:O}=E_(),[C,A]=j.useState(c),[P,I]=j.useState(!1),[ee,B]=j.useState(null),[H,Y]=j.useState({company:"",work_order_type:"",asset:"",asset_name:"",description:"",repair_status:"Open",workflow_state:"Draft",department:"",custom_priority_:"Normal",asset_type:"",manufacturer:"",supplier:"",serial_number:"",model:"",custom_site_contractor:"",custom_subcontractor:"",failure_date:c?Vv():"",custom_deadline_date:"",completion_date:"",first_responded_on:"",actions_performed:"",stock_consumption:0,stock_items:[],site_name:"",need_procurement:0,custom_assign_to_contractor:"",docstatus:0,custom_assigned_supervisor:"",custom_moh_supervisor:"",total_hours_spent:0,custom_pending_reason:"",total_repair_cost:0,custom_service_agreement:"",custom_service_coverage:"",custom_start_date:"",custom_end_date:"",custom_total_amount:0,__islocal:!1}),ue=H.asset_type==="Non Biomedical",xe=j.useCallback((ye,We,at)=>{if(!ye)return"";let Vt=0;const aa=at===1;return We==="Normal"?Vt=aa?30:5:We==="Urgent"&&(Vt=aa?30:1),tM(ye,Vt)},[]);j.useEffect(()=>{if(!C)return;const ye=xe(H.failure_date,H.custom_priority_||"Normal",H.need_procurement||0);ye&&ye!==H.custom_deadline_date&&Y(We=>Ee(ie({},We),{custom_deadline_date:ye}))},[H.failure_date,H.custom_priority_,H.need_procurement,C,xe]),j.useEffect(()=>{ue&&C&&Y(ye=>Ee(ie({},ye),{asset:"",asset_name:"",serial_number:"",manufacturer:"",supplier:"",model:""}))},[ue,C]);const{shouldShowField:le,isMandatory:ge,isReadOnly:be}=Vw("Work_Order",H);j.useCallback(ye=>le(ye),[le]),j.useCallback(ye=>ge(ye),[ge]);const me=j.useCallback(ye=>be(ye),[be]);j.useCallback(ye=>C?me(ye):!0,[C,me]);const ae=j.useMemo(()=>{if(!c)return{asset_type:(y==null?void 0:y.asset_type)||H.asset_type||"",site_name:(y==null?void 0:y.site_name)||H.site_name||"",need_procurement:(y==null?void 0:y.need_procurement)||H.need_procurement||0,custom_assign_to_contractor:(y==null?void 0:y.custom_assign_to_contractor)||H.custom_assign_to_contractor||"",docstatus:(y==null?void 0:y.docstatus)||H.docstatus||0,company:(y==null?void 0:y.company)||H.company||"",department:(y==null?void 0:y.department)||H.department||"",repair_status:(y==null?void 0:y.repair_status)||H.repair_status||""}},[c,y==null?void 0:y.asset_type,y==null?void 0:y.site_name,y==null?void 0:y.need_procurement,y==null?void 0:y.custom_assign_to_contractor,y==null?void 0:y.docstatus,y==null?void 0:y.company,y==null?void 0:y.department,y==null?void 0:y.repair_status,H.asset_type,H.site_name,H.need_procurement,H.custom_assign_to_contractor,H.docstatus,H.company,H.department,H.repair_status]),{transitions:Z,loading:K,actionLoading:te,error:se,isSystemManager:F,applyAction:D,getStateStyle:W,getButtonStyle:G,getIcon:J}=Xw({doctype:"Work_Order",docname:c?null:e||null,workflowState:y==null?void 0:y.workflow_state,enabled:!c,docData:ae}),de="Al Jouf Central Warehouse - AJH",[De,Ne]=j.useState({}),$e=(ye,We)=>oe(null,null,function*(){if(!ye||!We)return 0;try{const at=yield rt.apiCall(`/api/resource/Bin?filters=[["item_code","=","${ye}"],["warehouse","=","${We}"]]&fields=["actual_qty"]&limit=1`);return at!=null&&at.data&&at.data.length>0&&at.data[0].actual_qty||0}catch(at){return console.error("Error fetching available stock:",at),0}}),Ve=ye=>oe(null,null,function*(){var We;if(!ye)return 0;try{const at=yield rt.apiCall(`/api/resource/Item/${ye}?fields=["valuation_rate"]`);return((We=at==null?void 0:at.data)==null?void 0:We.valuation_rate)||0}catch(at){return console.error("Error fetching valuation rate:",at),0}}),st=(ye,We)=>oe(null,null,function*(){const at=[...H.stock_items||[]];if(at[ye]=Ee(ie({},at[ye]),{item_code:We}),We){const Vt=yield Ve(We);if(at[ye].valuation_rate=Vt,at[ye].total_value=Vt*(at[ye].consumed_quantity||1),at[ye].warehouse){const aa=yield $e(We,at[ye].warehouse);at[ye].custom_available_stock=aa,zt(ye,at[ye].consumed_quantity,aa,We,at[ye].warehouse)}}Y(Ee(ie({},H),{stock_items:at}))}),gt=(ye,We)=>oe(null,null,function*(){const at=[...H.stock_items||[]];if(at[ye]=Ee(ie({},at[ye]),{warehouse:We}),We&&at[ye].item_code){const Vt=yield $e(at[ye].item_code,We);at[ye].custom_available_stock=Vt,zt(ye,at[ye].consumed_quantity,Vt,at[ye].item_code,We)}Y(Ee(ie({},H),{stock_items:at}))}),zt=(ye,We,at,Vt,aa)=>{We>at?(Ne(Va=>Ee(ie({},Va),{[ye]:`Insufficient stock for ${Vt} in ${aa}. Available: ${at}, Required: ${We}`})),Et.warning(`Insufficient stock for ${Vt}. Available: ${at}, Required: ${We}`,{position:"top-right",autoClose:5e3,icon:r.jsx(yr,{}),toastId:`stock-warning-${ye}`})):Ne(Va=>{const Ma=ie({},Va);return delete Ma[ye],Ma})},Ge=(ye,We)=>{const at=[...H.stock_items||[]],Vt=at[ye].valuation_rate||0,aa=at[ye].custom_available_stock||0;at[ye]=Ee(ie({},at[ye]),{consumed_quantity:We,total_value:Vt*We}),at[ye].item_code&&at[ye].warehouse&&zt(ye,We,aa,at[ye].item_code,at[ye].warehouse),Y(Ee(ie({},H),{stock_items:at}))},[Ct,St]=j.useState({});j.useEffect(()=>{const ye={};H.company&&(ye.company=H.company),St(ye)},[H.company]);const Ue=ye=>oe(null,null,function*(){if(!ye)return null;try{I(!0);const We=yield rt.apiCall(`/api/resource/Asset/${ye}`);return(We==null?void 0:We.data)||null}catch(We){return console.error("Error fetching asset details:",We),null}finally{I(!1)}}),ce=ye=>oe(null,null,function*(){if(!ye)return null;try{I(!0);const We=yield rt.apiCall(`/api/resource/Asset?filters=[["custom_serial_number","=","${ye}"]]&fields=["name","asset_name","company","department","custom_serial_number","custom_asset_type","custom_manufacturer","supplier","custom_site_contractor","custom_subcontractor","custom_model","custom_service_agreement","custom_service_coverage","custom_start_date","custom_end_date","custom_total_amount","custom_site"]&limit=1`);return We!=null&&We.data&&We.data.length>0?We.data[0]:null}catch(We){return console.error("Error fetching asset by serial number:",We),null}finally{I(!1)}}),we=ye=>ye?ye.split(" ")[0]:"",Ie=ye=>{ye&&Y(We=>Ee(ie({},We),{asset:ye.name||We.asset,asset_name:ye.asset_name||"",company:ye.company||"",department:ye.department||"",serial_number:ye.custom_serial_number||"",asset_type:ye.custom_asset_type||"",manufacturer:ye.custom_manufacturer||"",supplier:ye.supplier||"",custom_site_contractor:ye.custom_site_contractor||"",custom_subcontractor:ye.custom_subcontractor||"",model:ye.custom_model||"",site_name:ye.custom_site||"",custom_service_agreement:ye.custom_service_agreement||"",custom_service_coverage:ye.custom_service_coverage||"",custom_start_date:we(ye.custom_start_date)||"",custom_end_date:we(ye.custom_end_date)||"",custom_total_amount:ye.custom_total_amount||0}))},lt=ye=>oe(null,null,function*(){if(Y(We=>Ee(ie({},We),{asset:ye})),ye){const We=yield Ue(ye);We&&Ie(We)}else Y(We=>Ee(ie({},We),{asset:"",asset_name:"",serial_number:"",asset_type:"",manufacturer:"",supplier:"",custom_site_contractor:"",custom_subcontractor:"",model:"",site_name:"",custom_service_agreement:"",custom_service_coverage:"",custom_start_date:"",custom_end_date:"",custom_total_amount:0}))}),ft=()=>oe(null,null,function*(){if(!H.serial_number){Et.warning("Please enter a serial number to search",{position:"top-right",autoClose:3e3,icon:r.jsx(yr,{})});return}const ye=yield ce(H.serial_number);ye?(Ie(ye),Et.success(`Asset found: ${ye.asset_name||ye.name}`,{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})})):Et.error("No asset found with this serial number",{position:"top-right",autoClose:4e3,icon:r.jsx(hn,{})})}),Ze=()=>oe(null,null,function*(){if(H.serial_number&&!H.asset){const ye=yield ce(H.serial_number);ye&&Ie(ye)}});j.useEffect(()=>{if(c&&d&&!f){const ye={asset:a.get("asset")||"",asset_name:a.get("asset_name")||"",asset_type:a.get("asset_type")||"",manufacturer:a.get("manufacturer")||"",supplier:a.get("supplier")||"",serial_number:a.get("serial_number")||"",department:a.get("department")||"",custom_site_contractor:a.get("site_contractor")||"",custom_subcontractor:a.get("subcontractor")||"",company:a.get("company")||"",site_name:a.get("site_name")||""};Y(We=>Ee(ie(ie({},We),ye),{repair_status:"Open",workflow_state:"Draft",custom_priority_:"Normal",failure_date:Vv()}))}},[c,d,f,a]),j.useEffect(()=>{y&&Y({company:y.company||"",work_order_type:y.work_order_type||"",asset:y.asset||"",asset_name:f?`${y.asset_name} (Copy)`:y.asset_name||"",description:y.description||"",repair_status:f?"Open":y.repair_status||"Open",workflow_state:f?"Draft":y.workflow_state||"Draft",department:y.department||"",custom_priority_:y.custom_priority_||"Normal",asset_type:y.asset_type||"",manufacturer:y.manufacturer||"",supplier:y.supplier||"",serial_number:y.serial_number||"",model:y.model||"",custom_site_contractor:y.custom_site_contractor||"",custom_subcontractor:y.custom_subcontractor||"",failure_date:we(y.failure_date)||"",custom_deadline_date:we(y.custom_deadline_date)||"",first_responded_on:we(y.first_responded_on)||"",completion_date:we(y.completion_date)||"",actions_performed:y.actions_performed||"",stock_consumption:y.stock_consumption||0,stock_items:y.stock_items||[],site_name:y.site_name||"",need_procurement:y.need_procurement||0,custom_assign_to_contractor:y.custom_assign_to_contractor||"",docstatus:y.docstatus||0,custom_assigned_supervisor:y.custom_assigned_supervisor||"",custom_moh_supervisor:y.custom_moh_supervisor||"",total_hours_spent:y.total_hours_spent||0,custom_pending_reason:y.custom_pending_reason||"",total_repair_cost:y.total_repair_cost||0,custom_service_agreement:y.custom_service_agreement||"",custom_service_coverage:y.custom_service_coverage||"",custom_start_date:we(y.custom_start_date)||"",custom_end_date:we(y.custom_end_date)||"",custom_total_amount:y.custom_total_amount||0})},[y,f]);const ze=ye=>{const{name:We,value:at}=ye.target;Y(Vt=>Ee(ie({},Vt),{[We]:at}))},bt=ye=>{const We=ye.target.value;Y(at=>Ee(ie({},at),{custom_priority_:We}))},Nt=ye=>{const We=ye.target.value;Y(at=>Ee(ie({},at),{failure_date:We}))},Ot=ye=>{const We=ye.target.checked?1:0;Y(at=>Ee(ie({},at),{need_procurement:We}))},Pt=ye=>{Y(ye==="Non Biomedical"?We=>Ee(ie({},We),{asset_type:ye,asset:"",asset_name:"",serial_number:"",manufacturer:"",supplier:"",model:""}):We=>Ee(ie({},We),{asset_type:ye}))},je=ye=>oe(null,null,function*(){if(ye.preventDefault(),!H.work_order_type){Et.error("Please select a Work Order Type",{position:"top-right",autoClose:4e3,icon:r.jsx(hn,{})});return}try{if(c||f){const We=yield N(H),at=f?"Work order duplicated successfully!":d?"Work order created from asset successfully!":"Work order created successfully!";Et.success(at,{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),t(`/work-orders/${We.name}`)}else e&&(yield S(e,H),Et.success("Work order updated successfully!",{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),A(!1),T())}catch(We){console.error("Work order save error:",We);const at=We instanceof Error?We.message:"Unknown error",Vt=JSON.stringify(We);at.includes("TimestampMismatchError")||at.includes("Document has been modified")||at.includes("Please refresh")||Vt.includes("TimestampMismatchError")?(Et.error("Document was modified by another user. Refreshing...",{position:"top-right",autoClose:4e3,icon:r.jsx(yr,{})}),yield T(),Et.info("Please review the latest changes and try saving again.",{position:"top-right",autoClose:5e3,icon:r.jsx(Hd,{})})):Et.error(`Failed to save work order: ${at}`,{position:"top-right",autoClose:6e3,icon:r.jsx(hn,{})})}});j.useEffect(()=>{c||fetch("/api/method/asset_lite.api.user_roles.check_has_role",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({roles:"Maintenance Manager"})}).then(ye=>ye.json()).then(ye=>{var We;(We=ye.message)!=null&&We.has_role&&x(!0)}).catch(ye=>console.error("Role check error:",ye))},[c]);const ut=ye=>oe(null,null,function*(){if(!e||c||!["Apply","Send For Repair"].includes(ye))return null;try{const at=yield rt.apiCall("/api/method/assign_supervisor_or_technician",{method:"POST",body:JSON.stringify({work_order:e,action:ye,asset_type:H.asset_type||(y==null?void 0:y.asset_type)||""})});return(at==null?void 0:at.message)||null}catch(at){return console.error("Error in before_workflow_action:",at),null}}),jt=(ye,We)=>oe(null,null,function*(){if(["Reject","Cancel","Close"].includes(ye)&&(ee==null?void 0:ee.action)!==ye){B({action:ye,nextState:We||""});return}B(null);const Vt=Et.loading(`Applying action "${ye}"...`,{position:"top-right"}),aa=yield ut(ye);aa!=null&&aa.assigned_to&&Et.info(`Assigned to: ${aa.assigned_to}`,{position:"top-right",autoClose:4e3,icon:r.jsx(Ja,{})});const Va=yield D(ye,We);if(Et.dismiss(Vt),Va)Et.success(`Action "${ye}" completed successfully!`,{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),T();else{const Ma=se||"Please try again.";Ma.includes("TimestampMismatchError")||Ma.includes("Document has been modified")||Ma.includes("Please refresh")?(Et.error("Document was modified. Refreshing...",{position:"top-right",autoClose:4e3,icon:r.jsx(yr,{})}),yield T(),Et.info("Please try the action again after reviewing the latest changes.",{position:"top-right",autoClose:5e3,icon:r.jsx(Hd,{})})):Et.error(`Failed to apply action "${ye}". ${Ma}`,{position:"top-right",autoClose:6e3,icon:r.jsx(hn,{})})}});if(_)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading work order details..."})]})});if(k&&!c&&!f)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",k]}),r.jsx("button",{onClick:()=>t("/work-orders"),className:"mt-2 text-red-700 dark:text-red-400 underline hover:text-red-800 dark:hover:text-red-300",children:"Back to work orders list"})]})});const $t=()=>f?"Duplicate Work Order":d?"Create Work Order from Asset":c?"New Work Order":"Work Order Details",Fe=(y==null?void 0:y.workflow_state)||H.workflow_state||"Draft",ot=W(Fe),dt=(Je=(la=y==null?void 0:y.docstatus)!=null?la:H.docstatus)!=null?Je:0,wt=(y==null?void 0:y.workflow_state)||H.workflow_state||"Draft",Ft=c||F&&dt===0||p&&wt==="Sent to Team Leader"||!K&&Z.length>0;return r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[r.jsx(Hp,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:fh}),r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("button",{onClick:()=>t("/work-orders"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(Gs,{}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:$t()})]}),!c&&r.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${ot.bg} ${ot.text} ${ot.border} border`,children:Fe}),d&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-300 rounded-full text-xs font-medium",children:[r.jsx(vg,{size:10}),"Linked from Asset: ",i]}),P&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-full text-xs font-medium",children:[r.jsx(Pn,{className:"animate-spin",size:12}),"Loading asset details..."]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[!c&&r.jsxs("button",{onClick:g,className:"bg-purple-600 hover:bg-purple-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",title:"Print Service Report",children:[r.jsx(so,{}),"Service Report"]}),!c&&!C&&Ft&&r.jsxs("button",{onClick:()=>{A(!0),Et.info("Edit mode enabled",{position:"top-right",autoClose:2e3,icon:r.jsx(Rr,{})})},className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Rr,{}),"Edit"]}),C&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{c?t("/work-orders"):(A(!1),Et.info("Edit cancelled - changes discarded",{position:"top-right",autoClose:2e3,icon:r.jsx(hn,{})}))},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-lg",disabled:O,children:"Cancel"}),r.jsxs("button",{onClick:je,disabled:O||P,className:"bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(jr,{}),O?"Saving...":"Save Changes"]})]})]})]}),d&&c&&r.jsx("div",{className:"mb-6 bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(vg,{className:"text-orange-500 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-orange-800 dark:text-orange-300",children:"Creating Work Order from Asset"}),r.jsxs("p",{className:"text-xs text-orange-700 dark:text-orange-400 mt-1",children:["Asset information has been pre-filled from ",r.jsx("strong",{children:H.asset_name||i}),". Please select a Work Order Type and add any additional details."]})]})]})}),r.jsx("form",{onSubmit:je,className:"space-y-6",style:{overflow:"visible"},children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",style:{overflow:"visible"},children:[r.jsxs("div",{className:"lg:col-span-3 space-y-6",style:{overflow:"visible"},children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Asset Information"}),d&&r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400 rounded text-[10px] font-medium",children:[r.jsx(vg,{size:8}),"From Asset"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsx("div",{children:r.jsx(kt,{label:"Hospital",doctype:"Company",value:H.company||"",onChange:ye=>Y(Ee(ie({},H),{company:ye,department:""})),disabled:!C,filters:{domain:"Healthcare"}})}),r.jsx("div",{children:r.jsx(kt,{label:"Asset Type",doctype:"Asset Type",value:H.asset_type||"",onChange:Pt,disabled:!C})}),(ue||((Lt=H.company)==null?void 0:Lt.startsWith("Mobile")))&&r.jsx("div",{children:r.jsx(kt,{label:"Site Name",doctype:"Mobile Team Site",value:H.site_name||"",onChange:ye=>Y(Ee(ie({},H),{site_name:ye})),disabled:!C})}),!ue&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative z-[50]",children:[r.jsx(kt,{label:"Asset ID",doctype:"Asset",value:H.asset||"",onChange:lt,disabled:!C||P,filters:H.company?{company:H.company}:{}}),H.asset&&r.jsx("p",{className:"mt-1 text-xs text-green-600 dark:text-green-400",children:"✓ Asset details auto-populated"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Serial Number"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",name:"serial_number",value:H.serial_number,onChange:ze,onBlur:Ze,disabled:!C||P,placeholder:"Enter serial number",className:"flex-1 px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),C&&r.jsx("button",{type:"button",onClick:ft,disabled:P||!H.serial_number,className:"px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md disabled:opacity-50 disabled:cursor-not-allowed",title:"Search asset by serial number",children:r.jsx($s,{size:14})})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Name"}),r.jsx("input",{type:"text",name:"asset_name",value:H.asset_name,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsx("div",{children:r.jsx(kt,{label:"Manufacturer",doctype:"Manufacturer",value:H.manufacturer||"",onChange:ye=>Y(Ee(ie({},H),{manufacturer:ye})),disabled:!C})}),r.jsx("div",{children:r.jsx(kt,{label:"Supplier",doctype:"Supplier",value:H.supplier||"",onChange:ye=>Y(Ee(ie({},H),{supplier:ye})),disabled:!C})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Model"}),r.jsx("input",{type:"text",name:"model",value:H.model,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Work Order Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Work Order ID"}),r.jsx("input",{type:"text",value:c||f?"Auto-generated":y==null?void 0:y.name,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"})]}),r.jsx("div",{className:"relative z-[50]",children:r.jsx(kt,{label:"Work Order Type",doctype:"Issue Type",value:H.work_order_type||"",onChange:ye=>Y(Ee(ie({},H),{work_order_type:ye})),disabled:!C})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),r.jsxs("select",{name:"custom_priority_",value:H.custom_priority_,onChange:bt,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Normal",children:"Normal"}),r.jsx("option",{value:"Urgent",children:"Urgent"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),r.jsx("input",{type:"text",value:H.repair_status,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Pending Reason"}),r.jsxs("select",{name:"custom_pending_reason",value:H.custom_pending_reason||"",onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Pending Reason"}),r.jsx("option",{value:"Need Part",children:"Need Part"}),r.jsx("option",{value:"Waiting For Quotation",children:"Waiting For Quotation"}),r.jsx("option",{value:"Waiting For PO",children:"Waiting For PO"}),r.jsx("option",{value:"Waiting For Part Delivery",children:"Waiting For Part Delivery"})]})]}),r.jsx("div",{className:"flex items-center",children:r.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:H.need_procurement===1,onChange:Ot,disabled:!C,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 disabled:opacity-50"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Need Procurement"})]})})]})]}),!ue&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Service Agreement Details"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Site Contractor"}),r.jsx("input",{type:"text",name:"custom_site_contractor",value:H.custom_site_contractor,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Subcontractor"}),r.jsx("input",{type:"text",name:"custom_subcontractor",value:H.custom_subcontractor,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Agreement"}),r.jsxs("select",{name:"custom_service_agreement",value:H.custom_service_agreement||"",onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Service Agreement"}),r.jsx("option",{value:"Warranty",children:"Warranty"}),r.jsx("option",{value:"Contract",children:"Contract"}),r.jsx("option",{value:"Frame Work",children:"Frame Work"}),r.jsx("option",{value:"Main Contractor",children:"Main Contractor"}),r.jsx("option",{value:"Out of warranty",children:"Out of warranty"}),r.jsx("option",{value:"Under Dismantle",children:"Under Dismantle"}),r.jsx("option",{value:"Under Installation",children:"Under Installation"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Service Coverage"}),r.jsxs("select",{name:"custom_service_coverage",value:H.custom_service_coverage||"",onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Service Coverage"}),r.jsx("option",{value:"PM Only",children:"PM Only"}),r.jsx("option",{value:"Labour",children:"Labour"}),r.jsx("option",{value:"Labour & Parts",children:"Labour & Parts"}),r.jsx("option",{value:"Comprehensive",children:"Comprehensive"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Start Date"}),r.jsx("input",{type:"date",name:"custom_start_date",value:H.custom_start_date||"",onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"End Date"}),r.jsx("input",{type:"date",name:"custom_end_date",value:H.custom_end_date||"",onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Amount"}),r.jsx("input",{type:"number",name:"custom_total_amount",min:"0",step:"0.01",value:H.custom_total_amount||0,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Description"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Nature of Complaint"}),r.jsx("textarea",{name:"description",value:H.description,onChange:ze,disabled:!C,placeholder:"Describe the nature of complaint...",rows:4,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white resize-none"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Work Performed"}),r.jsx("textarea",{name:"actions_performed",value:H.actions_performed,onChange:ze,disabled:!C,placeholder:"Describe the work performed...",rows:4,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white resize-none"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Location & Assignment"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsx("div",{children:r.jsx(kt,{label:"MOH Supervisor",doctype:"User",value:H.custom_moh_supervisor||"",onChange:ye=>Y(Ee(ie({},H),{custom_moh_supervisor:ye})),disabled:!C})}),r.jsx("div",{children:r.jsx(kt,{label:"Team Leader",doctype:"User",value:H.custom_assigned_supervisor||"",onChange:ye=>Y(Ee(ie({},H),{custom_assigned_supervisor:ye})),disabled:!C})}),r.jsx("div",{children:r.jsx(kt,{label:"Assigned Technician",doctype:"User",value:H.custom_assign_to_contractor||"",onChange:ye=>Y(Ee(ie({},H),{custom_assign_to_contractor:ye})),disabled:!C})}),r.jsx("div",{children:r.jsx(kt,{label:"Department",doctype:"Department",value:H.department||"",onChange:ye=>Y(Ee(ie({},H),{department:ye})),disabled:!C,filters:Ct})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Failure Date"}),r.jsx("input",{type:"date",name:"failure_date",value:H.failure_date,onChange:Nt,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Deadline Date",r.jsx("span",{className:"ml-1 text-xs text-gray-400",children:"(Auto-calculated)"})]}),r.jsx("input",{type:"date",name:"custom_deadline_date",value:H.custom_deadline_date,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),C&&H.failure_date&&r.jsxs("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[H.custom_priority_==="Urgent"?"Urgent":"Normal"," priority",H.need_procurement===1?" + Procurement":"",":"," ","+",H.need_procurement===1?30:H.custom_priority_==="Urgent"?1:5," days"]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Hours Spent"}),r.jsx("input",{type:"number",name:"total_hours_spent",min:"0",step:"0.5",value:H.total_hours_spent||0,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"First Responded On"}),r.jsx("input",{type:"date",name:"first_responded_on",value:H.first_responded_on,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Completion Date"}),r.jsx("input",{type:"date",name:"completion_date",value:H.completion_date,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700 relative z-20",style:{overflow:"visible"},children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Stock Consumption Details"}),r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:H.stock_consumption===1,onChange:ye=>{var We;Y(Ee(ie({},H),{stock_consumption:ye.target.checked?1:0,stock_items:ye.target.checked?(We=H.stock_items)!=null&&We.length?H.stock_items:[{item_code:"",warehouse:de,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]:[]}))},disabled:!C,className:"w-5 h-5 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 disabled:opacity-50"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Parts Consumed"})]}),r.jsx("p",{className:"mt-1 ml-8 text-xs text-gray-500 dark:text-gray-400",children:"Check this if spare parts or items were used during the repair"})]}),H.stock_consumption===1&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Stock Items"}),C&&r.jsxs("button",{type:"button",onClick:()=>{Y(Ee(ie({},H),{stock_items:[...H.stock_items||[],{item_code:"",warehouse:de,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]})),Et.info("New stock item row added",{position:"top-right",autoClose:2e3,icon:r.jsx(ts,{})})},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-green-600 hover:bg-green-700 rounded-md transition-colors",children:[r.jsx(ts,{size:10}),"Add Item"]})]}),r.jsx("div",{className:"stock-items-table-wrapper",children:r.jsx("div",{className:"stock-items-scroll-container",children:r.jsxs("table",{className:"w-full text-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:[r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-10",children:"#"}),r.jsxs("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider min-w-[180px]",children:["Item ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-28",children:"Valuation Rate"}),r.jsxs("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider min-w-[180px]",children:["Warehouse ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-24",children:"Consumed Qty"}),r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-28",children:"Available Stock"}),r.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-28",children:"Total Value"}),C&&r.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-16",children:"Action"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(H.stock_items||[]).length===0?r.jsx("tr",{children:r.jsxs("td",{colSpan:C?8:7,className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:[r.jsx("p",{children:"No items added yet"}),C&&r.jsx("button",{type:"button",onClick:()=>{Y(Ee(ie({},H),{stock_items:[{item_code:"",warehouse:de,consumed_quantity:1,valuation_rate:0,custom_available_stock:0,total_value:0}]}))},className:"mt-2 text-blue-600 dark:text-blue-400 hover:underline text-sm",children:"+ Add first item"})]})}):(H.stock_items||[]).map((ye,We)=>r.jsxs(ia.Fragment,{children:[r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 ${De[We]?"bg-red-50 dark:bg-red-900/20":""}`,children:[r.jsx("td",{className:"px-3 py-3 text-gray-500 dark:text-gray-400",children:We+1}),r.jsx("td",{className:"px-3 py-3 relative",style:{zIndex:50-We},children:r.jsx("div",{className:"relative",children:r.jsx(kt,{label:"",doctype:"Item",value:ye.item_code,onChange:at=>st(We,at),disabled:!C,placeholder:"Select Item",compact:!0,usePortal:!0,filters:ie({is_stock_item:1},H.company?{custom_hospital_name:H.company}:{})})})}),r.jsx("td",{className:"px-3 py-3",children:r.jsx("input",{type:"number",min:"0",step:"0.01",value:ye.valuation_rate||0,onChange:at=>{const Vt=[...H.stock_items||[]],aa=parseFloat(at.target.value)||0,Va=Vt[We].consumed_quantity||0;Vt[We]=Ee(ie({},Vt[We]),{valuation_rate:aa,total_value:aa*Va}),Y(Ee(ie({},H),{stock_items:Vt}))},disabled:!C,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),r.jsx("td",{className:"px-3 py-3 relative",style:{zIndex:50-We},children:r.jsx("div",{className:"relative",children:r.jsx(kt,{label:"",doctype:"Warehouse",value:ye.warehouse,onChange:at=>gt(We,at),disabled:!C,placeholder:"Select Warehouse",compact:!0,usePortal:!0})})}),r.jsx("td",{className:"px-3 py-3",children:r.jsx("input",{type:"number",min:"1",value:ye.consumed_quantity||1,onChange:at=>Ge(We,parseInt(at.target.value)||1),disabled:!C,className:`w-full px-2 py-1.5 text-sm border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white ${De[We]?"border-red-500 dark:border-red-500":"border-gray-300 dark:border-gray-600"}`})}),r.jsx("td",{className:"px-3 py-3",children:r.jsx("input",{type:"number",min:"0",value:ye.custom_available_stock||0,disabled:!0,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300",title:"Auto-populated from stock"})}),r.jsx("td",{className:"px-3 py-3",children:r.jsx("input",{type:"number",min:"0",step:"0.01",value:ye.total_value||0,disabled:!0,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"})}),C&&r.jsx("td",{className:"px-3 py-3 text-center",children:r.jsx("button",{type:"button",onClick:()=>{var aa;const at=(aa=H.stock_items)==null?void 0:aa[We],Vt=(H.stock_items||[]).filter((Va,Ma)=>Ma!==We);Y(Ee(ie({},H),{stock_items:Vt})),Ne(Va=>{const Ma=ie({},Va);return delete Ma[We],Ma}),Et.warning(`Stock item ${(at==null?void 0:at.item_code)||"row"} removed`,{position:"top-right",autoClose:2e3,icon:r.jsx(ha,{})})},className:"p-1.5 text-red-500 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors",title:"Remove item",children:r.jsx(ha,{size:14})})})]}),De[We]&&r.jsx("tr",{className:"bg-red-50 dark:bg-red-900/30",children:r.jsx("td",{colSpan:C?8:7,className:"px-4 py-2",children:r.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs",children:[r.jsx(yr,{}),r.jsx("span",{children:De[We]})]})})})]},We))})]})})}),(H.stock_items||[]).length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap justify-between items-center gap-4 text-sm bg-gray-50 dark:bg-gray-700/50 p-3 rounded-lg",children:[r.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Items: ",r.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:(H.stock_items||[]).length})]}),r.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Qty: ",r.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:(H.stock_items||[]).reduce((ye,We)=>ye+(We.consumed_quantity||0),0)})]}),r.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Total Value: ",r.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:(H.stock_items||[]).reduce((ye,We)=>ye+(We.total_value||0),0).toFixed(2)})]})]})]}),r.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200 dark:border-gray-700",children:r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Total Repair Cost"}),r.jsx("input",{type:"number",name:"total_repair_cost",min:"0",step:"0.01",value:H.total_repair_cost||0,onChange:ze,disabled:!C,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})})})]})]}),r.jsxs("div",{className:"space-y-6",children:[!c&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white",children:"Workflow Actions"})}),r.jsxs("div",{className:`p-4 rounded-lg border mb-4 ${ot.bg} ${ot.border}`,children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Current State"}),r.jsx("p",{className:`text-lg font-semibold ${ot.text}`,children:Fe})]}),K&&r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-4",children:[r.jsx(Pn,{className:"animate-spin"}),r.jsx("span",{className:"text-sm",children:"Loading actions..."})]}),se&&r.jsx("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg mb-4",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(yr,{className:"text-red-500 mt-0.5"}),r.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:se})]})}),ee&&r.jsxs("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg mb-4",children:[r.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[r.jsx(yr,{className:"text-yellow-500 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200",children:"Confirm Action"}),r.jsxs("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mt-1",children:["Are you sure you want to ",r.jsx("strong",{children:ee.action})," this work order?"]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>jt(ee.action,ee.nextState),disabled:te,className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm rounded-md disabled:opacity-50",children:te?r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Pn,{className:"animate-spin",size:12}),"Processing..."]}):`Yes, ${ee.action}`}),r.jsx("button",{onClick:()=>B(null),disabled:te,className:"px-3 py-1.5 bg-gray-300 hover:bg-gray-400 text-gray-700 text-sm rounded-md disabled:opacity-50",children:"Cancel"})]})]}),!K&&Z.length>0&&!ee&&r.jsxs("div",{className:"space-y-3",children:[F&&r.jsx("div",{className:"p-2 bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg mb-2",children:r.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[r.jsx("strong",{children:"System Manager:"})," Showing all valid actions for this state (conditions evaluated)."]})}),r.jsxs("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[r.jsx(Hd,{size:12}),"Available Actions (",Z.length,")"]}),r.jsx("div",{className:"flex flex-col gap-2",children:Z.map((ye,We)=>r.jsxs("button",{onClick:()=>jt(ye.action,ye.next_state),disabled:te,className:`w-full px-4 py-2.5 rounded-lg text-sm font-medium transition-colors disabled:opacity-50 flex items-center justify-center gap-2 ${G(ye.action)}`,children:[te?r.jsx(Pn,{className:"animate-spin",size:14}):r.jsx("span",{children:J(ye.action)}),ye.action]},`${ye.action}-${ye.next_state}-${We}`))}),r.jsxs("div",{className:"mt-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Action Results:"}),Z.map((ye,We)=>r.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:[ye.action," → ",r.jsx("span",{className:"font-medium",children:ye.next_state})]},We))]})]}),!K&&Z.length===0&&r.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center",children:"No workflow actions available"}),r.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-1",children:"(Conditions may not be met for available transitions)"})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Status Summary"}),!c&&y&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Repair Status"}),r.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:y.repair_status||"Open"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Priority"}),r.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:y.custom_priority_||"Normal"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:y.creation?new Date(y.creation).toLocaleString():"-"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Last Modified"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:y.modified?new Date(y.modified).toLocaleString():"-"})]})]}),c&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Hd,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Status information will appear after creation"})]})]})]})]})}),r.jsx("style",{children:`
|
||
/* Wrapper for table - allow natural flow */
|
||
.stock-items-table-wrapper {
|
||
width: 100%;
|
||
position: relative;
|
||
}
|
||
|
||
/* Scroll container handles horizontal scrolling only */
|
||
.stock-items-scroll-container {
|
||
width: 100%;
|
||
overflow-x: auto;
|
||
overflow-y: visible;
|
||
-webkit-overflow-scrolling: touch;
|
||
}
|
||
|
||
/* Table styling */
|
||
.stock-items-scroll-container table {
|
||
border-collapse: separate;
|
||
border-spacing: 0;
|
||
min-width: 100%;
|
||
}
|
||
|
||
.stock-items-scroll-container tbody tr td {
|
||
position: relative;
|
||
}
|
||
`})]})},rM=()=>{const{t:e}=Qa(),t=Na(),[a,s]=j.useState(0),[i,d]=j.useState(""),[c,f]=j.useState(""),[g,p]=j.useState(null),[x,y]=j.useState(null),_=j.useRef(null),k=20,T=c?{maintenance_status:c}:{},{logs:N,totalCount:S,hasMore:O,loading:C,error:A,refetch:P}=Wf(T,k,a*k,"due_date asc"),{deleteLog:I,loading:ee}=C_();j.useEffect(()=>{const te=se=>{_.current&&!_.current.contains(se.target)&&y(null)};return x&&document.addEventListener("mousedown",te),()=>{document.removeEventListener("mousedown",te)}},[x]);const B=()=>{t("/maintenance/new")},H=te=>{t(`/maintenance/${te}`)},Y=te=>{t(`/maintenance/${te}`)},ue=te=>oe(null,null,function*(){try{yield I(te),p(null),P(),alert("Maintenance log deleted successfully!")}catch(se){alert(`Failed to delete: ${se instanceof Error?se.message:"Unknown error"}`)}}),xe=te=>{t(`/maintenance/new?duplicate=${te}`)},le=te=>{const se=JSON.stringify(te,null,2),F=new Blob([se],{type:"application/json"}),D=URL.createObjectURL(F),W=document.createElement("a");W.href=D,W.download=`maintenance_${te.name}.json`,W.click(),URL.revokeObjectURL(D)},ge=te=>{window.open(`/maintenance/${te}?print=true`,"_blank")},be=()=>{const se=[["Log ID","Asset","Type","Status","Due Date","Assigned To"].join(","),...N.map(G=>[G.name,G.asset_name||"",G.maintenance_type||"",G.maintenance_status||"",G.due_date||"",G.assign_to_name||""].join(","))].join(`
|
||
`),F=new Blob([se],{type:"text/csv"}),D=URL.createObjectURL(F),W=document.createElement("a");W.href=D,W.download=`maintenance_logs_${new Date().toISOString().split("T")[0]}.csv`,W.click(),URL.revokeObjectURL(D)},me=te=>{switch(te==null?void 0:te.toLowerCase()){case"completed":return r.jsx(Ja,{className:"text-green-500"});case"planned":return r.jsx(D_,{className:"text-blue-500"});case"overdue":return r.jsx(yr,{className:"text-red-500"});default:return r.jsx(ll,{className:"text-gray-400"})}},ae=te=>{switch(te==null?void 0:te.toLowerCase()){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300";case"planned":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300";case"overdue":return"bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300";case"cancelled":return"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300";default:return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300"}},Z=(te,se)=>!te||(se==null?void 0:se.toLowerCase())==="completed"?!1:new Date(te)<new Date;if(C&&a===0)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance logs..."})]})});if(A)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ Maintenance API Not Available"}),r.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"The Asset Maintenance API endpoint is not deployed yet."})}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:()=>t("/maintenance/new"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Creating New (Demo)"}),r.jsx("button",{onClick:P,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),r.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-yellow-300 dark:border-yellow-700",children:r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[r.jsx("strong",{children:"Technical Error:"})," ",A]})})]})});const K=N.filter(te=>{var se,F,D;return((se=te.name)==null?void 0:se.toLowerCase().includes(i.toLowerCase()))||((F=te.asset_name)==null?void 0:F.toLowerCase().includes(i.toLowerCase()))||((D=te.task_name)==null?void 0:D.toLowerCase().includes(i.toLowerCase()))});return r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("maintenance.title")}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",S," maintenance log",S!==1?"s":""]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:be,className:"bg-green-600 hover:bg-green-700 text-white px-4 py-3 rounded-lg flex items-center gap-2 shadow transition-all",disabled:N.length===0,children:[r.jsx(Qr,{}),r.jsx("span",{className:"font-medium",children:"Export All"})]}),r.jsxs("button",{onClick:B,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(ts,{}),r.jsx("span",{className:"font-medium",children:"New Maintenance Log"})]})]})]}),r.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:r.jsxs("div",{className:"flex items-center gap-2 border border-gray-300 dark:border-gray-600 rounded-lg px-4 py-2 bg-white dark:bg-gray-700",children:[r.jsx($s,{className:"text-gray-400 dark:text-gray-500"}),r.jsx("input",{type:"text",placeholder:"Search by ID, asset, task...",value:i,onChange:te=>d(te.target.value),className:"flex-1 outline-none text-gray-700 dark:text-gray-200 bg-transparent"})]})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:r.jsxs("select",{value:c,onChange:te=>{f(te.target.value),s(0)},className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:"All Statuses"}),r.jsx("option",{value:"Planned",children:"Planned"}),r.jsx("option",{value:"Completed",children:"Completed"}),r.jsx("option",{value:"Overdue",children:"Overdue"}),r.jsx("option",{value:"Cancelled",children:"Cancelled"})]})})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Log ID"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Due Date"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:K.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx($s,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No maintenance logs found"}),r.jsx("button",{onClick:B,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first maintenance log"})]})})}):K.map(te=>{const se=Z(te.due_date||"",te.maintenance_status||"");return r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${se?"bg-red-50 dark:bg-red-900/10":""}`,onClick:()=>H(te.name),children:[r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:te.name}),r.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:te.creation?new Date(te.creation).toLocaleDateString():""})]}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:te.asset_name||"-"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:te.custom_asset_type||""})]}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:te.maintenance_type||"-"}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[r.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:te.due_date?new Date(te.due_date).toLocaleDateString():"-"}),se&&r.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 font-semibold",children:"Overdue"})]}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center gap-2",children:[me(te.maintenance_status||""),r.jsx("span",{className:`px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${ae(te.maintenance_status||"")}`,children:te.maintenance_status||"Unknown"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:F=>F.stopPropagation(),children:[r.jsx("button",{onClick:()=>H(te.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:r.jsx(hl,{})}),r.jsx("button",{onClick:()=>Y(te.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Log",children:r.jsx(Rr,{})}),r.jsx("button",{onClick:()=>xe(te.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate",children:r.jsx(Cc,{})}),r.jsx("button",{onClick:()=>p(te.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete",disabled:ee,children:r.jsx(ha,{})}),r.jsxs("div",{className:"relative",ref:x===te.name?_:null,children:[r.jsx("button",{onClick:()=>y(x===te.name?null:te.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded transition-colors",title:"More Actions",children:r.jsx(g0,{})}),x===te.name&&r.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-10",children:[r.jsxs("button",{onClick:()=>{le(te),y(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-t-lg",children:[r.jsx(_i,{className:"text-blue-500"}),"Export as JSON"]}),r.jsxs("button",{onClick:()=>{ge(te.name),y(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2 rounded-b-lg",children:[r.jsx(so,{className:"text-purple-500"}),"Print Log"]})]})]})]})})]},te.name)})})]})}),K.length>0&&r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-4 flex items-center justify-between border-t border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",r.jsx("span",{className:"font-medium",children:a*k+1})," to"," ",r.jsx("span",{className:"font-medium",children:Math.min((a+1)*k,S)})," ","of ",r.jsx("span",{className:"font-medium",children:S})," results"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{disabled:a===0,onClick:()=>s(a-1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),r.jsx("button",{disabled:!O,onClick:()=>s(a+1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]}),g&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(ha,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Maintenance Log"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this maintenance log? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Log ID:"})," ",g]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>p(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:ee,children:"Cancel"}),r.jsx("button",{onClick:()=>ue(g),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",disabled:ee,children:ee?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ha,{}),"Delete Log"]})})]})]})]})})})]})},nM=rt,sM=({message:e,type:t,onClose:a})=>{j.useEffect(()=>{const i=setTimeout(a,1e4);return()=>clearTimeout(i)},[a]);const s=t==="warning"?"bg-yellow-500":t==="success"?"bg-green-500":"bg-red-500";return r.jsx("div",{className:`fixed top-4 right-4 ${s} text-white px-6 py-4 rounded-lg shadow-lg z-50 max-w-md`,children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(yr,{className:"mt-0.5 flex-shrink-0"}),r.jsx("p",{className:"text-sm",children:e}),r.jsx("button",{onClick:a,className:"ml-2 text-white hover:text-gray-200",children:r.jsx(vt,{})})]})})},iM=()=>{const{logName:e}=ul(),t=Na(),[a]=fl(),s=a.get("duplicate"),i=e==="new",d=i&&!!s,{log:c,loading:f,error:g}=lS(d?s:i?null:e||null),{createLog:p,updateLog:x,loading:y}=C_(),_=(c==null?void 0:c.workflow_state)==="Approved",[k,T]=j.useState(i),[N,S]=j.useState([]),[O,C]=j.useState(null),[A,P]=j.useState(!1),[I,ee]=j.useState({asset_name:"",custom_asset_type:"",item_code:"",item_name:"",custom_asset_names:"",custom_hospital_name:"",task:"",task_name:"",maintenance_type:"Preventive Maintenance",periodicity:"",has_certificate:0,custom_early_completion:"",maintenance_status:"Planned",custom_accepted_by_moh:0,assign_to_name:"",due_date:"",completion_date:"",custom_early_completion_reason:"",custom_accepted_by_moh_:0,custom_template:"",custom_table:[],description:""}),B=j.useCallback((te,se,F)=>{if(F!=="Completed"){ee(J=>Ee(ie({},J),{custom_early_completion:""}));return}if(!te||!se)return;const D=new Date(te),W=new Date(se),G=new Date(D.getFullYear(),D.getMonth(),1);if(W<G){ee(De=>Ee(ie({},De),{custom_early_completion:"Yes"}));const J=W.toLocaleDateString(),de=D.toLocaleDateString();C({message:`⚠️ Warning: Completion Date (${J}) is before the Due Date Month (${de}). Please verify.`,type:"warning"})}},[]),H=j.useCallback(te=>oe(null,null,function*(){var se;if(te){P(!0);try{const F=yield nM.apiCall(`/api/resource/PPM Templates/${encodeURIComponent(te)}`,"GET");if((se=F==null?void 0:F.data)!=null&&se.ppm_template_table&&Array.isArray(F.data.ppm_template_table)){const D=F.data.ppm_template_table.map((W,G)=>({idx:G+1,maintenance_name:W.maintenance_name||"",working:0,defect_found:0,not_working:0}));S(D)}}catch(F){console.error("Error loading PPM template:",F),C({message:"Failed to load PPM template. Please add items manually.",type:"error"})}finally{P(!1)}}}),[]);j.useEffect(()=>{c&&(c.workflow_state==="Approved"&&T(!1),ee({asset_name:c.asset_name||"",custom_asset_type:c.custom_asset_type||"",item_code:c.item_code||"",item_name:c.item_name||"",custom_asset_names:c.custom_asset_names||"",custom_hospital_name:c.custom_hospital_name||"",task:c.task||"",task_name:c.task_name||"",maintenance_type:c.maintenance_type||"Preventive Maintenance",periodicity:c.periodicity||"",has_certificate:c.has_certificate||0,custom_early_completion:d?"":c.custom_early_completion||"",maintenance_status:d?"Planned":c.maintenance_status||"Planned",custom_accepted_by_moh:c.custom_accepted_by_moh||0,assign_to_name:c.assign_to_name||"",due_date:c.due_date||"",completion_date:d?"":c.completion_date||"",custom_early_completion_reason:d?"":c.custom_early_completion_reason||"",custom_accepted_by_moh_:c.custom_accepted_by_moh_||0,custom_template:c.custom_template||"",custom_table:c.custom_table||[],description:c.description||""}),c.custom_table&&Array.isArray(c.custom_table)&&c.custom_table.length>0?S(c.custom_table.map((te,se)=>({name:te.name,idx:te.idx||se+1,maintenance_name:te.maintenance_name||"",working:te.working||0,defect_found:te.defect_found||0,not_working:te.not_working||0}))):c.custom_template&&(!c.custom_table||c.custom_table.length===0)&&H(c.custom_template))},[c,d,H]),j.useEffect(()=>{I.completion_date&&I.due_date&&B(I.due_date,I.completion_date,I.maintenance_status)},[I.completion_date,I.due_date,I.maintenance_status,B]);const Y=te=>{const{name:se,value:F,type:D}=te.target,W=te.target.checked;ee(G=>Ee(ie({},G),{[se]:D==="checkbox"?W?1:0:F}))},ue=te=>{const se=te.target.value;ee(F=>Ee(ie({},F),{maintenance_status:se})),se==="Completed"?B(I.due_date||"",I.completion_date||"",se):ee(F=>Ee(ie({},F),{custom_early_completion:""}))},xe=te=>{const se=te.target.value;ee(F=>Ee(ie({},F),{completion_date:se})),I.maintenance_status==="Completed"&&B(I.due_date||"",se,I.maintenance_status)},le=te=>oe(null,null,function*(){const se=te.target.value;ee(F=>Ee(ie({},F),{custom_template:se})),(se&&N.length===0||se&&N.length>0&&window.confirm("Loading a template will replace existing checklist items. Continue?"))&&H(se)}),ge=()=>{const te={idx:N.length+1,maintenance_name:"",working:0,defect_found:0,not_working:0};S([...N,te])},be=te=>{const se=N.filter((F,D)=>D!==te).map((F,D)=>Ee(ie({},F),{idx:D+1}));S(se)},me=(te,se,F)=>{const D=[...N];D[te]=Ee(ie({},D[te]),{[se]:F}),S(D)},ae=te=>oe(null,null,function*(){if(te.preventDefault(),!I.asset_name){alert("Please enter Asset Name");return}if(!I.maintenance_type){alert("Please select Maintenance Type");return}const se=N.map((D,W)=>{const G={idx:D.idx||W+1,maintenance_name:D.maintenance_name||"",working:D.working?1:0,defect_found:D.defect_found?1:0,not_working:D.not_working?1:0};return D.name&&typeof D.name=="string"&&D.name.trim()!==""&&(G.name=D.name),G}),F=Ee(ie({},I),{custom_table:se});console.log("Submitting maintenance log data:",F);try{if(i||d){const D=yield p(F);alert(d?"Maintenance log duplicated successfully!":"Maintenance log created successfully!"),t(`/maintenance/${D.name}`)}else e&&(yield x(e,F),alert("Maintenance log updated successfully!"),T(!1))}catch(D){console.error("Maintenance log save error:",D),alert("Failed to save: "+(D instanceof Error?D.message:"Unknown error"))}}),Z=te=>({Draft:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",Applied:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",Pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",Approved:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",Rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",Completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"})[te]||"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",K=te=>({Planned:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",Completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",Overdue:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",Cancelled:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"})[te]||"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";return f?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance log..."})]})}):g&&!i&&!d?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",g]}),r.jsx("button",{onClick:()=>t("/maintenance"),className:"mt-2 text-red-700 dark:text-red-400 underline hover:text-red-800 dark:hover:text-red-300",children:"Back to maintenance logs"})]})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[O&&r.jsx(sM,{message:O.message,type:O.type,onClose:()=>C(null)}),r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("button",{onClick:()=>t("/maintenance"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(Gs,{}),r.jsx("span",{className:"text-gray-900 dark:text-white font-semibold",children:d?"Duplicate Maintenance Log":i?"New Maintenance Log":"Maintenance Log Details"})]}),!i&&(c==null?void 0:c.workflow_state)&&r.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${Z(c.workflow_state)}`,children:c.workflow_state})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[!i&&!k&&!_&&r.jsxs("button",{onClick:()=>T(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Rr,{}),"Edit"]}),k&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{i?t("/maintenance"):T(!1)},className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-lg",disabled:y,children:"Cancel"}),r.jsxs("button",{onClick:ae,disabled:y,className:"bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(jr,{}),y?"Saving...":"Save Changes"]})]})]})]}),r.jsx("form",{onSubmit:ae,className:"space-y-6",children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Log ID"}),r.jsx("input",{type:"text",value:i||d?"Auto-generated":(c==null?void 0:c.name)||"",disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white"}),d&&r.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["💡 Duplicating from: ",s]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Hospital"}),r.jsx("input",{type:"text",name:"custom_hospital_name",value:I.custom_hospital_name||"",onChange:Y,disabled:!k,placeholder:"Hospital name",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Asset Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"asset_name",value:I.asset_name,onChange:Y,required:!0,disabled:!k,placeholder:"Asset ID",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Display Name"}),r.jsx("input",{type:"text",name:"custom_asset_names",value:I.custom_asset_names||"",onChange:Y,disabled:!k,placeholder:"Display name",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Asset Type"}),r.jsx("input",{type:"text",name:"custom_asset_type",value:I.custom_asset_type||"",onChange:Y,disabled:!k,placeholder:"e.g., Bio Medical",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Maintenance Details"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Maintenance Type ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsxs("select",{name:"maintenance_type",value:I.maintenance_type,onChange:Y,required:!0,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Preventive Maintenance",children:"Preventive Maintenance"}),r.jsx("option",{value:"Corrective Maintenance",children:"Corrective Maintenance"}),r.jsx("option",{value:"Calibration",children:"Calibration"}),r.jsx("option",{value:"Inspection",children:"Inspection"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Periodicity"}),r.jsxs("select",{name:"periodicity",value:I.periodicity||"",onChange:Y,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select periodicity"}),r.jsx("option",{value:"Daily",children:"Daily"}),r.jsx("option",{value:"Weekly",children:"Weekly"}),r.jsx("option",{value:"Monthly",children:"Monthly"}),r.jsx("option",{value:"Quarterly",children:"Quarterly"}),r.jsx("option",{value:"Half Yearly",children:"Half Yearly"}),r.jsx("option",{value:"Yearly",children:"Yearly"}),r.jsx("option",{value:"2 Yearly",children:"2 Yearly"}),r.jsx("option",{value:"3 Yearly",children:"3 Yearly"})]})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Template",A&&r.jsx("span",{className:"ml-2 text-blue-500",children:"(Loading...)"})]}),r.jsx("input",{type:"text",name:"custom_template",value:I.custom_template||"",onChange:le,disabled:!k,placeholder:"PPM Template name",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Enter template name to auto-load checklist items"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),r.jsxs("select",{name:"maintenance_status",value:I.maintenance_status,onChange:ue,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Planned",children:"Planned"}),r.jsx("option",{value:"Completed",children:"Completed"}),r.jsx("option",{value:"Overdue",children:"Overdue"}),r.jsx("option",{value:"Cancelled",children:"Cancelled"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Assigned To"}),r.jsx("input",{type:"text",name:"assign_to_name",value:I.assign_to_name||"",onChange:Y,disabled:!k,placeholder:"Technician name",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Due Date"}),r.jsx("input",{type:"date",name:"due_date",value:I.due_date||"",onChange:Y,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Completion Date"}),r.jsx("input",{type:"date",name:"completion_date",value:I.completion_date||"",onChange:xe,disabled:!k,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Completion & Approval"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Early Completion",I.custom_early_completion==="Yes"&&r.jsx("span",{className:"ml-2 text-yellow-500",children:"⚠️ Auto-detected"})]}),r.jsx("input",{type:"text",value:I.custom_early_completion||"No",disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Auto-set based on completion date vs due date"})]}),I.custom_early_completion==="Yes"&&r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Early Completion Reason ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"custom_early_completion_reason",value:I.custom_early_completion_reason||"",onChange:Y,disabled:!k,required:!0,placeholder:"Required when early completion",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"checkbox",name:"custom_accepted_by_moh",checked:!!I.custom_accepted_by_moh,onChange:Y,disabled:!k,className:"w-4 h-4 text-blue-600 rounded focus:ring-2 focus:ring-blue-500"}),r.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:"Accepted by MOH"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-base font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[r.jsx(TS,{}),"PPM Checklist Table",A&&r.jsx("span",{className:"text-sm text-blue-500 font-normal",children:"(Loading template...)"})]}),k&&r.jsxs("button",{type:"button",onClick:ge,className:"flex items-center gap-1 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-sm rounded-md",children:[r.jsx(ts,{className:"text-xs"}),"Add Row"]})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-gray-50 dark:bg-gray-700",children:[r.jsx("th",{className:"text-left py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300 w-12",children:"#"}),r.jsx("th",{className:"text-left py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300",children:"Maintenance Task"}),r.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-green-600 dark:text-green-400 w-24",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(P_,{})," Working"]})}),r.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-yellow-600 dark:text-yellow-400 w-28",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(yr,{})," Defect"]})}),r.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-red-600 dark:text-red-400 w-28",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(vt,{})," Not Working"]})}),k&&r.jsx("th",{className:"text-center py-3 px-3 text-xs font-medium text-gray-700 dark:text-gray-300 w-16",children:"Action"})]})}),r.jsx("tbody",{children:N.length===0?r.jsx("tr",{children:r.jsxs("td",{colSpan:k?6:5,className:"text-center py-8 text-gray-500 dark:text-gray-400",children:["No checklist items. ",k&&'Enter a template name above or click "Add Row" to add items.']})}):N.map((te,se)=>r.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[r.jsx("td",{className:"py-3 px-3 text-sm text-gray-600 dark:text-gray-400",children:te.idx||se+1}),r.jsx("td",{className:"py-3 px-3",children:k?r.jsx("input",{type:"text",value:te.maintenance_name,onChange:F=>me(se,"maintenance_name",F.target.value),placeholder:"Enter maintenance task",className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-1 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:te.maintenance_name})}),r.jsx("td",{className:"py-3 px-3 text-center",children:r.jsx("input",{type:"checkbox",checked:!!te.working,onChange:F=>me(se,"working",F.target.checked?1:0),disabled:!k,className:"w-5 h-5 text-green-600 rounded focus:ring-2 focus:ring-green-500 cursor-pointer disabled:cursor-default"})}),r.jsx("td",{className:"py-3 px-3 text-center",children:r.jsx("input",{type:"checkbox",checked:!!te.defect_found,onChange:F=>me(se,"defect_found",F.target.checked?1:0),disabled:!k,className:"w-5 h-5 text-yellow-600 rounded focus:ring-2 focus:ring-yellow-500 cursor-pointer disabled:cursor-default"})}),r.jsx("td",{className:"py-3 px-3 text-center",children:r.jsx("input",{type:"checkbox",checked:!!te.not_working,onChange:F=>me(se,"not_working",F.target.checked?1:0),disabled:!k,className:"w-5 h-5 text-red-600 rounded focus:ring-2 focus:ring-red-500 cursor-pointer disabled:cursor-default"})}),k&&r.jsx("td",{className:"py-3 px-3 text-center",children:r.jsx("button",{type:"button",onClick:()=>be(se),className:"text-red-500 hover:text-red-700 p-1",title:"Remove row",children:r.jsx(ha,{})})})]},te.name||se))})]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[!i&&c&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Workflow Actions"}),r.jsx(QO,{doctype:"Asset Maintenance Log",docname:c.name||null,workflowState:c.workflow_state,showStateInfo:!1,onActionComplete:(te,se)=>{se&&console.log(`Action "${te}" completed successfully`)},onStateChange:()=>{window.location.reload()}})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Status Summary"}),!i&&c?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Current Status"}),r.jsx("span",{className:`inline-block px-3 py-1 rounded-full text-sm font-medium ${K(I.maintenance_status)}`,children:I.maintenance_status||"Planned"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Workflow State"}),r.jsx("span",{className:`inline-block px-3 py-1 rounded-full text-sm font-medium ${Z(c.workflow_state||"Draft")}`,children:c.workflow_state||"Draft"})]}),I.custom_early_completion==="Yes"&&r.jsxs("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[r.jsx("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 mb-1",children:"⚠️ Early Completion"}),r.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300 font-medium",children:"Completion date is before the due month"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Due Date"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:I.due_date?new Date(I.due_date).toLocaleDateString():"Not set"}),I.due_date&&new Date(I.due_date)<new Date&&I.maintenance_status!=="Completed"&&r.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 font-semibold mt-1",children:"⚠️ Overdue"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Completion Date"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:I.completion_date?new Date(I.completion_date).toLocaleDateString():"Not completed"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Assigned To"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:I.assign_to_name||"Unassigned"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"PPM Checklist"}),r.jsxs("p",{className:"text-sm text-gray-900 dark:text-white",children:[N.length," item(s)"]}),N.length>0&&r.jsxs("div",{className:"mt-2 text-xs space-y-1",children:[r.jsxs("p",{className:"text-green-600 dark:text-green-400",children:["✓ Working: ",N.filter(te=>te.working).length]}),r.jsxs("p",{className:"text-yellow-600 dark:text-yellow-400",children:["⚠ Defects: ",N.filter(te=>te.defect_found).length]}),r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["✗ Not Working: ",N.filter(te=>te.not_working).length]})]})]})]}):r.jsxs("div",{className:"text-center py-8",children:[r.jsx(ll,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Status information will appear after creation"})]})]}),!i&&c&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-base font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:"Audit Information"}),r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Created By"}),r.jsx("p",{className:"text-gray-900 dark:text-white",children:c.owner||"-"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Created On"}),r.jsx("p",{className:"text-gray-900 dark:text-white",children:c.creation?new Date(c.creation).toLocaleString():"-"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Modified By"}),r.jsx("p",{className:"text-gray-900 dark:text-white",children:c.modified_by||"-"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Modified On"}),r.jsx("p",{className:"text-gray-900 dark:text-white",children:c.modified?new Date(c.modified).toLocaleString():"-"})]})]})]})]})]})})]})};class lM{getAssetMaintenances(t,a,s=20,i=0,d){return oe(this,null,function*(){const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&a.length>0&&c.append("fields",JSON.stringify(a)),c.append("limit",s.toString()),c.append("offset",i.toString()),d&&c.append("order_by",d);const f=`${Bt.ENDPOINTS.GET_ASSET_MAINTENANCES}?${c.toString()}`;return rt.apiCall(f)})}getAssetMaintenanceDetails(t){return oe(this,null,function*(){const a=new URLSearchParams;a.append("maintenance_name",t);const s=`${Bt.ENDPOINTS.GET_ASSET_MAINTENANCE_DETAILS}?${a.toString()}`;return rt.apiCall(s)})}createAssetMaintenance(t){return oe(this,null,function*(){const a=`${Bt.ENDPOINTS.CREATE_ASSET_MAINTENANCE}`;return rt.apiCall(a,{method:"POST",body:JSON.stringify({maintenance_data:JSON.stringify(t)})})})}updateAssetMaintenance(t,a){return oe(this,null,function*(){const s=`${Bt.ENDPOINTS.UPDATE_ASSET_MAINTENANCE}`;return rt.apiCall(s,{method:"POST",body:JSON.stringify({maintenance_name:t,maintenance_data:JSON.stringify(a)})})})}deleteAssetMaintenance(t){return oe(this,null,function*(){const a=`${Bt.ENDPOINTS.DELETE_ASSET_MAINTENANCE}`;return rt.apiCall(a,{method:"POST",body:JSON.stringify({maintenance_name:t})})})}getMaintenanceTasks(t){return oe(this,null,function*(){const a=new URLSearchParams;a.append("maintenance_name",t);const s=`${Bt.ENDPOINTS.GET_MAINTENANCE_TASKS}?${a.toString()}`;return rt.apiCall(s)})}getServiceCoverage(t){return oe(this,null,function*(){const a=new URLSearchParams;a.append("maintenance_name",t);const s=`${Bt.ENDPOINTS.GET_SERVICE_COVERAGE}?${a.toString()}`;return rt.apiCall(s)})}getMaintenancesByAsset(t,a,s=20,i=0){return oe(this,null,function*(){const d=new URLSearchParams;d.append("asset_name",t),a&&d.append("filters",JSON.stringify(a)),d.append("limit",s.toString()),d.append("offset",i.toString());const c=`${Bt.ENDPOINTS.GET_MAINTENANCES_BY_ASSET}?${d.toString()}`;return rt.apiCall(c)})}getActiveServiceContracts(t,a=20,s=0){return oe(this,null,function*(){const i=new URLSearchParams;t&&i.append("filters",JSON.stringify(t)),i.append("limit",a.toString()),i.append("offset",s.toString());const d=`${Bt.ENDPOINTS.GET_ACTIVE_SERVICE_CONTRACTS}?${i.toString()}`;return rt.apiCall(d)})}}const e0=new lM;function oM(e,t=20,a=0,s){const[i,d]=j.useState([]),[c,f]=j.useState(0),[g,p]=j.useState(!1),[x,y]=j.useState(!0),[_,k]=j.useState(null),[T,N]=j.useState(0),S=j.useRef(!1),O=JSON.stringify(e);j.useEffect(()=>{if(S.current&&_)return;let A=!1;return S.current=!0,oe(null,null,function*(){try{y(!0);const I=yield e0.getAssetMaintenances(e,void 0,t,a,s);A||(d(I.asset_maintenances),f(I.total_count),p(I.has_more),k(null))}catch(I){if(!A){const ee=I instanceof Error?I.message:"Failed to fetch PPM schedules";ee.includes("417")||ee.includes("Expectation Failed")||ee.includes("has no attribute")?k("API endpoint not deployed. Please deploy ppm_api.py to your Frappe server."):k(ee),d([]),f(0),p(!1)}}finally{A||y(!1)}}),()=>{A=!0}},[O,t,a,s,T]);const C=j.useCallback(()=>{S.current=!1,N(A=>A+1)},[]);return{ppms:i,totalCount:c,hasMore:g,loading:x,error:_,refetch:C}}function cM(e){const[t,a]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>oe(null,null,function*(){if(!e){a(null),i(!1);return}try{i(!0),c(null);const p=yield e0.getAssetMaintenanceDetails(e);a(p)}catch(p){c(p instanceof Error?p.message:"Failed to fetch PPM details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const g=j.useCallback(()=>{f()},[f]);return{ppm:t,loading:s,error:d,refetch:g}}function nk(){const[e,t]=j.useState(!1),[a,s]=j.useState(null),i=j.useCallback(f=>oe(null,null,function*(){try{return t(!0),s(null),yield e0.createAssetMaintenance(f)}catch(g){const p=g instanceof Error?g.message:"Failed to create PPM schedule";throw s(p),g}finally{t(!1)}}),[]),d=j.useCallback((f,g)=>oe(null,null,function*(){try{return t(!0),s(null),yield e0.updateAssetMaintenance(f,g)}catch(p){const x=p instanceof Error?p.message:"Failed to update PPM schedule";throw s(x),p}finally{t(!1)}}),[]),c=j.useCallback(f=>oe(null,null,function*(){try{return t(!0),s(null),yield e0.deleteAssetMaintenance(f)}catch(g){const p=g instanceof Error?g.message:"Failed to delete PPM schedule";throw s(p),g}finally{t(!1)}}),[]);return{createPPM:i,updatePPM:d,deletePPM:c,loading:e,error:a}}const dM=()=>{const{t:e}=Qa(),t=Na(),[a,s]=j.useState(0),[i,d]=j.useState(""),[c,f]=j.useState(""),[g,p]=j.useState(null),[x,y]=j.useState(null),_=j.useRef(null),k=20,T=c?{company:c}:{},{ppms:N,totalCount:S,hasMore:O,loading:C,error:A,refetch:P}=oM(T,k,a*k,"creation desc"),{deletePPM:I,loading:ee}=nk();j.useEffect(()=>{const me=ae=>{_.current&&!_.current.contains(ae.target)&&y(null)};return x&&document.addEventListener("mousedown",me),()=>{document.removeEventListener("mousedown",me)}},[x]);const B=()=>{t("/ppm/new")},H=me=>{t(`/ppm/${me}`)},Y=me=>{t(`/ppm/${me}`)},ue=me=>oe(null,null,function*(){try{yield I(me),p(null),P(),alert("PPM schedule deleted successfully!")}catch(ae){alert(`Failed to delete: ${ae instanceof Error?ae.message:"Unknown error"}`)}}),xe=me=>{t(`/ppm/new?duplicate=${me}`)},le=me=>{const ae=JSON.stringify(me,null,2),Z=new Blob([ae],{type:"application/json"}),K=URL.createObjectURL(Z),te=document.createElement("a");te.href=K,te.download=`ppm_${me.name}.json`,te.click(),URL.revokeObjectURL(K)},ge=()=>{const ae=[["PPM ID","Company","Asset","Asset Type","Frequency","No. of PMs","Total Amount"].join(","),...N.map(se=>[se.name,se.company||"",se.asset_name||"",se.custom_asset_type||"",se.custom_frequency||"",se.custom_no_of_pms||"",se.custom_total_amount||""].join(","))].join(`
|
||
`),Z=new Blob([ae],{type:"text/csv"}),K=URL.createObjectURL(Z),te=document.createElement("a");te.href=K,te.download=`ppm_schedules_${new Date().toISOString().split("T")[0]}.csv`,te.click(),URL.revokeObjectURL(K)};if(C&&a===0)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]})});if(A)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-yellow-800 dark:text-yellow-300 mb-4",children:"⚠️ PPM API Not Available"}),r.jsxs("div",{className:"text-yellow-700 dark:text-yellow-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"The PPM API endpoint is not deployed yet."})}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:()=>t("/ppm/new"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Creating New (Demo)"}),r.jsx("button",{onClick:P,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),r.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-yellow-300 dark:border-yellow-700",children:r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[r.jsx("strong",{children:"Technical Error:"})," ",A]})})]})});const be=N.filter(me=>{var ae,Z,K,te;return((ae=me.name)==null?void 0:ae.toLowerCase().includes(i.toLowerCase()))||((Z=me.asset_name)==null?void 0:Z.toLowerCase().includes(i.toLowerCase()))||((K=me.company)==null?void 0:K.toLowerCase().includes(i.toLowerCase()))||((te=me.custom_asset_type)==null?void 0:te.toLowerCase().includes(i.toLowerCase()))});return r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:e("ppm.title")}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",S," PPM schedule",S!==1?"s":""]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:ge,className:"bg-green-600 hover:bg-green-700 text-white px-4 py-3 rounded-lg flex items-center gap-2 shadow transition-all",disabled:N.length===0,children:[r.jsx(Qr,{}),r.jsx("span",{className:"font-medium",children:e("listPages.export")})]}),r.jsxs("button",{onClick:B,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(ts,{}),r.jsx("span",{className:"font-medium",children:e("ppm.addPPM")})]})]})]}),r.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:r.jsxs("div",{className:"flex items-center gap-2 border border-gray-300 dark:border-gray-600 rounded-lg px-4 py-2 bg-white dark:bg-gray-700",children:[r.jsx($s,{className:"text-gray-400 dark:text-gray-500"}),r.jsx("input",{type:"text",placeholder:"Search by ID, asset, company...",value:i,onChange:me=>d(me.target.value),className:"flex-1 outline-none text-gray-700 dark:text-gray-200 bg-transparent"})]})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4",children:r.jsx("input",{type:"text",placeholder:"Filter by Company",value:c,onChange:me=>{f(me.target.value),s(0)},className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500"})})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"PPM ID"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Company"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Asset Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Frequency"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"No. of PMs"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Total Amount"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:be.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx($s,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No PPM schedules found"}),r.jsx("button",{onClick:B,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first PPM schedule"})]})})}):be.map(me=>r.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer",onClick:()=>H(me.name),children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:me.name})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hp,{className:"text-gray-400"}),r.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.company||"-"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.asset_name||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.custom_asset_type||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(D_,{className:"text-blue-500"}),r.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.custom_frequency||"-"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:me.custom_no_of_pms||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:me.custom_total_amount?`$${me.custom_total_amount.toLocaleString()}`:"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"relative",onClick:ae=>ae.stopPropagation(),children:[r.jsx("button",{onClick:()=>y(x===me.name?null:me.name),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700",children:r.jsx(g0,{})}),x===me.name&&r.jsxs("div",{ref:_,className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg z-10 border border-gray-200 dark:border-gray-700",children:[r.jsxs("button",{onClick:()=>{H(me.name),y(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(hl,{}),"View"]}),r.jsxs("button",{onClick:()=>{Y(me.name),y(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(Rr,{}),"Edit"]}),r.jsxs("button",{onClick:()=>{xe(me.name),y(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(Cc,{}),"Duplicate"]}),r.jsxs("button",{onClick:()=>{le(me),y(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[r.jsx(Qr,{}),"Export"]}),r.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700"}),r.jsxs("button",{onClick:()=>{p(me.name),y(null)},className:"w-full text-left px-4 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center gap-2",children:[r.jsx(ha,{}),"Delete"]})]})]})})]},me.name))})]})}),(O||a>0)&&r.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",a*k+1," to ",Math.min((a+1)*k,S)," of ",S," results"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>s(Math.max(0,a-1)),disabled:a===0,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),r.jsx("button",{onClick:()=>s(a+1),disabled:!O,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]}),g&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4",children:[r.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white mb-4",children:"Confirm Delete"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"Are you sure you want to delete this PPM schedule? This action cannot be undone."}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>p(null),className:"px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-200 dark:bg-gray-700 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-600",children:"Cancel"}),r.jsx("button",{onClick:()=>ue(g),disabled:ee,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50",children:ee?"Deleting...":"Delete"})]})]})})]})},uM=()=>{const{ppmName:e}=ul(),t=Na(),[a]=fl(),s=a.get("duplicate"),i=e==="new",d=i&&!!s,{ppm:c,loading:f,error:g,refetch:p}=cM(d?s:i?null:e||null),{createPPM:x,updatePPM:y,loading:_}=nk(),[k,T]=j.useState(i),[N,S]=j.useState({company:"",asset_name:"",custom_asset_type:"",maintenance_team:"",custom_frequency:"",custom_total_amount:0,custom_no_of_pms:0,custom_price_per_pm:0});j.useEffect(()=>{c&&S({company:c.company||"",asset_name:c.asset_name||"",custom_asset_type:c.custom_asset_type||"",maintenance_team:c.maintenance_team||"",custom_frequency:c.custom_frequency||"",custom_total_amount:c.custom_total_amount||0,custom_no_of_pms:c.custom_no_of_pms||0,custom_price_per_pm:c.custom_price_per_pm||0})},[c,d]);const O=A=>{const{name:P,value:I}=A.target;S(ee=>Ee(ie({},ee),{[P]:P.includes("amount")||P.includes("pms")||P.includes("price")?parseFloat(I)||0:I}))},C=A=>oe(null,null,function*(){var P;if(A.preventDefault(),!N.asset_name){alert("Please enter Asset Name");return}try{if(i||d){const I=yield x(N);alert(d?"PPM schedule duplicated successfully!":"PPM schedule created successfully!"),(P=I.asset_maintenance)!=null&&P.name?t(`/ppm/${I.asset_maintenance.name}`):(p(),t("/ppm"))}else e&&(yield y(e,N),alert("PPM schedule updated successfully!"),T(!1),p())}catch(I){console.error("PPM save error:",I),alert("Failed to save: "+(I instanceof Error?I.message:"Unknown error"))}});return f?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading PPM schedule..."})]})}):g&&!i&&!d?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error: ",g]}),r.jsx("button",{onClick:()=>t("/ppm"),className:"mt-2 text-red-700 dark:text-red-400 underline hover:text-red-800 dark:hover:text-red-300",children:"Back to PPM schedules"})]})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsx("div",{className:"flex items-center gap-4",children:r.jsxs("button",{onClick:()=>t("/ppm"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(Gs,{}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:d?"Duplicate PPM Schedule":i?"New PPM Schedule":"PPM Schedule Details"})]})}),r.jsx("div",{className:"flex items-center gap-3",children:!i&&!k&&r.jsxs("button",{onClick:()=>T(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Rr,{}),"Edit"]})})]}),r.jsxs("form",{onSubmit:C,children:[r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Company *"}),k?r.jsx("input",{type:"text",name:"company",value:N.company,onChange:O,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.company)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Name *"}),k?r.jsx("input",{type:"text",name:"asset_name",value:N.asset_name,onChange:O,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.asset_name)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Type"}),k?r.jsx("input",{type:"text",name:"custom_asset_type",value:N.custom_asset_type,onChange:O,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_asset_type)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Team"}),k?r.jsx("input",{type:"text",name:"maintenance_team",value:N.maintenance_team,onChange:O,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.maintenance_team)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Frequency"}),k?r.jsx("input",{type:"text",name:"custom_frequency",value:N.custom_frequency,onChange:O,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"e.g., Monthly, Quarterly, Yearly"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_frequency)||"-"})})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"Financial Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Number of PMs"}),k?r.jsx("input",{type:"number",name:"custom_no_of_pms",value:N.custom_no_of_pms,onChange:O,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",min:"0"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:(c==null?void 0:c.custom_no_of_pms)||"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Price per PM"}),k?r.jsx("input",{type:"number",name:"custom_price_per_pm",value:N.custom_price_per_pm,onChange:O,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",min:"0",step:"0.01"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white",children:c!=null&&c.custom_price_per_pm?`$${c.custom_price_per_pm.toLocaleString()}`:"-"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Total Amount"}),k?r.jsx("input",{type:"number",name:"custom_total_amount",value:N.custom_total_amount,onChange:O,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",min:"0",step:"0.01"}):r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-gray-900 dark:text-white font-semibold",children:c!=null&&c.custom_total_amount?`$${c.custom_total_amount.toLocaleString()}`:"-"})})]})]})]})]}),r.jsx("div",{className:"lg:col-span-1",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Schedule Information"}),!i&&c&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"PPM ID"}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:c.name})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),r.jsx("p",{className:"text-xs text-gray-900 dark:text-white",children:c.creation?new Date(c.creation).toLocaleString():"-"})]})]}),i&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Wg,{className:"text-4xl text-gray-400 dark:text-gray-500 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Schedule information will appear after creation"})]})]})})]}),k&&r.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[r.jsx("button",{type:"button",onClick:()=>{i?t("/ppm"):(T(!1),c&&S({company:c.company||"",asset_name:c.asset_name||"",custom_asset_type:c.custom_asset_type||"",maintenance_team:c.maintenance_team||"",custom_frequency:c.custom_frequency||"",custom_total_amount:c.custom_total_amount||0,custom_no_of_pms:c.custom_no_of_pms||0,custom_price_per_pm:c.custom_price_per_pm||0}))},className:"px-6 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:"Cancel"}),r.jsxs("button",{type:"submit",disabled:_,className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(jr,{}),_?"Saving...":i?"Create":"Save Changes"]})]})]})]})};class fM{submitDocument(t,a){return oe(this,null,function*(){try{const s=yield this.fetchWithTimeout(`${Bt.BASE_URL}/api/resource/PM Schedule Generator/${encodeURIComponent(t)}`,{method:"GET",headers:{Accept:"application/json"},credentials:"include"},3e4);if(!s.ok){const f=yield s.text();console.warn("Failed to fetch document for submit:",f);return}const d=(yield s.json()).data;if(!d){console.warn("No document data received");return}const c=yield this.fetchWithTimeout(`${Bt.BASE_URL}/api/method/frappe.client.submit`,{method:"POST",headers:a,credentials:"include",body:JSON.stringify({doc:d})},6e4);if(c.ok)console.log("✅ Document submitted successfully");else{const f=yield c.text();console.warn("Failed to submit document:",f)}}catch(s){console.warn("Error submitting document:",s.message)}})}fetchWithTimeout(t,a,s=12e4){return oe(this,null,function*(){var c,f;const i=new AbortController,d=setTimeout(()=>i.abort(),s);try{const g=yield fetch(t,Ee(ie({},a),{signal:i.signal}));return clearTimeout(d),g}catch(g){throw clearTimeout(d),g.name==="AbortError"?new Error(`Request timeout after ${s}ms. The server may be slow or the request is too large.`):(c=g.message)!=null&&c.includes("Failed to fetch")||(f=g.message)!=null&&f.includes("ERR_CONNECTION_TIMED_OUT")?new Error(`Connection timeout. Please check:
|
||
1. Your internet connection
|
||
2. Server is accessible
|
||
3. Try with fewer assets`):g}})}getFilteredAssets(t){return oe(this,null,function*(){const a=[];t.modality&&a.push(["custom_modality","=",t.modality]),t.asset_type&&a.push(["custom_asset_type","=",t.asset_type]),t.department&&a.push(["department","=",t.department]),t.location&&a.push(["location","=",t.location]),t.manufacturer&&a.push(["custom_manufacturer","=",t.manufacturer]),t.model&&a.push(["custom_model","=",t.model]);const s=JSON.stringify(a),i=JSON.stringify(["name","asset_name","custom_asset_type","department","location","custom_manufacturer","custom_model","custom_modality","company"]),d=yield rt.apiCall(`/api/resource/Asset?filters=${encodeURIComponent(s)}&fields=${encodeURIComponent(i)}&limit_page_length=1000`);return(d==null?void 0:d.data)||[]})}createBulkMaintenanceSchedules(t){return oe(this,null,function*(){var d,f,g,p,x,y;if(!t.hospital)throw new Error("Hospital/Company is required to create PM Schedule Generator");if(!t.periodicity)throw new Error("Periodicity is required");if(t.assets.length===0)throw new Error("At least one asset must be selected");t.assets.length>50&&console.warn(`Creating schedules for ${t.assets.length} assets. This may take a while...`);const a={doctype:"PM Schedule Generator",hospital:t.hospital,start_date:t.start_date,end_date:t.end_date,periodicity:t.periodicity,pm_for:t.pm_for||null,no_of_pms:t.no_of_pms||null,maintenance_team:t.maintenance_team||null,maintenance_manager:t.maintenance_manager||null,assign_to:t.assign_to||null,modality:t.modality||null,manufacturer:t.manufacturer||null,model:t.model||null,department:t.department||null,maintenance_entries:t.assets.map(_=>({doctype:"PM Entry Line",asset:_.name,start_date:t.start_date,end_date:t.end_date,manufacturer:_.custom_manufacturer||null,model:_.custom_model||null}))};console.log("Creating PM Schedule Generator with document:",JSON.stringify(a,null,2));const s=yield rt.getCSRFToken(),i={"Content-Type":"application/json",Accept:"application/json"};s&&(i["X-Frappe-CSRF-Token"]=s);try{const _=yield this.fetchWithTimeout(`${Bt.BASE_URL}/api/method/frappe.client.insert`,{method:"POST",headers:i,credentials:"include",body:JSON.stringify({doc:a})},12e4),k=yield _.text();if(console.log("frappe.client.insert response:",k),!_.ok)throw new Error(`HTTP ${_.status}: ${k}`);const T=JSON.parse(k),N=(d=T==null?void 0:T.message)==null?void 0:d.name;if(N)return console.log("✅ PM Schedule Generator created successfully:",N),yield this.submitDocument(N,i),{success:!0,created:t.assets.length,document:N,message:`PM Schedule Generator "${N}" created and submitted with ${t.assets.length} assets`};throw new Error("No document name in response")}catch(_){console.warn("Method 1 (frappe.client.insert) failed:",_.message);try{const c=a,{doctype:k,maintenance_entries:T}=c,N=fn(c,["doctype","maintenance_entries"]),S=Ee(ie({},N),{maintenance_entries:T.map(B=>{var H=B,{doctype:I}=H,ee=fn(H,["doctype"]);return ee})});console.log("Trying Resource API with:",JSON.stringify(S,null,2));const O=yield this.fetchWithTimeout(`${Bt.BASE_URL}/api/resource/PM%20Schedule%20Generator`,{method:"POST",headers:i,credentials:"include",body:JSON.stringify(S)},12e4),C=yield O.text();if(console.log("Resource API response:",C),!O.ok)throw new Error(`HTTP ${O.status}: ${C}`);const A=JSON.parse(C),P=(f=A==null?void 0:A.data)==null?void 0:f.name;if(P)return console.log("✅ PM Schedule Generator created via Resource API:",P),yield this.submitDocument(P,i),{success:!0,created:t.assets.length,document:P,message:`PM Schedule Generator "${P}" created and submitted with ${t.assets.length} assets`};throw new Error("No document name in response")}catch(k){console.warn("Method 2 (Resource API) failed:",k.message);const T=[];throw(((g=_==null?void 0:_.message)==null?void 0:g.includes("timeout"))||((p=_==null?void 0:_.message)==null?void 0:p.includes("Failed to fetch")))&&(((x=k==null?void 0:k.message)==null?void 0:x.includes("timeout"))||((y=k==null?void 0:k.message)==null?void 0:y.includes("Failed to fetch")))?T.push(`⚠️ Connection timeout detected. This usually means:
|
||
• The server is taking too long to process ${t.assets.length} assets
|
||
• Network connection is slow or unstable
|
||
• Server may be overloaded
|
||
|
||
💡 Suggestions:
|
||
• Try with fewer assets (10-20 at a time)
|
||
• Check your internet connection
|
||
• Try again later if server is busy`):(T.push("Failed to create PM Schedule Generator. Errors:"),_!=null&&_.message&&T.push(`• frappe.client.insert: ${_.message.substring(0,150)}`),k!=null&&k.message&&T.push(`• Resource API: ${k.message.substring(0,150)}`),T.push(`
|
||
Please ensure:
|
||
1. Hospital (${t.hospital}) is valid
|
||
2. You have permission to create PM Schedule Generator
|
||
3. All required fields are filled (including PM Name and Assign To)`)),new Error(`Failed to create PM Schedule Generator.
|
||
|
||
${T.join(`
|
||
`)}`)}}})}getFilterOptions(){return oe(this,null,function*(){try{const t=yield rt.apiCall(`/api/resource/Asset?fields=${encodeURIComponent(JSON.stringify(["custom_modality","custom_asset_type","department","location","custom_manufacturer","custom_model"]))}&limit_page_length=1000`),a=(t==null?void 0:t.data)||[];return{modalities:[...new Set(a.map(i=>i.custom_modality).filter(Boolean))],assetTypes:[...new Set(a.map(i=>i.custom_asset_type).filter(Boolean))],departments:[...new Set(a.map(i=>i.department).filter(Boolean))],locations:[...new Set(a.map(i=>i.location).filter(Boolean))],manufacturers:[...new Set(a.map(i=>i.custom_manufacturer).filter(Boolean))],models:[...new Set(a.map(i=>i.custom_model).filter(Boolean))],company:[...new Set(a.map(i=>i.company).filter(Boolean))]}}catch(t){return console.error("Error fetching filter options:",t),{modalities:[],assetTypes:[],departments:[],locations:[],manufacturers:[],models:[],company:[]}}})}getMaintenanceTeams(){return oe(this,null,function*(){try{const t=yield rt.apiCall(`/api/resource/Asset Maintenance Team?fields=${encodeURIComponent(JSON.stringify(["name"]))}&limit_page_length=1000`);return t!=null&&t.data&&t.data.length>0?t.data.map(a=>({name:a.name,maintenance_team_name:a.name})):[]}catch(t){return console.warn("Could not fetch maintenance teams:",(t==null?void 0:t.message)||"Unknown error"),[]}})}getMaintenanceTeamDetails(t){return oe(this,null,function*(){try{const a=yield rt.apiCall(`/api/resource/Asset Maintenance Team/${encodeURIComponent(t)}`);if(a!=null&&a.data){const s=a.data,i=[];return s.maintenance_team_members&&Array.isArray(s.maintenance_team_members)&&s.maintenance_team_members.forEach(d=>{d.team_member&&i.push(d.team_member)}),{name:s.name,maintenance_manager:s.maintenance_manager||void 0,team_members:i.length>0?i:void 0}}return null}catch(a){return console.warn("Could not fetch maintenance team details:",(a==null?void 0:a.message)||"Unknown error"),null}})}}const cf=new fM,hM=()=>{const{t:e}=Qa(),t=Na(),[a,s]=j.useState({}),[i,d]=j.useState([]),[c,f]=j.useState({start_date:"",end_date:"",maintenance_team:"",assign_to:"",pm_for:"",maintenance_manager:"",periodicity:"Monthly",maintenance_type:"Preventive",no_of_pms:"",department:""}),[g,p]=j.useState(!1),[x,y]=j.useState(!1),[_,k]=j.useState([]),[T,N]=j.useState({modalities:[],assetTypes:[],departments:[],locations:[],manufacturers:[],models:[],company:[]}),[S,O]=j.useState([]),[C,A]=j.useState(""),[P,I]=j.useState(null);j.useEffect(()=>{B(),H()},[]);const ee=(Z,K,te)=>{if(!Z||!K||!te)return null;const se=parseInt(te,10);if(isNaN(se)||se<1)return null;const F=se-1;if(F<0)return null;const D=new Date(Z),W=new Date(D);switch(K){case"Daily":W.setDate(W.getDate()+F);break;case"Weekly":W.setDate(W.getDate()+F*7);break;case"Monthly":W.setMonth(W.getMonth()+F);break;case"Quarterly":W.setMonth(W.getMonth()+F*3);break;case"Half-yearly":W.setMonth(W.getMonth()+F*6);break;case"Yearly":W.setFullYear(W.getFullYear()+F);break;case"2 Yearly":W.setFullYear(W.getFullYear()+F*2);break;case"3 Yearly":W.setFullYear(W.getFullYear()+F*3);break;default:return null}const G=W.getFullYear(),J=String(W.getMonth()+1).padStart(2,"0"),de=String(W.getDate()).padStart(2,"0");return`${G}-${J}-${de}`};j.useEffect(()=>{oe(null,null,function*(){if(c.maintenance_team){const K=yield cf.getMaintenanceTeamDetails(c.maintenance_team);K&&f(te=>Ee(ie({},te),{maintenance_manager:K.maintenance_manager||"",assign_to:K.team_members&&K.team_members.length===1?K.team_members[0]:te.assign_to}))}else f(K=>Ee(ie({},K),{maintenance_manager:"",assign_to:""}))})},[c.maintenance_team]),j.useEffect(()=>{if(c.start_date&&c.periodicity&&c.no_of_pms){const Z=ee(c.start_date,c.periodicity,c.no_of_pms);Z&&f(K=>Ee(ie({},K),{end_date:Z}))}},[c.start_date,c.periodicity,c.no_of_pms]);const B=()=>oe(null,null,function*(){const Z=yield cf.getFilterOptions();N(Z)}),H=()=>oe(null,null,function*(){const Z=yield cf.getMaintenanceTeams();O(Z)}),Y=()=>oe(null,null,function*(){y(!0);try{const Z=new URLSearchParams;a.company&&Z.append("company",a.company),a.custom_modality&&Z.append("custom_modality",a.custom_modality),a.custom_manufacturer&&Z.append("custom_manufacturer",a.custom_manufacturer),a.custom_device_status&&Z.append("custom_device_status",a.custom_device_status),a.custom_model&&Z.append("custom_model",a.custom_model),a.department&&Z.append("department",a.department);const K=yield fetch(`/api/method/get_assets?${Z.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!K.ok)throw new Error(`HTTP error! status: ${K.status}`);const se=(yield K.json()).message||[];k(se),d([])}catch(Z){console.error("Error fetching assets:",Z),alert("Failed to fetch assets: "+(Z instanceof Error?Z.message:"Unknown error"))}finally{y(!1)}}),ue=(Z,K)=>{s(te=>Ee(ie({},te),{[Z]:K||void 0}))},xe=Z=>{d(K=>K.includes(Z)?K.filter(te=>te!==Z):[...K,Z])},le=()=>{const Z=ge();i.length===Z.length&&Z.length>0?d([]):d(Z.map(K=>K.name))},ge=()=>{if(!C)return _;const Z=C.toLowerCase();return _.filter(K=>{var te,se,F,D,W,G;return((te=K.asset_name)==null?void 0:te.toLowerCase().includes(Z))||((se=K.custom_modality)==null?void 0:se.toLowerCase().includes(Z))||((F=K.company)==null?void 0:F.toLowerCase().includes(Z))||((D=K.custom_manufacturer)==null?void 0:D.toLowerCase().includes(Z))||((W=K.custom_model)==null?void 0:W.toLowerCase().includes(Z))||((G=K.custom_device_status)==null?void 0:G.toLowerCase().includes(Z))})},be=()=>oe(null,null,function*(){if(i.length===0){alert("Please select at least one asset");return}if(!a.company){alert("Please select a Hospital/Company in the filters first");return}if(!c.pm_for){alert("Please enter a PM Name");return}if(!c.start_date||!c.end_date){alert("Please select start and end dates");return}if(new Date(c.start_date)>new Date(c.end_date)){alert("Start date must be before end date");return}if(!c.assign_to){alert("Please assign the task to a team member. This is required for Asset Maintenance creation.");return}if(window.confirm(`Are you sure you want to create maintenance schedules for ${i.length} asset(s)?`)){p(!0);try{const K=_.filter(F=>i.includes(F.name)).map(F=>({name:F.name,custom_manufacturer:F.custom_manufacturer,custom_model:F.custom_model})),te={assets:K,start_date:c.start_date,end_date:c.end_date,maintenance_team:c.maintenance_team||void 0,assign_to:c.assign_to||void 0,maintenance_manager:c.maintenance_manager||void 0,periodicity:c.periodicity,maintenance_type:c.maintenance_type,no_of_pms:c.no_of_pms||void 0,pm_for:c.pm_for||void 0,hospital:a.company,modality:a.custom_modality,manufacturer:a.custom_manufacturer,model:a.custom_model,department:c.department||a.department||void 0};console.log("=== DEBUG: Selected Asset Details ===",K),console.log("=== DEBUG: bulkData ===",te);const se=yield cf.createBulkMaintenanceSchedules(te);I({show:!0,document:se.document,count:se.created||i.length,type:"pm_schedule"}),d([]),f({start_date:"",end_date:"",maintenance_team:"",assign_to:"",pm_for:"",maintenance_manager:"",periodicity:"Monthly",maintenance_type:"Preventive",no_of_pms:"",department:""})}catch(K){console.error("Error creating schedules:",K);const te=K instanceof Error?K.message:"Unknown error";alert(`Failed to create maintenance schedules:
|
||
|
||
${te}`)}finally{p(!1)}}}),me=ge(),ae=Object.values(a).some(Z=>Z);return r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[r.jsxs("button",{onClick:()=>t("/ppm-planner"),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 flex items-center gap-2",children:[r.jsx(Gs,{}),r.jsx("span",{children:"Back to PPM Planner"})]}),r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:"PPM Planner - Bulk Schedule Generator"})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[r.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white",children:[r.jsx(ws,{})," Filter Assets"]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[r.jsx("div",{children:r.jsx(kt,{label:"Hospital/Company *",doctype:"Company",value:a.company||"",onChange:Z=>ue("company",Z),placeholder:"Select a hospital/company"})}),r.jsx("div",{children:r.jsx(kt,{label:"Modality",doctype:"Modality",value:a.custom_modality||"",onChange:Z=>ue("custom_modality",Z),placeholder:"Leave empty for all modalities"})}),r.jsx("div",{children:r.jsx(kt,{label:"Manufacturer",doctype:"Manufacturer",value:a.custom_manufacturer||"",onChange:Z=>ue("custom_manufacturer",Z),placeholder:"Leave empty for all manufacturers"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Device Status"}),r.jsxs("select",{value:a.custom_device_status||"",onChange:Z=>ue("custom_device_status",Z.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:"All Statuses"}),r.jsx("option",{value:"Active",children:"Active"}),r.jsx("option",{value:"Inactive",children:"Inactive"}),r.jsx("option",{value:"Under Maintenance",children:"Under Maintenance"}),r.jsx("option",{value:"Decommissioned",children:"Decommissioned"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Model"}),r.jsxs("select",{value:a.custom_model||"",onChange:Z=>ue("custom_model",Z.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:"Select Model (optional)"}),T.models.map(Z=>r.jsx("option",{value:Z,children:Z},Z))]})]}),r.jsx("div",{children:r.jsx(kt,{label:"Department",doctype:"Department",value:a.department||"",onChange:Z=>ue("department",Z),placeholder:"Select department (optional)"})})]}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:Y,disabled:x,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:x?r.jsxs(r.Fragment,{children:[r.jsx(Pn,{className:"animate-spin"}),"Loading..."]}):r.jsxs(r.Fragment,{children:[r.jsx($s,{}),"Fetch Assets"]})}),ae&&r.jsx("button",{onClick:()=>{s({}),k([]),d([])},className:"bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-lg",children:"Clear Filters"})]})]}),_.length>0&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsxs("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:["Select Assets (",i.length," of ",_.length," selected)"]}),r.jsxs("div",{className:"flex gap-3 items-center",children:[r.jsxs("div",{className:"relative",children:[r.jsx($s,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"text",placeholder:"Search assets...",value:C,onChange:Z=>A(Z.target.value),className:"pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsx("button",{onClick:le,className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 px-4 py-2 border border-blue-600 dark:border-blue-400 rounded-lg",children:i.length===me.length&&me.length>0?"Deselect All":"Select All"})]})]}),r.jsx("div",{className:"max-h-96 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 sticky top-0",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:r.jsx("input",{type:"checkbox",checked:i.length===me.length&&me.length>0,onChange:le,className:"rounded"})}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Asset Name"}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Modality"}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Manufacturer"}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Model"}),r.jsx("th",{className:"text-left p-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Status"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:me.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:6,className:"p-6 text-center text-gray-500 dark:text-gray-400",children:"No assets match your search criteria"})}):me.map(Z=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${i.includes(Z.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[r.jsx("td",{className:"p-3",children:r.jsx("input",{type:"checkbox",checked:i.includes(Z.name),onChange:()=>xe(Z.name),className:"rounded"})}),r.jsx("td",{className:"p-3 text-sm text-gray-900 dark:text-white font-medium",children:Z.asset_name}),r.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:Z.custom_modality||"-"}),r.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:Z.custom_manufacturer||"-"}),r.jsx("td",{className:"p-3 text-sm text-gray-700 dark:text-gray-300",children:Z.custom_model||"-"}),r.jsx("td",{className:"p-3 text-sm",children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${Z.custom_device_status==="Active"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":Z.custom_device_status==="Inactive"?"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:Z.custom_device_status||"-"})})]},Z.name))})]})})]}),i.length>0&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6",children:[r.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white",children:[r.jsx(ff,{})," Schedule Configuration"]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"PPM Name *"}),r.jsx("input",{type:"text",value:c.pm_for,onChange:Z=>f(K=>Ee(ie({},K),{pm_for:Z.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"Enter PM Name",required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"First PPM Date *"}),r.jsx("input",{type:"date",value:c.start_date,onChange:Z=>f(K=>Ee(ie({},K),{start_date:Z.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Periodicity *"}),r.jsxs("select",{value:c.periodicity,onChange:Z=>f(K=>Ee(ie({},K),{periodicity:Z.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"Daily",children:"Daily"}),r.jsx("option",{value:"Weekly",children:"Weekly"}),r.jsx("option",{value:"Monthly",children:"Monthly"}),r.jsx("option",{value:"Quarterly",children:"Quarterly"}),r.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),r.jsx("option",{value:"Yearly",children:"Yearly"}),r.jsx("option",{value:"2 Yearly",children:"2 Yearly"}),r.jsx("option",{value:"3 Yearly",children:"3 Yearly"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Maintenance Type"}),r.jsxs("select",{value:c.maintenance_type,onChange:Z=>f(K=>Ee(ie({},K),{maintenance_type:Z.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"Preventive",children:"Preventive"}),r.jsx("option",{value:"Corrective",children:"Corrective"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"No. of PMs"}),r.jsx("input",{type:"number",value:c.no_of_pms,onChange:Z=>f(K=>Ee(ie({},K),{no_of_pms:Z.target.value})),min:"1",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"Enter number of PMs"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"End date will be auto-calculated"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium mb-2 text-gray-700 dark:text-gray-300",children:"Last PPM Date *"}),r.jsx("input",{type:"date",value:c.end_date,onChange:Z=>f(K=>Ee(ie({},K),{end_date:Z.target.value})),min:c.start_date,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0})]}),r.jsxs("div",{children:[r.jsx(kt,{label:"Maintenance Team",doctype:"Asset Maintenance Team",value:c.maintenance_team,onChange:Z=>f(K=>Ee(ie({},K),{maintenance_team:Z}))}),c.maintenance_manager&&r.jsxs("div",{className:"mt-2 p-2 bg-blue-50 dark:bg-blue-900/20 rounded text-xs text-gray-600 dark:text-gray-400",children:[r.jsx("span",{className:"font-medium",children:"Maintenance Manager:"})," ",c.maintenance_manager]})]}),r.jsxs("div",{children:[r.jsx(kt,{label:"Assign To *",doctype:"User",value:c.assign_to,onChange:Z=>f(K=>Ee(ie({},K),{assign_to:Z})),placeholder:c.maintenance_team?"Select user (auto-selected if only one team member)":"Select user to assign tasks"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Required for Asset Maintenance creation"}),c.assign_to&&r.jsxs("div",{className:"mt-1 p-2 bg-green-50 dark:bg-green-900/20 rounded text-xs text-gray-600 dark:text-gray-400",children:[r.jsx("span",{className:"font-medium",children:"Assigned To:"})," ",c.assign_to]})]}),r.jsx("div",{children:r.jsx(kt,{label:"Department",doctype:"Department",value:c.department,onChange:Z=>f(K=>Ee(ie({},K),{department:Z})),placeholder:"Select department (optional)"})})]}),r.jsx("button",{onClick:be,disabled:g||!c.start_date||!c.end_date||!c.pm_for||!c.assign_to,className:"mt-6 bg-green-600 hover:bg-green-700 text-white px-6 py-3 rounded-lg flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed font-medium",children:g?r.jsxs(r.Fragment,{children:[r.jsx(Pn,{className:"animate-spin"}),"Creating Schedules..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ja,{}),"Generate Maintenance Schedules (",i.length," asset",i.length!==1?"s":"",")"]})})]}),_.length===0&&!x&&!(P!=null&&P.show)&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-12 text-center",children:[r.jsx(ws,{className:"mx-auto text-4xl text-gray-400 dark:text-gray-600 mb-4"}),r.jsx("h3",{className:"text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"No Assets Loaded"}),r.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:'Use the filters above to search for assets, then click "Fetch Assets" to load them.'}),r.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-400",children:"Note: Only submitted assets without existing maintenance schedules will be shown."})]}),(P==null?void 0:P.show)&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-lg w-full p-6",children:[r.jsxs("div",{className:"text-center mb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mx-auto mb-4",children:r.jsx(Ja,{className:"text-green-600 dark:text-green-400 text-3xl"})}),r.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:"Schedules Created Successfully!"}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400",children:[P.count," maintenance schedule",P.count!==1?"s":""," have been created."]})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 mb-6",children:[r.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"What was created:"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Document:"}),r.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-400",children:P.document})]}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:["A PM Schedule Generator document has been created with ",P.count," asset(s). Frappe will automatically create Asset Maintenance Logs when the document is submitted. You can view and manage it in the PPM Planner section."]})]})]}),r.jsxs("div",{className:"flex flex-col gap-3",children:[P.document&&r.jsxs("button",{onClick:()=>{t(`/ppm-planner/${P.document}`),I(null)},className:"w-full bg-blue-600 hover:bg-blue-700 text-white px-4 py-3 rounded-lg font-medium text-center flex items-center justify-center gap-2",children:[r.jsx(ff,{}),"View PPM Planner"]}),r.jsxs("button",{onClick:()=>t("/maintenance-calendar"),className:"w-full bg-purple-600 hover:bg-purple-700 text-white px-4 py-3 rounded-lg font-medium flex items-center justify-center gap-2",children:[r.jsx(ff,{}),"View Calendar"]}),r.jsx("button",{onClick:()=>I(null),className:"w-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 px-4 py-3 rounded-lg font-medium",children:"Create More Schedules"})]})]})})]})};function $p(e={},t=20,a=0,s="creation desc",i={}){const[d,c]=j.useState([]),[f,g]=j.useState(0),[p,x]=j.useState(!1),[y,_]=j.useState(!0),[k,T]=j.useState(null),[N,S]=j.useState(0),O=JSON.stringify(e),C=JSON.stringify(i);j.useEffect(()=>{let P=!1;const I=O,ee=C,B=t,H=a,Y=s;return oe(null,null,function*(){try{_(!0),T(null);let xe={},le={};try{xe=I?JSON.parse(I):{}}catch(me){xe={}}try{le=ee?JSON.parse(ee):{}}catch(me){le={}}const ge=ie(ie({},xe),le),be=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.get_pm_schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:JSON.stringify(ge),limit:B,offset:H,order_by:Y,include_child_tables:!0,fields:JSON.stringify(["name","pm_for","hospital","modality","periodicity","start_date","end_date","due_date"])})});if(!P){const me=(be==null?void 0:be.message)||be;if(me&&me.pm_schedules){const ae=me.pm_schedules||[];if(console.log("[usePMSchedules] Loaded",ae.length,"PM Schedules"),ae.length>0){const Z=ae[0];console.log("[usePMSchedules] 🔍 FIRST SCHEDULE FIELDS:",{name:Z.name,pm_for:Z.pm_for,"pm_for (bracket)":Z.pm_for,allKeys:Object.keys(Z),allKeysList:Object.keys(Z).join(", "),fullObject:Z})}c(ae),g(me.total_count||0),x(me.has_more||!1)}else console.warn("[usePMSchedules] No pm_schedules in response:",be),c([]),g(0),x(!1)}}catch(xe){P||(console.error("Error fetching PM Schedules:",xe),T(xe instanceof Error?xe.message:"Failed to fetch PM Schedules"),c([]),g(0))}finally{P||_(!1)}}),()=>{P=!0}},[O,C,t,a,s,N]);const A=j.useCallback(()=>{S(P=>P+1)},[]);return{pmSchedules:d,totalCount:f,hasMore:p,loading:y,error:k,refetch:A}}function mM(e){const[t,a]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>oe(null,null,function*(){if(!e){a(null),i(!1);return}i(!0),c(null);try{const g=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.get_pm_schedule_details",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:e})});if(console.log("[usePMScheduleDetails] API Response:",g),g&&g.name&&!g.error)console.log("[usePMScheduleDetails] Setting PM Schedule:",g),a(g);else{const p=(g==null?void 0:g.error)||"PM Schedule not found";console.warn("[usePMScheduleDetails] Error or not found:",p),c(p),a(null)}}catch(g){console.error("Error fetching PM Schedule details:",g),c(g instanceof Error?g.message:"Failed to fetch PM Schedule"),a(null)}finally{i(!1)}}),[e]);return j.useEffect(()=>{f()},[f]),{pmSchedule:t,loading:s,error:d,refetch:f}}function sk(){const[e,t]=j.useState(!1);return{createPMSchedule:x=>oe(null,null,function*(){t(!0);try{const y=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.create_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_data:JSON.stringify(x)})});if(y!=null&&y.success)return y.pm_schedule;throw new Error((y==null?void 0:y.error)||"Failed to create PM Schedule")}finally{t(!1)}}),updatePMSchedule:(x,y)=>oe(null,null,function*(){t(!0);try{const _=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.update_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x,pm_schedule_data:JSON.stringify(y)})});if(_!=null&&_.success)return _.pm_schedule;throw new Error((_==null?void 0:_.error)||"Failed to update PM Schedule")}finally{t(!1)}}),deletePMSchedule:x=>oe(null,null,function*(){t(!0);try{const y=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.delete_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x})});if(!(y!=null&&y.success))throw new Error((y==null?void 0:y.error)||"Failed to delete PM Schedule")}finally{t(!1)}}),submitPMSchedule:x=>oe(null,null,function*(){t(!0);try{const y=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.submit_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x})});if(y!=null&&y.success)return y.pm_schedule;throw new Error((y==null?void 0:y.error)||"Failed to submit PM Schedule")}finally{t(!1)}}),cancelPMSchedule:x=>oe(null,null,function*(){t(!0);try{const y=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.cancel_pm_schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x})});if(y!=null&&y.success)return y.pm_schedule;throw new Error((y==null?void 0:y.error)||"Failed to cancel PM Schedule")}finally{t(!1)}}),addMaintenanceEntry:(x,y)=>oe(null,null,function*(){t(!0);try{const _=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.add_maintenance_entry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x,entry_data:JSON.stringify(y)})});if(_!=null&&_.success)return _.maintenance_entries;throw new Error((_==null?void 0:_.error)||"Failed to add maintenance entry")}finally{t(!1)}}),removeMaintenanceEntry:(x,y)=>oe(null,null,function*(){t(!0);try{const _=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.remove_maintenance_entry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x,entry_name:y})});if(_!=null&&_.success)return _.maintenance_entries;throw new Error((_==null?void 0:_.error)||"Failed to remove maintenance entry")}finally{t(!1)}}),updateMaintenanceEntry:(x,y,_)=>oe(null,null,function*(){t(!0);try{const k=yield rt.apiCall("/api/method/asset_lite.api.ppm_generator_api.update_maintenance_entry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pm_schedule_name:x,entry_name:y,entry_data:JSON.stringify(_)})});if(k!=null&&k.success)return k.maintenance_entries;throw new Error((k==null?void 0:k.error)||"Failed to update maintenance entry")}finally{t(!1)}}),loading:e}}const gM=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const{t:g}=Qa(),[p,x]=j.useState(a>0?"selected":"all_with_filters"),[y,_]=j.useState("csv"),[k,T]=j.useState(f.filter(C=>C.default).map(C=>C.key));j.useEffect(()=>{a>0?x("selected"):x("all_with_filters")},[a]);const N=C=>{T(A=>A.includes(C)?A.filter(P=>P!==C):[...A,C])},S=()=>{T(f.map(C=>C.key))},O=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qr,{className:"text-white text-xl"}),r.jsxs("h3",{className:"text-lg font-semibold text-white",children:[g("listPages.export")," PPM Schedules"]})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(vt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Scope"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>x("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected schedule",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:p==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," schedule",i!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[i," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:p==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," schedule",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:g("listPages.exportFormat")}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${y==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:y==="csv",onChange:()=>_("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Ac,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:g("listPages.csv")}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${y==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:y==="excel",onChange:()=>_("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Oc,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:g("listPages.excel")}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:O,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(C=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${k.includes(C.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[p==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,p==="all_on_page"&&`Exporting ${i} row${i!==1?"s":""} from current page`,p==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>d(p,y,k),disabled:k.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_i,{}),"Export"]})})]})]})]})}):null},pM=({isOpen:e,onClose:t,selectedItems:a,onPrint:s,isPrinting:i})=>{const{t:d}=Qa(),[c,f]=j.useState(""),[g,p]=j.useState(!0),[x,y]=j.useState(""),[_,k]=j.useState("A4"),[T,N]=j.useState([]),[S,O]=j.useState([]),[C,A]=j.useState(!1);j.useEffect(()=>{e&&(P(),I())},[e]);const P=()=>oe(null,null,function*(){A(!0);try{const Y=((yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Print Format",filters:{doc_type:"PM Schedule Generator",disabled:0},fields:["name"],limit_page_length:0})})).json()).message||[]).map(ue=>ue.name);N(Y),Y.length>0&&!c&&f(Y[0])}catch(B){console.error("Error fetching print formats:",B)}finally{A(!1)}}),I=()=>oe(null,null,function*(){try{const Y=((yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Letter Head",filters:{disabled:0},fields:["name"],limit_page_length:0})})).json()).message||[]).map(ue=>ue.name);O(Y),Y.length>0&&!x&&y(Y[0])}catch(B){console.error("Error fetching letterheads:",B)}}),ee=()=>{if(!c){alert("Please select a print format");return}s(c,x,!g,_)};return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-lg w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-purple-500 to-purple-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(so,{className:"text-white text-xl"}),r.jsx("h3",{className:"text-lg font-semibold text-white",children:"Print PM Schedules"})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:i,children:r.jsx(vt,{size:20})})]})}),r.jsxs("div",{className:"p-6",children:[r.jsxs("div",{className:"mb-6 p-4 bg-purple-50 dark:bg-purple-900/20 rounded-lg border border-purple-200 dark:border-purple-700",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Fn,{className:"text-purple-600 dark:text-purple-400"}),r.jsxs("span",{className:"font-medium text-purple-800 dark:text-purple-300",children:[a.length," schedule",a.length!==1?"s":""," selected for printing"]})]}),r.jsxs("div",{className:"mt-2 text-sm text-purple-600 dark:text-purple-400 max-h-20 overflow-y-auto",children:[a.slice(0,5).join(", "),a.length>5&&` and ${a.length-5} more...`]})]}),r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:["Print Format ",r.jsx("span",{className:"text-red-500",children:"*"})]}),C?r.jsxs("div",{className:"flex items-center gap-2 text-gray-500",children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-purple-500"}),"Loading formats..."]}):T.length===0?r.jsx("div",{className:"text-amber-600 dark:text-amber-400 text-sm p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg",children:"No print formats found for PM Schedule Generator. Please create one in ERPNext."}):r.jsxs("select",{value:c,onChange:B=>f(B.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Select Print Format"}),T.map(B=>r.jsx("option",{value:B,children:B},B))]})]}),r.jsx("div",{className:"mb-4",children:r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:g,onChange:B=>p(B.target.checked),className:"rounded text-purple-600 focus:ring-purple-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Use Letterhead"})]})}),g&&r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Letterhead"}),r.jsxs("select",{value:x,onChange:B=>y(B.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"Default Letterhead"}),S.map(B=>r.jsx("option",{value:B,children:B},B))]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Page Size"}),r.jsxs("select",{value:_,onChange:B=>k(B.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"A4",children:"A4"}),r.jsx("option",{value:"Letter",children:"Letter"}),r.jsx("option",{value:"A3",children:"A3"}),r.jsx("option",{value:"A5",children:"A5"}),r.jsx("option",{value:"Legal",children:"Legal"})]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-end gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:i,children:"Cancel"}),r.jsx("button",{onClick:ee,disabled:!c||i||a.length===0,className:"px-4 py-2 text-sm font-medium text-white bg-purple-600 hover:bg-purple-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:i?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Preparing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(so,{}),"Print ",a.length," Schedule",a.length!==1?"s":""]})})]})]})}):null},xM=()=>{const{t:e}=Qa(),t=Na(),[a,s]=j.useState(0),[i,d]=j.useState(""),[c,f]=j.useState(null),[g,p]=j.useState(null),x=j.useRef(null),[y,_]=j.useState(!1),[k,T]=j.useState(""),[N,S]=j.useState(""),[O,C]=j.useState(""),[A,P]=j.useState(""),[I,ee]=j.useState(new Set),[B,H]=j.useState(!1),[Y,ue]=j.useState(!1),[xe,le]=j.useState(!1),[ge,be]=j.useState(!1),me=20,ae=[{key:"name",label:e("commonFields.pmId"),default:!0},{key:"pm_for",label:e("commonFields.name"),default:!0},{key:"hospital",label:e("commonFields.hospital"),default:!0},{key:"modality",label:e("commonFields.modality"),default:!0},{key:"manufacturer",label:e("commonFields.manufacturer"),default:!0},{key:"periodicity",label:e("ppm.periodicity"),default:!0},{key:"maintenance_team",label:"Maintenance Team",default:!1},{key:"docstatus",label:e("commonFields.status"),default:!0},{key:"creation",label:e("commonFields.createdOn"),default:!1},{key:"modified",label:e("commonFields.modifiedOn"),default:!1},{key:"owner",label:e("commonFields.createdBy"),default:!1},{key:"modified_by",label:e("commonFields.modifiedBy"),default:!1}],Z={};k&&(Z.hospital=k),N&&(Z.modality=N),O&&(Z.manufacturer=O),A&&(Z.periodicity=A);const{pmSchedules:K,totalCount:te,hasMore:se,loading:F,error:D,refetch:W}=$p(Z,me,a*me,"creation desc"),{deletePMSchedule:G,loading:J}=sk();j.useEffect(()=>{const Ze=ze=>{x.current&&!x.current.contains(ze.target)&&p(null)};return g&&document.addEventListener("mousedown",Ze),()=>{document.removeEventListener("mousedown",Ze)}},[g]),j.useEffect(()=>{ee(new Set)},[k,N,O,A,i,a]);const de=K.filter(Ze=>{var bt,Nt,Ot,Pt,je,ut;if(!i)return!0;const ze=i.toLowerCase();return((bt=Ze.name)==null?void 0:bt.toLowerCase().includes(ze))||((Nt=Ze.pm_for)==null?void 0:Nt.toLowerCase().includes(ze))||((Ot=Ze.hospital)==null?void 0:Ot.toLowerCase().includes(ze))||((Pt=Ze.modality)==null?void 0:Pt.toLowerCase().includes(ze))||((je=Ze.manufacturer)==null?void 0:je.toLowerCase().includes(ze))||((ut=Ze.maintenance_team)==null?void 0:ut.toLowerCase().includes(ze))}),De=()=>{I.size===de.length?ee(new Set):ee(new Set(de.map(Ze=>Ze.name)))},Ne=de.length>0&&I.size===de.length,$e=I.size>0&&I.size<de.length,Ve=Ze=>{ee(ze=>{const bt=new Set(ze);return bt.has(Ze)?bt.delete(Ze):bt.add(Ze),bt})},st=j.useCallback(()=>oe(null,null,function*(){const Ze=[];let ze=0;const bt=100;let Nt=!0;for(;Nt;)try{const je=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"PM Schedule Generator",filters:Z,fields:["*"],limit_start:ze*bt,limit_page_length:bt,order_by:"creation desc"})})).json()).message||[];Ze.push(...je),je.length<bt?Nt=!1:ze++,ze>100&&(console.warn("Export safety limit reached"),Nt=!1)}catch(Ot){throw console.error("Error fetching schedules for export:",Ot),Ot}return Ze}),[Z]),gt=(Ze,ze,bt)=>oe(null,null,function*(){ue(!0);try{let Nt=[];switch(Ze){case"selected":Nt=de.filter(je=>I.has(je.name));break;case"all_on_page":Nt=de;break;case"all_with_filters":Nt=yield st();break}if(Nt.length===0){alert("No data to export");return}const Ot=Nt.map(je=>{const ut=ie({},je);if(bt.includes("docstatus")){const jt=we(je);ut.docstatus=jt===1?"Submitted":jt===2?"Cancelled":"Draft"}return ut}),Pt=bt.map(je=>{const ut=ae.find(jt=>jt.key===je);return(ut==null?void 0:ut.label)||je});if(ze==="csv"){const je=[Pt.join(","),...Ot.map(Fe=>bt.map(ot=>{let dt=Fe[ot]||"";return typeof dt=="string"&&(dt.includes(",")||dt.includes('"')||dt.includes(`
|
||
`))&&(dt=`"${dt.replace(/"/g,'""')}"`),dt}).join(","))].join(`
|
||
`),ut=new Blob(["\uFEFF"+je],{type:"text/csv;charset=utf-8;"}),jt=URL.createObjectURL(ut),$t=document.createElement("a");$t.href=jt,$t.download=`ppm_schedules_export_${new Date().toISOString().split("T")[0]}.csv`,$t.click(),URL.revokeObjectURL(jt)}else if(ze==="excel"){const je=[Pt,...Ot.map($t=>bt.map(Fe=>$t[Fe]||""))],ut=kr.aoa_to_sheet(je),jt=kr.book_new();kr.book_append_sheet(jt,ut,"PPM Schedules"),Ic(jt,`ppm_schedules_export_${new Date().toISOString().split("T")[0]}.xlsx`)}H(!1),ee(new Set)}catch(Nt){console.error("Export failed:",Nt),alert(`Export failed: ${Nt instanceof Error?Nt.message:"Unknown error"}`)}finally{ue(!1)}}),zt=(Ze,ze,bt,Nt)=>{be(!0);try{const Ot=Array.from(I);if(Ot.length===0){alert("No schedules selected for printing");return}const Pt=window.location.origin,je=new URLSearchParams;je.append("doctype","PM Schedule Generator"),je.append("name",JSON.stringify(Ot)),je.append("format",Ze),je.append("no_letterhead",bt?"1":"0"),ze&&!bt&&je.append("letterhead",ze),je.append("options",JSON.stringify({"page-size":Nt}));const ut=`${Pt}/api/method/frappe.utils.print_format.download_multi_pdf?${je.toString()}`;window.open(ut,"_blank"),le(!1)}catch(Ot){console.error("Print failed:",Ot),alert(`Print failed: ${Ot instanceof Error?Ot.message:"Unknown error"}`)}finally{be(!1)}},Ge=()=>{t("/ppm-planner/new")},Ct=Ze=>{t(`/ppm-planner/${Ze}`)},St=Ze=>{t(`/ppm-planner/${Ze}`)},Ue=Ze=>oe(null,null,function*(){try{yield G(Ze),W(),f(null)}catch(ze){console.error("Error deleting PM Schedule:",ze),alert("Failed to delete PM Schedule")}}),ce=()=>{T(""),S(""),C(""),P(""),s(0)},we=Ze=>{var ze;return Ze.docstatus!==void 0?Number(Ze.docstatus):((ze=Ze.maintenance_entries)==null?void 0:ze.length)>0?Number(Ze.maintenance_entries[0].docstatus):0},Ie=k||N||O||A,lt=[k,N,O,A].filter(Boolean).length,ft=Math.ceil(te/me);return r.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsxs("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3 lg:px-6",children:[r.jsxs("div",{className:"flex justify-between items-center mb-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(xi,{className:"text-blue-600 dark:text-blue-400",size:24}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-800 dark:text-white",children:e("sidebar.ppmPlanner")}),r.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[e("ppm.manageSchedules"),I.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",I.size," selected"]})]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:()=>H(!0),className:"px-3 py-1.5 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors flex items-center gap-2 text-sm",disabled:te===0,children:[r.jsx(Qr,{}),r.jsx("span",{children:e("listPages.export")}),I.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:I.size})]}),r.jsxs("button",{onClick:()=>le(!0),className:"px-3 py-1.5 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors flex items-center gap-2 text-sm disabled:opacity-50 disabled:cursor-not-allowed",disabled:I.size===0,title:I.size===0?"Select schedules to print":`Print ${I.size} selected`,children:[r.jsx(so,{}),r.jsx("span",{children:"Print"}),I.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:I.size})]}),r.jsxs("button",{onClick:Ge,className:"px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2 text-sm",children:[r.jsx(ts,{}),r.jsx("span",{children:e("ppm.addPPM")})]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx($s,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400",size:14}),r.jsx("input",{type:"text",placeholder:e("listPages.searchPlaceholder"),value:i,onChange:Ze=>d(Ze.target.value),className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),r.jsxs("button",{onClick:()=>_(!y),className:`px-3 py-1.5 border rounded-lg transition-colors flex items-center gap-2 text-sm ${Ie?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400":"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[r.jsx(ws,{}),r.jsx("span",{children:e("listPages.filters")}),lt>0&&r.jsx("span",{className:"bg-blue-600 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs",children:lt}),y?r.jsx(m0,{}):r.jsx(Ec,{})]})]}),y&&r.jsxs("div",{className:"mt-3 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg border border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[r.jsx("div",{children:r.jsx(kt,{label:e("commonFields.hospital"),doctype:"Company",value:k,onChange:T,placeholder:e("filters.allHospitals"),filters:{domain:"Healthcare"}})}),r.jsx("div",{children:r.jsx(kt,{label:e("commonFields.modality"),doctype:"Modality",value:N,onChange:S,placeholder:e("filters.allModalities"),filters:{}})}),r.jsx("div",{children:r.jsx(kt,{label:e("commonFields.manufacturer"),doctype:"Manufacturer",value:O,onChange:C,placeholder:e("filters.allManufacturers"),filters:{}})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e("ppm.periodicity")}),r.jsxs("select",{value:A,onChange:Ze=>P(Ze.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:e("listPages.all")}),r.jsx("option",{value:"Daily",children:"Daily"}),r.jsx("option",{value:"Weekly",children:"Weekly"}),r.jsx("option",{value:"Monthly",children:"Monthly"}),r.jsx("option",{value:"Quarterly",children:"Quarterly"}),r.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),r.jsx("option",{value:"Yearly",children:"Yearly"})]})]})]}),Ie&&r.jsx("div",{className:"mt-4 flex justify-end",children:r.jsxs("button",{onClick:ce,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 flex items-center gap-2",children:[r.jsx(vt,{}),e("listPages.clearFilters")]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto p-4 lg:p-5",children:F&&a===0?r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),r.jsx("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:e("listPages.loading")})]}):D?r.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:r.jsx("p",{className:"text-red-600 dark:text-red-400",children:D})}):de.length===0?r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-8 text-center",children:[r.jsx(xi,{className:"mx-auto text-gray-400 mb-4",size:48}),r.jsx("h3",{className:"text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2",children:e("listPages.noResults")}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:e(i||Ie?"listPages.tryAdjustingFilters":"listPages.getStartedCreateFirst")}),!i&&!Ie&&r.jsx("button",{onClick:Ge,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:e("ppm.addPPM")})]}):r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:[r.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:De,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:Ne?"Deselect all":"Select all",children:Ne?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):$e?r.jsxs("div",{className:"relative",children:[r.jsx(wr,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(wr,{size:18})})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:e("commonFields.pmId")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:e("commonFields.name")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:e("commonFields.hospital")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:e("commonFields.modality")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:e("commonFields.manufacturer")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:e("ppm.periodicity")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:e("commonFields.status")}),r.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:e("listPages.actions")})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:de.map(Ze=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${I.has(Ze.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[r.jsx("td",{className:"px-4 py-4",children:r.jsx("button",{onClick:()=>Ve(Ze.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:I.has(Ze.name)?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):r.jsx(wr,{size:18})})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("button",{onClick:()=>Ct(Ze.name),className:"text-blue-600 dark:text-blue-400 hover:underline font-medium",children:Ze.name})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Ze.pm_for||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Ze.hospital||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Ze.modality||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Ze.manufacturer||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:Ze.periodicity||"-"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:(()=>{const ze=we(Ze);return r.jsx("span",{className:`px-2 py-1 text-xs font-semibold rounded-full ${ze===1?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":ze===0?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400"}`,children:ze===1?"Submitted":ze===2?"Cancelled":"Draft"})})()}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:r.jsxs("div",{className:"relative inline-block",ref:g===Ze.name?x:null,children:[r.jsx("button",{onClick:()=>p(g===Ze.name?null:Ze.name),className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 p-2",children:r.jsx(g0,{})}),g===Ze.name&&r.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-700 rounded-lg shadow-lg border border-gray-200 dark:border-gray-600 z-10",children:[r.jsxs("button",{onClick:()=>{Ct(Ze.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[r.jsx(hl,{})," ",e("listPages.view")]}),r.jsxs("button",{onClick:()=>{St(Ze.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[r.jsx(Rr,{})," ",e("listPages.edit")]}),r.jsxs("button",{onClick:()=>{f(Ze.name),p(null)},className:"w-full px-4 py-2 text-left text-sm text-red-600 dark:text-red-400 hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center gap-2",children:[r.jsx(ha,{})," ",e("listPages.delete")]})]})]})})]},Ze.name))})]}),ft>1&&r.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[e("listPages.showing")," ",a*me+1," ",e("listPages.to")," ",Math.min((a+1)*me,te)," ",e("listPages.of")," ",te," ",e("listPages.results")]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>s(Math.max(0,a-1)),disabled:a===0,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300",children:"Previous"}),r.jsx("button",{onClick:()=>s(a+1),disabled:!se,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300",children:"Next"})]})]})]})}),r.jsx(gM,{isOpen:B,onClose:()=>H(!1),selectedCount:I.size,totalCount:te,pageCount:de.length,onExport:gt,isExporting:Y,exportColumns:ae}),r.jsx(pM,{isOpen:xe,onClose:()=>le(!1),selectedItems:Array.from(I),onPrint:zt,isPrinting:ge}),c&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-md",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:e("confirmations.confirmDelete")}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:e("confirmations.cannotUndo")}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>f(null),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",disabled:J,children:e("common.cancel")}),r.jsx("button",{onClick:()=>Ue(c),className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",disabled:J,children:e(J?"common.deleting":"common.delete")})]})]})}),r.jsx("style",{children:`
|
||
@keyframes scale-in {
|
||
from {
|
||
transform: scale(0.95);
|
||
opacity: 0;
|
||
}
|
||
to {
|
||
transform: scale(1);
|
||
opacity: 1;
|
||
}
|
||
}
|
||
.animate-scale-in {
|
||
animation: scale-in 0.2s ease-out;
|
||
}
|
||
`})]})},yM=()=>{const{t:e}=Qa(),{scheduleName:t}=ul(),a=Na(),{pmSchedule:s,loading:i,error:d,refetch:c}=mM(t||null),{updatePMSchedule:f,deletePMSchedule:g,submitPMSchedule:p,cancelPMSchedule:x,loading:y}=sk(),{logs:_,refetch:k}=Wf({},1e4,0),[T,N]=j.useState(!1),[S,O]=j.useState(!1),[C,A]=j.useState(!1),[P,I]=j.useState(""),[ee,B]=j.useState(""),[H,Y]=j.useState(!1),[ue,xe]=j.useState(!1),[le,ge]=j.useState(new Set),[be,me]=j.useState(!1),[ae,Z]=j.useState(!1),[K,te]=j.useState(new Set),[se,F]=j.useState([]),[D,W]=j.useState([]),[G,J]=j.useState([]),[de,De]=j.useState(""),[Ne,$e]=j.useState({hospital:"",modality:"",device_status:"",start_date:"",end_date:"",maintenance_team:"",maintenance_manager:"",periodicity:"Monthly",assign_to:"",due_date:"",next_pm_date:"",manufacturer:"",model:"",pm_for:"",asset_name:"",no_of_pms:""});j.useEffect(()=>{oe(null,null,function*(){try{const dt=yield(yield fetch("/api/method/frappe.auth.get_logged_user",{method:"GET",credentials:"include"})).json();dt.message&&De(dt.message)}catch(ot){console.error("Error fetching current user:",ot)}})},[]),j.useEffect(()=>{if(t){const Fe=localStorage.getItem(`ppm_activity_${t}`);Fe&&J(JSON.parse(Fe))}},[t]),j.useEffect(()=>{if(s!=null&&s.maintenance_entries&&_.length>0){const Fe=[],ot=[];s.maintenance_entries.forEach(dt=>{_.filter(Ft=>Ft.asset_name===dt.asset).forEach(Ft=>{Ft.workflow_state==="Applied"?ot.push(Ee(ie({},Ft),{asset_display_name:dt.asset_name||dt.asset})):Ft.maintenance_status==="Planned"&&(!Ft.workflow_state||Ft.workflow_state==="Draft")&&Fe.push(Ee(ie({},Ft),{asset_display_name:dt.asset_name||dt.asset}))})}),F(Fe),W(ot)}},[s,_]),j.useEffect(()=>{if(_.length>0&&(s!=null&&s.maintenance_entries)){const Fe=[];if(s.maintenance_entries.forEach(ot=>{_.filter(wt=>wt.asset_name===ot.asset).forEach(wt=>{const Ft=wt.maintenance_status==="Planned"&&(!wt.workflow_state||wt.workflow_state==="Draft"),la=wt.workflow_state==="Applied";(Ft||la)&&wt.due_date&&Fe.push(wt.due_date)})}),Fe.length>0){const ot=Fe.sort((dt,wt)=>new Date(dt).getTime()-new Date(wt).getTime())[0];console.log("📅 Pending due dates:",Fe),console.log("📅 Earliest (Next PM Date):",ot),$e(dt=>dt.next_pm_date!==ot?Ee(ie({},dt),{next_pm_date:ot}):dt)}else console.log("📅 No pending entries found - all completed"),$e(ot=>Ee(ie({},ot),{next_pm_date:""}))}},[s,_]),j.useEffect(()=>{s&&$e({hospital:s.hospital||"",modality:s.modality||"",device_status:s.device_status||"",start_date:s.start_date||"",end_date:s.end_date||"",maintenance_team:s.maintenance_team||"",maintenance_manager:s.maintenance_manager||"",periodicity:s.periodicity||"Monthly",assign_to:s.assign_to||"",due_date:s.due_date||"",next_pm_date:s.next_pm_date||"",manufacturer:s.manufacturer||"",model:s.model||"",pm_for:s.pm_for||"",asset_name:s.asset_name||"",no_of_pms:s.no_of_pms||""})},[s]),j.useEffect(()=>{if(P&&Ne.next_pm_date){const Fe=new Date(P),ot=new Date(Ne.next_pm_date);Y(Fe<ot)}else Y(!1)},[P,Ne.next_pm_date]);const Ve=(Fe,ot,dt)=>{if(!Fe||!ot||!dt)return null;const wt=parseInt(dt,10);if(isNaN(wt)||wt<1)return null;const Ft=wt-1;if(Ft<0)return null;const la=new Date(Fe),Je=new Date(la);switch(ot){case"Daily":Je.setDate(Je.getDate()+Ft);break;case"Weekly":Je.setDate(Je.getDate()+Ft*7);break;case"Monthly":Je.setMonth(Je.getMonth()+Ft);break;case"Quarterly":Je.setMonth(Je.getMonth()+Ft*3);break;case"Half-yearly":Je.setMonth(Je.getMonth()+Ft*6);break;case"Yearly":Je.setFullYear(Je.getFullYear()+Ft);break;case"2 Yearly":Je.setFullYear(Je.getFullYear()+Ft*2);break;case"3 Yearly":Je.setFullYear(Je.getFullYear()+Ft*3);break;default:return null}const Lt=Je.getFullYear(),ye=String(Je.getMonth()+1).padStart(2,"0"),We=String(Je.getDate()).padStart(2,"0");return`${Lt}-${ye}-${We}`},st=Fe=>{const{name:ot,value:dt}=Fe.target;$e(wt=>{const Ft=Ee(ie({},wt),{[ot]:dt});if(ot==="start_date"||ot==="periodicity"||ot==="no_of_pms"){const la=Ve(ot==="start_date"?dt:wt.start_date,ot==="periodicity"?dt:wt.periodicity,ot==="no_of_pms"?dt:wt.no_of_pms);la&&(Ft.end_date=la)}return Ft})},gt=()=>oe(null,null,function*(){if(t)try{yield f(t,Ne),N(!1),c(),alert("PPM Planner updated successfully")}catch(Fe){console.error("Error updating PPM Planner:",Fe),alert("Failed to update PPM Planner")}}),zt=()=>oe(null,null,function*(){if(t)try{yield g(t),a("/ppm-planner")}catch(Fe){console.error("Error deleting PPM Planner:",Fe),alert("Failed to delete PPM Planner")}}),Ge=()=>oe(null,null,function*(){if(t)try{yield p(t),c(),alert("PPM Planner submitted successfully")}catch(Fe){console.error("Error submitting PPM Planner:",Fe),alert("Failed to submit PPM Planner")}}),Ct=()=>oe(null,null,function*(){if(t)try{yield x(t),c(),alert("PPM Planner cancelled successfully")}catch(Fe){console.error("Error cancelling PPM Planner:",Fe),alert("Failed to cancel PPM Planner")}}),St=()=>{if(se.length===0){alert("No planned maintenance entries found to apply.");return}const Fe=new Date().toISOString().split("T")[0];I(Fe),B(""),ge(new Set(se.map(ot=>ot.name))),A(!0)},Ue=Fe=>{ge(ot=>{const dt=new Set(ot);return dt.has(Fe)?dt.delete(Fe):dt.add(Fe),dt})},ce=()=>{ge(new Set(se.map(Fe=>Fe.name)))},we=()=>{ge(new Set)},Ie=()=>oe(null,null,function*(){if(!P){alert("Please enter a completion date.");return}if(H&&!ee.trim()){alert("Please provide a reason for early completion.");return}if(le.size===0){alert("Please select at least one entry to complete.");return}xe(!0);try{let Fe=0,ot=0;const dt=[],wt=se.filter(Je=>le.has(Je.name));for(const Je of wt)try{const Lt={maintenance_status:"Completed",workflow_state:"Applied",completion_date:P};H&&ee&&(Lt.custom_early_completion_reason=ee,Lt.custom_early_completion="Yes");const We=yield(yield fetch("/api/method/frappe.client.set_value",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({doctype:"Asset Maintenance Log",name:Je.name,fieldname:Lt})})).json();We.message?(Fe++,dt.push(Je.name)):(ot++,console.error(`Failed to apply ${Je.name}:`,We))}catch(Lt){ot++,console.error(`Error applying ${Je.name}:`,Lt)}const la=[{id:Date.now().toString(),user:de||"Unknown User",timestamp:new Date().toISOString(),action:"Applied",entriesCount:Fe,completionDate:P,earlyReason:H?ee:void 0,entries:dt},...G];J(la),t&&localStorage.setItem(`ppm_activity_${t}`,JSON.stringify(la)),A(!1),I(""),B(""),ge(new Set),k(),c(),alert(ot===0?`Successfully applied ${Fe} maintenance entries. They are now pending approval.`:`Applied ${Fe} entries. Failed to apply ${ot} entries.`)}catch(Fe){console.error("Error applying entries:",Fe),alert("Failed to apply entries.")}finally{xe(!1)}}),lt=()=>{if(D.length===0){alert("No entries pending approval.");return}te(new Set(D.map(Fe=>Fe.name))),me(!0)},ft=Fe=>{te(ot=>{const dt=new Set(ot);return dt.has(Fe)?dt.delete(Fe):dt.add(Fe),dt})},Ze=()=>{te(new Set(D.map(Fe=>Fe.name)))},ze=()=>{te(new Set)},bt=()=>oe(null,null,function*(){if(K.size===0){alert("Please select at least one entry to approve.");return}Z(!0);try{let Fe=0,ot=0;const dt=[],wt=D.filter(Je=>K.has(Je.name));for(const Je of wt)try{const ye=yield(yield fetch(`/api/resource/Asset Maintenance Log/${encodeURIComponent(Je.name)}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(!ye.data){console.error(`Failed to get document ${Je.name}`),ot++;continue}const We=Ee(ie({},ye.data),{workflow_state:"Approved",docstatus:1}),Vt=yield(yield fetch(`/api/resource/Asset Maintenance Log/${encodeURIComponent(Je.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(We)})).json();if(Vt.data&&Vt.data.docstatus===1)Fe++,dt.push(Je.name),console.log(`✅ Successfully approved and submitted: ${Je.name}`);else{console.log(`Trying alternative submit method for ${Je.name}...`);const aa=yield fetch("/api/method/frappe.desk.form.utils.get_next",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({doctype:"Asset Maintenance Log",name:Je.name,workflow_action:"Approve"})}),Ma=yield(yield fetch("/api/method/run_doc_method",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({dt:"Asset Maintenance Log",dn:Je.name,method:"submit"})})).json();Ma.message||!Ma.exc?(Fe++,dt.push(Je.name),console.log(`✅ Successfully submitted via run_doc_method: ${Je.name}`)):(ot++,console.error(`Failed to submit ${Je.name}:`,Ma))}}catch(Lt){ot++,console.error(`Error approving ${Je.name}:`,Lt)}const la=[{id:Date.now().toString(),user:de||"Unknown User",timestamp:new Date().toISOString(),action:"Approved",entriesCount:Fe,entries:dt},...G];J(la),t&&localStorage.setItem(`ppm_activity_${t}`,JSON.stringify(la)),me(!1),te(new Set),setTimeout(()=>{k(),c()},1e3),alert(ot===0?`Successfully approved and submitted ${Fe} maintenance entries. New planned entries should be created automatically.`:`Approved ${Fe} entries. Failed to approve ${ot} entries.`)}catch(Fe){console.error("Error approving entries:",Fe),alert("Failed to approve entries.")}finally{Z(!1)}}),Nt=Fe=>{switch(Fe){case"Planned":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400";case"Applied":return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";case"Approved":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}},Ot=Fe=>_.filter(dt=>dt.asset_name===Fe).filter(dt=>{const wt=dt.maintenance_status==="Planned"&&(!dt.workflow_state||dt.workflow_state==="Draft"),Ft=dt.workflow_state==="Applied";return wt||Ft}),Pt=Fe=>Ot(Fe).length>0,je=()=>s!=null&&s.maintenance_entries?s.maintenance_entries.filter(Fe=>Pt(Fe.asset)):[];if(i)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Pn,{className:"animate-spin text-blue-600",size:24}),r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Loading PPM Planner..."})]})});if(d)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:[r.jsx("p",{className:"text-red-600 dark:text-red-400",children:d}),r.jsx("button",{onClick:()=>a("/ppm-planner"),className:"mt-4 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:"Back to List"})]})});if(!s)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[r.jsx("p",{className:"text-yellow-600 dark:text-yellow-400",children:"PPM Planner not found"}),r.jsx("button",{onClick:()=>a("/ppm-planner"),className:"mt-4 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:"Back to List"})]})});const ut=s.docstatus===0,jt=s.docstatus===1;s.docstatus;const $t=je();return r.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[r.jsxs("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:()=>a("/ppm-planner"),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:r.jsx(Gs,{className:"text-gray-600 dark:text-gray-400"})}),r.jsx(xi,{className:"text-blue-600 dark:text-blue-400",size:28}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:s.name}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"PPM Planner Details"})]}),r.jsx("span",{className:`ml-4 px-3 py-1 text-sm font-semibold rounded-full ${jt?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":ut?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400"}`,children:jt?"Submitted":ut?"Draft":"Cancelled"})]}),r.jsxs("div",{className:"flex gap-2",children:[jt&&r.jsxs("div",{className:"flex gap-2 mr-4 pr-4 border-r border-gray-300 dark:border-gray-600",children:[se.length>0&&r.jsxs("button",{onClick:St,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2",children:[r.jsx(Yu,{}),"Bulk Complete(",se.length,")"]}),D.length>0&&r.jsxs("button",{onClick:lt,className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors flex items-center gap-2",children:[r.jsx(Ju,{}),"Approve (",D.length,")"]})]}),ut&&!T&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>N(!0),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2",children:[r.jsx(Rr,{}),"Edit"]}),r.jsxs("button",{onClick:Ge,disabled:y,className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",children:[r.jsx(Ja,{}),"Submit"]}),r.jsxs("button",{onClick:()=>O(!0),disabled:y,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",children:[r.jsx(ha,{}),"Delete"]})]}),T&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:gt,disabled:y,className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",children:[y?r.jsx(Pn,{className:"animate-spin"}):r.jsx(jr,{}),"Save"]}),r.jsx("button",{onClick:()=>{N(!1),$e({hospital:s.hospital||"",modality:s.modality||"",device_status:s.device_status||"",start_date:s.start_date||"",end_date:s.end_date||"",maintenance_team:s.maintenance_team||"",maintenance_manager:s.maintenance_manager||"",periodicity:s.periodicity||"Monthly",assign_to:s.assign_to||"",due_date:s.due_date||"",next_pm_date:s.next_pm_date||"",manufacturer:s.manufacturer||"",model:s.model||"",pm_for:s.pm_for||"",asset_name:s.asset_name||"",no_of_pms:s.no_of_pms||""})},disabled:y,className:"px-4 py-2 bg-gray-600 hover:bg-gray-700 text-white rounded-lg transition-colors disabled:opacity-50",children:"Cancel"})]}),jt&&r.jsx("button",{onClick:Ct,disabled:y,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",children:"Cancel Document"})]})]}),jt&&r.jsxs("div",{className:"flex items-center gap-4 mt-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Workflow Status:"}),se.length>0&&r.jsxs("span",{className:"px-3 py-1 text-sm font-medium rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",children:[se.length," Planned"]}),D.length>0&&r.jsxs("span",{className:"px-3 py-1 text-sm font-medium rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",children:[D.length," Pending Approval"]}),se.length===0&&D.length===0&&r.jsx("span",{className:"px-3 py-1 text-sm font-medium rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"All Approved ✓"})]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[r.jsx("div",{className:"flex-1 overflow-auto p-6",children:r.jsx("div",{className:"max-w-4xl mx-auto bg-white dark:bg-gray-800 rounded-lg shadow",children:r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{children:T?r.jsx(kt,{label:"Hospital *",doctype:"Company",value:Ne.hospital,onChange:Fe=>$e(ot=>Ee(ie({},ot),{hospital:Fe})),placeholder:"Select Hospital",filters:{}}):r.jsxs(r.Fragment,{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Hospital"}),r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.hospital||"-"})]})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Modality"}),T?r.jsx("input",{type:"text",name:"modality",value:Ne.modality,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.modality||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Device Status"}),T?r.jsx("input",{type:"text",name:"device_status",value:Ne.device_status,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.device_status||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Periodicity *"}),T?r.jsxs("select",{name:"periodicity",value:Ne.periodicity,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"Daily",children:"Daily"}),r.jsx("option",{value:"Weekly",children:"Weekly"}),r.jsx("option",{value:"Monthly",children:"Monthly"}),r.jsx("option",{value:"Quarterly",children:"Quarterly"}),r.jsx("option",{value:"Half-yearly",children:"Half-yearly"}),r.jsx("option",{value:"Yearly",children:"Yearly"})]}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.periodicity||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Manufacturer"}),T?r.jsx("input",{type:"text",name:"manufacturer",value:Ne.manufacturer,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.manufacturer||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Model"}),T?r.jsx("input",{type:"text",name:"model",value:Ne.model,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.model||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"PM Name"}),T?r.jsx("input",{type:"text",name:"pm_for",value:Ne.pm_for,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.pm_for||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Asset Name"}),T?r.jsx("input",{type:"text",name:"asset_name",value:Ne.asset_name,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.asset_name||"-"})]})]})]}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Schedule Dates"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Start Date *"}),T?r.jsx("input",{type:"date",name:"start_date",value:Ne.start_date,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.start_date?new Date(s.start_date).toLocaleDateString():"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"End Date *"}),T?r.jsx("input",{type:"date",name:"end_date",value:Ne.end_date,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.end_date?new Date(s.end_date).toLocaleDateString():"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"First PM Date"}),T?r.jsx("input",{type:"date",name:"due_date",value:Ne.due_date,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.due_date?new Date(s.due_date).toLocaleDateString():"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Next PM Date"}),T?r.jsx("input",{type:"date",name:"next_pm_date",value:Ne.next_pm_date,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:Ne.next_pm_date?new Date(Ne.next_pm_date).toLocaleDateString():s.next_pm_date?new Date(s.next_pm_date).toLocaleDateString():"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"No. of PMs"}),T?r.jsx("input",{type:"number",name:"no_of_pms",value:Ne.no_of_pms,onChange:st,min:"1",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",placeholder:"Enter number of PMs"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.no_of_pms||"-"})]})]})]}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Assignment"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Team"}),T?r.jsx("input",{type:"text",name:"maintenance_team",value:Ne.maintenance_team,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.maintenance_team||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Maintenance Manager"}),T?r.jsx("input",{type:"text",name:"maintenance_manager",value:Ne.maintenance_manager,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.maintenance_manager||"-"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Assign To"}),T?r.jsx("input",{type:"text",name:"assign_to",value:Ne.assign_to,onChange:st,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}):r.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg text-gray-900 dark:text-white",children:s.assign_to||"-"})]})]})]}),$t.length>0&&r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:["Pending Maintenance Entries",r.jsx("span",{className:"ml-2 text-sm font-normal text-gray-500 dark:text-gray-400",children:"(Showing Planned & Applied only)"})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse border border-gray-300 dark:border-gray-600",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-gray-100 dark:bg-gray-700",children:[r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Asset"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Asset Name"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Manufacturer"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Maintenance Log"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Status"}),r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Next PM Date"})]})}),r.jsx("tbody",{children:$t.map((Fe,ot)=>{const dt=Ot(Fe.asset);return dt.map((wt,Ft)=>r.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[Ft===0&&r.jsxs(r.Fragment,{children:[r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",rowSpan:dt.length,children:Fe.asset?r.jsx("button",{onClick:()=>a(`/assets/${Fe.asset}`),className:"text-blue-600 dark:text-blue-400 hover:underline",children:Fe.asset}):"-"}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",rowSpan:dt.length,children:Fe.asset_name||"-"}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",rowSpan:dt.length,children:Fe.manufacturer||"-"})]}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:r.jsx("button",{onClick:()=>a(`/maintenance/${wt.name}`),className:"text-blue-600 dark:text-blue-400 hover:underline",children:wt.name})}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm",children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${wt.workflow_state==="Applied"?Nt("Applied"):Nt("Planned")}`,children:wt.workflow_state==="Applied"?"Applied (Pending Approval)":"Planned"})}),r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm text-gray-900 dark:text-white",children:wt.due_date?new Date(wt.due_date).toLocaleDateString():"-"})]},`${Fe.name}-${wt.name}`))})})]})})]}),jt&&$t.length===0&&r.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-6 text-center",children:[r.jsx(Ja,{className:"mx-auto text-green-600 dark:text-green-400 text-3xl mb-2"}),r.jsx("h3",{className:"text-lg font-semibold text-green-800 dark:text-green-300 mb-1",children:"All Maintenance Entries Completed"}),r.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"All maintenance entries have been approved. New planned entries will appear when generated."})]}),r.jsxs("div",{className:"pt-4 border-t border-gray-200 dark:border-gray-700",children:[r.jsx("h2",{className:"text-sm font-semibold text-gray-600 dark:text-gray-400 mb-3",children:"Metadata"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Created:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:s.creation?new Date(s.creation).toLocaleString():"-"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Created By:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:s.owner||"-"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Modified:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:s.modified?new Date(s.modified).toLocaleString():"-"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:"Modified By:"}),r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:s.modified_by||"-"})]})]})]})]})})}),r.jsx("div",{className:"w-80 flex-shrink-0 bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700 overflow-auto",children:r.jsxs("div",{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx($g,{className:"text-blue-600 dark:text-blue-400"}),r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Activity Log"})]}),G.length===0?r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[r.jsx($g,{className:"mx-auto text-3xl mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No activity recorded yet"})]}):r.jsx("div",{className:"space-y-3",children:G.map(Fe=>r.jsx("div",{className:`rounded-lg p-3 border ${Fe.action==="Approved"?"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800":Fe.action==="Applied"?"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800":"bg-gray-50 dark:bg-gray-700 border-gray-200 dark:border-gray-600"}`,children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center ${Fe.action==="Approved"?"bg-green-100 dark:bg-green-900/30":Fe.action==="Applied"?"bg-blue-100 dark:bg-blue-900/30":"bg-gray-100 dark:bg-gray-600"}`,children:Fe.action==="Approved"?r.jsx(Ju,{className:"text-green-600 dark:text-green-400 text-sm"}):r.jsx(Yu,{className:"text-blue-600 dark:text-blue-400 text-sm"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`text-sm font-medium ${Fe.action==="Approved"?"text-green-800 dark:text-green-300":Fe.action==="Applied"?"text-blue-800 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:Fe.action}),r.jsxs("div",{className:"flex items-center gap-1 mt-1 text-xs text-gray-500 dark:text-gray-400",children:[r.jsx(R_,{className:"text-[10px]"}),r.jsx("span",{className:"truncate",children:Fe.user})]}),r.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-gray-500 dark:text-gray-400",children:[r.jsx(ll,{className:"text-[10px]"}),r.jsx("span",{children:new Date(Fe.timestamp).toLocaleString()})]}),r.jsx("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-600",children:r.jsxs("div",{className:"text-xs space-y-1",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Entries:"}),r.jsx("span",{className:`font-medium ${Fe.action==="Approved"?"text-green-600 dark:text-green-400":"text-blue-600 dark:text-blue-400"}`,children:Fe.entriesCount})]}),Fe.completionDate&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Completion Date:"}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:new Date(Fe.completionDate).toLocaleDateString()})]})]})})]})]})},Fe.id))})]})})]}),C&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-lg w-full mx-4",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center",children:r.jsx(Yu,{className:"text-blue-600 dark:text-blue-400"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Apply for Approval"}),r.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[le.size," of ",se.length," ",se.length===1?"entry":"entries"," selected"]})]})]}),r.jsxs("div",{className:"mb-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:"Select Entries to Complete:"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button",onClick:ce,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{type:"button",onClick:we,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Deselect All"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-700 rounded-lg p-3 space-y-2",children:se.map((Fe,ot)=>r.jsxs("label",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-all ${le.has(Fe.name)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700":"bg-white dark:bg-gray-600 border border-gray-200 dark:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-550"}`,children:[r.jsx("input",{type:"checkbox",checked:le.has(Fe.name),onChange:()=>Ue(Fe.name),className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-5 h-5 bg-yellow-100 dark:bg-yellow-900/30 rounded-full flex items-center justify-center text-[10px] font-medium text-yellow-700 dark:text-yellow-400 flex-shrink-0",children:ot+1}),r.jsxs("div",{className:"truncate",children:[r.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Fe.asset_display_name||Fe.asset_name||"Unknown Asset"}),r.jsx("span",{className:"text-gray-400 dark:text-gray-500 mx-1",children:"-"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:Fe.name})]})]}),Fe.due_date&&r.jsxs("div",{className:"ml-7 text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:["Due: ",new Date(Fe.due_date).toLocaleDateString()]})]})]},Fe.name))}),r.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[r.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[le.size," selected"]}),le.size===0&&r.jsx("span",{className:"text-red-500 dark:text-red-400",children:"Please select at least one entry"})]})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Completion Date *"}),r.jsx("input",{type:"date",value:P,onChange:Fe=>I(Fe.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),Ne.next_pm_date&&r.jsx("div",{className:"mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg",children:r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(xi,{className:"text-blue-600 dark:text-blue-400"}),r.jsxs("span",{className:"text-gray-700 dark:text-gray-300",children:["Next PM Date: ",r.jsx("strong",{className:"text-blue-600 dark:text-blue-400",children:new Date(Ne.next_pm_date).toLocaleDateString()})]})]})}),H&&r.jsxs("div",{className:"mb-4",children:[r.jsx("div",{className:"p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-800 mb-3",children:r.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-400 flex items-center gap-2",children:[r.jsx("span",{className:"text-lg",children:"⚠️"}),"Completion date is before the Next PM Date. Please provide a reason."]})}),r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Early Completion Reason *"}),r.jsx("textarea",{value:ee,onChange:Fe=>B(Fe.target.value),rows:3,placeholder:"Enter reason for early completion...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-amber-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white resize-none"})]}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>{A(!1),I(""),B(""),ge(new Set)},className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 transition-colors",disabled:ue,children:"Cancel"}),r.jsx("button",{onClick:Ie,disabled:ue||!P||le.size===0||H&&!ee.trim(),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:ue?r.jsxs(r.Fragment,{children:[r.jsx(Pn,{className:"animate-spin"}),"Applying..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Yu,{}),"Complete (",le.size,")"]})})]})]})}),be&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-lg w-full mx-4",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:r.jsx(Ju,{className:"text-green-600 dark:text-green-400"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Approve Entries"}),r.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[K.size," of ",D.length," ",D.length===1?"entry":"entries"," selected"]})]})]}),r.jsxs("div",{className:"mb-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:"Select Entries to Approve:"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button",onClick:Ze,className:"text-xs text-green-600 dark:text-green-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{type:"button",onClick:ze,className:"text-xs text-green-600 dark:text-green-400 hover:underline",children:"Deselect All"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-700 rounded-lg p-3 space-y-2",children:D.map((Fe,ot)=>r.jsxs("label",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-all ${K.has(Fe.name)?"bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-700":"bg-white dark:bg-gray-600 border border-gray-200 dark:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-550"}`,children:[r.jsx("input",{type:"checkbox",checked:K.has(Fe.name),onChange:()=>ft(Fe.name),className:"w-4 h-4 text-green-600 bg-gray-100 border-gray-300 rounded focus:ring-green-500 dark:focus:ring-green-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-5 h-5 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center text-[10px] font-medium text-blue-700 dark:text-blue-400 flex-shrink-0",children:ot+1}),r.jsxs("div",{className:"truncate",children:[r.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Fe.asset_display_name||Fe.asset_name||"Unknown Asset"}),r.jsx("span",{className:"text-gray-400 dark:text-gray-500 mx-1",children:"-"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:Fe.name})]})]}),Fe.completion_date&&r.jsxs("div",{className:"ml-7 text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:["Completed: ",new Date(Fe.completion_date).toLocaleDateString()]})]})]},Fe.name))}),r.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[r.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[K.size," selected"]}),K.size===0&&r.jsx("span",{className:"text-red-500 dark:text-red-400",children:"Please select at least one entry"})]})]}),r.jsx("div",{className:"mb-4 p-3 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800",children:r.jsxs("p",{className:"text-sm text-green-700 dark:text-green-400",children:["✓ Approving will ",r.jsx("strong",{children:"submit"})," the documents (docstatus = 1) and trigger auto-creation of next planned entries."]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>{me(!1),te(new Set)},className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 transition-colors",disabled:ae,children:"Cancel"}),r.jsx("button",{onClick:bt,disabled:ae||K.size===0,className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:ae?r.jsxs(r.Fragment,{children:[r.jsx(Pn,{className:"animate-spin"}),"Approving..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ju,{}),"Approve (",K.size,")"]})})]})]})}),S&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-md",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4",children:"Confirm Delete"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"Are you sure you want to delete this PPM Planner? This action cannot be undone."}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>O(!1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",disabled:y,children:"Cancel"}),r.jsx("button",{onClick:zt,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",disabled:y,children:y?"Deleting...":"Delete"})]})]})})]})},bM=({month:e,year:t,filters:a={},viewType:s="maintenance-log",timeView:i="day-month"})=>{const d=Na(),c=new Date,[f,g]=j.useState(e!=null?e:c.getMonth()),[p,x]=j.useState(t!=null?t:c.getFullYear()),y=new Date(p,f,1).toISOString().split("T")[0],_=new Date(p,f+1,0).toISOString().split("T")[0],k=JSON.stringify(a),T=j.useMemo(()=>a,[k]),N=j.useMemo(()=>ie({due_date:["between",[y,_]]},T),[y,_,T]),S=j.useMemo(()=>({}),[]),O=j.useMemo(()=>({}),[]),{logs:C,loading:A}=Wf(s==="maintenance-log"?N:S,s==="maintenance-log"?1e3:0,0,"due_date asc"),{pmSchedules:P,loading:I}=$p(s==="ppm-planner"?T:S,1e3,0,"creation desc",O),ee=s==="maintenance-log"?A:I,B=j.useMemo(()=>s==="maintenance-log"?C.filter(Z=>{if(!Z.due_date)return!1;const K=new Date(Z.due_date);return K.getMonth()===f&&K.getFullYear()===p}):P.filter(K=>{const te=K.due_date||K.start_date;if(!te)return!1;const[se,F,D]=te.split("-").map(Number),W=new Date(se,F-1,D);return W.getMonth()===f&&W.getFullYear()===p}),[C,P,f,p,s]);j.useEffect(()=>{s==="ppm-planner"&&!I&&(console.log("=== PPM PLANNER DEBUG ==="),console.log("[MaintenanceCalendar] Viewing Month:",f+1,"Year:",p),console.log("[MaintenanceCalendar] Total PM Schedules fetched:",P.length),console.log("[MaintenanceCalendar] Filtered for current month:",B.length),B.length>0?(console.log("[MaintenanceCalendar] Schedules showing in this month:"),B.forEach(Z=>{console.log(` - ${Z.name}: due_date=${Z.due_date}, start_date=${Z.start_date}`)})):(console.log("[MaintenanceCalendar] No schedules match this month."),console.log("[MaintenanceCalendar] Due dates in fetched data:"),P.slice(0,5).forEach(Z=>{const K=Z.due_date||Z.start_date;console.log(` - ${Z.name}: due_date=${Z.due_date}, start_date=${Z.start_date}, will show in: ${K?(()=>{const[te,se]=K.split("-").map(Number);return`${se}/${te}`})():"unknown"}`)}),console.log("[MaintenanceCalendar] TIP: Navigate to the month where due_dates match to see schedules.")),console.log("========================="))},[s,P,I,B.length,f,p]);const H=(Z,K)=>{const te=new Date(K)<new Date&&Z!=="Completed";switch(Z){case"Completed":return"bg-green-500 text-white border-green-600";case"Planned":return te?"bg-red-500 text-white border-red-600":"bg-yellow-500 text-white border-yellow-600";case"Overdue":return"bg-red-600 text-white border-red-700";default:return"bg-gray-500 text-white border-gray-600"}},Y=new Date(p,f,1).getDay(),ue=new Date(p,f+1,0).getDate(),xe=Array.from({length:ue},(Z,K)=>K+1),le=Z=>{Z>0?f===11?(g(0),x(p+1)):g(f+1):f===0?(g(11),x(p-1)):g(f-1)},ge=Z=>s==="maintenance-log"?B.filter(K=>K.due_date?new Date(K.due_date).getDate()===Z:!1):B.filter(te=>{const se=te.due_date||te.start_date;if(!se)return!1;const[F,D,W]=se.split("-").map(Number),G=new Date(F,D-1,W);return G.getDate()===Z&&G.getMonth()===f&&G.getFullYear()===p}),be=()=>{g(c.getMonth()),x(c.getFullYear())},me=["January","February","March","April","May","June","July","August","September","October","November","December"],ae=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow h-full flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex-shrink-0 flex justify-between items-center p-4 lg:p-6 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center gap-2 lg:gap-3",children:[r.jsx(xi,{className:"text-blue-600 dark:text-blue-400",size:20}),r.jsxs("h2",{className:"text-xl lg:text-2xl font-bold text-gray-800 dark:text-white",children:[me[f]," ",p]})]}),r.jsxs("div",{className:"flex gap-1 lg:gap-2",children:[r.jsx("button",{onClick:()=>le(-1),className:"px-2 py-2 lg:px-4 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg text-gray-700 dark:text-gray-300 transition-colors",title:"Previous Month",children:r.jsx(Vf,{})}),r.jsx("button",{onClick:be,className:"px-2 py-2 lg:px-4 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors text-xs lg:text-sm font-medium",children:"Today"}),r.jsx("button",{onClick:()=>le(1),className:"px-2 py-2 lg:px-4 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg text-gray-700 dark:text-gray-300 transition-colors",title:"Next Month",children:r.jsx(Gf,{})})]})]}),ee?r.jsxs("div",{className:"flex items-center justify-center flex-1",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),r.jsxs("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:["Loading ",s==="maintenance-log"?"maintenance logs":"PPM Planners","..."]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex-1 overflow-auto p-4 lg:p-6",children:[r.jsx("div",{className:"grid grid-cols-7 gap-1 lg:gap-2 mb-2",children:ae.map(Z=>r.jsx("div",{className:"text-center font-semibold p-1 lg:p-2 text-gray-700 dark:text-gray-300 text-xs lg:text-sm",children:Z},Z))}),r.jsxs("div",{className:"grid grid-cols-7 gap-1 lg:gap-2 auto-rows-fr",children:[Array.from({length:Y}).map((Z,K)=>r.jsx("div",{className:"p-1 lg:p-2"},`empty-${K}`)),xe.map(Z=>{const K=ge(Z),te=Z===c.getDate()&&f===c.getMonth()&&p===c.getFullYear();return r.jsxs("div",{className:`border rounded-lg p-1 lg:p-2 min-h-16 lg:min-h-20 hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors flex flex-col ${te?"border-blue-500 border-2 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700"}`,children:[r.jsx("div",{className:`font-semibold mb-1 text-xs lg:text-sm flex-shrink-0 ${te?"text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300"}`,children:Z}),r.jsxs("div",{className:"space-y-1 flex-1 overflow-hidden",children:[K.slice(0,2).map(se=>{if(s==="maintenance-log"){const F=se,D=new Date(F.due_date||"")<new Date&&F.maintenance_status!=="Completed";return r.jsx("div",{onClick:()=>d(`/maintenance/${F.name}`),className:`text-xs p-1 rounded border ${H(F.maintenance_status||"Planned",F.due_date||"")} truncate cursor-pointer hover:opacity-80 transition-opacity`,title:`${F.asset_name||F.name} - ${F.maintenance_status||"Planned"}${D?" (Overdue)":""} - Click to view details`,children:r.jsx("div",{className:"truncate font-medium text-xs",children:F.asset_name||F.name})},F.name)}else{const F=se,W=F.pm_for||F.pm_for||F["PM Name"]||null||F.name||"PPM Planner",G=F.name?`${F.name}${F.modality?` - ${F.modality}`:""}${F.hospital?` - ${F.hospital}`:""} - Click to view PPM Planner`:"Click to view PPM Planner";return r.jsx("div",{onClick:()=>d(`/ppm-planner/${F.name}`),className:"text-xs p-1 rounded border bg-purple-500 text-white border-purple-600 truncate cursor-pointer hover:opacity-80 transition-opacity",title:G,children:r.jsx("div",{className:"truncate font-medium text-xs",children:W})},F.name)}}),K.length>2&&r.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["+",K.length-2]})]})]},Z)})]})]}),r.jsx("div",{className:"flex-shrink-0 border-t border-gray-200 dark:border-gray-700 p-3 lg:p-4 bg-gray-50 dark:bg-gray-900/30",children:r.jsxs("div",{className:"flex flex-col lg:flex-row justify-between items-center gap-3 lg:gap-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-3 lg:gap-4 items-center justify-center lg:justify-start",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 bg-green-500 rounded border border-green-600"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Completed"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded border border-yellow-600"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Planned"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 bg-red-500 rounded border border-red-600"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Overdue"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 border-2 border-blue-500 rounded bg-blue-50 dark:bg-blue-900/20"}),r.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Today"})]})]}),r.jsx("div",{className:"flex gap-4 lg:gap-6 text-center",children:s==="maintenance-log"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg lg:text-xl font-bold text-green-600 dark:text-green-400",children:B.filter(Z=>Z.maintenance_status==="Completed").length}),r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Completed"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg lg:text-xl font-bold text-yellow-600 dark:text-yellow-400",children:B.filter(Z=>Z.maintenance_status==="Planned"&&new Date(Z.due_date||"")>=new Date).length}),r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Planned"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg lg:text-xl font-bold text-red-600 dark:text-red-400",children:B.filter(Z=>new Date(Z.due_date||"")<new Date&&Z.maintenance_status!=="Completed").length}),r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Overdue"})]})]}):r.jsxs("div",{children:[r.jsx("div",{className:"text-lg lg:text-xl font-bold text-purple-600 dark:text-purple-400",children:B.length}),r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"PPM Planners"})]})})]})})]})]})},vM=()=>{const e=Na(),[t]=fl(),[a,s]=j.useState(""),[i,d]=j.useState(""),[c,f]=j.useState(""),[g,p]=j.useState("");j.useEffect(()=>{const A=t.get("hospital"),P=t.get("status");A&&s(A),P&&f(P)},[t]);const[x,y]=j.useState("maintenance-log"),[_,k]=j.useState(!1),[T,N]=j.useState(0);j.useEffect(()=>{const A=[a,i,c,g].filter(Boolean).length;N(A)},[a,i,c,g]);const S=()=>{s(""),d(""),f(""),p("")},O=a||i||c||g,C=j.useMemo(()=>{const A={};return a&&(A.company=a),i&&(A.department=i),c&&(A.maintenance_status=c),g&&(A.assign_to_name=g),A},[a,i,c,g]);return r.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[r.jsxs("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-2.5 lg:px-6",children:[r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-3 md:gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[r.jsx(xi,{className:"text-blue-600 dark:text-blue-400 flex-shrink-0",size:22}),r.jsx("div",{className:"min-w-0",children:r.jsx("h1",{className:"text-lg md:text-xl font-bold text-gray-800 dark:text-white whitespace-nowrap",children:"Maintenance Calendar"})})]}),r.jsxs("div",{className:"flex items-end gap-2 md:gap-3 flex-wrap md:flex-nowrap",children:[r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"View Type"}),r.jsxs("select",{value:x,onChange:A=>y(A.target.value),className:"px-2.5 md:px-3 py-1.5 text-xs md:text-sm border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"maintenance-log",children:"Maintenance Log"}),r.jsx("option",{value:"ppm-planner",children:"PPM Planner"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 invisible",children:"Filters"}),r.jsxs("button",{onClick:()=>k(!_),className:`px-3 md:px-4 py-1.5 md:py-2 border rounded-lg transition-colors flex items-center gap-1.5 md:gap-2 text-xs md:text-sm ${O?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400":"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[r.jsx(ws,{size:14}),r.jsx("span",{className:"hidden sm:inline",children:"Filters"}),T>0&&r.jsx("span",{className:"bg-blue-600 text-white rounded-full w-4 h-4 md:w-5 md:h-5 flex items-center justify-center text-[10px] md:text-xs",children:T}),_?r.jsx(m0,{size:12}):r.jsx(Ec,{size:12})]})]}),x==="ppm-planner"&&r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 invisible",children:"Yearly Map"}),r.jsxs("button",{onClick:()=>e("/yearly-ppm-planner"),className:"px-3 md:px-4 py-1.5 md:py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors flex items-center gap-1.5 md:gap-2 text-xs md:text-sm font-medium whitespace-nowrap",title:"View Yearly PPM Planner Map",children:[r.jsx(ES,{size:14}),r.jsx("span",{className:"hidden sm:inline",children:"Yearly Map"}),r.jsx("span",{className:"sm:hidden",children:"Map"})]})]})]})]}),_&&r.jsxs("div",{className:"mt-2.5 md:mt-3 p-3 md:p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg border border-gray-200 dark:border-gray-600",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(kt,{label:"Hospital",doctype:"Company",value:a,onChange:A=>s(A),placeholder:"Select Hospital",compact:!0}),a&&r.jsx("button",{onClick:()=>s(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[55]",children:[r.jsx(kt,{label:"Department",doctype:"Department",value:i,onChange:A=>d(A),placeholder:"All Departments",compact:!0}),i&&r.jsx("button",{onClick:()=>d(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),r.jsxs("select",{value:c,onChange:A=>f(A.target.value),className:"w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Statuses"}),r.jsx("option",{value:"Planned",children:"Planned"}),r.jsx("option",{value:"Completed",children:"Completed"}),r.jsx("option",{value:"Overdue",children:"Overdue"}),r.jsx("option",{value:"Cancelled",children:"Cancelled"})]}),c&&r.jsx("button",{onClick:()=>f(""),className:"absolute right-8 top-7 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[50]",children:[r.jsx(kt,{label:"Assigned To",doctype:"User",value:g,onChange:A=>p(A),placeholder:"All Technicians",compact:!0}),g&&r.jsx("button",{onClick:()=>p(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]})]}),O&&r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsxs("button",{onClick:S,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 flex items-center gap-2",children:[r.jsx(vt,{}),"Clear Filters"]})})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden px-3 pb-3 lg:px-4 lg:pb-4",children:r.jsx(bM,{filters:C,viewType:x,timeView:"day-month"})})]})},Gv=()=>{const e=Na(),[t,a]=j.useState(2025),[s,i]=j.useState(2030),d=j.useMemo(()=>({}),[]),c=j.useMemo(()=>({}),[]),{pmSchedules:f,loading:g,error:p}=$p(d,1e3,0,"creation desc",c),x=(N,S,O,C,A)=>{const P=N.toLowerCase().trim(),I=S.getFullYear(),ee=S.getMonth(),B=new Date(C,A,1),H=new Date(C,A+1,0,23,59,59,999);if(B>O||H<S)return!1;const Y=(C-I)*12+(A-ee);switch(P){case"daily":return B<=O&&H>=S;case"weekly":return B<=O&&H>=S;case"monthly":return Y>=0&&B<=O;case"quarterly":return Y>=0&&Y%3===0&&B<=O;case"half-yearly":case"half yearly":return Y>=0&&Y%6===0&&B<=O;case"yearly":case"annually":return A===ee&&B<=O&&B>=S;case"2 yearly":case"2-yearly":return Y>=0&&Y%24===0&&B<=O;case"3 yearly":case"3-yearly":return Y>=0&&Y%36===0&&B<=O;default:return B<=O&&H>=S}},y=j.useMemo(()=>{const N={};for(let S=t;S<=s;S++){N[S]={};for(let O=0;O<12;O++)N[S][O]=[]}return f.forEach(S=>{let O=null,C=null;if(S.start_date){const[I,ee,B]=S.start_date.split("-").map(Number)}if(S.end_date){const[I,ee,B]=S.end_date.split("-").map(Number);O=new Date(I,ee-1,B)}if(S.due_date){const[I,ee,B]=S.due_date.split("-").map(Number);C=new Date(I,ee-1,B)}if(!C)return;const A=O||C,P=S.periodicity||"monthly";for(let I=t;I<=s;I++)for(let ee=0;ee<12;ee++)x(P,C,A,I,ee)&&(N[I][ee].some(H=>H.name===S.name)||N[I][ee].push(S))}),N},[f,t,s]);j.useEffect(()=>{g||(console.log("[YearlyPPMPlannerPage] PM Schedules count:",f.length),console.log("[YearlyPPMPlannerPage] Matrix years:",t,"to",s))},[f,g,t,s]);const _=N=>{a(S=>S+N),i(S=>S+N)},k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],T=Array.from({length:s-t+1},(N,S)=>t+S);return r.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[r.jsx("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3 lg:px-6",children:r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:()=>e("/maintenance-calendar/month-view"),className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Back to Month View",children:r.jsx(Gs,{className:"text-gray-600 dark:text-gray-400",size:18})}),r.jsx(xi,{className:"text-blue-600 dark:text-blue-400",size:24}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-800 dark:text-white",children:"Site or Cluster PPM Calendar"}),r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"View PM Schedule Generators across multiple years"})]})]}),r.jsxs("button",{onClick:()=>e("/maintenance-calendar/month-view"),className:"px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors flex items-center gap-2 text-sm font-medium",title:"Go to Month View",children:[r.jsx(ff,{size:14}),"Month"]})]})}),r.jsx("div",{className:"flex-shrink-0 px-3 lg:px-4 py-2",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700 p-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("button",{onClick:()=>_(-1),className:"px-3 py-1.5 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg text-gray-700 dark:text-gray-300 transition-colors",children:r.jsx(Vf,{})}),r.jsxs("h2",{className:"text-lg font-bold text-gray-800 dark:text-white",children:[t," - ",s]}),r.jsx("button",{onClick:()=>_(1),className:"px-3 py-1.5 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg text-gray-700 dark:text-gray-300 transition-colors",children:r.jsx(Gf,{})})]})})}),r.jsx("div",{className:"flex-1 overflow-auto px-3 pb-3 lg:px-4 lg:pb-4",children:g?r.jsxs("div",{className:"flex items-center justify-center h-full",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),r.jsx("span",{className:"ml-3 text-gray-600 dark:text-gray-400",children:"Loading PPM Planners..."})]}):p?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:r.jsxs("p",{className:"text-red-600 dark:text-red-400",children:["Error loading PPM Planners: ",p]})})}):r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 sticky top-0 z-10",children:r.jsxs("tr",{children:[r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-4 py-3 text-left font-bold text-gray-800 dark:text-white bg-gray-200 dark:bg-gray-800",children:"Year/Month"}),k.map((N,S)=>r.jsx("th",{className:"border border-gray-300 dark:border-gray-600 px-2 py-3 text-center font-semibold text-gray-800 dark:text-white min-w-[140px]",children:N},S))]})}),r.jsx("tbody",{children:T.map(N=>r.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-4 py-3 font-bold text-gray-800 dark:text-white bg-gray-50 dark:bg-gray-800/50",children:N}),k.map((S,O)=>{var A;const C=((A=y[N])==null?void 0:A[O])||[];return r.jsx("td",{className:"border border-gray-300 dark:border-gray-600 px-2 py-2 align-top min-h-[60px]",children:C.length>0?r.jsx("div",{className:"space-y-1",children:C.map(P=>{const I=P.pm_for||P.pm_for||P["PM Name"]||null;C.indexOf(P)===0&&console.log("[YearlyCalendar] 🔍 SCHEDULE IN CELL:",{name:P.name,pm_for:P.pm_for,"pm_for (bracket)":P.pm_for,allKeys:Object.keys(P),pmName:I});const ee=I||P.name||"PPM Planner",B=[];P.name&&B.push(P.name),P.modality&&B.push(P.modality),P.hospital&&B.push(P.hospital);const H=B.length>0?`${B.join(" - ")} - Click to view details`:"Click to view details";return r.jsx("div",{onClick:()=>e(`/ppm-planner/${P.name}`),className:"text-[10px] p-1 bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700 rounded cursor-pointer hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors group",title:H,children:r.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-300 leading-tight group-hover:underline break-words",children:ee})},P.name)})}):r.jsx("div",{className:"text-xs text-gray-300 dark:text-gray-700 text-center py-1",children:"-"})},O)})]},N))})]})})})})]})};function ik(e,t){const a=j.useRef(t);j.useEffect(function(){t!==a.current&&e.attributionControl!=null&&(a.current!=null&&e.attributionControl.removeAttribution(a.current),t!=null&&e.attributionControl.addAttribution(t)),a.current=t},[e,t])}const _M=1;function wM(e){return Object.freeze({__version:_M,map:e})}function kM(e,t){return Object.freeze(ie(ie({},e),t))}const Wp=j.createContext(null);function Vp(){const e=j.use(Wp);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}function NM(e){function t(a,s){const{instance:i,context:d}=e(a).current;j.useImperativeHandle(s,()=>i);const{children:c}=a;return c==null?null:ia.createElement(Wp,{value:d},c)}return j.forwardRef(t)}function jM(e){function t(a,s){const[i,d]=j.useState(!1),{instance:c}=e(a,d).current;j.useImperativeHandle(s,()=>c),j.useEffect(function(){i&&c.update()},[c,i,a.children]);const f=c._contentNode;return f?w_.createPortal(a.children,f):null}return j.forwardRef(t)}function SM(e){function t(a,s){const{instance:i}=e(a).current;return j.useImperativeHandle(s,()=>i),null}return j.forwardRef(t)}function lk(e,t){const a=j.useRef(void 0);j.useEffect(function(){return t!=null&&e.instance.on(t),a.current=t,function(){a.current!=null&&e.instance.off(a.current),a.current=null}},[e,t])}function Gp(e,t){var s;const a=(s=e.pane)!=null?s:t.pane;return a?Ee(ie({},e),{pane:a}):e}function TM(e,t){return function(s,i){const d=Vp(),c=e(Gp(s,d),d);return ik(d.map,s.attribution),lk(c.current,s.eventHandlers),t(c.current,d,s,i),c}}var Wd={exports:{}};var EM=Wd.exports,Zv;function CM(){return Zv||(Zv=1,(function(e,t){(function(a,s){s(t)})(EM,(function(a){var s="1.9.4";function i(o){var h,b,E,M;for(b=1,E=arguments.length;b<E;b++){M=arguments[b];for(h in M)o[h]=M[h]}return o}var d=Object.create||(function(){function o(){}return function(h){return o.prototype=h,new o}})();function c(o,h){var b=Array.prototype.slice;if(o.bind)return o.bind.apply(o,b.call(arguments,1));var E=b.call(arguments,2);return function(){return o.apply(h,E.length?E.concat(b.call(arguments)):arguments)}}var f=0;function g(o){return"_leaflet_id"in o||(o._leaflet_id=++f),o._leaflet_id}function p(o,h,b){var E,M,V,fe;return fe=function(){E=!1,M&&(V.apply(b,M),M=!1)},V=function(){E?M=arguments:(o.apply(b,arguments),setTimeout(fe,h),E=!0)},V}function x(o,h,b){var E=h[1],M=h[0],V=E-M;return o===E&&b?o:((o-M)%V+V)%V+M}function y(){return!1}function _(o,h){if(h===!1)return o;var b=Math.pow(10,h===void 0?6:h);return Math.round(o*b)/b}function k(o){return o.trim?o.trim():o.replace(/^\s+|\s+$/g,"")}function T(o){return k(o).split(/\s+/)}function N(o,h){Object.prototype.hasOwnProperty.call(o,"options")||(o.options=o.options?d(o.options):{});for(var b in h)o.options[b]=h[b];return o.options}function S(o,h,b){var E=[];for(var M in o)E.push(encodeURIComponent(b?M.toUpperCase():M)+"="+encodeURIComponent(o[M]));return(!h||h.indexOf("?")===-1?"?":"&")+E.join("&")}var O=/\{ *([\w_ -]+) *\}/g;function C(o,h){return o.replace(O,function(b,E){var M=h[E];if(M===void 0)throw new Error("No value provided for variable "+b);return typeof M=="function"&&(M=M(h)),M})}var A=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"};function P(o,h){for(var b=0;b<o.length;b++)if(o[b]===h)return b;return-1}var I="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function ee(o){return window["webkit"+o]||window["moz"+o]||window["ms"+o]}var B=0;function H(o){var h=+new Date,b=Math.max(0,16-(h-B));return B=h+b,window.setTimeout(o,b)}var Y=window.requestAnimationFrame||ee("RequestAnimationFrame")||H,ue=window.cancelAnimationFrame||ee("CancelAnimationFrame")||ee("CancelRequestAnimationFrame")||function(o){window.clearTimeout(o)};function xe(o,h,b){if(b&&Y===H)o.call(h);else return Y.call(window,c(o,h))}function le(o){o&&ue.call(window,o)}var ge={__proto__:null,extend:i,create:d,bind:c,get lastId(){return f},stamp:g,throttle:p,wrapNum:x,falseFn:y,formatNum:_,trim:k,splitWords:T,setOptions:N,getParamString:S,template:C,isArray:A,indexOf:P,emptyImageUrl:I,requestFn:Y,cancelFn:ue,requestAnimFrame:xe,cancelAnimFrame:le};function be(){}be.extend=function(o){var h=function(){N(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},b=h.__super__=this.prototype,E=d(b);E.constructor=h,h.prototype=E;for(var M in this)Object.prototype.hasOwnProperty.call(this,M)&&M!=="prototype"&&M!=="__super__"&&(h[M]=this[M]);return o.statics&&i(h,o.statics),o.includes&&(me(o.includes),i.apply(null,[E].concat(o.includes))),i(E,o),delete E.statics,delete E.includes,E.options&&(E.options=b.options?d(b.options):{},i(E.options,o.options)),E._initHooks=[],E.callInitHooks=function(){if(!this._initHooksCalled){b.callInitHooks&&b.callInitHooks.call(this),this._initHooksCalled=!0;for(var V=0,fe=E._initHooks.length;V<fe;V++)E._initHooks[V].call(this)}},h},be.include=function(o){var h=this.prototype.options;return i(this.prototype,o),o.options&&(this.prototype.options=h,this.mergeOptions(o.options)),this},be.mergeOptions=function(o){return i(this.prototype.options,o),this},be.addInitHook=function(o){var h=Array.prototype.slice.call(arguments,1),b=typeof o=="function"?o:function(){this[o].apply(this,h)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(b),this};function me(o){if(!(typeof L=="undefined"||!L||!L.Mixin)){o=A(o)?o:[o];for(var h=0;h<o.length;h++)o[h]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var ae={on:function(o,h,b){if(typeof o=="object")for(var E in o)this._on(E,o[E],h);else{o=T(o);for(var M=0,V=o.length;M<V;M++)this._on(o[M],h,b)}return this},off:function(o,h,b){if(!arguments.length)delete this._events;else if(typeof o=="object")for(var E in o)this._off(E,o[E],h);else{o=T(o);for(var M=arguments.length===1,V=0,fe=o.length;V<fe;V++)M?this._off(o[V]):this._off(o[V],h,b)}return this},_on:function(o,h,b,E){if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}if(this._listens(o,h,b)===!1){b===this&&(b=void 0);var M={fn:h,ctx:b};E&&(M.once=!0),this._events=this._events||{},this._events[o]=this._events[o]||[],this._events[o].push(M)}},_off:function(o,h,b){var E,M,V;if(this._events&&(E=this._events[o],!!E)){if(arguments.length===1){if(this._firingCount)for(M=0,V=E.length;M<V;M++)E[M].fn=y;delete this._events[o];return}if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}var fe=this._listens(o,h,b);if(fe!==!1){var Te=E[fe];this._firingCount&&(Te.fn=y,this._events[o]=E=E.slice()),E.splice(fe,1)}}},fire:function(o,h,b){if(!this.listens(o,b))return this;var E=i({},h,{type:o,target:this,sourceTarget:h&&h.sourceTarget||this});if(this._events){var M=this._events[o];if(M){this._firingCount=this._firingCount+1||1;for(var V=0,fe=M.length;V<fe;V++){var Te=M[V],Pe=Te.fn;Te.once&&this.off(o,Pe,Te.ctx),Pe.call(Te.ctx||this,E)}this._firingCount--}}return b&&this._propagateEvent(E),this},listens:function(o,h,b,E){typeof o!="string"&&console.warn('"string" type argument expected');var M=h;typeof h!="function"&&(E=!!h,M=void 0,b=void 0);var V=this._events&&this._events[o];if(V&&V.length&&this._listens(o,M,b)!==!1)return!0;if(E){for(var fe in this._eventParents)if(this._eventParents[fe].listens(o,h,b,E))return!0}return!1},_listens:function(o,h,b){if(!this._events)return!1;var E=this._events[o]||[];if(!h)return!!E.length;b===this&&(b=void 0);for(var M=0,V=E.length;M<V;M++)if(E[M].fn===h&&E[M].ctx===b)return M;return!1},once:function(o,h,b){if(typeof o=="object")for(var E in o)this._on(E,o[E],h,!0);else{o=T(o);for(var M=0,V=o.length;M<V;M++)this._on(o[M],h,b,!0)}return this},addEventParent:function(o){return this._eventParents=this._eventParents||{},this._eventParents[g(o)]=o,this},removeEventParent:function(o){return this._eventParents&&delete this._eventParents[g(o)],this},_propagateEvent:function(o){for(var h in this._eventParents)this._eventParents[h].fire(o.type,i({layer:o.target,propagatedFrom:o.target},o),!0)}};ae.addEventListener=ae.on,ae.removeEventListener=ae.clearAllEventListeners=ae.off,ae.addOneTimeEventListener=ae.once,ae.fireEvent=ae.fire,ae.hasEventListeners=ae.listens;var Z=be.extend(ae);function K(o,h,b){this.x=b?Math.round(o):o,this.y=b?Math.round(h):h}var te=Math.trunc||function(o){return o>0?Math.floor(o):Math.ceil(o)};K.prototype={clone:function(){return new K(this.x,this.y)},add:function(o){return this.clone()._add(se(o))},_add:function(o){return this.x+=o.x,this.y+=o.y,this},subtract:function(o){return this.clone()._subtract(se(o))},_subtract:function(o){return this.x-=o.x,this.y-=o.y,this},divideBy:function(o){return this.clone()._divideBy(o)},_divideBy:function(o){return this.x/=o,this.y/=o,this},multiplyBy:function(o){return this.clone()._multiplyBy(o)},_multiplyBy:function(o){return this.x*=o,this.y*=o,this},scaleBy:function(o){return new K(this.x*o.x,this.y*o.y)},unscaleBy:function(o){return new K(this.x/o.x,this.y/o.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=te(this.x),this.y=te(this.y),this},distanceTo:function(o){o=se(o);var h=o.x-this.x,b=o.y-this.y;return Math.sqrt(h*h+b*b)},equals:function(o){return o=se(o),o.x===this.x&&o.y===this.y},contains:function(o){return o=se(o),Math.abs(o.x)<=Math.abs(this.x)&&Math.abs(o.y)<=Math.abs(this.y)},toString:function(){return"Point("+_(this.x)+", "+_(this.y)+")"}};function se(o,h,b){return o instanceof K?o:A(o)?new K(o[0],o[1]):o==null?o:typeof o=="object"&&"x"in o&&"y"in o?new K(o.x,o.y):new K(o,h,b)}function F(o,h){if(o)for(var b=h?[o,h]:o,E=0,M=b.length;E<M;E++)this.extend(b[E])}F.prototype={extend:function(o){var h,b;if(!o)return this;if(o instanceof K||typeof o[0]=="number"||"x"in o)h=b=se(o);else if(o=D(o),h=o.min,b=o.max,!h||!b)return this;return!this.min&&!this.max?(this.min=h.clone(),this.max=b.clone()):(this.min.x=Math.min(h.x,this.min.x),this.max.x=Math.max(b.x,this.max.x),this.min.y=Math.min(h.y,this.min.y),this.max.y=Math.max(b.y,this.max.y)),this},getCenter:function(o){return se((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,o)},getBottomLeft:function(){return se(this.min.x,this.max.y)},getTopRight:function(){return se(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(o){var h,b;return typeof o[0]=="number"||o instanceof K?o=se(o):o=D(o),o instanceof F?(h=o.min,b=o.max):h=b=o,h.x>=this.min.x&&b.x<=this.max.x&&h.y>=this.min.y&&b.y<=this.max.y},intersects:function(o){o=D(o);var h=this.min,b=this.max,E=o.min,M=o.max,V=M.x>=h.x&&E.x<=b.x,fe=M.y>=h.y&&E.y<=b.y;return V&&fe},overlaps:function(o){o=D(o);var h=this.min,b=this.max,E=o.min,M=o.max,V=M.x>h.x&&E.x<b.x,fe=M.y>h.y&&E.y<b.y;return V&&fe},isValid:function(){return!!(this.min&&this.max)},pad:function(o){var h=this.min,b=this.max,E=Math.abs(h.x-b.x)*o,M=Math.abs(h.y-b.y)*o;return D(se(h.x-E,h.y-M),se(b.x+E,b.y+M))},equals:function(o){return o?(o=D(o),this.min.equals(o.getTopLeft())&&this.max.equals(o.getBottomRight())):!1}};function D(o,h){return!o||o instanceof F?o:new F(o,h)}function W(o,h){if(o)for(var b=h?[o,h]:o,E=0,M=b.length;E<M;E++)this.extend(b[E])}W.prototype={extend:function(o){var h=this._southWest,b=this._northEast,E,M;if(o instanceof J)E=o,M=o;else if(o instanceof W){if(E=o._southWest,M=o._northEast,!E||!M)return this}else return o?this.extend(de(o)||G(o)):this;return!h&&!b?(this._southWest=new J(E.lat,E.lng),this._northEast=new J(M.lat,M.lng)):(h.lat=Math.min(E.lat,h.lat),h.lng=Math.min(E.lng,h.lng),b.lat=Math.max(M.lat,b.lat),b.lng=Math.max(M.lng,b.lng)),this},pad:function(o){var h=this._southWest,b=this._northEast,E=Math.abs(h.lat-b.lat)*o,M=Math.abs(h.lng-b.lng)*o;return new W(new J(h.lat-E,h.lng-M),new J(b.lat+E,b.lng+M))},getCenter:function(){return new J((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new J(this.getNorth(),this.getWest())},getSouthEast:function(){return new J(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(o){typeof o[0]=="number"||o instanceof J||"lat"in o?o=de(o):o=G(o);var h=this._southWest,b=this._northEast,E,M;return o instanceof W?(E=o.getSouthWest(),M=o.getNorthEast()):E=M=o,E.lat>=h.lat&&M.lat<=b.lat&&E.lng>=h.lng&&M.lng<=b.lng},intersects:function(o){o=G(o);var h=this._southWest,b=this._northEast,E=o.getSouthWest(),M=o.getNorthEast(),V=M.lat>=h.lat&&E.lat<=b.lat,fe=M.lng>=h.lng&&E.lng<=b.lng;return V&&fe},overlaps:function(o){o=G(o);var h=this._southWest,b=this._northEast,E=o.getSouthWest(),M=o.getNorthEast(),V=M.lat>h.lat&&E.lat<b.lat,fe=M.lng>h.lng&&E.lng<b.lng;return V&&fe},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(o,h){return o?(o=G(o),this._southWest.equals(o.getSouthWest(),h)&&this._northEast.equals(o.getNorthEast(),h)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function G(o,h){return o instanceof W?o:new W(o,h)}function J(o,h,b){if(isNaN(o)||isNaN(h))throw new Error("Invalid LatLng object: ("+o+", "+h+")");this.lat=+o,this.lng=+h,b!==void 0&&(this.alt=+b)}J.prototype={equals:function(o,h){if(!o)return!1;o=de(o);var b=Math.max(Math.abs(this.lat-o.lat),Math.abs(this.lng-o.lng));return b<=(h===void 0?1e-9:h)},toString:function(o){return"LatLng("+_(this.lat,o)+", "+_(this.lng,o)+")"},distanceTo:function(o){return Ne.distance(this,de(o))},wrap:function(){return Ne.wrapLatLng(this)},toBounds:function(o){var h=180*o/40075017,b=h/Math.cos(Math.PI/180*this.lat);return G([this.lat-h,this.lng-b],[this.lat+h,this.lng+b])},clone:function(){return new J(this.lat,this.lng,this.alt)}};function de(o,h,b){return o instanceof J?o:A(o)&&typeof o[0]!="object"?o.length===3?new J(o[0],o[1],o[2]):o.length===2?new J(o[0],o[1]):null:o==null?o:typeof o=="object"&&"lat"in o?new J(o.lat,"lng"in o?o.lng:o.lon,o.alt):h===void 0?null:new J(o,h,b)}var De={latLngToPoint:function(o,h){var b=this.projection.project(o),E=this.scale(h);return this.transformation._transform(b,E)},pointToLatLng:function(o,h){var b=this.scale(h),E=this.transformation.untransform(o,b);return this.projection.unproject(E)},project:function(o){return this.projection.project(o)},unproject:function(o){return this.projection.unproject(o)},scale:function(o){return 256*Math.pow(2,o)},zoom:function(o){return Math.log(o/256)/Math.LN2},getProjectedBounds:function(o){if(this.infinite)return null;var h=this.projection.bounds,b=this.scale(o),E=this.transformation.transform(h.min,b),M=this.transformation.transform(h.max,b);return new F(E,M)},infinite:!1,wrapLatLng:function(o){var h=this.wrapLng?x(o.lng,this.wrapLng,!0):o.lng,b=this.wrapLat?x(o.lat,this.wrapLat,!0):o.lat,E=o.alt;return new J(b,h,E)},wrapLatLngBounds:function(o){var h=o.getCenter(),b=this.wrapLatLng(h),E=h.lat-b.lat,M=h.lng-b.lng;if(E===0&&M===0)return o;var V=o.getSouthWest(),fe=o.getNorthEast(),Te=new J(V.lat-E,V.lng-M),Pe=new J(fe.lat-E,fe.lng-M);return new W(Te,Pe)}},Ne=i({},De,{wrapLng:[-180,180],R:6371e3,distance:function(o,h){var b=Math.PI/180,E=o.lat*b,M=h.lat*b,V=Math.sin((h.lat-o.lat)*b/2),fe=Math.sin((h.lng-o.lng)*b/2),Te=V*V+Math.cos(E)*Math.cos(M)*fe*fe,Pe=2*Math.atan2(Math.sqrt(Te),Math.sqrt(1-Te));return this.R*Pe}}),$e=6378137,Ve={R:$e,MAX_LATITUDE:85.0511287798,project:function(o){var h=Math.PI/180,b=this.MAX_LATITUDE,E=Math.max(Math.min(b,o.lat),-b),M=Math.sin(E*h);return new K(this.R*o.lng*h,this.R*Math.log((1+M)/(1-M))/2)},unproject:function(o){var h=180/Math.PI;return new J((2*Math.atan(Math.exp(o.y/this.R))-Math.PI/2)*h,o.x*h/this.R)},bounds:(function(){var o=$e*Math.PI;return new F([-o,-o],[o,o])})()};function st(o,h,b,E){if(A(o)){this._a=o[0],this._b=o[1],this._c=o[2],this._d=o[3];return}this._a=o,this._b=h,this._c=b,this._d=E}st.prototype={transform:function(o,h){return this._transform(o.clone(),h)},_transform:function(o,h){return h=h||1,o.x=h*(this._a*o.x+this._b),o.y=h*(this._c*o.y+this._d),o},untransform:function(o,h){return h=h||1,new K((o.x/h-this._b)/this._a,(o.y/h-this._d)/this._c)}};function gt(o,h,b,E){return new st(o,h,b,E)}var zt=i({},Ne,{code:"EPSG:3857",projection:Ve,transformation:(function(){var o=.5/(Math.PI*Ve.R);return gt(o,.5,-o,.5)})()}),Ge=i({},zt,{code:"EPSG:900913"});function Ct(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function St(o,h){var b="",E,M,V,fe,Te,Pe;for(E=0,V=o.length;E<V;E++){for(Te=o[E],M=0,fe=Te.length;M<fe;M++)Pe=Te[M],b+=(M?"L":"M")+Pe.x+" "+Pe.y;b+=h?ve.svg?"z":"x":""}return b||"M0 0"}var Ue=document.documentElement.style,ce="ActiveXObject"in window,we=ce&&!document.addEventListener,Ie="msLaunchUri"in navigator&&!("documentMode"in document),lt=er("webkit"),ft=er("android"),Ze=er("android 2")||er("android 3"),ze=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),bt=ft&&er("Google")&&ze<537&&!("AudioNode"in window),Nt=!!window.opera,Ot=!Ie&&er("chrome"),Pt=er("gecko")&&!lt&&!Nt&&!ce,je=!Ot&&er("safari"),ut=er("phantom"),jt="OTransition"in Ue,$t=navigator.platform.indexOf("Win")===0,Fe=ce&&"transition"in Ue,ot="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Ze,dt="MozPerspective"in Ue,wt=!window.L_DISABLE_3D&&(Fe||ot||dt)&&!jt&&!ut,Ft=typeof orientation!="undefined"||er("mobile"),la=Ft&<,Je=Ft&&ot,Lt=!window.PointerEvent&&window.MSPointerEvent,ye=!!(window.PointerEvent||Lt),We="ontouchstart"in window||!!window.TouchEvent,at=!window.L_NO_TOUCH&&(We||ye),Vt=Ft&&Nt,aa=Ft&&Pt,Va=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Ma=(function(){var o=!1;try{var h=Object.defineProperty({},"passive",{get:function(){o=!0}});window.addEventListener("testPassiveEventSupport",y,h),window.removeEventListener("testPassiveEventSupport",y,h)}catch(b){}return o})(),zn=(function(){return!!document.createElement("canvas").getContext})(),Vr=!!(document.createElementNS&&Ct("svg").createSVGRect),ns=!!Vr&&(function(){var o=document.createElement("div");return o.innerHTML="<svg/>",(o.firstChild&&o.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),bn=!Vr&&(function(){try{var o=document.createElement("div");o.innerHTML='<v:shape adj="1"/>';var h=o.firstChild;return h.style.behavior="url(#default#VML)",h&&typeof h.adj=="object"}catch(b){return!1}})(),Bn=navigator.platform.indexOf("Mac")===0,js=navigator.platform.indexOf("Linux")===0;function er(o){return navigator.userAgent.toLowerCase().indexOf(o)>=0}var ve={ie:ce,ielt9:we,edge:Ie,webkit:lt,android:ft,android23:Ze,androidStock:bt,opera:Nt,chrome:Ot,gecko:Pt,safari:je,phantom:ut,opera12:jt,win:$t,ie3d:Fe,webkit3d:ot,gecko3d:dt,any3d:wt,mobile:Ft,mobileWebkit:la,mobileWebkit3d:Je,msPointer:Lt,pointer:ye,touch:at,touchNative:We,mobileOpera:Vt,mobileGecko:aa,retina:Va,passiveEvents:Ma,canvas:zn,svg:Vr,vml:bn,inlineSvg:ns,mac:Bn,linux:js},U=ve.msPointer?"MSPointerDown":"pointerdown",ne=ve.msPointer?"MSPointerMove":"pointermove",X=ve.msPointer?"MSPointerUp":"pointerup",Q=ve.msPointer?"MSPointerCancel":"pointercancel",re={touchstart:U,touchmove:ne,touchend:X,touchcancel:Q},z={touchstart:xt,touchmove:it,touchend:it,touchcancel:it},he={},Me=!1;function ke(o,h,b){return h==="touchstart"&&pt(),z[h]?(b=z[h].bind(this,b),o.addEventListener(re[h],b,!1),b):(console.warn("wrong event specified:",h),y)}function Ae(o,h,b){if(!re[h]){console.warn("wrong event specified:",h);return}o.removeEventListener(re[h],b,!1)}function Ce(o){he[o.pointerId]=o}function tt(o){he[o.pointerId]&&(he[o.pointerId]=o)}function ct(o){delete he[o.pointerId]}function pt(){Me||(document.addEventListener(U,Ce,!0),document.addEventListener(ne,tt,!0),document.addEventListener(X,ct,!0),document.addEventListener(Q,ct,!0),Me=!0)}function it(o,h){if(h.pointerType!==(h.MSPOINTER_TYPE_MOUSE||"mouse")){h.touches=[];for(var b in he)h.touches.push(he[b]);h.changedTouches=[h],o(h)}}function xt(o,h){h.MSPOINTER_TYPE_TOUCH&&h.pointerType===h.MSPOINTER_TYPE_TOUCH&&Ga(h),it(o,h)}function _t(o){var h={},b,E;for(E in o)b=o[E],h[E]=b&&b.bind?b.bind(o):b;return o=h,h.type="dblclick",h.detail=2,h.isTrusted=!1,h._simulated=!0,h}var ja=200;function Sa(o,h){o.addEventListener("dblclick",h);var b=0,E;function M(V){if(V.detail!==1){E=V.detail;return}if(!(V.pointerType==="mouse"||V.sourceCapabilities&&!V.sourceCapabilities.firesTouchEvents)){var fe=bl(V);if(!(fe.some(function(Pe){return Pe instanceof HTMLLabelElement&&Pe.attributes.for})&&!fe.some(function(Pe){return Pe instanceof HTMLInputElement||Pe instanceof HTMLSelectElement}))){var Te=Date.now();Te-b<=ja?(E++,E===2&&h(_t(V))):E=1,b=Te}}}return o.addEventListener("click",M),{dblclick:h,simDblclick:M}}function Fa(o,h){o.removeEventListener("dblclick",h.dblclick),o.removeEventListener("click",h.simDblclick)}var Ir=gl(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),vn=gl(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ss=vn==="webkitTransition"||vn==="OTransition"?vn+"End":"transitionend";function _n(o){return typeof o=="string"?document.getElementById(o):o}function is(o,h){var b=o.style[h]||o.currentStyle&&o.currentStyle[h];if((!b||b==="auto")&&document.defaultView){var E=document.defaultView.getComputedStyle(o,null);b=E?E[h]:null}return b==="auto"?null:b}function Ht(o,h,b){var E=document.createElement(o);return E.className=h||"",b&&b.appendChild(E),E}function Ta(o){var h=o.parentNode;h&&h.removeChild(o)}function en(o){for(;o.firstChild;)o.removeChild(o.firstChild)}function ur(o){var h=o.parentNode;h&&h.lastChild!==o&&h.appendChild(o)}function Zs(o){var h=o.parentNode;h&&h.firstChild!==o&&h.insertBefore(o,h.firstChild)}function Bc(o,h){if(o.classList!==void 0)return o.classList.contains(h);var b=xo(o);return b.length>0&&new RegExp("(^|\\s)"+h+"(\\s|$)").test(b)}function Gt(o,h){if(o.classList!==void 0)for(var b=T(h),E=0,M=b.length;E<M;E++)o.classList.add(b[E]);else if(!Bc(o,h)){var V=xo(o);ki(o,(V?V+" ":"")+h)}}function Ua(o,h){o.classList!==void 0?o.classList.remove(h):ki(o,k((" "+xo(o)+" ").replace(" "+h+" "," ")))}function ki(o,h){o.className.baseVal===void 0?o.className=h:o.className.baseVal=h}function xo(o){return o.correspondingElement&&(o=o.correspondingElement),o.className.baseVal===void 0?o.className:o.className.baseVal}function Ia(o,h){"opacity"in o.style?o.style.opacity=h:"filter"in o.style&&Uc(o,h)}function Uc(o,h){var b=!1,E="DXImageTransform.Microsoft.Alpha";try{b=o.filters.item(E)}catch(M){if(h===1)return}h=Math.round(h*100),b?(b.Enabled=h!==100,b.Opacity=h):o.style.filter+=" progid:"+E+"(opacity="+h+")"}function gl(o){for(var h=document.documentElement.style,b=0;b<o.length;b++)if(o[b]in h)return o[b];return!1}function ls(o,h,b){var E=h||new K(0,0);o.style[Ir]=(ve.ie3d?"translate("+E.x+"px,"+E.y+"px)":"translate3d("+E.x+"px,"+E.y+"px,0)")+(b?" scale("+b+")":"")}function La(o,h){o._leaflet_pos=h,ve.any3d?ls(o,h):(o.style.left=h.x+"px",o.style.top=h.y+"px")}function Ss(o){return o._leaflet_pos||new K(0,0)}var Ni,Un,Hc;if("onselectstart"in document)Ni=function(){Ut(window,"selectstart",Ga)},Un=function(){xa(window,"selectstart",Ga)};else{var ji=gl(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Ni=function(){if(ji){var o=document.documentElement.style;Hc=o[ji],o[ji]="none"}},Un=function(){ji&&(document.documentElement.style[ji]=Hc,Hc=void 0)}}function yo(){Ut(window,"dragstart",Ga)}function pl(){xa(window,"dragstart",Ga)}var bo,$c;function Si(o){for(;o.tabIndex===-1;)o=o.parentNode;o.style&&(tn(),bo=o,$c=o.style.outlineStyle,o.style.outlineStyle="none",Ut(window,"keydown",tn))}function tn(){bo&&(bo.style.outlineStyle=$c,bo=void 0,$c=void 0,xa(window,"keydown",tn))}function vo(o){do o=o.parentNode;while((!o.offsetWidth||!o.offsetHeight)&&o!==document.body);return o}function xl(o){var h=o.getBoundingClientRect();return{x:h.width/o.offsetWidth||1,y:h.height/o.offsetHeight||1,boundingClientRect:h}}var Ti={__proto__:null,TRANSFORM:Ir,TRANSITION:vn,TRANSITION_END:ss,get:_n,getStyle:is,create:Ht,remove:Ta,empty:en,toFront:ur,toBack:Zs,hasClass:Bc,addClass:Gt,removeClass:Ua,setClass:ki,getClass:xo,setOpacity:Ia,testProp:gl,setTransform:ls,setPosition:La,getPosition:Ss,get disableTextSelection(){return Ni},get enableTextSelection(){return Un},disableImageDrag:yo,enableImageDrag:pl,preventOutline:Si,restoreOutline:tn,getSizedParentNode:vo,getScale:xl};function Ut(o,h,b,E){if(h&&typeof h=="object")for(var M in h)kn(o,M,h[M],b);else{h=T(h);for(var V=0,fe=h.length;V<fe;V++)kn(o,h[V],b,E)}return this}var wn="_leaflet_events";function xa(o,h,b,E){if(arguments.length===1)Wc(o),delete o[wn];else if(h&&typeof h=="object")for(var M in h)yl(o,M,h[M],b);else if(h=T(h),arguments.length===2)Wc(o,function(Te){return P(h,Te)!==-1});else for(var V=0,fe=h.length;V<fe;V++)yl(o,h[V],b,E);return this}function Wc(o,h){for(var b in o[wn]){var E=b.split(/\d/)[0];(!h||h(E))&&yl(o,E,null,null,b)}}var qs={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function kn(o,h,b,E){var M=h+g(b)+(E?"_"+g(E):"");if(o[wn]&&o[wn][M])return this;var V=function(Te){return b.call(E||o,Te||window.event)},fe=V;!ve.touchNative&&ve.pointer&&h.indexOf("touch")===0?V=ke(o,h,V):ve.touch&&h==="dblclick"?V=Sa(o,V):"addEventListener"in o?h==="touchstart"||h==="touchmove"||h==="wheel"||h==="mousewheel"?o.addEventListener(qs[h]||h,V,ve.passiveEvents?{passive:!1}:!1):h==="mouseenter"||h==="mouseleave"?(V=function(Te){Te=Te||window.event,os(o,Te)&&fe(Te)},o.addEventListener(qs[h],V,!1)):o.addEventListener(h,fe,!1):o.attachEvent("on"+h,V),o[wn]=o[wn]||{},o[wn][M]=V}function yl(o,h,b,E,M){M=M||h+g(b)+(E?"_"+g(E):"");var V=o[wn]&&o[wn][M];if(!V)return this;!ve.touchNative&&ve.pointer&&h.indexOf("touch")===0?Ae(o,h,V):ve.touch&&h==="dblclick"?Fa(o,V):"removeEventListener"in o?o.removeEventListener(qs[h]||h,V,!1):o.detachEvent("on"+h,V),o[wn][M]=null}function Nn(o){return o.stopPropagation?o.stopPropagation():o.originalEvent?o.originalEvent._stopped=!0:o.cancelBubble=!0,this}function Hn(o){return kn(o,"wheel",Nn),this}function Ys(o){return Ut(o,"mousedown touchstart dblclick contextmenu",Nn),o._leaflet_disable_click=!0,this}function Ga(o){return o.preventDefault?o.preventDefault():o.returnValue=!1,this}function Ts(o){return Ga(o),Nn(o),this}function bl(o){if(o.composedPath)return o.composedPath();for(var h=[],b=o.target;b;)h.push(b),b=b.parentNode;return h}function vl(o,h){if(!h)return new K(o.clientX,o.clientY);var b=xl(h),E=b.boundingClientRect;return new K((o.clientX-E.left)/b.x-h.clientLeft,(o.clientY-E.top)/b.y-h.clientTop)}var C0=ve.linux&&ve.chrome?window.devicePixelRatio:ve.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Tr(o){return ve.edge?o.wheelDeltaY/2:o.deltaY&&o.deltaMode===0?-o.deltaY/C0:o.deltaY&&o.deltaMode===1?-o.deltaY*20:o.deltaY&&o.deltaMode===2?-o.deltaY*60:o.deltaX||o.deltaZ?0:o.wheelDelta?(o.wheelDeltaY||o.wheelDelta)/2:o.detail&&Math.abs(o.detail)<32765?-o.detail*20:o.detail?o.detail/-32765*60:0}function os(o,h){var b=h.relatedTarget;if(!b)return!0;try{for(;b&&b!==o;)b=b.parentNode}catch(E){return!1}return b!==o}var _o={__proto__:null,on:Ut,off:xa,stopPropagation:Nn,disableScrollPropagation:Hn,disableClickPropagation:Ys,preventDefault:Ga,stop:Ts,getPropagationPath:bl,getMousePosition:vl,getWheelDelta:Tr,isExternalTarget:os,addListener:Ut,removeListener:xa},Ei=Z.extend({run:function(o,h,b,E){this.stop(),this._el=o,this._inProgress=!0,this._duration=b||.25,this._easeOutPower=1/Math.max(E||.5,.2),this._startPos=Ss(o),this._offset=h.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=xe(this._animate,this),this._step()},_step:function(o){var h=+new Date-this._startTime,b=this._duration*1e3;h<b?this._runFrame(this._easeOut(h/b),o):(this._runFrame(1),this._complete())},_runFrame:function(o,h){var b=this._startPos.add(this._offset.multiplyBy(o));h&&b._round(),La(this._el,b),this.fire("step")},_complete:function(){le(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(o){return 1-Math.pow(1-o,this._easeOutPower)}}),ra=Z.extend({options:{crs:zt,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(o,h){h=N(this,h),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(o),this._initLayout(),this._onResize=c(this._onResize,this),this._initEvents(),h.maxBounds&&this.setMaxBounds(h.maxBounds),h.zoom!==void 0&&(this._zoom=this._limitZoom(h.zoom)),h.center&&h.zoom!==void 0&&this.setView(de(h.center),h.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=vn&&ve.any3d&&!ve.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Ut(this._proxy,ss,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(o,h,b){if(h=h===void 0?this._zoom:this._limitZoom(h),o=this._limitCenter(de(o),h,this.options.maxBounds),b=b||{},this._stop(),this._loaded&&!b.reset&&b!==!0){b.animate!==void 0&&(b.zoom=i({animate:b.animate},b.zoom),b.pan=i({animate:b.animate,duration:b.duration},b.pan));var E=this._zoom!==h?this._tryAnimatedZoom&&this._tryAnimatedZoom(o,h,b.zoom):this._tryAnimatedPan(o,b.pan);if(E)return clearTimeout(this._sizeTimer),this}return this._resetView(o,h,b.pan&&b.pan.noMoveStart),this},setZoom:function(o,h){return this._loaded?this.setView(this.getCenter(),o,{zoom:h}):(this._zoom=o,this)},zoomIn:function(o,h){return o=o||(ve.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+o,h)},zoomOut:function(o,h){return o=o||(ve.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-o,h)},setZoomAround:function(o,h,b){var E=this.getZoomScale(h),M=this.getSize().divideBy(2),V=o instanceof K?o:this.latLngToContainerPoint(o),fe=V.subtract(M).multiplyBy(1-1/E),Te=this.containerPointToLatLng(M.add(fe));return this.setView(Te,h,{zoom:b})},_getBoundsCenterZoom:function(o,h){h=h||{},o=o.getBounds?o.getBounds():G(o);var b=se(h.paddingTopLeft||h.padding||[0,0]),E=se(h.paddingBottomRight||h.padding||[0,0]),M=this.getBoundsZoom(o,!1,b.add(E));if(M=typeof h.maxZoom=="number"?Math.min(h.maxZoom,M):M,M===1/0)return{center:o.getCenter(),zoom:M};var V=E.subtract(b).divideBy(2),fe=this.project(o.getSouthWest(),M),Te=this.project(o.getNorthEast(),M),Pe=this.unproject(fe.add(Te).divideBy(2).add(V),M);return{center:Pe,zoom:M}},fitBounds:function(o,h){if(o=G(o),!o.isValid())throw new Error("Bounds are not valid.");var b=this._getBoundsCenterZoom(o,h);return this.setView(b.center,b.zoom,h)},fitWorld:function(o){return this.fitBounds([[-90,-180],[90,180]],o)},panTo:function(o,h){return this.setView(o,this._zoom,{pan:h})},panBy:function(o,h){if(o=se(o).round(),h=h||{},!o.x&&!o.y)return this.fire("moveend");if(h.animate!==!0&&!this.getSize().contains(o))return this._resetView(this.unproject(this.project(this.getCenter()).add(o)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Ei,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),h.noMoveStart||this.fire("movestart"),h.animate!==!1){Gt(this._mapPane,"leaflet-pan-anim");var b=this._getMapPanePos().subtract(o).round();this._panAnim.run(this._mapPane,b,h.duration||.25,h.easeLinearity)}else this._rawPanBy(o),this.fire("move").fire("moveend");return this},flyTo:function(o,h,b){if(b=b||{},b.animate===!1||!ve.any3d)return this.setView(o,h,b);this._stop();var E=this.project(this.getCenter()),M=this.project(o),V=this.getSize(),fe=this._zoom;o=de(o),h=h===void 0?fe:h;var Te=Math.max(V.x,V.y),Pe=Te*this.getZoomScale(fe,h),Ke=M.distanceTo(E)||1,yt=1.42,Dt=yt*yt;function Xt(Wa){var fs=Wa?-1:1,Qs=Wa?Pe:Te,sd=Pe*Pe-Te*Te+fs*Dt*Dt*Ke*Ke,Rl=2*Qs*Dt*Ke,Fl=sd/Rl,Rs=Math.sqrt(Fl*Fl+1)-Fl,hs=Rs<1e-9?-18:Math.log(Rs);return hs}function fr(Wa){return(Math.exp(Wa)-Math.exp(-Wa))/2}function Za(Wa){return(Math.exp(Wa)+Math.exp(-Wa))/2}function Zr(Wa){return fr(Wa)/Za(Wa)}var oa=Xt(0);function ca(Wa){return Te*(Za(oa)/Za(oa+yt*Wa))}function Qt(Wa){return Te*(Za(oa)*Zr(oa+yt*Wa)-fr(oa))/Dt}function Ds(Wa){return 1-Math.pow(1-Wa,1.5)}var sn=Date.now(),Po=(Xt(1)-oa)/yt,Ps=b.duration?1e3*b.duration:1e3*Po*.8;function nd(){var Wa=(Date.now()-sn)/Ps,fs=Ds(Wa)*Po;Wa<=1?(this._flyToFrame=xe(nd,this),this._move(this.unproject(E.add(M.subtract(E).multiplyBy(Qt(fs)/Ke)),fe),this.getScaleZoom(Te/ca(fs),fe),{flyTo:!0})):this._move(o,h)._moveEnd(!0)}return this._moveStart(!0,b.noMoveStart),nd.call(this),this},flyToBounds:function(o,h){var b=this._getBoundsCenterZoom(o,h);return this.flyTo(b.center,b.zoom,h)},setMaxBounds:function(o){return o=G(o),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),o.isValid()?(this.options.maxBounds=o,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(o){var h=this.options.minZoom;return this.options.minZoom=o,this._loaded&&h!==o&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(o):this},setMaxZoom:function(o){var h=this.options.maxZoom;return this.options.maxZoom=o,this._loaded&&h!==o&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(o):this},panInsideBounds:function(o,h){this._enforcingBounds=!0;var b=this.getCenter(),E=this._limitCenter(b,this._zoom,G(o));return b.equals(E)||this.panTo(E,h),this._enforcingBounds=!1,this},panInside:function(o,h){h=h||{};var b=se(h.paddingTopLeft||h.padding||[0,0]),E=se(h.paddingBottomRight||h.padding||[0,0]),M=this.project(this.getCenter()),V=this.project(o),fe=this.getPixelBounds(),Te=D([fe.min.add(b),fe.max.subtract(E)]),Pe=Te.getSize();if(!Te.contains(V)){this._enforcingBounds=!0;var Ke=V.subtract(Te.getCenter()),yt=Te.extend(V).getSize().subtract(Pe);M.x+=Ke.x<0?-yt.x:yt.x,M.y+=Ke.y<0?-yt.y:yt.y,this.panTo(this.unproject(M),h),this._enforcingBounds=!1}return this},invalidateSize:function(o){if(!this._loaded)return this;o=i({animate:!1,pan:!0},o===!0?{animate:!0}:o);var h=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var b=this.getSize(),E=h.divideBy(2).round(),M=b.divideBy(2).round(),V=E.subtract(M);return!V.x&&!V.y?this:(o.animate&&o.pan?this.panBy(V):(o.pan&&this._rawPanBy(V),this.fire("move"),o.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(c(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:h,newSize:b}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(o){if(o=this._locateOptions=i({timeout:1e4,watch:!1},o),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var h=c(this._handleGeolocationResponse,this),b=c(this._handleGeolocationError,this);return o.watch?this._locationWatchId=navigator.geolocation.watchPosition(h,b,o):navigator.geolocation.getCurrentPosition(h,b,o),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(o){if(this._container._leaflet_id){var h=o.code,b=o.message||(h===1?"permission denied":h===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:h,message:"Geolocation error: "+b+"."})}},_handleGeolocationResponse:function(o){if(this._container._leaflet_id){var h=o.coords.latitude,b=o.coords.longitude,E=new J(h,b),M=E.toBounds(o.coords.accuracy*2),V=this._locateOptions;if(V.setView){var fe=this.getBoundsZoom(M);this.setView(E,V.maxZoom?Math.min(fe,V.maxZoom):fe)}var Te={latlng:E,bounds:M,timestamp:o.timestamp};for(var Pe in o.coords)typeof o.coords[Pe]=="number"&&(Te[Pe]=o.coords[Pe]);this.fire("locationfound",Te)}},addHandler:function(o,h){if(!h)return this;var b=this[o]=new h(this);return this._handlers.push(b),this.options[o]&&b.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(h){this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Ta(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(le(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var o;for(o in this._layers)this._layers[o].remove();for(o in this._panes)Ta(this._panes[o]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(o,h){var b="leaflet-pane"+(o?" leaflet-"+o.replace("Pane","")+"-pane":""),E=Ht("div",b,h||this._mapPane);return o&&(this._panes[o]=E),E},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var o=this.getPixelBounds(),h=this.unproject(o.getBottomLeft()),b=this.unproject(o.getTopRight());return new W(h,b)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(o,h,b){o=G(o),b=se(b||[0,0]);var E=this.getZoom()||0,M=this.getMinZoom(),V=this.getMaxZoom(),fe=o.getNorthWest(),Te=o.getSouthEast(),Pe=this.getSize().subtract(b),Ke=D(this.project(Te,E),this.project(fe,E)).getSize(),yt=ve.any3d?this.options.zoomSnap:1,Dt=Pe.x/Ke.x,Xt=Pe.y/Ke.y,fr=h?Math.max(Dt,Xt):Math.min(Dt,Xt);return E=this.getScaleZoom(fr,E),yt&&(E=Math.round(E/(yt/100))*(yt/100),E=h?Math.ceil(E/yt)*yt:Math.floor(E/yt)*yt),Math.max(M,Math.min(V,E))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new K(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(o,h){var b=this._getTopLeftPoint(o,h);return new F(b,b.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(o){return this.options.crs.getProjectedBounds(o===void 0?this.getZoom():o)},getPane:function(o){return typeof o=="string"?this._panes[o]:o},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(o,h){var b=this.options.crs;return h=h===void 0?this._zoom:h,b.scale(o)/b.scale(h)},getScaleZoom:function(o,h){var b=this.options.crs;h=h===void 0?this._zoom:h;var E=b.zoom(o*b.scale(h));return isNaN(E)?1/0:E},project:function(o,h){return h=h===void 0?this._zoom:h,this.options.crs.latLngToPoint(de(o),h)},unproject:function(o,h){return h=h===void 0?this._zoom:h,this.options.crs.pointToLatLng(se(o),h)},layerPointToLatLng:function(o){var h=se(o).add(this.getPixelOrigin());return this.unproject(h)},latLngToLayerPoint:function(o){var h=this.project(de(o))._round();return h._subtract(this.getPixelOrigin())},wrapLatLng:function(o){return this.options.crs.wrapLatLng(de(o))},wrapLatLngBounds:function(o){return this.options.crs.wrapLatLngBounds(G(o))},distance:function(o,h){return this.options.crs.distance(de(o),de(h))},containerPointToLayerPoint:function(o){return se(o).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(o){return se(o).add(this._getMapPanePos())},containerPointToLatLng:function(o){var h=this.containerPointToLayerPoint(se(o));return this.layerPointToLatLng(h)},latLngToContainerPoint:function(o){return this.layerPointToContainerPoint(this.latLngToLayerPoint(de(o)))},mouseEventToContainerPoint:function(o){return vl(o,this._container)},mouseEventToLayerPoint:function(o){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(o))},mouseEventToLatLng:function(o){return this.layerPointToLatLng(this.mouseEventToLayerPoint(o))},_initContainer:function(o){var h=this._container=_n(o);if(h){if(h._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Ut(h,"scroll",this._onScroll,this),this._containerId=g(h)},_initLayout:function(){var o=this._container;this._fadeAnimated=this.options.fadeAnimation&&ve.any3d,Gt(o,"leaflet-container"+(ve.touch?" leaflet-touch":"")+(ve.retina?" leaflet-retina":"")+(ve.ielt9?" leaflet-oldie":"")+(ve.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var h=is(o,"position");h!=="absolute"&&h!=="relative"&&h!=="fixed"&&h!=="sticky"&&(o.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var o=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),La(this._mapPane,new K(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Gt(o.markerPane,"leaflet-zoom-hide"),Gt(o.shadowPane,"leaflet-zoom-hide"))},_resetView:function(o,h,b){La(this._mapPane,new K(0,0));var E=!this._loaded;this._loaded=!0,h=this._limitZoom(h),this.fire("viewprereset");var M=this._zoom!==h;this._moveStart(M,b)._move(o,h)._moveEnd(M),this.fire("viewreset"),E&&this.fire("load")},_moveStart:function(o,h){return o&&this.fire("zoomstart"),h||this.fire("movestart"),this},_move:function(o,h,b,E){h===void 0&&(h=this._zoom);var M=this._zoom!==h;return this._zoom=h,this._lastCenter=o,this._pixelOrigin=this._getNewPixelOrigin(o),E?b&&b.pinch&&this.fire("zoom",b):((M||b&&b.pinch)&&this.fire("zoom",b),this.fire("move",b)),this},_moveEnd:function(o){return o&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return le(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(o){La(this._mapPane,this._getMapPanePos().subtract(o))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(o){this._targets={},this._targets[g(this._container)]=this;var h=o?xa:Ut;h(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&h(window,"resize",this._onResize,this),ve.any3d&&this.options.transform3DLimit&&(o?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){le(this._resizeRequest),this._resizeRequest=xe(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var o=this._getMapPanePos();Math.max(Math.abs(o.x),Math.abs(o.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(o,h){for(var b=[],E,M=h==="mouseout"||h==="mouseover",V=o.target||o.srcElement,fe=!1;V;){if(E=this._targets[g(V)],E&&(h==="click"||h==="preclick")&&this._draggableMoved(E)){fe=!0;break}if(E&&E.listens(h,!0)&&(M&&!os(V,o)||(b.push(E),M))||V===this._container)break;V=V.parentNode}return!b.length&&!fe&&!M&&this.listens(h,!0)&&(b=[this]),b},_isClickDisabled:function(o){for(;o&&o!==this._container;){if(o._leaflet_disable_click)return!0;o=o.parentNode}},_handleDOMEvent:function(o){var h=o.target||o.srcElement;if(!(!this._loaded||h._leaflet_disable_events||o.type==="click"&&this._isClickDisabled(h))){var b=o.type;b==="mousedown"&&Si(h),this._fireDOMEvent(o,b)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(o,h,b){if(o.type==="click"){var E=i({},o);E.type="preclick",this._fireDOMEvent(E,E.type,b)}var M=this._findEventTargets(o,h);if(b){for(var V=[],fe=0;fe<b.length;fe++)b[fe].listens(h,!0)&&V.push(b[fe]);M=V.concat(M)}if(M.length){h==="contextmenu"&&Ga(o);var Te=M[0],Pe={originalEvent:o};if(o.type!=="keypress"&&o.type!=="keydown"&&o.type!=="keyup"){var Ke=Te.getLatLng&&(!Te._radius||Te._radius<=10);Pe.containerPoint=Ke?this.latLngToContainerPoint(Te.getLatLng()):this.mouseEventToContainerPoint(o),Pe.layerPoint=this.containerPointToLayerPoint(Pe.containerPoint),Pe.latlng=Ke?Te.getLatLng():this.layerPointToLatLng(Pe.layerPoint)}for(fe=0;fe<M.length;fe++)if(M[fe].fire(h,Pe,!0),Pe.originalEvent._stopped||M[fe].options.bubblingMouseEvents===!1&&P(this._mouseEvents,h)!==-1)return}},_draggableMoved:function(o){return o=o.dragging&&o.dragging.enabled()?o:this,o.dragging&&o.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var o=0,h=this._handlers.length;o<h;o++)this._handlers[o].disable()},whenReady:function(o,h){return this._loaded?o.call(h||this,{target:this}):this.on("load",o,h),this},_getMapPanePos:function(){return Ss(this._mapPane)||new K(0,0)},_moved:function(){var o=this._getMapPanePos();return o&&!o.equals([0,0])},_getTopLeftPoint:function(o,h){var b=o&&h!==void 0?this._getNewPixelOrigin(o,h):this.getPixelOrigin();return b.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(o,h){var b=this.getSize()._divideBy(2);return this.project(o,h)._subtract(b)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(o,h,b){var E=this._getNewPixelOrigin(b,h);return this.project(o,h)._subtract(E)},_latLngBoundsToNewLayerBounds:function(o,h,b){var E=this._getNewPixelOrigin(b,h);return D([this.project(o.getSouthWest(),h)._subtract(E),this.project(o.getNorthWest(),h)._subtract(E),this.project(o.getSouthEast(),h)._subtract(E),this.project(o.getNorthEast(),h)._subtract(E)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(o){return this.latLngToLayerPoint(o).subtract(this._getCenterLayerPoint())},_limitCenter:function(o,h,b){if(!b)return o;var E=this.project(o,h),M=this.getSize().divideBy(2),V=new F(E.subtract(M),E.add(M)),fe=this._getBoundsOffset(V,b,h);return Math.abs(fe.x)<=1&&Math.abs(fe.y)<=1?o:this.unproject(E.add(fe),h)},_limitOffset:function(o,h){if(!h)return o;var b=this.getPixelBounds(),E=new F(b.min.add(o),b.max.add(o));return o.add(this._getBoundsOffset(E,h))},_getBoundsOffset:function(o,h,b){var E=D(this.project(h.getNorthEast(),b),this.project(h.getSouthWest(),b)),M=E.min.subtract(o.min),V=E.max.subtract(o.max),fe=this._rebound(M.x,-V.x),Te=this._rebound(M.y,-V.y);return new K(fe,Te)},_rebound:function(o,h){return o+h>0?Math.round(o-h)/2:Math.max(0,Math.ceil(o))-Math.max(0,Math.floor(h))},_limitZoom:function(o){var h=this.getMinZoom(),b=this.getMaxZoom(),E=ve.any3d?this.options.zoomSnap:1;return E&&(o=Math.round(o/E)*E),Math.max(h,Math.min(b,o))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Ua(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(o,h){var b=this._getCenterOffset(o)._trunc();return(h&&h.animate)!==!0&&!this.getSize().contains(b)?!1:(this.panBy(b,h),!0)},_createAnimProxy:function(){var o=this._proxy=Ht("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(o),this.on("zoomanim",function(h){var b=Ir,E=this._proxy.style[b];ls(this._proxy,this.project(h.center,h.zoom),this.getZoomScale(h.zoom,1)),E===this._proxy.style[b]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Ta(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var o=this.getCenter(),h=this.getZoom();ls(this._proxy,this.project(o,h),this.getZoomScale(h,1))},_catchTransitionEnd:function(o){this._animatingZoom&&o.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(o,h,b){if(this._animatingZoom)return!0;if(b=b||{},!this._zoomAnimated||b.animate===!1||this._nothingToAnimate()||Math.abs(h-this._zoom)>this.options.zoomAnimationThreshold)return!1;var E=this.getZoomScale(h),M=this._getCenterOffset(o)._divideBy(1-1/E);return b.animate!==!0&&!this.getSize().contains(M)?!1:(xe(function(){this._moveStart(!0,b.noMoveStart||!1)._animateZoom(o,h,!0)},this),!0)},_animateZoom:function(o,h,b,E){this._mapPane&&(b&&(this._animatingZoom=!0,this._animateToCenter=o,this._animateToZoom=h,Gt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:o,zoom:h,noUpdate:E}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(c(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Ua(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Vc(o,h){return new ra(o,h)}var Gr=be.extend({options:{position:"topright"},initialize:function(o){N(this,o)},getPosition:function(){return this.options.position},setPosition:function(o){var h=this._map;return h&&h.removeControl(this),this.options.position=o,h&&h.addControl(this),this},getContainer:function(){return this._container},addTo:function(o){this.remove(),this._map=o;var h=this._container=this.onAdd(o),b=this.getPosition(),E=o._controlCorners[b];return Gt(h,"leaflet-control"),b.indexOf("bottom")!==-1?E.insertBefore(h,E.firstChild):E.appendChild(h),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Ta(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(o){this._map&&o&&o.screenX>0&&o.screenY>0&&this._map.getContainer().focus()}}),cs=function(o){return new Gr(o)};ra.include({addControl:function(o){return o.addTo(this),this},removeControl:function(o){return o.remove(),this},_initControlPos:function(){var o=this._controlCorners={},h="leaflet-",b=this._controlContainer=Ht("div",h+"control-container",this._container);function E(M,V){var fe=h+M+" "+h+V;o[M+V]=Ht("div",fe,b)}E("top","left"),E("top","right"),E("bottom","left"),E("bottom","right")},_clearControlPos:function(){for(var o in this._controlCorners)Ta(this._controlCorners[o]);Ta(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var _l=Gr.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(o,h,b,E){return b<E?-1:E<b?1:0}},initialize:function(o,h,b){N(this,b),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var E in o)this._addLayer(o[E],E);for(E in h)this._addLayer(h[E],E,!0)},onAdd:function(o){this._initLayout(),this._update(),this._map=o,o.on("zoomend",this._checkDisabledLayers,this);for(var h=0;h<this._layers.length;h++)this._layers[h].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(o){return Gr.prototype.addTo.call(this,o),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var o=0;o<this._layers.length;o++)this._layers[o].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(o,h){return this._addLayer(o,h),this._map?this._update():this},addOverlay:function(o,h){return this._addLayer(o,h,!0),this._map?this._update():this},removeLayer:function(o){o.off("add remove",this._onLayerChange,this);var h=this._getLayer(g(o));return h&&this._layers.splice(this._layers.indexOf(h),1),this._map?this._update():this},expand:function(){Gt(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var o=this._map.getSize().y-(this._container.offsetTop+50);return o<this._section.clientHeight?(Gt(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=o+"px"):Ua(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Ua(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var o="leaflet-control-layers",h=this._container=Ht("div",o),b=this.options.collapsed;h.setAttribute("aria-haspopup",!0),Ys(h),Hn(h);var E=this._section=Ht("section",o+"-list");b&&(this._map.on("click",this.collapse,this),Ut(h,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var M=this._layersLink=Ht("a",o+"-toggle",h);M.href="#",M.title="Layers",M.setAttribute("role","button"),Ut(M,{keydown:function(V){V.keyCode===13&&this._expandSafely()},click:function(V){Ga(V),this._expandSafely()}},this),b||this.expand(),this._baseLayersList=Ht("div",o+"-base",E),this._separator=Ht("div",o+"-separator",E),this._overlaysList=Ht("div",o+"-overlays",E),h.appendChild(E)},_getLayer:function(o){for(var h=0;h<this._layers.length;h++)if(this._layers[h]&&g(this._layers[h].layer)===o)return this._layers[h]},_addLayer:function(o,h,b){this._map&&o.on("add remove",this._onLayerChange,this),this._layers.push({layer:o,name:h,overlay:b}),this.options.sortLayers&&this._layers.sort(c(function(E,M){return this.options.sortFunction(E.layer,M.layer,E.name,M.name)},this)),this.options.autoZIndex&&o.setZIndex&&(this._lastZIndex++,o.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;en(this._baseLayersList),en(this._overlaysList),this._layerControlInputs=[];var o,h,b,E,M=0;for(b=0;b<this._layers.length;b++)E=this._layers[b],this._addItem(E),h=h||E.overlay,o=o||!E.overlay,M+=E.overlay?0:1;return this.options.hideSingleBase&&(o=o&&M>1,this._baseLayersList.style.display=o?"":"none"),this._separator.style.display=h&&o?"":"none",this},_onLayerChange:function(o){this._handlingClick||this._update();var h=this._getLayer(g(o.target)),b=h.overlay?o.type==="add"?"overlayadd":"overlayremove":o.type==="add"?"baselayerchange":null;b&&this._map.fire(b,h)},_createRadioElement:function(o,h){var b='<input type="radio" class="leaflet-control-layers-selector" name="'+o+'"'+(h?' checked="checked"':"")+"/>",E=document.createElement("div");return E.innerHTML=b,E.firstChild},_addItem:function(o){var h=document.createElement("label"),b=this._map.hasLayer(o.layer),E;o.overlay?(E=document.createElement("input"),E.type="checkbox",E.className="leaflet-control-layers-selector",E.defaultChecked=b):E=this._createRadioElement("leaflet-base-layers_"+g(this),b),this._layerControlInputs.push(E),E.layerId=g(o.layer),Ut(E,"click",this._onInputClick,this);var M=document.createElement("span");M.innerHTML=" "+o.name;var V=document.createElement("span");h.appendChild(V),V.appendChild(E),V.appendChild(M);var fe=o.overlay?this._overlaysList:this._baseLayersList;return fe.appendChild(h),this._checkDisabledLayers(),h},_onInputClick:function(){if(!this._preventClick){var o=this._layerControlInputs,h,b,E=[],M=[];this._handlingClick=!0;for(var V=o.length-1;V>=0;V--)h=o[V],b=this._getLayer(h.layerId).layer,h.checked?E.push(b):h.checked||M.push(b);for(V=0;V<M.length;V++)this._map.hasLayer(M[V])&&this._map.removeLayer(M[V]);for(V=0;V<E.length;V++)this._map.hasLayer(E[V])||this._map.addLayer(E[V]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var o=this._layerControlInputs,h,b,E=this._map.getZoom(),M=o.length-1;M>=0;M--)h=o[M],b=this._getLayer(h.layerId).layer,h.disabled=b.options.minZoom!==void 0&&E<b.options.minZoom||b.options.maxZoom!==void 0&&E>b.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var o=this._section;this._preventClick=!0,Ut(o,"click",Ga),this.expand();var h=this;setTimeout(function(){xa(o,"click",Ga),h._preventClick=!1})}}),A0=function(o,h,b){return new _l(o,h,b)},Gc=Gr.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(o){var h="leaflet-control-zoom",b=Ht("div",h+" leaflet-bar"),E=this.options;return this._zoomInButton=this._createButton(E.zoomInText,E.zoomInTitle,h+"-in",b,this._zoomIn),this._zoomOutButton=this._createButton(E.zoomOutText,E.zoomOutTitle,h+"-out",b,this._zoomOut),this._updateDisabled(),o.on("zoomend zoomlevelschange",this._updateDisabled,this),b},onRemove:function(o){o.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(o){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(o.shiftKey?3:1))},_zoomOut:function(o){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(o.shiftKey?3:1))},_createButton:function(o,h,b,E,M){var V=Ht("a",b,E);return V.innerHTML=o,V.href="#",V.title=h,V.setAttribute("role","button"),V.setAttribute("aria-label",h),Ys(V),Ut(V,"click",Ts),Ut(V,"click",M,this),Ut(V,"click",this._refocusOnMap,this),V},_updateDisabled:function(){var o=this._map,h="leaflet-disabled";Ua(this._zoomInButton,h),Ua(this._zoomOutButton,h),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||o._zoom===o.getMinZoom())&&(Gt(this._zoomOutButton,h),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||o._zoom===o.getMaxZoom())&&(Gt(this._zoomInButton,h),this._zoomInButton.setAttribute("aria-disabled","true"))}});ra.mergeOptions({zoomControl:!0}),ra.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Gc,this.addControl(this.zoomControl))});var mh=function(o){return new Gc(o)},O0=Gr.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(o){var h="leaflet-control-scale",b=Ht("div",h),E=this.options;return this._addScales(E,h+"-line",b),o.on(E.updateWhenIdle?"moveend":"move",this._update,this),o.whenReady(this._update,this),b},onRemove:function(o){o.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(o,h,b){o.metric&&(this._mScale=Ht("div",h,b)),o.imperial&&(this._iScale=Ht("div",h,b))},_update:function(){var o=this._map,h=o.getSize().y/2,b=o.distance(o.containerPointToLatLng([0,h]),o.containerPointToLatLng([this.options.maxWidth,h]));this._updateScales(b)},_updateScales:function(o){this.options.metric&&o&&this._updateMetric(o),this.options.imperial&&o&&this._updateImperial(o)},_updateMetric:function(o){var h=this._getRoundNum(o),b=h<1e3?h+" m":h/1e3+" km";this._updateScale(this._mScale,b,h/o)},_updateImperial:function(o){var h=o*3.2808399,b,E,M;h>5280?(b=h/5280,E=this._getRoundNum(b),this._updateScale(this._iScale,E+" mi",E/b)):(M=this._getRoundNum(h),this._updateScale(this._iScale,M+" ft",M/h))},_updateScale:function(o,h,b){o.style.width=Math.round(this.options.maxWidth*b)+"px",o.innerHTML=h},_getRoundNum:function(o){var h=Math.pow(10,(Math.floor(o)+"").length-1),b=o/h;return b=b>=10?10:b>=5?5:b>=3?3:b>=2?2:1,h*b}}),Zc=function(o){return new O0(o)},gh='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',qc=Gr.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(ve.inlineSvg?gh+" ":"")+"Leaflet</a>"},initialize:function(o){N(this,o),this._attributions={}},onAdd:function(o){o.attributionControl=this,this._container=Ht("div","leaflet-control-attribution"),Ys(this._container);for(var h in o._layers)o._layers[h].getAttribution&&this.addAttribution(o._layers[h].getAttribution());return this._update(),o.on("layeradd",this._addAttribution,this),this._container},onRemove:function(o){o.off("layeradd",this._addAttribution,this)},_addAttribution:function(o){o.layer.getAttribution&&(this.addAttribution(o.layer.getAttribution()),o.layer.once("remove",function(){this.removeAttribution(o.layer.getAttribution())},this))},setPrefix:function(o){return this.options.prefix=o,this._update(),this},addAttribution:function(o){return o?(this._attributions[o]||(this._attributions[o]=0),this._attributions[o]++,this._update(),this):this},removeAttribution:function(o){return o?(this._attributions[o]&&(this._attributions[o]--,this._update()),this):this},_update:function(){if(this._map){var o=[];for(var h in this._attributions)this._attributions[h]&&o.push(h);var b=[];this.options.prefix&&b.push(this.options.prefix),o.length&&b.push(o.join(", ")),this._container.innerHTML=b.join(' <span aria-hidden="true">|</span> ')}}});ra.mergeOptions({attributionControl:!0}),ra.addInitHook(function(){this.options.attributionControl&&new qc().addTo(this)});var ph=function(o){return new qc(o)};Gr.Layers=_l,Gr.Zoom=Gc,Gr.Scale=O0,Gr.Attribution=qc,cs.layers=A0,cs.zoom=mh,cs.scale=Zc,cs.attribution=ph;var $n=be.extend({initialize:function(o){this._map=o},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});$n.addTo=function(o,h){return o.addHandler(h,this),this};var xh={Events:ae},Yc=ve.touch?"touchstart mousedown":"mousedown",Es=Z.extend({options:{clickTolerance:3},initialize:function(o,h,b,E){N(this,E),this._element=o,this._dragStartTarget=h||o,this._preventOutline=b},enable:function(){this._enabled||(Ut(this._dragStartTarget,Yc,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Es._dragging===this&&this.finishDrag(!0),xa(this._dragStartTarget,Yc,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(o){if(this._enabled&&(this._moved=!1,!Bc(this._element,"leaflet-zoom-anim"))){if(o.touches&&o.touches.length!==1){Es._dragging===this&&this.finishDrag();return}if(!(Es._dragging||o.shiftKey||o.which!==1&&o.button!==1&&!o.touches)&&(Es._dragging=this,this._preventOutline&&Si(this._element),yo(),Ni(),!this._moving)){this.fire("down");var h=o.touches?o.touches[0]:o,b=vo(this._element);this._startPoint=new K(h.clientX,h.clientY),this._startPos=Ss(this._element),this._parentScale=xl(b);var E=o.type==="mousedown";Ut(document,E?"mousemove":"touchmove",this._onMove,this),Ut(document,E?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(o){if(this._enabled){if(o.touches&&o.touches.length>1){this._moved=!0;return}var h=o.touches&&o.touches.length===1?o.touches[0]:o,b=new K(h.clientX,h.clientY)._subtract(this._startPoint);!b.x&&!b.y||Math.abs(b.x)+Math.abs(b.y)<this.options.clickTolerance||(b.x/=this._parentScale.x,b.y/=this._parentScale.y,Ga(o),this._moved||(this.fire("dragstart"),this._moved=!0,Gt(document.body,"leaflet-dragging"),this._lastTarget=o.target||o.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Gt(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(b),this._moving=!0,this._lastEvent=o,this._updatePosition())}},_updatePosition:function(){var o={originalEvent:this._lastEvent};this.fire("predrag",o),La(this._element,this._newPos),this.fire("drag",o)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(o){Ua(document.body,"leaflet-dragging"),this._lastTarget&&(Ua(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),xa(document,"mousemove touchmove",this._onMove,this),xa(document,"mouseup touchend touchcancel",this._onUp,this),pl(),Un();var h=this._moved&&this._moving;this._moving=!1,Es._dragging=!1,h&&this.fire("dragend",{noInertia:o,distance:this._newPos.distanceTo(this._startPos)})}});function M0(o,h,b){var E,M=[1,4,2,8],V,fe,Te,Pe,Ke,yt,Dt,Xt;for(V=0,yt=o.length;V<yt;V++)o[V]._code=Xs(o[V],h);for(Te=0;Te<4;Te++){for(Dt=M[Te],E=[],V=0,yt=o.length,fe=yt-1;V<yt;fe=V++)Pe=o[V],Ke=o[fe],Pe._code&Dt?Ke._code&Dt||(Xt=wo(Ke,Pe,Dt,h,b),Xt._code=Xs(Xt,h),E.push(Xt)):(Ke._code&Dt&&(Xt=wo(Ke,Pe,Dt,h,b),Xt._code=Xs(Xt,h),E.push(Xt)),E.push(Pe));o=E}return o}function L0(o,h){var b,E,M,V,fe,Te,Pe,Ke,yt;if(!o||o.length===0)throw new Error("latlngs not passed");an(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var Dt=de([0,0]),Xt=G(o),fr=Xt.getNorthWest().distanceTo(Xt.getSouthWest())*Xt.getNorthEast().distanceTo(Xt.getNorthWest());fr<1700&&(Dt=Xc(o));var Za=o.length,Zr=[];for(b=0;b<Za;b++){var oa=de(o[b]);Zr.push(h.project(de([oa.lat-Dt.lat,oa.lng-Dt.lng])))}for(Te=Pe=Ke=0,b=0,E=Za-1;b<Za;E=b++)M=Zr[b],V=Zr[E],fe=M.y*V.x-V.y*M.x,Pe+=(M.x+V.x)*fe,Ke+=(M.y+V.y)*fe,Te+=fe*3;Te===0?yt=Zr[0]:yt=[Pe/Te,Ke/Te];var ca=h.unproject(se(yt));return de([ca.lat+Dt.lat,ca.lng+Dt.lng])}function Xc(o){for(var h=0,b=0,E=0,M=0;M<o.length;M++){var V=de(o[M]);h+=V.lat,b+=V.lng,E++}return de([h/E,b/E])}var Jc={__proto__:null,clipPolygon:M0,polygonCenter:L0,centroid:Xc};function D0(o,h){if(!h||!o.length)return o.slice();var b=h*h;return o=bh(o,b),o=R0(o,b),o}function P0(o,h,b){return Math.sqrt(wl(o,h,b,!0))}function yh(o,h,b){return wl(o,h,b)}function R0(o,h){var b=o.length,E=typeof Uint8Array!="undefined"?Uint8Array:Array,M=new E(b);M[0]=M[b-1]=1,Kc(o,M,h,0,b-1);var V,fe=[];for(V=0;V<b;V++)M[V]&&fe.push(o[V]);return fe}function Kc(o,h,b,E,M){var V=0,fe,Te,Pe;for(Te=E+1;Te<=M-1;Te++)Pe=wl(o[Te],o[E],o[M],!0),Pe>V&&(fe=Te,V=Pe);V>b&&(h[fe]=1,Kc(o,h,b,E,fe),Kc(o,h,b,fe,M))}function bh(o,h){for(var b=[o[0]],E=1,M=0,V=o.length;E<V;E++)vh(o[E],o[M])>h&&(b.push(o[E]),M=E);return M<V-1&&b.push(o[V-1]),b}var F0;function I0(o,h,b,E,M){var V=E?F0:Xs(o,b),fe=Xs(h,b),Te,Pe,Ke;for(F0=fe;;){if(!(V|fe))return[o,h];if(V&fe)return!1;Te=V||fe,Pe=wo(o,h,Te,b,M),Ke=Xs(Pe,b),Te===V?(o=Pe,V=Ke):(h=Pe,fe=Ke)}}function wo(o,h,b,E,M){var V=h.x-o.x,fe=h.y-o.y,Te=E.min,Pe=E.max,Ke,yt;return b&8?(Ke=o.x+V*(Pe.y-o.y)/fe,yt=Pe.y):b&4?(Ke=o.x+V*(Te.y-o.y)/fe,yt=Te.y):b&2?(Ke=Pe.x,yt=o.y+fe*(Pe.x-o.x)/V):b&1&&(Ke=Te.x,yt=o.y+fe*(Te.x-o.x)/V),new K(Ke,yt,M)}function Xs(o,h){var b=0;return o.x<h.min.x?b|=1:o.x>h.max.x&&(b|=2),o.y<h.min.y?b|=4:o.y>h.max.y&&(b|=8),b}function vh(o,h){var b=h.x-o.x,E=h.y-o.y;return b*b+E*E}function wl(o,h,b,E){var M=h.x,V=h.y,fe=b.x-M,Te=b.y-V,Pe=fe*fe+Te*Te,Ke;return Pe>0&&(Ke=((o.x-M)*fe+(o.y-V)*Te)/Pe,Ke>1?(M=b.x,V=b.y):Ke>0&&(M+=fe*Ke,V+=Te*Ke)),fe=o.x-M,Te=o.y-V,E?fe*fe+Te*Te:new K(M,V)}function an(o){return!A(o[0])||typeof o[0][0]!="object"&&typeof o[0][0]!="undefined"}function ko(o){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),an(o)}function Ci(o,h){var b,E,M,V,fe,Te,Pe,Ke;if(!o||o.length===0)throw new Error("latlngs not passed");an(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var yt=de([0,0]),Dt=G(o),Xt=Dt.getNorthWest().distanceTo(Dt.getSouthWest())*Dt.getNorthEast().distanceTo(Dt.getNorthWest());Xt<1700&&(yt=Xc(o));var fr=o.length,Za=[];for(b=0;b<fr;b++){var Zr=de(o[b]);Za.push(h.project(de([Zr.lat-yt.lat,Zr.lng-yt.lng])))}for(b=0,E=0;b<fr-1;b++)E+=Za[b].distanceTo(Za[b+1])/2;if(E===0)Ke=Za[0];else for(b=0,V=0;b<fr-1;b++)if(fe=Za[b],Te=Za[b+1],M=fe.distanceTo(Te),V+=M,V>E){Pe=(V-E)/M,Ke=[Te.x-Pe*(Te.x-fe.x),Te.y-Pe*(Te.y-fe.y)];break}var oa=h.unproject(se(Ke));return de([oa.lat+yt.lat,oa.lng+yt.lng])}var _h={__proto__:null,simplify:D0,pointToSegmentDistance:P0,closestPointOnSegment:yh,clipSegment:I0,_getEdgeIntersection:wo,_getBitCode:Xs,_sqClosestPointOnSegment:wl,isFlat:an,_flat:ko,polylineCenter:Ci},No={project:function(o){return new K(o.lng,o.lat)},unproject:function(o){return new J(o.y,o.x)},bounds:new F([-180,-90],[180,90])},jo={R:6378137,R_MINOR:6356752314245179e-9,bounds:new F([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(o){var h=Math.PI/180,b=this.R,E=o.lat*h,M=this.R_MINOR/b,V=Math.sqrt(1-M*M),fe=V*Math.sin(E),Te=Math.tan(Math.PI/4-E/2)/Math.pow((1-fe)/(1+fe),V/2);return E=-b*Math.log(Math.max(Te,1e-10)),new K(o.lng*h*b,E)},unproject:function(o){for(var h=180/Math.PI,b=this.R,E=this.R_MINOR/b,M=Math.sqrt(1-E*E),V=Math.exp(-o.y/b),fe=Math.PI/2-2*Math.atan(V),Te=0,Pe=.1,Ke;Te<15&&Math.abs(Pe)>1e-7;Te++)Ke=M*Math.sin(fe),Ke=Math.pow((1-Ke)/(1+Ke),M/2),Pe=Math.PI/2-2*Math.atan(V*Ke)-fe,fe+=Pe;return new J(fe*h,o.x*h/b)}},z0={__proto__:null,LonLat:No,Mercator:jo,SphericalMercator:Ve},B0=i({},Ne,{code:"EPSG:3395",projection:jo,transformation:(function(){var o=.5/(Math.PI*jo.R);return gt(o,.5,-o,.5)})()}),Qc=i({},Ne,{code:"EPSG:4326",projection:No,transformation:gt(1/180,1,-1/180,.5)}),Ai=i({},De,{projection:No,transformation:gt(1,0,-1,0),scale:function(o){return Math.pow(2,o)},zoom:function(o){return Math.log(o)/Math.LN2},distance:function(o,h){var b=h.lng-o.lng,E=h.lat-o.lat;return Math.sqrt(b*b+E*E)},infinite:!0});De.Earth=Ne,De.EPSG3395=B0,De.EPSG3857=zt,De.EPSG900913=Ge,De.EPSG4326=Qc,De.Simple=Ai;var jn=Z.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(o){return o.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(o){return o&&o.removeLayer(this),this},getPane:function(o){return this._map.getPane(o?this.options[o]||o:this.options.pane)},addInteractiveTarget:function(o){return this._map._targets[g(o)]=this,this},removeInteractiveTarget:function(o){return delete this._map._targets[g(o)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(o){var h=o.target;if(h.hasLayer(this)){if(this._map=h,this._zoomAnimated=h._zoomAnimated,this.getEvents){var b=this.getEvents();h.on(b,this),this.once("remove",function(){h.off(b,this)},this)}this.onAdd(h),this.fire("add"),h.fire("layeradd",{layer:this})}}});ra.include({addLayer:function(o){if(!o._layerAdd)throw new Error("The provided object is not a Layer.");var h=g(o);return this._layers[h]?this:(this._layers[h]=o,o._mapToAdd=this,o.beforeAdd&&o.beforeAdd(this),this.whenReady(o._layerAdd,o),this)},removeLayer:function(o){var h=g(o);return this._layers[h]?(this._loaded&&o.onRemove(this),delete this._layers[h],this._loaded&&(this.fire("layerremove",{layer:o}),o.fire("remove")),o._map=o._mapToAdd=null,this):this},hasLayer:function(o){return g(o)in this._layers},eachLayer:function(o,h){for(var b in this._layers)o.call(h,this._layers[b]);return this},_addLayers:function(o){o=o?A(o)?o:[o]:[];for(var h=0,b=o.length;h<b;h++)this.addLayer(o[h])},_addZoomLimit:function(o){(!isNaN(o.options.maxZoom)||!isNaN(o.options.minZoom))&&(this._zoomBoundLayers[g(o)]=o,this._updateZoomLevels())},_removeZoomLimit:function(o){var h=g(o);this._zoomBoundLayers[h]&&(delete this._zoomBoundLayers[h],this._updateZoomLevels())},_updateZoomLevels:function(){var o=1/0,h=-1/0,b=this._getZoomSpan();for(var E in this._zoomBoundLayers){var M=this._zoomBoundLayers[E].options;o=M.minZoom===void 0?o:Math.min(o,M.minZoom),h=M.maxZoom===void 0?h:Math.max(h,M.maxZoom)}this._layersMaxZoom=h===-1/0?void 0:h,this._layersMinZoom=o===1/0?void 0:o,b!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Oi=jn.extend({initialize:function(o,h){N(this,h),this._layers={};var b,E;if(o)for(b=0,E=o.length;b<E;b++)this.addLayer(o[b])},addLayer:function(o){var h=this.getLayerId(o);return this._layers[h]=o,this._map&&this._map.addLayer(o),this},removeLayer:function(o){var h=o in this._layers?o:this.getLayerId(o);return this._map&&this._layers[h]&&this._map.removeLayer(this._layers[h]),delete this._layers[h],this},hasLayer:function(o){var h=typeof o=="number"?o:this.getLayerId(o);return h in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(o){var h=Array.prototype.slice.call(arguments,1),b,E;for(b in this._layers)E=this._layers[b],E[o]&&E[o].apply(E,h);return this},onAdd:function(o){this.eachLayer(o.addLayer,o)},onRemove:function(o){this.eachLayer(o.removeLayer,o)},eachLayer:function(o,h){for(var b in this._layers)o.call(h,this._layers[b]);return this},getLayer:function(o){return this._layers[o]},getLayers:function(){var o=[];return this.eachLayer(o.push,o),o},setZIndex:function(o){return this.invoke("setZIndex",o)},getLayerId:function(o){return g(o)}}),wh=function(o,h){return new Oi(o,h)},Wn=Oi.extend({addLayer:function(o){return this.hasLayer(o)?this:(o.addEventParent(this),Oi.prototype.addLayer.call(this,o),this.fire("layeradd",{layer:o}))},removeLayer:function(o){return this.hasLayer(o)?(o in this._layers&&(o=this._layers[o]),o.removeEventParent(this),Oi.prototype.removeLayer.call(this,o),this.fire("layerremove",{layer:o})):this},setStyle:function(o){return this.invoke("setStyle",o)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var o=new W;for(var h in this._layers){var b=this._layers[h];o.extend(b.getBounds?b.getBounds():b.getLatLng())}return o}}),U0=function(o,h){return new Wn(o,h)},Vn=be.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(o){N(this,o)},createIcon:function(o){return this._createIcon("icon",o)},createShadow:function(o){return this._createIcon("shadow",o)},_createIcon:function(o,h){var b=this._getIconUrl(o);if(!b){if(o==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var E=this._createImg(b,h&&h.tagName==="IMG"?h:null);return this._setIconStyles(E,o),(this.options.crossOrigin||this.options.crossOrigin==="")&&(E.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),E},_setIconStyles:function(o,h){var b=this.options,E=b[h+"Size"];typeof E=="number"&&(E=[E,E]);var M=se(E),V=se(h==="shadow"&&b.shadowAnchor||b.iconAnchor||M&&M.divideBy(2,!0));o.className="leaflet-marker-"+h+" "+(b.className||""),V&&(o.style.marginLeft=-V.x+"px",o.style.marginTop=-V.y+"px"),M&&(o.style.width=M.x+"px",o.style.height=M.y+"px")},_createImg:function(o,h){return h=h||document.createElement("img"),h.src=o,h},_getIconUrl:function(o){return ve.retina&&this.options[o+"RetinaUrl"]||this.options[o+"Url"]}});function kl(o){return new Vn(o)}var Nl=Vn.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(o){return typeof Nl.imagePath!="string"&&(Nl.imagePath=this._detectIconPath()),(this.options.imagePath||Nl.imagePath)+Vn.prototype._getIconUrl.call(this,o)},_stripUrl:function(o){var h=function(b,E,M){var V=E.exec(b);return V&&V[M]};return o=h(o,/^url\((['"])?(.+)\1\)$/,2),o&&h(o,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var o=Ht("div","leaflet-default-icon-path",document.body),h=is(o,"background-image")||is(o,"backgroundImage");if(document.body.removeChild(o),h=this._stripUrl(h),h)return h;var b=document.querySelector('link[href$="leaflet.css"]');return b?b.href.substring(0,b.href.length-11-1):""}}),jl=$n.extend({initialize:function(o){this._marker=o},addHooks:function(){var o=this._marker._icon;this._draggable||(this._draggable=new Es(o,o,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Gt(o,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&Ua(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(o){var h=this._marker,b=h._map,E=this._marker.options.autoPanSpeed,M=this._marker.options.autoPanPadding,V=Ss(h._icon),fe=b.getPixelBounds(),Te=b.getPixelOrigin(),Pe=D(fe.min._subtract(Te).add(M),fe.max._subtract(Te).subtract(M));if(!Pe.contains(V)){var Ke=se((Math.max(Pe.max.x,V.x)-Pe.max.x)/(fe.max.x-Pe.max.x)-(Math.min(Pe.min.x,V.x)-Pe.min.x)/(fe.min.x-Pe.min.x),(Math.max(Pe.max.y,V.y)-Pe.max.y)/(fe.max.y-Pe.max.y)-(Math.min(Pe.min.y,V.y)-Pe.min.y)/(fe.min.y-Pe.min.y)).multiplyBy(E);b.panBy(Ke,{animate:!1}),this._draggable._newPos._add(Ke),this._draggable._startPos._add(Ke),La(h._icon,this._draggable._newPos),this._onDrag(o),this._panRequest=xe(this._adjustPan.bind(this,o))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(o){this._marker.options.autoPan&&(le(this._panRequest),this._panRequest=xe(this._adjustPan.bind(this,o)))},_onDrag:function(o){var h=this._marker,b=h._shadow,E=Ss(h._icon),M=h._map.layerPointToLatLng(E);b&&La(b,E),h._latlng=M,o.latlng=M,o.oldLatLng=this._oldLatLng,h.fire("move",o).fire("drag",o)},_onDragEnd:function(o){le(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",o)}}),Sl=jn.extend({options:{icon:new Nl,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(o,h){N(this,h),this._latlng=de(o)},onAdd:function(o){this._zoomAnimated=this._zoomAnimated&&o.options.markerZoomAnimation,this._zoomAnimated&&o.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(o){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&o.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(o){var h=this._latlng;return this._latlng=de(o),this.update(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},setZIndexOffset:function(o){return this.options.zIndexOffset=o,this.update()},getIcon:function(){return this.options.icon},setIcon:function(o){return this.options.icon=o,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var o=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(o)}return this},_initIcon:function(){var o=this.options,h="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),b=o.icon.createIcon(this._icon),E=!1;b!==this._icon&&(this._icon&&this._removeIcon(),E=!0,o.title&&(b.title=o.title),b.tagName==="IMG"&&(b.alt=o.alt||"")),Gt(b,h),o.keyboard&&(b.tabIndex="0",b.setAttribute("role","button")),this._icon=b,o.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Ut(b,"focus",this._panOnFocus,this);var M=o.icon.createShadow(this._shadow),V=!1;M!==this._shadow&&(this._removeShadow(),V=!0),M&&(Gt(M,h),M.alt=""),this._shadow=M,o.opacity<1&&this._updateOpacity(),E&&this.getPane().appendChild(this._icon),this._initInteraction(),M&&V&&this.getPane(o.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&xa(this._icon,"focus",this._panOnFocus,this),Ta(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&Ta(this._shadow),this._shadow=null},_setPos:function(o){this._icon&&La(this._icon,o),this._shadow&&La(this._shadow,o),this._zIndex=o.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(o){this._icon&&(this._icon.style.zIndex=this._zIndex+o)},_animateZoom:function(o){var h=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center).round();this._setPos(h)},_initInteraction:function(){if(this.options.interactive&&(Gt(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),jl)){var o=this.options.draggable;this.dragging&&(o=this.dragging.enabled(),this.dragging.disable()),this.dragging=new jl(this),o&&this.dragging.enable()}},setOpacity:function(o){return this.options.opacity=o,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var o=this.options.opacity;this._icon&&Ia(this._icon,o),this._shadow&&Ia(this._shadow,o)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var o=this._map;if(o){var h=this.options.icon.options,b=h.iconSize?se(h.iconSize):se(0,0),E=h.iconAnchor?se(h.iconAnchor):se(0,0);o.panInside(this._latlng,{paddingTopLeft:E,paddingBottomRight:b.subtract(E)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function H0(o,h){return new Sl(o,h)}var Gn=jn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(o){this._renderer=o.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(o){return N(this,o),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&o&&Object.prototype.hasOwnProperty.call(o,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),Mi=Gn.extend({options:{fill:!0,radius:10},initialize:function(o,h){N(this,h),this._latlng=de(o),this._radius=this.options.radius},setLatLng:function(o){var h=this._latlng;return this._latlng=de(o),this.redraw(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(o){return this.options.radius=this._radius=o,this.redraw()},getRadius:function(){return this._radius},setStyle:function(o){var h=o&&o.radius||this._radius;return Gn.prototype.setStyle.call(this,o),this.setRadius(h),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var o=this._radius,h=this._radiusY||o,b=this._clickTolerance(),E=[o+b,h+b];this._pxBounds=new F(this._point.subtract(E),this._point.add(E))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(o){return o.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function $0(o,h){return new Mi(o,h)}var So=Mi.extend({initialize:function(o,h,b){if(typeof h=="number"&&(h=i({},b,{radius:h})),N(this,h),this._latlng=de(o),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(o){return this._mRadius=o,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var o=[this._radius,this._radiusY||this._radius];return new W(this._map.layerPointToLatLng(this._point.subtract(o)),this._map.layerPointToLatLng(this._point.add(o)))},setStyle:Gn.prototype.setStyle,_project:function(){var o=this._latlng.lng,h=this._latlng.lat,b=this._map,E=b.options.crs;if(E.distance===Ne.distance){var M=Math.PI/180,V=this._mRadius/Ne.R/M,fe=b.project([h+V,o]),Te=b.project([h-V,o]),Pe=fe.add(Te).divideBy(2),Ke=b.unproject(Pe).lat,yt=Math.acos((Math.cos(V*M)-Math.sin(h*M)*Math.sin(Ke*M))/(Math.cos(h*M)*Math.cos(Ke*M)))/M;(isNaN(yt)||yt===0)&&(yt=V/Math.cos(Math.PI/180*h)),this._point=Pe.subtract(b.getPixelOrigin()),this._radius=isNaN(yt)?0:Pe.x-b.project([Ke,o-yt]).x,this._radiusY=Pe.y-fe.y}else{var Dt=E.unproject(E.project(this._latlng).subtract([this._mRadius,0]));this._point=b.latLngToLayerPoint(this._latlng),this._radius=this._point.x-b.latLngToLayerPoint(Dt).x}this._updateBounds()}});function W0(o,h,b){return new So(o,h,b)}var ds=Gn.extend({options:{smoothFactor:1,noClip:!1},initialize:function(o,h){N(this,h),this._setLatLngs(o)},getLatLngs:function(){return this._latlngs},setLatLngs:function(o){return this._setLatLngs(o),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(o){for(var h=1/0,b=null,E=wl,M,V,fe=0,Te=this._parts.length;fe<Te;fe++)for(var Pe=this._parts[fe],Ke=1,yt=Pe.length;Ke<yt;Ke++){M=Pe[Ke-1],V=Pe[Ke];var Dt=E(o,M,V,!0);Dt<h&&(h=Dt,b=E(o,M,V))}return b&&(b.distance=Math.sqrt(h)),b},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Ci(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(o,h){return h=h||this._defaultShape(),o=de(o),h.push(o),this._bounds.extend(o),this.redraw()},_setLatLngs:function(o){this._bounds=new W,this._latlngs=this._convertLatLngs(o)},_defaultShape:function(){return an(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(o){for(var h=[],b=an(o),E=0,M=o.length;E<M;E++)b?(h[E]=de(o[E]),this._bounds.extend(h[E])):h[E]=this._convertLatLngs(o[E]);return h},_project:function(){var o=new F;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,o),this._bounds.isValid()&&o.isValid()&&(this._rawPxBounds=o,this._updateBounds())},_updateBounds:function(){var o=this._clickTolerance(),h=new K(o,o);this._rawPxBounds&&(this._pxBounds=new F([this._rawPxBounds.min.subtract(h),this._rawPxBounds.max.add(h)]))},_projectLatlngs:function(o,h,b){var E=o[0]instanceof J,M=o.length,V,fe;if(E){for(fe=[],V=0;V<M;V++)fe[V]=this._map.latLngToLayerPoint(o[V]),b.extend(fe[V]);h.push(fe)}else for(V=0;V<M;V++)this._projectLatlngs(o[V],h,b)},_clipPoints:function(){var o=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(o))){if(this.options.noClip){this._parts=this._rings;return}var h=this._parts,b,E,M,V,fe,Te,Pe;for(b=0,M=0,V=this._rings.length;b<V;b++)for(Pe=this._rings[b],E=0,fe=Pe.length;E<fe-1;E++)Te=I0(Pe[E],Pe[E+1],o,E,!0),Te&&(h[M]=h[M]||[],h[M].push(Te[0]),(Te[1]!==Pe[E+1]||E===fe-2)&&(h[M].push(Te[1]),M++))}},_simplifyPoints:function(){for(var o=this._parts,h=this.options.smoothFactor,b=0,E=o.length;b<E;b++)o[b]=D0(o[b],h)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(o,h){var b,E,M,V,fe,Te,Pe=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(b=0,V=this._parts.length;b<V;b++)for(Te=this._parts[b],E=0,fe=Te.length,M=fe-1;E<fe;M=E++)if(!(!h&&E===0)&&P0(o,Te[M],Te[E])<=Pe)return!0;return!1}});function kh(o,h){return new ds(o,h)}ds._flat=ko;var Li=ds.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return L0(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(o){var h=ds.prototype._convertLatLngs.call(this,o),b=h.length;return b>=2&&h[0]instanceof J&&h[0].equals(h[b-1])&&h.pop(),h},_setLatLngs:function(o){ds.prototype._setLatLngs.call(this,o),an(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return an(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var o=this._renderer._bounds,h=this.options.weight,b=new K(h,h);if(o=new F(o.min.subtract(b),o.max.add(b)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(o))){if(this.options.noClip){this._parts=this._rings;return}for(var E=0,M=this._rings.length,V;E<M;E++)V=M0(this._rings[E],o,!0),V.length&&this._parts.push(V)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(o){var h=!1,b,E,M,V,fe,Te,Pe,Ke;if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(V=0,Pe=this._parts.length;V<Pe;V++)for(b=this._parts[V],fe=0,Ke=b.length,Te=Ke-1;fe<Ke;Te=fe++)E=b[fe],M=b[Te],E.y>o.y!=M.y>o.y&&o.x<(M.x-E.x)*(o.y-E.y)/(M.y-E.y)+E.x&&(h=!h);return h||ds.prototype._containsPoint.call(this,o,!0)}});function Nh(o,h){return new Li(o,h)}var us=Wn.extend({initialize:function(o,h){N(this,h),this._layers={},o&&this.addData(o)},addData:function(o){var h=A(o)?o:o.features,b,E,M;if(h){for(b=0,E=h.length;b<E;b++)M=h[b],(M.geometries||M.geometry||M.features||M.coordinates)&&this.addData(M);return this}var V=this.options;if(V.filter&&!V.filter(o))return this;var fe=gr(o,V);return fe?(fe.feature=Co(o),fe.defaultOptions=fe.options,this.resetStyle(fe),V.onEachFeature&&V.onEachFeature(o,fe),this.addLayer(fe)):this},resetStyle:function(o){return o===void 0?this.eachLayer(this.resetStyle,this):(o.options=i({},o.defaultOptions),this._setLayerStyle(o,this.options.style),this)},setStyle:function(o){return this.eachLayer(function(h){this._setLayerStyle(h,o)},this)},_setLayerStyle:function(o,h){o.setStyle&&(typeof h=="function"&&(h=h(o.feature)),o.setStyle(h))}});function gr(o,h){var b=o.type==="Feature"?o.geometry:o,E=b?b.coordinates:null,M=[],V=h&&h.pointToLayer,fe=h&&h.coordsToLatLng||To,Te,Pe,Ke,yt;if(!E&&!b)return null;switch(b.type){case"Point":return Te=fe(E),Di(V,o,Te,h);case"MultiPoint":for(Ke=0,yt=E.length;Ke<yt;Ke++)Te=fe(E[Ke]),M.push(Di(V,o,Te,h));return new Wn(M);case"LineString":case"MultiLineString":return Pe=Tl(E,b.type==="LineString"?0:1,fe),new ds(Pe,h);case"Polygon":case"MultiPolygon":return Pe=Tl(E,b.type==="Polygon"?1:2,fe),new Li(Pe,h);case"GeometryCollection":for(Ke=0,yt=b.geometries.length;Ke<yt;Ke++){var Dt=gr({geometry:b.geometries[Ke],type:"Feature",properties:o.properties},h);Dt&&M.push(Dt)}return new Wn(M);case"FeatureCollection":for(Ke=0,yt=b.features.length;Ke<yt;Ke++){var Xt=gr(b.features[Ke],h);Xt&&M.push(Xt)}return new Wn(M);default:throw new Error("Invalid GeoJSON object.")}}function Di(o,h,b,E){return o?o(h,b):new Sl(b,E&&E.markersInheritOptions&&E)}function To(o){return new J(o[1],o[0],o[2])}function Tl(o,h,b){for(var E=[],M=0,V=o.length,fe;M<V;M++)fe=h?Tl(o[M],h-1,b):(b||To)(o[M]),E.push(fe);return E}function Eo(o,h){return o=de(o),o.alt!==void 0?[_(o.lng,h),_(o.lat,h),_(o.alt,h)]:[_(o.lng,h),_(o.lat,h)]}function El(o,h,b,E){for(var M=[],V=0,fe=o.length;V<fe;V++)M.push(h?El(o[V],an(o[V])?0:h-1,b,E):Eo(o[V],E));return!h&&b&&M.length>0&&M.push(M[0].slice()),M}function Cs(o,h){return o.feature?i({},o.feature,{geometry:h}):Co(h)}function Co(o){return o.type==="Feature"||o.type==="FeatureCollection"?o:{type:"Feature",properties:{},geometry:o}}var As={toGeoJSON:function(o){return Cs(this,{type:"Point",coordinates:Eo(this.getLatLng(),o)})}};Sl.include(As),So.include(As),Mi.include(As),ds.include({toGeoJSON:function(o){var h=!an(this._latlngs),b=El(this._latlngs,h?1:0,!1,o);return Cs(this,{type:(h?"Multi":"")+"LineString",coordinates:b})}}),Li.include({toGeoJSON:function(o){var h=!an(this._latlngs),b=h&&!an(this._latlngs[0]),E=El(this._latlngs,b?2:h?1:0,!0,o);return h||(E=[E]),Cs(this,{type:(b?"Multi":"")+"Polygon",coordinates:E})}}),Oi.include({toMultiPoint:function(o){var h=[];return this.eachLayer(function(b){h.push(b.toGeoJSON(o).geometry.coordinates)}),Cs(this,{type:"MultiPoint",coordinates:h})},toGeoJSON:function(o){var h=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(h==="MultiPoint")return this.toMultiPoint(o);var b=h==="GeometryCollection",E=[];return this.eachLayer(function(M){if(M.toGeoJSON){var V=M.toGeoJSON(o);if(b)E.push(V.geometry);else{var fe=Co(V);fe.type==="FeatureCollection"?E.push.apply(E,fe.features):E.push(fe)}}}),b?Cs(this,{geometries:E,type:"GeometryCollection"}):{type:"FeatureCollection",features:E}}});function Ao(o,h){return new us(o,h)}var Cl=Ao,Pi=jn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(o,h,b){this._url=o,this._bounds=G(h),N(this,b)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Gt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Ta(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(o){return this.options.opacity=o,this._image&&this._updateOpacity(),this},setStyle:function(o){return o.opacity&&this.setOpacity(o.opacity),this},bringToFront:function(){return this._map&&ur(this._image),this},bringToBack:function(){return this._map&&Zs(this._image),this},setUrl:function(o){return this._url=o,this._image&&(this._image.src=o),this},setBounds:function(o){return this._bounds=G(o),this._map&&this._reset(),this},getEvents:function(){var o={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},setZIndex:function(o){return this.options.zIndex=o,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var o=this._url.tagName==="IMG",h=this._image=o?this._url:Ht("img");if(Gt(h,"leaflet-image-layer"),this._zoomAnimated&&Gt(h,"leaflet-zoom-animated"),this.options.className&&Gt(h,this.options.className),h.onselectstart=y,h.onmousemove=y,h.onload=c(this.fire,this,"load"),h.onerror=c(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(h.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),o){this._url=h.src;return}h.src=this._url,h.alt=this.options.alt},_animateZoom:function(o){var h=this._map.getZoomScale(o.zoom),b=this._map._latLngBoundsToNewLayerBounds(this._bounds,o.zoom,o.center).min;ls(this._image,b,h)},_reset:function(){var o=this._image,h=new F(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),b=h.getSize();La(o,h.min),o.style.width=b.x+"px",o.style.height=b.y+"px"},_updateOpacity:function(){Ia(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var o=this.options.errorOverlayUrl;o&&this._url!==o&&(this._url=o,this._image.src=o)},getCenter:function(){return this._bounds.getCenter()}}),V0=function(o,h,b){return new Pi(o,h,b)},Os=Pi.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var o=this._url.tagName==="VIDEO",h=this._image=o?this._url:Ht("video");if(Gt(h,"leaflet-image-layer"),this._zoomAnimated&&Gt(h,"leaflet-zoom-animated"),this.options.className&&Gt(h,this.options.className),h.onselectstart=y,h.onmousemove=y,h.onloadeddata=c(this.fire,this,"load"),o){for(var b=h.getElementsByTagName("source"),E=[],M=0;M<b.length;M++)E.push(b[M].src);this._url=b.length>0?E:[h.src];return}A(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(h.style,"objectFit")&&(h.style.objectFit="fill"),h.autoplay=!!this.options.autoplay,h.loop=!!this.options.loop,h.muted=!!this.options.muted,h.playsInline=!!this.options.playsInline;for(var V=0;V<this._url.length;V++){var fe=Ht("source");fe.src=this._url[V],h.appendChild(fe)}}});function Ri(o,h,b){return new Os(o,h,b)}var Oo=Pi.extend({_initImage:function(){var o=this._image=this._url;Gt(o,"leaflet-image-layer"),this._zoomAnimated&&Gt(o,"leaflet-zoom-animated"),this.options.className&&Gt(o,this.options.className),o.onselectstart=y,o.onmousemove=y}});function G0(o,h,b){return new Oo(o,h,b)}var pr=jn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(o,h){o&&(o instanceof J||A(o))?(this._latlng=de(o),N(this,h)):(N(this,o),this._source=h),this.options.content&&(this._content=this.options.content)},openOn:function(o){return o=arguments.length?o:this._source._map,o.hasLayer(this)||o.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(o){return this._map?this.close():(arguments.length?this._source=o:o=this._source,this._prepareOpen(),this.openOn(o._map)),this},onAdd:function(o){this._zoomAnimated=o._zoomAnimated,this._container||this._initLayout(),o._fadeAnimated&&Ia(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),o._fadeAnimated&&Ia(this._container,1),this.bringToFront(),this.options.interactive&&(Gt(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(o){o._fadeAnimated?(Ia(this._container,0),this._removeTimeout=setTimeout(c(Ta,void 0,this._container),200)):Ta(this._container),this.options.interactive&&(Ua(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(o){return this._latlng=de(o),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(o){return this._content=o,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var o={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&ur(this._container),this},bringToBack:function(){return this._map&&Zs(this._container),this},_prepareOpen:function(o){var h=this._source;if(!h._map)return!1;if(h instanceof Wn){h=null;var b=this._source._layers;for(var E in b)if(b[E]._map){h=b[E];break}if(!h)return!1;this._source=h}if(!o)if(h.getCenter)o=h.getCenter();else if(h.getLatLng)o=h.getLatLng();else if(h.getBounds)o=h.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(o),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var o=this._contentNode,h=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof h=="string")o.innerHTML=h;else{for(;o.hasChildNodes();)o.removeChild(o.firstChild);o.appendChild(h)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var o=this._map.latLngToLayerPoint(this._latlng),h=se(this.options.offset),b=this._getAnchor();this._zoomAnimated?La(this._container,o.add(b)):h=h.add(o).add(b);var E=this._containerBottom=-h.y,M=this._containerLeft=-Math.round(this._containerWidth/2)+h.x;this._container.style.bottom=E+"px",this._container.style.left=M+"px"}},_getAnchor:function(){return[0,0]}});ra.include({_initOverlay:function(o,h,b,E){var M=h;return M instanceof o||(M=new o(E).setContent(h)),b&&M.setLatLng(b),M}}),jn.include({_initOverlay:function(o,h,b,E){var M=b;return M instanceof o?(N(M,E),M._source=this):(M=h&&!E?h:new o(E,this),M.setContent(b)),M}});var Al=pr.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(o){return o=arguments.length?o:this._source._map,!o.hasLayer(this)&&o._popup&&o._popup.options.autoClose&&o.removeLayer(o._popup),o._popup=this,pr.prototype.openOn.call(this,o)},onAdd:function(o){pr.prototype.onAdd.call(this,o),o.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Gn||this._source.on("preclick",Nn))},onRemove:function(o){pr.prototype.onRemove.call(this,o),o.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Gn||this._source.off("preclick",Nn))},getEvents:function(){var o=pr.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(o.preclick=this.close),this.options.keepInView&&(o.moveend=this._adjustPan),o},_initLayout:function(){var o="leaflet-popup",h=this._container=Ht("div",o+" "+(this.options.className||"")+" leaflet-zoom-animated"),b=this._wrapper=Ht("div",o+"-content-wrapper",h);if(this._contentNode=Ht("div",o+"-content",b),Ys(h),Hn(this._contentNode),Ut(h,"contextmenu",Nn),this._tipContainer=Ht("div",o+"-tip-container",h),this._tip=Ht("div",o+"-tip",this._tipContainer),this.options.closeButton){var E=this._closeButton=Ht("a",o+"-close-button",h);E.setAttribute("role","button"),E.setAttribute("aria-label","Close popup"),E.href="#close",E.innerHTML='<span aria-hidden="true">×</span>',Ut(E,"click",function(M){Ga(M),this.close()},this)}},_updateLayout:function(){var o=this._contentNode,h=o.style;h.width="",h.whiteSpace="nowrap";var b=o.offsetWidth;b=Math.min(b,this.options.maxWidth),b=Math.max(b,this.options.minWidth),h.width=b+1+"px",h.whiteSpace="",h.height="";var E=o.offsetHeight,M=this.options.maxHeight,V="leaflet-popup-scrolled";M&&E>M?(h.height=M+"px",Gt(o,V)):Ua(o,V),this._containerWidth=this._container.offsetWidth},_animateZoom:function(o){var h=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center),b=this._getAnchor();La(this._container,h.add(b))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var o=this._map,h=parseInt(is(this._container,"marginBottom"),10)||0,b=this._container.offsetHeight+h,E=this._containerWidth,M=new K(this._containerLeft,-b-this._containerBottom);M._add(Ss(this._container));var V=o.layerPointToContainerPoint(M),fe=se(this.options.autoPanPadding),Te=se(this.options.autoPanPaddingTopLeft||fe),Pe=se(this.options.autoPanPaddingBottomRight||fe),Ke=o.getSize(),yt=0,Dt=0;V.x+E+Pe.x>Ke.x&&(yt=V.x+E-Ke.x+Pe.x),V.x-yt-Te.x<0&&(yt=V.x-Te.x),V.y+b+Pe.y>Ke.y&&(Dt=V.y+b-Ke.y+Pe.y),V.y-Dt-Te.y<0&&(Dt=V.y-Te.y),(yt||Dt)&&(this.options.keepInView&&(this._autopanning=!0),o.fire("autopanstart").panBy([yt,Dt]))}},_getAnchor:function(){return se(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Z0=function(o,h){return new Al(o,h)};ra.mergeOptions({closePopupOnClick:!0}),ra.include({openPopup:function(o,h,b){return this._initOverlay(Al,o,h,b).openOn(this),this},closePopup:function(o){return o=arguments.length?o:this._popup,o&&o.close(),this}}),jn.include({bindPopup:function(o,h){return this._popup=this._initOverlay(Al,this._popup,o,h),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(o){return this._popup&&(this instanceof Wn||(this._popup._source=this),this._popup._prepareOpen(o||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(o){return this._popup&&this._popup.setContent(o),this},getPopup:function(){return this._popup},_openPopup:function(o){if(!(!this._popup||!this._map)){Ts(o);var h=o.layer||o.target;if(this._popup._source===h&&!(h instanceof Gn)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(o.latlng);return}this._popup._source=h,this.openPopup(o.latlng)}},_movePopup:function(o){this._popup.setLatLng(o.latlng)},_onKeyPress:function(o){o.originalEvent.keyCode===13&&this._openPopup(o)}});var Ol=pr.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(o){pr.prototype.onAdd.call(this,o),this.setOpacity(this.options.opacity),o.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(o){pr.prototype.onRemove.call(this,o),o.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var o=pr.prototype.getEvents.call(this);return this.options.permanent||(o.preclick=this.close),o},_initLayout:function(){var o="leaflet-tooltip",h=o+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Ht("div",h),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+g(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(o){var h,b,E=this._map,M=this._container,V=E.latLngToContainerPoint(E.getCenter()),fe=E.layerPointToContainerPoint(o),Te=this.options.direction,Pe=M.offsetWidth,Ke=M.offsetHeight,yt=se(this.options.offset),Dt=this._getAnchor();Te==="top"?(h=Pe/2,b=Ke):Te==="bottom"?(h=Pe/2,b=0):Te==="center"?(h=Pe/2,b=Ke/2):Te==="right"?(h=0,b=Ke/2):Te==="left"?(h=Pe,b=Ke/2):fe.x<V.x?(Te="right",h=0,b=Ke/2):(Te="left",h=Pe+(yt.x+Dt.x)*2,b=Ke/2),o=o.subtract(se(h,b,!0)).add(yt).add(Dt),Ua(M,"leaflet-tooltip-right"),Ua(M,"leaflet-tooltip-left"),Ua(M,"leaflet-tooltip-top"),Ua(M,"leaflet-tooltip-bottom"),Gt(M,"leaflet-tooltip-"+Te),La(M,o)},_updatePosition:function(){var o=this._map.latLngToLayerPoint(this._latlng);this._setPosition(o)},setOpacity:function(o){this.options.opacity=o,this._container&&Ia(this._container,o)},_animateZoom:function(o){var h=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center);this._setPosition(h)},_getAnchor:function(){return se(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),jh=function(o,h){return new Ol(o,h)};ra.include({openTooltip:function(o,h,b){return this._initOverlay(Ol,o,h,b).openOn(this),this},closeTooltip:function(o){return o.close(),this}}),jn.include({bindTooltip:function(o,h){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Ol,this._tooltip,o,h),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(o){if(!(!o&&this._tooltipHandlersAdded)){var h=o?"off":"on",b={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?b.add=this._openTooltip:(b.mouseover=this._openTooltip,b.mouseout=this.closeTooltip,b.click=this._openTooltip,this._map?this._addFocusListeners():b.add=this._addFocusListeners),this._tooltip.options.sticky&&(b.mousemove=this._moveTooltip),this[h](b),this._tooltipHandlersAdded=!o}},openTooltip:function(o){return this._tooltip&&(this instanceof Wn||(this._tooltip._source=this),this._tooltip._prepareOpen(o)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(o){return this._tooltip&&this._tooltip.setContent(o),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(o){var h=typeof o.getElement=="function"&&o.getElement();h&&(Ut(h,"focus",function(){this._tooltip._source=o,this.openTooltip()},this),Ut(h,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(o){var h=typeof o.getElement=="function"&&o.getElement();h&&h.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(o){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var h=this;this._map.once("moveend",function(){h._openOnceFlag=!1,h._openTooltip(o)});return}this._tooltip._source=o.layer||o.target,this.openTooltip(this._tooltip.options.sticky?o.latlng:void 0)}},_moveTooltip:function(o){var h=o.latlng,b,E;this._tooltip.options.sticky&&o.originalEvent&&(b=this._map.mouseEventToContainerPoint(o.originalEvent),E=this._map.containerPointToLayerPoint(b),h=this._map.layerPointToLatLng(E)),this._tooltip.setLatLng(h)}});var q0=Vn.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(o){var h=o&&o.tagName==="DIV"?o:document.createElement("div"),b=this.options;if(b.html instanceof Element?(en(h),h.appendChild(b.html)):h.innerHTML=b.html!==!1?b.html:"",b.bgPos){var E=se(b.bgPos);h.style.backgroundPosition=-E.x+"px "+-E.y+"px"}return this._setIconStyles(h,"icon"),h},createShadow:function(){return null}});function Sh(o){return new q0(o)}Vn.Default=Nl;var Fi=jn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:ve.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(o){N(this,o)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(o){o._addZoomLimit(this)},onRemove:function(o){this._removeAllTiles(),Ta(this._container),o._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(ur(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Zs(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(o){return this.options.opacity=o,this._updateOpacity(),this},setZIndex:function(o){return this.options.zIndex=o,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var o=this._clampZoom(this._map.getZoom());o!==this._tileZoom&&(this._tileZoom=o,this._updateLevels()),this._update()}return this},getEvents:function(){var o={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=p(this._onMoveEnd,this.options.updateInterval,this)),o.move=this._onMove),this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},createTile:function(){return document.createElement("div")},getTileSize:function(){var o=this.options.tileSize;return o instanceof K?o:new K(o,o)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(o){for(var h=this.getPane().children,b=-o(-1/0,1/0),E=0,M=h.length,V;E<M;E++)V=h[E].style.zIndex,h[E]!==this._container&&V&&(b=o(b,+V));isFinite(b)&&(this.options.zIndex=b+o(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!ve.ielt9){Ia(this._container,this.options.opacity);var o=+new Date,h=!1,b=!1;for(var E in this._tiles){var M=this._tiles[E];if(!(!M.current||!M.loaded)){var V=Math.min(1,(o-M.loaded)/200);Ia(M.el,V),V<1?h=!0:(M.active?b=!0:this._onOpaqueTile(M),M.active=!0)}}b&&!this._noPrune&&this._pruneTiles(),h&&(le(this._fadeFrame),this._fadeFrame=xe(this._updateOpacity,this))}},_onOpaqueTile:y,_initContainer:function(){this._container||(this._container=Ht("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var o=this._tileZoom,h=this.options.maxZoom;if(o!==void 0){for(var b in this._levels)b=Number(b),this._levels[b].el.children.length||b===o?(this._levels[b].el.style.zIndex=h-Math.abs(o-b),this._onUpdateLevel(b)):(Ta(this._levels[b].el),this._removeTilesAtZoom(b),this._onRemoveLevel(b),delete this._levels[b]);var E=this._levels[o],M=this._map;return E||(E=this._levels[o]={},E.el=Ht("div","leaflet-tile-container leaflet-zoom-animated",this._container),E.el.style.zIndex=h,E.origin=M.project(M.unproject(M.getPixelOrigin()),o).round(),E.zoom=o,this._setZoomTransform(E,M.getCenter(),M.getZoom()),y(E.el.offsetWidth),this._onCreateLevel(E)),this._level=E,E}},_onUpdateLevel:y,_onRemoveLevel:y,_onCreateLevel:y,_pruneTiles:function(){if(this._map){var o,h,b=this._map.getZoom();if(b>this.options.maxZoom||b<this.options.minZoom){this._removeAllTiles();return}for(o in this._tiles)h=this._tiles[o],h.retain=h.current;for(o in this._tiles)if(h=this._tiles[o],h.current&&!h.active){var E=h.coords;this._retainParent(E.x,E.y,E.z,E.z-5)||this._retainChildren(E.x,E.y,E.z,E.z+2)}for(o in this._tiles)this._tiles[o].retain||this._removeTile(o)}},_removeTilesAtZoom:function(o){for(var h in this._tiles)this._tiles[h].coords.z===o&&this._removeTile(h)},_removeAllTiles:function(){for(var o in this._tiles)this._removeTile(o)},_invalidateAll:function(){for(var o in this._levels)Ta(this._levels[o].el),this._onRemoveLevel(Number(o)),delete this._levels[o];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(o,h,b,E){var M=Math.floor(o/2),V=Math.floor(h/2),fe=b-1,Te=new K(+M,+V);Te.z=+fe;var Pe=this._tileCoordsToKey(Te),Ke=this._tiles[Pe];return Ke&&Ke.active?(Ke.retain=!0,!0):(Ke&&Ke.loaded&&(Ke.retain=!0),fe>E?this._retainParent(M,V,fe,E):!1)},_retainChildren:function(o,h,b,E){for(var M=2*o;M<2*o+2;M++)for(var V=2*h;V<2*h+2;V++){var fe=new K(M,V);fe.z=b+1;var Te=this._tileCoordsToKey(fe),Pe=this._tiles[Te];if(Pe&&Pe.active){Pe.retain=!0;continue}else Pe&&Pe.loaded&&(Pe.retain=!0);b+1<E&&this._retainChildren(M,V,b+1,E)}},_resetView:function(o){var h=o&&(o.pinch||o.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),h,h)},_animateZoom:function(o){this._setView(o.center,o.zoom,!0,o.noUpdate)},_clampZoom:function(o){var h=this.options;return h.minNativeZoom!==void 0&&o<h.minNativeZoom?h.minNativeZoom:h.maxNativeZoom!==void 0&&h.maxNativeZoom<o?h.maxNativeZoom:o},_setView:function(o,h,b,E){var M=Math.round(h);this.options.maxZoom!==void 0&&M>this.options.maxZoom||this.options.minZoom!==void 0&&M<this.options.minZoom?M=void 0:M=this._clampZoom(M);var V=this.options.updateWhenZooming&&M!==this._tileZoom;(!E||V)&&(this._tileZoom=M,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),M!==void 0&&this._update(o),b||this._pruneTiles(),this._noPrune=!!b),this._setZoomTransforms(o,h)},_setZoomTransforms:function(o,h){for(var b in this._levels)this._setZoomTransform(this._levels[b],o,h)},_setZoomTransform:function(o,h,b){var E=this._map.getZoomScale(b,o.zoom),M=o.origin.multiplyBy(E).subtract(this._map._getNewPixelOrigin(h,b)).round();ve.any3d?ls(o.el,M,E):La(o.el,M)},_resetGrid:function(){var o=this._map,h=o.options.crs,b=this._tileSize=this.getTileSize(),E=this._tileZoom,M=this._map.getPixelWorldBounds(this._tileZoom);M&&(this._globalTileRange=this._pxBoundsToTileRange(M)),this._wrapX=h.wrapLng&&!this.options.noWrap&&[Math.floor(o.project([0,h.wrapLng[0]],E).x/b.x),Math.ceil(o.project([0,h.wrapLng[1]],E).x/b.y)],this._wrapY=h.wrapLat&&!this.options.noWrap&&[Math.floor(o.project([h.wrapLat[0],0],E).y/b.x),Math.ceil(o.project([h.wrapLat[1],0],E).y/b.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(o){var h=this._map,b=h._animatingZoom?Math.max(h._animateToZoom,h.getZoom()):h.getZoom(),E=h.getZoomScale(b,this._tileZoom),M=h.project(o,this._tileZoom).floor(),V=h.getSize().divideBy(E*2);return new F(M.subtract(V),M.add(V))},_update:function(o){var h=this._map;if(h){var b=this._clampZoom(h.getZoom());if(o===void 0&&(o=h.getCenter()),this._tileZoom!==void 0){var E=this._getTiledPixelBounds(o),M=this._pxBoundsToTileRange(E),V=M.getCenter(),fe=[],Te=this.options.keepBuffer,Pe=new F(M.getBottomLeft().subtract([Te,-Te]),M.getTopRight().add([Te,-Te]));if(!(isFinite(M.min.x)&&isFinite(M.min.y)&&isFinite(M.max.x)&&isFinite(M.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var Ke in this._tiles){var yt=this._tiles[Ke].coords;(yt.z!==this._tileZoom||!Pe.contains(new K(yt.x,yt.y)))&&(this._tiles[Ke].current=!1)}if(Math.abs(b-this._tileZoom)>1){this._setView(o,b);return}for(var Dt=M.min.y;Dt<=M.max.y;Dt++)for(var Xt=M.min.x;Xt<=M.max.x;Xt++){var fr=new K(Xt,Dt);if(fr.z=this._tileZoom,!!this._isValidTile(fr)){var Za=this._tiles[this._tileCoordsToKey(fr)];Za?Za.current=!0:fe.push(fr)}}if(fe.sort(function(oa,ca){return oa.distanceTo(V)-ca.distanceTo(V)}),fe.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Zr=document.createDocumentFragment();for(Xt=0;Xt<fe.length;Xt++)this._addTile(fe[Xt],Zr);this._level.el.appendChild(Zr)}}}},_isValidTile:function(o){var h=this._map.options.crs;if(!h.infinite){var b=this._globalTileRange;if(!h.wrapLng&&(o.x<b.min.x||o.x>b.max.x)||!h.wrapLat&&(o.y<b.min.y||o.y>b.max.y))return!1}if(!this.options.bounds)return!0;var E=this._tileCoordsToBounds(o);return G(this.options.bounds).overlaps(E)},_keyToBounds:function(o){return this._tileCoordsToBounds(this._keyToTileCoords(o))},_tileCoordsToNwSe:function(o){var h=this._map,b=this.getTileSize(),E=o.scaleBy(b),M=E.add(b),V=h.unproject(E,o.z),fe=h.unproject(M,o.z);return[V,fe]},_tileCoordsToBounds:function(o){var h=this._tileCoordsToNwSe(o),b=new W(h[0],h[1]);return this.options.noWrap||(b=this._map.wrapLatLngBounds(b)),b},_tileCoordsToKey:function(o){return o.x+":"+o.y+":"+o.z},_keyToTileCoords:function(o){var h=o.split(":"),b=new K(+h[0],+h[1]);return b.z=+h[2],b},_removeTile:function(o){var h=this._tiles[o];h&&(Ta(h.el),delete this._tiles[o],this.fire("tileunload",{tile:h.el,coords:this._keyToTileCoords(o)}))},_initTile:function(o){Gt(o,"leaflet-tile");var h=this.getTileSize();o.style.width=h.x+"px",o.style.height=h.y+"px",o.onselectstart=y,o.onmousemove=y,ve.ielt9&&this.options.opacity<1&&Ia(o,this.options.opacity)},_addTile:function(o,h){var b=this._getTilePos(o),E=this._tileCoordsToKey(o),M=this.createTile(this._wrapCoords(o),c(this._tileReady,this,o));this._initTile(M),this.createTile.length<2&&xe(c(this._tileReady,this,o,null,M)),La(M,b),this._tiles[E]={el:M,coords:o,current:!0},h.appendChild(M),this.fire("tileloadstart",{tile:M,coords:o})},_tileReady:function(o,h,b){h&&this.fire("tileerror",{error:h,tile:b,coords:o});var E=this._tileCoordsToKey(o);b=this._tiles[E],b&&(b.loaded=+new Date,this._map._fadeAnimated?(Ia(b.el,0),le(this._fadeFrame),this._fadeFrame=xe(this._updateOpacity,this)):(b.active=!0,this._pruneTiles()),h||(Gt(b.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:b.el,coords:o})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),ve.ielt9||!this._map._fadeAnimated?xe(this._pruneTiles,this):setTimeout(c(this._pruneTiles,this),250)))},_getTilePos:function(o){return o.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(o){var h=new K(this._wrapX?x(o.x,this._wrapX):o.x,this._wrapY?x(o.y,this._wrapY):o.y);return h.z=o.z,h},_pxBoundsToTileRange:function(o){var h=this.getTileSize();return new F(o.min.unscaleBy(h).floor(),o.max.unscaleBy(h).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var o in this._tiles)if(!this._tiles[o].loaded)return!1;return!0}});function Y0(o){return new Fi(o)}var Ms=Fi.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(o,h){this._url=o,h=N(this,h),h.detectRetina&&ve.retina&&h.maxZoom>0?(h.tileSize=Math.floor(h.tileSize/2),h.zoomReverse?(h.zoomOffset--,h.minZoom=Math.min(h.maxZoom,h.minZoom+1)):(h.zoomOffset++,h.maxZoom=Math.max(h.minZoom,h.maxZoom-1)),h.minZoom=Math.max(0,h.minZoom)):h.zoomReverse?h.minZoom=Math.min(h.maxZoom,h.minZoom):h.maxZoom=Math.max(h.minZoom,h.maxZoom),typeof h.subdomains=="string"&&(h.subdomains=h.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(o,h){return this._url===o&&h===void 0&&(h=!0),this._url=o,h||this.redraw(),this},createTile:function(o,h){var b=document.createElement("img");return Ut(b,"load",c(this._tileOnLoad,this,h,b)),Ut(b,"error",c(this._tileOnError,this,h,b)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(b.referrerPolicy=this.options.referrerPolicy),b.alt="",b.src=this.getTileUrl(o),b},getTileUrl:function(o){var h={r:ve.retina?"@2x":"",s:this._getSubdomain(o),x:o.x,y:o.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var b=this._globalTileRange.max.y-o.y;this.options.tms&&(h.y=b),h["-y"]=b}return C(this._url,i(h,this.options))},_tileOnLoad:function(o,h){ve.ielt9?setTimeout(c(o,this,null,h),0):o(null,h)},_tileOnError:function(o,h,b){var E=this.options.errorTileUrl;E&&h.getAttribute("src")!==E&&(h.src=E),o(b,h)},_onTileRemove:function(o){o.tile.onload=null},_getZoomForUrl:function(){var o=this._tileZoom,h=this.options.maxZoom,b=this.options.zoomReverse,E=this.options.zoomOffset;return b&&(o=h-o),o+E},_getSubdomain:function(o){var h=Math.abs(o.x+o.y)%this.options.subdomains.length;return this.options.subdomains[h]},_abortLoading:function(){var o,h;for(o in this._tiles)if(this._tiles[o].coords.z!==this._tileZoom&&(h=this._tiles[o].el,h.onload=y,h.onerror=y,!h.complete)){h.src=I;var b=this._tiles[o].coords;Ta(h),delete this._tiles[o],this.fire("tileabort",{tile:h,coords:b})}},_removeTile:function(o){var h=this._tiles[o];if(h)return h.el.setAttribute("src",I),Fi.prototype._removeTile.call(this,o)},_tileReady:function(o,h,b){if(!(!this._map||b&&b.getAttribute("src")===I))return Fi.prototype._tileReady.call(this,o,h,b)}});function rn(o,h){return new Ms(o,h)}var Ml=Ms.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(o,h){this._url=o;var b=i({},this.defaultWmsParams);for(var E in h)E in this.options||(b[E]=h[E]);h=N(this,h);var M=h.detectRetina&&ve.retina?2:1,V=this.getTileSize();b.width=V.x*M,b.height=V.y*M,this.wmsParams=b},onAdd:function(o){this._crs=this.options.crs||o.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var h=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[h]=this._crs.code,Ms.prototype.onAdd.call(this,o)},getTileUrl:function(o){var h=this._tileCoordsToNwSe(o),b=this._crs,E=D(b.project(h[0]),b.project(h[1])),M=E.min,V=E.max,fe=(this._wmsVersion>=1.3&&this._crs===Qc?[M.y,M.x,V.y,V.x]:[M.x,M.y,V.x,V.y]).join(","),Te=Ms.prototype.getTileUrl.call(this,o);return Te+S(this.wmsParams,Te,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+fe},setParams:function(o,h){return i(this.wmsParams,o),h||this.redraw(),this}});function nn(o,h){return new Ml(o,h)}Ms.WMS=Ml,rn.wms=nn;var zr=jn.extend({options:{padding:.1},initialize:function(o){N(this,o),g(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Gt(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var o={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(o.zoomanim=this._onAnimZoom),o},_onAnimZoom:function(o){this._updateTransform(o.center,o.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(o,h){var b=this._map.getZoomScale(h,this._zoom),E=this._map.getSize().multiplyBy(.5+this.options.padding),M=this._map.project(this._center,h),V=E.multiplyBy(-b).add(M).subtract(this._map._getNewPixelOrigin(o,h));ve.any3d?ls(this._container,V,b):La(this._container,V)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var o in this._layers)this._layers[o]._reset()},_onZoomEnd:function(){for(var o in this._layers)this._layers[o]._project()},_updatePaths:function(){for(var o in this._layers)this._layers[o]._update()},_update:function(){var o=this.options.padding,h=this._map.getSize(),b=this._map.containerPointToLayerPoint(h.multiplyBy(-o)).round();this._bounds=new F(b,b.add(h.multiplyBy(1+o*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Mo=zr.extend({options:{tolerance:0},getEvents:function(){var o=zr.prototype.getEvents.call(this);return o.viewprereset=this._onViewPreReset,o},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){zr.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var o=this._container=document.createElement("canvas");Ut(o,"mousemove",this._onMouseMove,this),Ut(o,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ut(o,"mouseout",this._handleMouseOut,this),o._leaflet_disable_events=!0,this._ctx=o.getContext("2d")},_destroyContainer:function(){le(this._redrawRequest),delete this._ctx,Ta(this._container),xa(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var o;this._redrawBounds=null;for(var h in this._layers)o=this._layers[h],o._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){zr.prototype._update.call(this);var o=this._bounds,h=this._container,b=o.getSize(),E=ve.retina?2:1;La(h,o.min),h.width=E*b.x,h.height=E*b.y,h.style.width=b.x+"px",h.style.height=b.y+"px",ve.retina&&this._ctx.scale(2,2),this._ctx.translate(-o.min.x,-o.min.y),this.fire("update")}},_reset:function(){zr.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(o){this._updateDashArray(o),this._layers[g(o)]=o;var h=o._order={layer:o,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=h),this._drawLast=h,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(o){this._requestRedraw(o)},_removePath:function(o){var h=o._order,b=h.next,E=h.prev;b?b.prev=E:this._drawLast=E,E?E.next=b:this._drawFirst=b,delete o._order,delete this._layers[g(o)],this._requestRedraw(o)},_updatePath:function(o){this._extendRedrawBounds(o),o._project(),o._update(),this._requestRedraw(o)},_updateStyle:function(o){this._updateDashArray(o),this._requestRedraw(o)},_updateDashArray:function(o){if(typeof o.options.dashArray=="string"){var h=o.options.dashArray.split(/[, ]+/),b=[],E,M;for(M=0;M<h.length;M++){if(E=Number(h[M]),isNaN(E))return;b.push(E)}o.options._dashArray=b}else o.options._dashArray=o.options.dashArray},_requestRedraw:function(o){this._map&&(this._extendRedrawBounds(o),this._redrawRequest=this._redrawRequest||xe(this._redraw,this))},_extendRedrawBounds:function(o){if(o._pxBounds){var h=(o.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new F,this._redrawBounds.extend(o._pxBounds.min.subtract([h,h])),this._redrawBounds.extend(o._pxBounds.max.add([h,h]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var o=this._redrawBounds;if(o){var h=o.getSize();this._ctx.clearRect(o.min.x,o.min.y,h.x,h.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var o,h=this._redrawBounds;if(this._ctx.save(),h){var b=h.getSize();this._ctx.beginPath(),this._ctx.rect(h.min.x,h.min.y,b.x,b.y),this._ctx.clip()}this._drawing=!0;for(var E=this._drawFirst;E;E=E.next)o=E.layer,(!h||o._pxBounds&&o._pxBounds.intersects(h))&&o._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(o,h){if(this._drawing){var b,E,M,V,fe=o._parts,Te=fe.length,Pe=this._ctx;if(Te){for(Pe.beginPath(),b=0;b<Te;b++){for(E=0,M=fe[b].length;E<M;E++)V=fe[b][E],Pe[E?"lineTo":"moveTo"](V.x,V.y);h&&Pe.closePath()}this._fillStroke(Pe,o)}}},_updateCircle:function(o){if(!(!this._drawing||o._empty())){var h=o._point,b=this._ctx,E=Math.max(Math.round(o._radius),1),M=(Math.max(Math.round(o._radiusY),1)||E)/E;M!==1&&(b.save(),b.scale(1,M)),b.beginPath(),b.arc(h.x,h.y/M,E,0,Math.PI*2,!1),M!==1&&b.restore(),this._fillStroke(b,o)}},_fillStroke:function(o,h){var b=h.options;b.fill&&(o.globalAlpha=b.fillOpacity,o.fillStyle=b.fillColor||b.color,o.fill(b.fillRule||"evenodd")),b.stroke&&b.weight!==0&&(o.setLineDash&&o.setLineDash(h.options&&h.options._dashArray||[]),o.globalAlpha=b.opacity,o.lineWidth=b.weight,o.strokeStyle=b.color,o.lineCap=b.lineCap,o.lineJoin=b.lineJoin,o.stroke())},_onClick:function(o){for(var h=this._map.mouseEventToLayerPoint(o),b,E,M=this._drawFirst;M;M=M.next)b=M.layer,b.options.interactive&&b._containsPoint(h)&&(!(o.type==="click"||o.type==="preclick")||!this._map._draggableMoved(b))&&(E=b);this._fireEvent(E?[E]:!1,o)},_onMouseMove:function(o){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var h=this._map.mouseEventToLayerPoint(o);this._handleMouseHover(o,h)}},_handleMouseOut:function(o){var h=this._hoveredLayer;h&&(Ua(this._container,"leaflet-interactive"),this._fireEvent([h],o,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(o,h){if(!this._mouseHoverThrottled){for(var b,E,M=this._drawFirst;M;M=M.next)b=M.layer,b.options.interactive&&b._containsPoint(h)&&(E=b);E!==this._hoveredLayer&&(this._handleMouseOut(o),E&&(Gt(this._container,"leaflet-interactive"),this._fireEvent([E],o,"mouseover"),this._hoveredLayer=E)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,o),this._mouseHoverThrottled=!0,setTimeout(c(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(o,h,b){this._map._fireDOMEvent(h,b||h.type,o)},_bringToFront:function(o){var h=o._order;if(h){var b=h.next,E=h.prev;if(b)b.prev=E;else return;E?E.next=b:b&&(this._drawFirst=b),h.prev=this._drawLast,this._drawLast.next=h,h.next=null,this._drawLast=h,this._requestRedraw(o)}},_bringToBack:function(o){var h=o._order;if(h){var b=h.next,E=h.prev;if(E)E.next=b;else return;b?b.prev=E:E&&(this._drawLast=E),h.prev=null,h.next=this._drawFirst,this._drawFirst.prev=h,this._drawFirst=h,this._requestRedraw(o)}}});function Ll(o){return ve.canvas?new Mo(o):null}var Ls=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(o){return document.createElement("<lvml:"+o+' class="lvml">')}}catch(o){}return function(o){return document.createElement("<"+o+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),ed={_initContainer:function(){this._container=Ht("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(zr.prototype._update.call(this),this.fire("update"))},_initPath:function(o){var h=o._container=Ls("shape");Gt(h,"leaflet-vml-shape "+(this.options.className||"")),h.coordsize="1 1",o._path=Ls("path"),h.appendChild(o._path),this._updateStyle(o),this._layers[g(o)]=o},_addPath:function(o){var h=o._container;this._container.appendChild(h),o.options.interactive&&o.addInteractiveTarget(h)},_removePath:function(o){var h=o._container;Ta(h),o.removeInteractiveTarget(h),delete this._layers[g(o)]},_updateStyle:function(o){var h=o._stroke,b=o._fill,E=o.options,M=o._container;M.stroked=!!E.stroke,M.filled=!!E.fill,E.stroke?(h||(h=o._stroke=Ls("stroke")),M.appendChild(h),h.weight=E.weight+"px",h.color=E.color,h.opacity=E.opacity,E.dashArray?h.dashStyle=A(E.dashArray)?E.dashArray.join(" "):E.dashArray.replace(/( *, *)/g," "):h.dashStyle="",h.endcap=E.lineCap.replace("butt","flat"),h.joinstyle=E.lineJoin):h&&(M.removeChild(h),o._stroke=null),E.fill?(b||(b=o._fill=Ls("fill")),M.appendChild(b),b.color=E.fillColor||E.color,b.opacity=E.fillOpacity):b&&(M.removeChild(b),o._fill=null)},_updateCircle:function(o){var h=o._point.round(),b=Math.round(o._radius),E=Math.round(o._radiusY||b);this._setPath(o,o._empty()?"M0 0":"AL "+h.x+","+h.y+" "+b+","+E+" 0,"+65535*360)},_setPath:function(o,h){o._path.v=h},_bringToFront:function(o){ur(o._container)},_bringToBack:function(o){Zs(o._container)}},Zn=ve.vml?Ls:Ct,Ii=zr.extend({_initContainer:function(){this._container=Zn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Zn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Ta(this._container),xa(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){zr.prototype._update.call(this);var o=this._bounds,h=o.getSize(),b=this._container;(!this._svgSize||!this._svgSize.equals(h))&&(this._svgSize=h,b.setAttribute("width",h.x),b.setAttribute("height",h.y)),La(b,o.min),b.setAttribute("viewBox",[o.min.x,o.min.y,h.x,h.y].join(" ")),this.fire("update")}},_initPath:function(o){var h=o._path=Zn("path");o.options.className&&Gt(h,o.options.className),o.options.interactive&&Gt(h,"leaflet-interactive"),this._updateStyle(o),this._layers[g(o)]=o},_addPath:function(o){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(o._path),o.addInteractiveTarget(o._path)},_removePath:function(o){Ta(o._path),o.removeInteractiveTarget(o._path),delete this._layers[g(o)]},_updatePath:function(o){o._project(),o._update()},_updateStyle:function(o){var h=o._path,b=o.options;h&&(b.stroke?(h.setAttribute("stroke",b.color),h.setAttribute("stroke-opacity",b.opacity),h.setAttribute("stroke-width",b.weight),h.setAttribute("stroke-linecap",b.lineCap),h.setAttribute("stroke-linejoin",b.lineJoin),b.dashArray?h.setAttribute("stroke-dasharray",b.dashArray):h.removeAttribute("stroke-dasharray"),b.dashOffset?h.setAttribute("stroke-dashoffset",b.dashOffset):h.removeAttribute("stroke-dashoffset")):h.setAttribute("stroke","none"),b.fill?(h.setAttribute("fill",b.fillColor||b.color),h.setAttribute("fill-opacity",b.fillOpacity),h.setAttribute("fill-rule",b.fillRule||"evenodd")):h.setAttribute("fill","none"))},_updatePoly:function(o,h){this._setPath(o,St(o._parts,h))},_updateCircle:function(o){var h=o._point,b=Math.max(Math.round(o._radius),1),E=Math.max(Math.round(o._radiusY),1)||b,M="a"+b+","+E+" 0 1,0 ",V=o._empty()?"M0 0":"M"+(h.x-b)+","+h.y+M+b*2+",0 "+M+-b*2+",0 ";this._setPath(o,V)},_setPath:function(o,h){o._path.setAttribute("d",h)},_bringToFront:function(o){ur(o._path)},_bringToBack:function(o){Zs(o._path)}});ve.vml&&Ii.include(ed);function Dl(o){return ve.svg||ve.vml?new Ii(o):null}ra.include({getRenderer:function(o){var h=o.options.renderer||this._getPaneRenderer(o.options.pane)||this.options.renderer||this._renderer;return h||(h=this._renderer=this._createRenderer()),this.hasLayer(h)||this.addLayer(h),h},_getPaneRenderer:function(o){if(o==="overlayPane"||o===void 0)return!1;var h=this._paneRenderers[o];return h===void 0&&(h=this._createRenderer({pane:o}),this._paneRenderers[o]=h),h},_createRenderer:function(o){return this.options.preferCanvas&&Ll(o)||Dl(o)}});var Js=Li.extend({initialize:function(o,h){Li.prototype.initialize.call(this,this._boundsToLatLngs(o),h)},setBounds:function(o){return this.setLatLngs(this._boundsToLatLngs(o))},_boundsToLatLngs:function(o){return o=G(o),[o.getSouthWest(),o.getNorthWest(),o.getNorthEast(),o.getSouthEast()]}});function Th(o,h){return new Js(o,h)}Ii.create=Zn,Ii.pointsToPath=St,us.geometryToLayer=gr,us.coordsToLatLng=To,us.coordsToLatLngs=Tl,us.latLngToCoords=Eo,us.latLngsToCoords=El,us.getFeature=Cs,us.asFeature=Co,ra.mergeOptions({boxZoom:!0});var Br=$n.extend({initialize:function(o){this._map=o,this._container=o._container,this._pane=o._panes.overlayPane,this._resetStateTimeout=0,o.on("unload",this._destroy,this)},addHooks:function(){Ut(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){xa(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Ta(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(o){if(!o.shiftKey||o.which!==1&&o.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Ni(),yo(),this._startPoint=this._map.mouseEventToContainerPoint(o),Ut(document,{contextmenu:Ts,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(o){this._moved||(this._moved=!0,this._box=Ht("div","leaflet-zoom-box",this._container),Gt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(o);var h=new F(this._point,this._startPoint),b=h.getSize();La(this._box,h.min),this._box.style.width=b.x+"px",this._box.style.height=b.y+"px"},_finish:function(){this._moved&&(Ta(this._box),Ua(this._container,"leaflet-crosshair")),Un(),pl(),xa(document,{contextmenu:Ts,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(o){if(!(o.which!==1&&o.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(c(this._resetState,this),0);var h=new W(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(h).fire("boxzoomend",{boxZoomBounds:h})}},_onKeyDown:function(o){o.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});ra.addInitHook("addHandler","boxZoom",Br),ra.mergeOptions({doubleClickZoom:!0});var Lo=$n.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(o){var h=this._map,b=h.getZoom(),E=h.options.zoomDelta,M=o.originalEvent.shiftKey?b-E:b+E;h.options.doubleClickZoom==="center"?h.setZoom(M):h.setZoomAround(o.containerPoint,M)}});ra.addInitHook("addHandler","doubleClickZoom",Lo),ra.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var qn=$n.extend({addHooks:function(){if(!this._draggable){var o=this._map;this._draggable=new Es(o._mapPane,o._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),o.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),o.on("zoomend",this._onZoomEnd,this),o.whenReady(this._onZoomEnd,this))}Gt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Ua(this._map._container,"leaflet-grab"),Ua(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var o=this._map;if(o._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var h=G(this._map.options.maxBounds);this._offsetLimit=D(this._map.latLngToContainerPoint(h.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(h.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;o.fire("movestart").fire("dragstart"),o.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(o){if(this._map.options.inertia){var h=this._lastTime=+new Date,b=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(b),this._times.push(h),this._prunePositions(h)}this._map.fire("move",o).fire("drag",o)},_prunePositions:function(o){for(;this._positions.length>1&&o-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var o=this._map.getSize().divideBy(2),h=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=h.subtract(o).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(o,h){return o-(o-h)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var o=this._draggable._newPos.subtract(this._draggable._startPos),h=this._offsetLimit;o.x<h.min.x&&(o.x=this._viscousLimit(o.x,h.min.x)),o.y<h.min.y&&(o.y=this._viscousLimit(o.y,h.min.y)),o.x>h.max.x&&(o.x=this._viscousLimit(o.x,h.max.x)),o.y>h.max.y&&(o.y=this._viscousLimit(o.y,h.max.y)),this._draggable._newPos=this._draggable._startPos.add(o)}},_onPreDragWrap:function(){var o=this._worldWidth,h=Math.round(o/2),b=this._initialWorldOffset,E=this._draggable._newPos.x,M=(E-h+b)%o+h-b,V=(E+h+b)%o-h-b,fe=Math.abs(M+b)<Math.abs(V+b)?M:V;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=fe},_onDragEnd:function(o){var h=this._map,b=h.options,E=!b.inertia||o.noInertia||this._times.length<2;if(h.fire("dragend",o),E)h.fire("moveend");else{this._prunePositions(+new Date);var M=this._lastPos.subtract(this._positions[0]),V=(this._lastTime-this._times[0])/1e3,fe=b.easeLinearity,Te=M.multiplyBy(fe/V),Pe=Te.distanceTo([0,0]),Ke=Math.min(b.inertiaMaxSpeed,Pe),yt=Te.multiplyBy(Ke/Pe),Dt=Ke/(b.inertiaDeceleration*fe),Xt=yt.multiplyBy(-Dt/2).round();!Xt.x&&!Xt.y?h.fire("moveend"):(Xt=h._limitOffset(Xt,h.options.maxBounds),xe(function(){h.panBy(Xt,{duration:Dt,easeLinearity:fe,noMoveStart:!0,animate:!0})}))}}});ra.addInitHook("addHandler","dragging",qn),ra.mergeOptions({keyboard:!0,keyboardPanDelta:80});var td=$n.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(o){this._map=o,this._setPanDelta(o.options.keyboardPanDelta),this._setZoomDelta(o.options.zoomDelta)},addHooks:function(){var o=this._map._container;o.tabIndex<=0&&(o.tabIndex="0"),Ut(o,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),xa(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var o=document.body,h=document.documentElement,b=o.scrollTop||h.scrollTop,E=o.scrollLeft||h.scrollLeft;this._map._container.focus(),window.scrollTo(E,b)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(o){var h=this._panKeys={},b=this.keyCodes,E,M;for(E=0,M=b.left.length;E<M;E++)h[b.left[E]]=[-1*o,0];for(E=0,M=b.right.length;E<M;E++)h[b.right[E]]=[o,0];for(E=0,M=b.down.length;E<M;E++)h[b.down[E]]=[0,o];for(E=0,M=b.up.length;E<M;E++)h[b.up[E]]=[0,-1*o]},_setZoomDelta:function(o){var h=this._zoomKeys={},b=this.keyCodes,E,M;for(E=0,M=b.zoomIn.length;E<M;E++)h[b.zoomIn[E]]=o;for(E=0,M=b.zoomOut.length;E<M;E++)h[b.zoomOut[E]]=-o},_addHooks:function(){Ut(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){xa(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(o){if(!(o.altKey||o.ctrlKey||o.metaKey)){var h=o.keyCode,b=this._map,E;if(h in this._panKeys){if(!b._panAnim||!b._panAnim._inProgress)if(E=this._panKeys[h],o.shiftKey&&(E=se(E).multiplyBy(3)),b.options.maxBounds&&(E=b._limitOffset(se(E),b.options.maxBounds)),b.options.worldCopyJump){var M=b.wrapLatLng(b.unproject(b.project(b.getCenter()).add(E)));b.panTo(M)}else b.panBy(E)}else if(h in this._zoomKeys)b.setZoom(b.getZoom()+(o.shiftKey?3:1)*this._zoomKeys[h]);else if(h===27&&b._popup&&b._popup.options.closeOnEscapeKey)b.closePopup();else return;Ts(o)}}});ra.addInitHook("addHandler","keyboard",td),ra.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Pl=$n.extend({addHooks:function(){Ut(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){xa(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(o){var h=Tr(o),b=this._map.options.wheelDebounceTime;this._delta+=h,this._lastMousePos=this._map.mouseEventToContainerPoint(o),this._startTime||(this._startTime=+new Date);var E=Math.max(b-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(c(this._performZoom,this),E),Ts(o)},_performZoom:function(){var o=this._map,h=o.getZoom(),b=this._map.options.zoomSnap||0;o._stop();var E=this._delta/(this._map.options.wheelPxPerZoomLevel*4),M=4*Math.log(2/(1+Math.exp(-Math.abs(E))))/Math.LN2,V=b?Math.ceil(M/b)*b:M,fe=o._limitZoom(h+(this._delta>0?V:-V))-h;this._delta=0,this._startTime=null,fe&&(o.options.scrollWheelZoom==="center"?o.setZoom(h+fe):o.setZoomAround(this._lastMousePos,h+fe))}});ra.addInitHook("addHandler","scrollWheelZoom",Pl);var Ks=600;ra.mergeOptions({tapHold:ve.touchNative&&ve.safari&&ve.mobile,tapTolerance:15});var Do=$n.extend({addHooks:function(){Ut(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){xa(this._map._container,"touchstart",this._onDown,this)},_onDown:function(o){if(clearTimeout(this._holdTimeout),o.touches.length===1){var h=o.touches[0];this._startPos=this._newPos=new K(h.clientX,h.clientY),this._holdTimeout=setTimeout(c(function(){this._cancel(),this._isTapValid()&&(Ut(document,"touchend",Ga),Ut(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",h))},this),Ks),Ut(document,"touchend touchcancel contextmenu",this._cancel,this),Ut(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function o(){xa(document,"touchend",Ga),xa(document,"touchend touchcancel",o)},_cancel:function(){clearTimeout(this._holdTimeout),xa(document,"touchend touchcancel contextmenu",this._cancel,this),xa(document,"touchmove",this._onMove,this)},_onMove:function(o){var h=o.touches[0];this._newPos=new K(h.clientX,h.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(o,h){var b=new MouseEvent(o,{bubbles:!0,cancelable:!0,view:window,screenX:h.screenX,screenY:h.screenY,clientX:h.clientX,clientY:h.clientY});b._simulated=!0,h.target.dispatchEvent(b)}});ra.addInitHook("addHandler","tapHold",Do),ra.mergeOptions({touchZoom:ve.touch,bounceAtZoomLimits:!0});var ad=$n.extend({addHooks:function(){Gt(this._map._container,"leaflet-touch-zoom"),Ut(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Ua(this._map._container,"leaflet-touch-zoom"),xa(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(o){var h=this._map;if(!(!o.touches||o.touches.length!==2||h._animatingZoom||this._zooming)){var b=h.mouseEventToContainerPoint(o.touches[0]),E=h.mouseEventToContainerPoint(o.touches[1]);this._centerPoint=h.getSize()._divideBy(2),this._startLatLng=h.containerPointToLatLng(this._centerPoint),h.options.touchZoom!=="center"&&(this._pinchStartLatLng=h.containerPointToLatLng(b.add(E)._divideBy(2))),this._startDist=b.distanceTo(E),this._startZoom=h.getZoom(),this._moved=!1,this._zooming=!0,h._stop(),Ut(document,"touchmove",this._onTouchMove,this),Ut(document,"touchend touchcancel",this._onTouchEnd,this),Ga(o)}},_onTouchMove:function(o){if(!(!o.touches||o.touches.length!==2||!this._zooming)){var h=this._map,b=h.mouseEventToContainerPoint(o.touches[0]),E=h.mouseEventToContainerPoint(o.touches[1]),M=b.distanceTo(E)/this._startDist;if(this._zoom=h.getScaleZoom(M,this._startZoom),!h.options.bounceAtZoomLimits&&(this._zoom<h.getMinZoom()&&M<1||this._zoom>h.getMaxZoom()&&M>1)&&(this._zoom=h._limitZoom(this._zoom)),h.options.touchZoom==="center"){if(this._center=this._startLatLng,M===1)return}else{var V=b._add(E)._divideBy(2)._subtract(this._centerPoint);if(M===1&&V.x===0&&V.y===0)return;this._center=h.unproject(h.project(this._pinchStartLatLng,this._zoom).subtract(V),this._zoom)}this._moved||(h._moveStart(!0,!1),this._moved=!0),le(this._animRequest);var fe=c(h._move,h,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=xe(fe,this,!0),Ga(o)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,le(this._animRequest),xa(document,"touchmove",this._onTouchMove,this),xa(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});ra.addInitHook("addHandler","touchZoom",ad),ra.BoxZoom=Br,ra.DoubleClickZoom=Lo,ra.Drag=qn,ra.Keyboard=td,ra.ScrollWheelZoom=Pl,ra.TapHold=Do,ra.TouchZoom=ad,a.Bounds=F,a.Browser=ve,a.CRS=De,a.Canvas=Mo,a.Circle=So,a.CircleMarker=Mi,a.Class=be,a.Control=Gr,a.DivIcon=q0,a.DivOverlay=pr,a.DomEvent=_o,a.DomUtil=Ti,a.Draggable=Es,a.Evented=Z,a.FeatureGroup=Wn,a.GeoJSON=us,a.GridLayer=Fi,a.Handler=$n,a.Icon=Vn,a.ImageOverlay=Pi,a.LatLng=J,a.LatLngBounds=W,a.Layer=jn,a.LayerGroup=Oi,a.LineUtil=_h,a.Map=ra,a.Marker=Sl,a.Mixin=xh,a.Path=Gn,a.Point=K,a.PolyUtil=Jc,a.Polygon=Li,a.Polyline=ds,a.Popup=Al,a.PosAnimation=Ei,a.Projection=z0,a.Rectangle=Js,a.Renderer=zr,a.SVG=Ii,a.SVGOverlay=Oo,a.TileLayer=Ms,a.Tooltip=Ol,a.Transformation=st,a.Util=ge,a.VideoOverlay=Os,a.bind=c,a.bounds=D,a.canvas=Ll,a.circle=W0,a.circleMarker=$0,a.control=cs,a.divIcon=Sh,a.extend=i,a.featureGroup=U0,a.geoJSON=Ao,a.geoJson=Cl,a.gridLayer=Y0,a.icon=kl,a.imageOverlay=V0,a.latLng=de,a.latLngBounds=G,a.layerGroup=wh,a.map=Vc,a.marker=H0,a.point=se,a.polygon=Nh,a.polyline=kh,a.popup=Z0,a.rectangle=Th,a.setOptions=N,a.stamp=g,a.svg=Dl,a.svgOverlay=G0,a.tileLayer=rn,a.tooltip=jh,a.transformation=gt,a.version=s,a.videoOverlay=Ri;var rd=window.L;a.noConflict=function(){return window.L=rd,this},window.L=a}))})(Wd,Wd.exports)),Wd.exports}var zc=CM();const Zp=Jv(zc);function hh(e,t,a){return Object.freeze({instance:e,context:t,container:a})}function qp(e,t){return t==null?function(s,i){const d=j.useRef(void 0);return d.current||(d.current=e(s,i)),d}:function(s,i){const d=j.useRef(void 0);d.current||(d.current=e(s,i));const c=j.useRef(s),{instance:f}=d.current;return j.useEffect(function(){c.current!==s&&(t(f,s,c.current),c.current=s)},[f,s,t]),d}}function AM(e,t){j.useEffect(function(){var i;return((i=t.layerContainer)!=null?i:t.map).addLayer(e.instance),function(){var c;(c=t.layerContainer)==null||c.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function ok(e){return function(a){const s=Vp(),i=e(Gp(a,s),s);return ik(s.map,a.attribution),lk(i.current,a.eventHandlers),AM(i.current,s),i}}function OM(e,t){const a=qp(e,t),s=ok(a);return NM(s)}function ck(e,t){const a=qp(e),s=TM(a,t);return jM(s)}function MM(e,t){const a=qp(e,t),s=ok(a);return SM(s)}function LM(e,t,a){const{opacity:s,zIndex:i}=t;s!=null&&s!==a.opacity&&e.setOpacity(s),i!=null&&i!==a.zIndex&&e.setZIndex(i)}function DM(){return Vp().map}function PM(_,y){var k=_,{bounds:e,boundsOptions:t,center:a,children:s,className:i,id:d,placeholder:c,style:f,whenReady:g,zoom:p}=k,x=fn(k,["bounds","boundsOptions","center","children","className","id","placeholder","style","whenReady","zoom"]);const[T]=j.useState({className:i,id:d,style:f}),[N,S]=j.useState(null),O=j.useRef(void 0);j.useImperativeHandle(y,()=>{var P;return(P=N==null?void 0:N.map)!=null?P:null},[N]);const C=j.useCallback(P=>{if(P!==null&&!O.current){const I=new zc.Map(P,x);O.current=I,a!=null&&p!=null?I.setView(a,p):e!=null&&I.fitBounds(e,t),g!=null&&I.whenReady(g),S(wM(I))}},[]);j.useEffect(()=>()=>{N==null||N.map.remove()},[N]);const A=N?ia.createElement(Wp,{value:N},s):c!=null?c:null;return ia.createElement("div",Ee(ie({},T),{ref:C}),A)}const RM=j.forwardRef(PM),FM=OM(function(i,s){var d=i,{position:t}=d,a=fn(d,["position"]);const c=new zc.Marker(t,a);return hh(c,kM(s,{overlayContainer:c}))},function(t,a,s){a.position!==s.position&&t.setLatLng(a.position),a.icon!=null&&a.icon!==s.icon&&t.setIcon(a.icon),a.zIndexOffset!=null&&a.zIndexOffset!==s.zIndexOffset&&t.setZIndexOffset(a.zIndexOffset),a.opacity!=null&&a.opacity!==s.opacity&&t.setOpacity(a.opacity),t.dragging!=null&&a.draggable!==s.draggable&&(a.draggable===!0?t.dragging.enable():t.dragging.disable())}),IM=ck(function(t,a){const s=new zc.Popup(t,a.overlayContainer);return hh(s,a)},function(t,a,{position:s},i){j.useEffect(function(){const{instance:c}=t;function f(p){p.popup===c&&(c.update(),i(!0))}function g(p){p.popup===c&&i(!1)}return a.map.on({popupopen:f,popupclose:g}),a.overlayContainer==null?(s!=null&&c.setLatLng(s),c.openOn(a.map)):a.overlayContainer.bindPopup(c),function(){var x;a.map.off({popupopen:f,popupclose:g}),(x=a.overlayContainer)==null||x.unbindPopup(),a.map.removeLayer(c)}},[t,a,i,s])}),zM=MM(function(i,s){var d=i,{url:t}=d,a=fn(d,["url"]);const c=new zc.TileLayer(t,Gp(a,s));return hh(c,s)},function(t,a,s){LM(t,a,s);const{url:i}=a;i!=null&&i!==s.url&&t.setUrl(i)}),BM=ck(function(t,a){const s=new zc.Tooltip(t,a.overlayContainer);return hh(s,a)},function(t,a,{position:s},i){j.useEffect(function(){const c=a.overlayContainer;if(c==null)return;const{instance:f}=t,g=x=>{x.tooltip===f&&(s!=null&&f.setLatLng(s),f.update(),i(!0))},p=x=>{x.tooltip===f&&i(!1)};return c.on({tooltipopen:g,tooltipclose:p}),c.bindTooltip(f),function(){c.off({tooltipopen:g,tooltipclose:p}),c._map!=null&&c.unbindTooltip()}},[t,a,i,s])}),UM="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",HM="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",$M=Zp.icon({iconUrl:UM,shadowUrl:HM,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]});Zp.Marker.prototype.options.icon=$M;const WM=({locations:e})=>{const t=DM();return j.useEffect(()=>{if(e.length>0&&e.some(a=>a.latitude&&a.longitude)){const a=Zp.latLngBounds(e.filter(s=>s.latitude&&s.longitude).map(s=>[s.latitude,s.longitude]));t.fitBounds(a,{padding:[30,30],maxZoom:8})}else t.setView([24.8,45.5],6)},[e,t]),null},VM=()=>{const e=Na(),[t,a]=j.useState(""),[s,i]=j.useState(""),[d,c]=j.useState([]),[f,g]=j.useState(!0),p=j.useRef({}),x=(S,O)=>oe(null,null,function*(){var ee,B,H,Y,ue,xe,le,ge,be,me,ae,Z;const C=O==="phcc",A=C?"custom_site":"company",P=C?"site_name":"company",I={assets:0,normal_work_orders:0,urgent_work_orders:0,planned_maintenance:0,completed_maintenance:0,overdue_maintenance:0,wo_open:0,wo_progress:0,wo_review:0,wo_completed:0,phcc_asset_names:[]};try{const K=yield rt.apiCall(`/api/resource/Asset?filters=${encodeURIComponent(JSON.stringify({[A]:S.name}))}&fields=["name"]&limit_page_length=0`),te=(K==null?void 0:K.data)||[];I.assets=te.length,C&&(I.phcc_asset_names=te.map(de=>de.name));const se=yield rt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[P]:S.name,custom_priority_:"Normal",repair_status:["in",["Open","Work In Progress"]]}))}&fields=["name"]`);I.normal_work_orders=((ee=se==null?void 0:se.data)==null?void 0:ee.length)||0;const F=yield rt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[P]:S.name,custom_priority_:"Urgent",repair_status:["in",["Open","Work In Progress"]]}))}&fields=["name"]`);I.urgent_work_orders=((B=F==null?void 0:F.data)==null?void 0:B.length)||0;const[D,W,G,J]=yield Promise.all([rt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[P]:S.name,repair_status:"Open"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[P]:S.name,repair_status:"Work In Progress"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[P]:S.name,repair_status:"Pending Review"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Work_Order?filters=${encodeURIComponent(JSON.stringify({[P]:S.name,repair_status:"Completed"}))}&fields=["name"]`)]);if(I.wo_open=((H=D==null?void 0:D.data)==null?void 0:H.length)||0,I.wo_progress=((Y=W==null?void 0:W.data)==null?void 0:Y.length)||0,I.wo_review=((ue=G==null?void 0:G.data)==null?void 0:ue.length)||0,I.wo_completed=((xe=J==null?void 0:J.data)==null?void 0:xe.length)||0,C&&I.phcc_asset_names&&I.phcc_asset_names.length>0){const[de,De,Ne]=yield Promise.all([rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",I.phcc_asset_names],maintenance_status:"Planned"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",I.phcc_asset_names],maintenance_status:"Completed"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({asset_name:["in",I.phcc_asset_names],maintenance_status:"Overdue"}))}&fields=["name"]`)]);I.planned_maintenance=((le=de==null?void 0:de.data)==null?void 0:le.length)||0,I.completed_maintenance=((ge=De==null?void 0:De.data)==null?void 0:ge.length)||0,I.overdue_maintenance=((be=Ne==null?void 0:Ne.data)==null?void 0:be.length)||0}else if(!C){const[de,De,Ne]=yield Promise.all([rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:S.name,maintenance_status:"Planned"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:S.name,maintenance_status:"Completed"}))}&fields=["name"]`),rt.apiCall(`/api/resource/Asset Maintenance Log?filters=${encodeURIComponent(JSON.stringify({custom_hospital_name:S.name,maintenance_status:"Overdue"}))}&fields=["name"]`)]);I.planned_maintenance=((me=de==null?void 0:de.data)==null?void 0:me.length)||0,I.completed_maintenance=((ae=De==null?void 0:De.data)==null?void 0:ae.length)||0,I.overdue_maintenance=((Z=Ne==null?void 0:Ne.data)==null?void 0:Z.length)||0}}catch(K){console.error(`Error fetching counts for ${S.name}:`,K)}return ie({name:S.name,latitude:parseFloat(S.latitude),longitude:parseFloat(S.longitude),location_type:O},I)}),y=()=>oe(null,null,function*(){g(!0);try{let S=[];const O=[];if(!s||t){const A={latitude:["!=",""],longitude:["!=",""],custom_is_hospital:1};t&&(A.name=t),O.push(oe(null,null,function*(){const P=yield rt.apiCall(`/api/resource/Location?filters=${encodeURIComponent(JSON.stringify(A))}&fields=["name","latitude","longitude"]&limit_page_length=0`),ee=((P==null?void 0:P.data)||[]).map(B=>x(B,"hospital"));return Promise.all(ee)}))}if(!t||s){const A={latitude:["!=",""],longitude:["!=",""],custom_is_phcc:1};s&&(A.name=s),O.push(oe(null,null,function*(){const P=yield rt.apiCall(`/api/resource/Location?filters=${encodeURIComponent(JSON.stringify(A))}&fields=["name","latitude","longitude"]&limit_page_length=0`),ee=((P==null?void 0:P.data)||[]).map(B=>x(B,"phcc"));return Promise.all(ee)}))}S=(yield Promise.all(O)).flat().filter(A=>!isNaN(A.latitude)&&!isNaN(A.longitude)),c(S)}catch(S){console.error("Error fetching map data:",S)}finally{g(!1)}});j.useEffect(()=>{y()},[t,s]);const _=(S,O,C)=>{const A=new URLSearchParams,P=S.location_type==="phcc"?"site_name":"company";A.set(P,S.name),O&&A.set("priority",O),C&&A.set("status",C),e(`/work-orders?${A.toString()}`)},k=S=>{const O=new URLSearchParams,C=S.location_type==="phcc"?"custom_site":"company";O.set(C,S.name),e(`/assets?${O.toString()}`)},T=(S,O)=>{const C=new URLSearchParams;S.location_type==="phcc"?C.set("phcc",S.name):C.set("hospital",S.name),O&&C.set("status",O),e(`/maintenance-calendar?${C.toString()}`)},N=S=>{const C=S.location_type==="phcc"?r.jsx("span",{className:"ml-2 px-2 py-0.5 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 text-xs font-semibold rounded-full",children:"PHCC"}):r.jsx("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 text-xs font-semibold rounded-full",children:"Hospital"});return r.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg shadow-lg min-w-[280px] max-w-[320px]",children:[r.jsxs("div",{className:"mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h3",{className:"text-lg font-bold text-gray-900 dark:text-white flex items-center flex-wrap",children:[S.name,C]}),r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:["Total Assets: ",r.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:S.assets})]})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"Work Order Status"}),r.jsxs("div",{className:"flex gap-2 mb-3",children:[r.jsxs("button",{onClick:()=>_(S,"Normal"),className:"px-3 py-1.5 bg-blue-100 dark:bg-blue-900/30 hover:bg-blue-200 dark:hover:bg-blue-900/50 text-blue-700 dark:text-blue-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Normal: ",S.normal_work_orders]}),r.jsxs("button",{onClick:()=>_(S,"Urgent"),className:"px-3 py-1.5 bg-red-100 dark:bg-red-900/30 hover:bg-red-200 dark:hover:bg-red-900/50 text-red-700 dark:text-red-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Urgent: ",S.urgent_work_orders]})]}),r.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left font-semibold text-gray-700 dark:text-gray-300",children:"Status"}),r.jsx("th",{className:"px-3 py-2 text-left font-semibold text-gray-700 dark:text-gray-300",children:"Count"})]})}),r.jsxs("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:[r.jsxs("tr",{className:"bg-red-50 dark:bg-red-900/20 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors",children:[r.jsx("td",{className:"px-3 py-2 text-red-800 dark:text-red-300 font-medium",children:"Open"}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>_(S,void 0,"Open"),className:"text-red-700 dark:text-red-400 font-bold hover:underline cursor-pointer",children:S.wo_open})})]}),r.jsxs("tr",{className:"bg-yellow-50 dark:bg-yellow-900/20 hover:bg-yellow-100 dark:hover:bg-yellow-900/30 transition-colors",children:[r.jsx("td",{className:"px-3 py-2 text-yellow-800 dark:text-yellow-300 font-medium",children:"Work In Progress"}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>_(S,void 0,"Work In Progress"),className:"text-yellow-700 dark:text-yellow-400 font-bold hover:underline cursor-pointer",children:S.wo_progress})})]}),r.jsxs("tr",{className:"bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30 transition-colors",children:[r.jsx("td",{className:"px-3 py-2 text-blue-800 dark:text-blue-300 font-medium",children:"Pending Review"}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>_(S,void 0,"Pending Review"),className:"text-blue-700 dark:text-blue-400 font-bold hover:underline cursor-pointer",children:S.wo_review})})]}),r.jsxs("tr",{className:"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30 transition-colors",children:[r.jsx("td",{className:"px-3 py-2 text-green-800 dark:text-green-300 font-medium",children:"Completed"}),r.jsx("td",{className:"px-3 py-2",children:r.jsx("button",{onClick:()=>_(S,void 0,"Completed"),className:"text-green-700 dark:text-green-400 font-bold hover:underline cursor-pointer",children:S.wo_completed})})]})]})]})})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"Preventive Maintenance"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("button",{onClick:()=>T(S,"Planned"),className:"px-3 py-1.5 bg-orange-100 dark:bg-orange-900/30 hover:bg-orange-200 dark:hover:bg-orange-900/50 text-orange-700 dark:text-orange-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Planned: ",S.planned_maintenance]}),r.jsxs("button",{onClick:()=>T(S,"Completed"),className:"px-3 py-1.5 bg-green-100 dark:bg-green-900/30 hover:bg-green-200 dark:hover:bg-green-900/50 text-green-700 dark:text-green-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Completed: ",S.completed_maintenance]}),r.jsxs("button",{onClick:()=>T(S,"Overdue"),className:"px-3 py-1.5 bg-red-100 dark:bg-red-900/30 hover:bg-red-200 dark:hover:bg-red-900/50 text-red-700 dark:text-red-300 rounded-lg text-xs font-semibold transition-colors cursor-pointer",children:["Overdue: ",S.overdue_maintenance]})]})]}),r.jsxs("div",{className:"flex gap-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[r.jsx("button",{onClick:()=>k(S),className:"flex-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-600 text-white rounded-lg text-sm font-medium transition-colors cursor-pointer",children:"View Assets"}),r.jsx("button",{onClick:()=>_(S),className:"flex-1 px-4 py-2 bg-purple-600 hover:bg-purple-700 dark:bg-purple-700 dark:hover:bg-purple-600 text-white rounded-lg text-sm font-medium transition-colors cursor-pointer",children:"View Work Orders"})]})]})};return r.jsxs("div",{className:"h-screen flex flex-col bg-gray-50 dark:bg-gray-900",children:[r.jsx("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 shadow-sm border-b border-gray-200 dark:border-gray-700 px-4 py-3",children:r.jsx("h1",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:"Active Map"})}),r.jsx("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3 relative z-[1000]",children:r.jsxs("div",{className:"flex flex-wrap gap-4 relative z-[1000]",children:[r.jsx("div",{className:"w-64 relative z-[1000]",children:r.jsx(kt,{label:"Hospital",doctype:"Location",value:t,onChange:a,filters:{custom_is_hospital:1},placeholder:"Select hospital"})}),r.jsx("div",{className:"w-64 relative z-[1000]",children:r.jsx(kt,{label:"PHCC",doctype:"Location",value:s,onChange:i,filters:{custom_is_phcc:1},placeholder:"Select PHCC"})})]})}),r.jsxs("div",{className:"flex-1 relative",style:{zIndex:1},children:[f&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75 dark:bg-gray-900 dark:bg-opacity-75 z-[1000]",children:r.jsx("div",{className:"text-gray-600 dark:text-gray-300",children:"Loading map data..."})}),r.jsxs(RM,{center:[24.8,45.5],zoom:6,style:{height:"100%",width:"100%"},zoomControl:!0,children:[r.jsx(zM,{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),r.jsx(WM,{locations:d}),d.map(S=>{const O=S.urgent_work_orders>0?"🚨 URGENT! ":"",C=S.location_type==="phcc",A=C?"🏥 PHCC":"🏨 Hospital",P=`${S.name}-${S.latitude}-${S.longitude}`;return r.jsxs(FM,{position:[S.latitude,S.longitude],ref:I=>{I&&(p.current[P]=I,setTimeout(()=>{const ee=I.getElement();ee&&(ee.classList.remove("urgent-marker","red-marker","phcc-marker"),S.urgent_work_orders>0?ee.classList.add("urgent-marker","red-marker"):C&&ee.classList.add("phcc-marker"))},100))},children:[r.jsx(BM,{permanent:!1,direction:"right",className:"hospital-tooltip-modern",children:r.jsxs("div",{className:"p-2 bg-white dark:bg-gray-800 rounded-lg shadow-lg min-w-[200px]",children:[r.jsxs("div",{className:"mb-2 pb-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-sm font-bold text-gray-900 dark:text-white",children:[O,S.name]}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:A}),r.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-0.5",children:["Assets: ",r.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:S.assets})]})]}),r.jsxs("div",{className:"space-y-1 text-xs",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Normal WOs:"}),r.jsx("span",{className:"font-semibold text-blue-700 dark:text-blue-300",children:S.normal_work_orders})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Urgent WOs:"}),r.jsx("span",{className:"font-semibold text-red-700 dark:text-red-300",children:S.urgent_work_orders})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Planned PMs:"}),r.jsx("span",{className:"font-semibold text-orange-700 dark:text-orange-300",children:S.planned_maintenance})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Completed PMs:"}),r.jsx("span",{className:"font-semibold text-green-700 dark:text-green-300",children:S.completed_maintenance})]})]})]})}),r.jsx(IM,{className:C?"phcc-popup-container":"hospital-popup-container",maxWidth:320,maxHeight:450,autoPan:!0,keepInView:!0,closeButton:!0,autoClose:!1,children:N(S)})]},P)})]})]}),r.jsx("style",{children:`
|
||
/* Ensure filter container and dropdowns stay above map */
|
||
.leaflet-container {
|
||
z-index: 1 !important;
|
||
}
|
||
|
||
/* LinkField dropdown z-index - ensure it's above everything */
|
||
[data-linkfield-dropdown],
|
||
.linkfield-dropdown,
|
||
.react-select__menu,
|
||
.react-select__menu-portal,
|
||
.select2-container,
|
||
.select2-dropdown {
|
||
z-index: 1050 !important;
|
||
}
|
||
|
||
/* Any dropdown menu from LinkField */
|
||
div[role="listbox"],
|
||
ul[role="listbox"],
|
||
.dropdown-menu,
|
||
.autocomplete-dropdown {
|
||
z-index: 1050 !important;
|
||
}
|
||
|
||
.hospital-tooltip-modern {
|
||
background: transparent !important;
|
||
border: none !important;
|
||
box-shadow: none !important;
|
||
}
|
||
|
||
.hospital-tooltip-modern .leaflet-tooltip-content-wrapper {
|
||
background: transparent !important;
|
||
border: none !important;
|
||
box-shadow: none !important;
|
||
padding: 0 !important;
|
||
}
|
||
|
||
.hospital-tooltip-modern .leaflet-tooltip-content {
|
||
margin: 0 !important;
|
||
}
|
||
|
||
.hospital-popup-container .leaflet-popup-content-wrapper {
|
||
padding: 0;
|
||
border-radius: 8px;
|
||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||
}
|
||
|
||
.hospital-popup-container .leaflet-popup-content {
|
||
margin: 0;
|
||
width: auto !important;
|
||
}
|
||
|
||
/* PHCC Popup Container - with green left border */
|
||
.phcc-popup-container .leaflet-popup-content-wrapper {
|
||
padding: 0;
|
||
border-radius: 8px;
|
||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||
border-left: 4px solid #28a745;
|
||
}
|
||
|
||
.phcc-popup-container .leaflet-popup-content {
|
||
margin: 0;
|
||
width: auto !important;
|
||
}
|
||
|
||
/* Red Flashing Animation for Urgent Work Orders (Both Hospital & PHCC) */
|
||
/* Fixed: Stays red throughout, just pulses brighter */
|
||
.urgent-marker {
|
||
animation: urgent-flash 2s infinite;
|
||
}
|
||
|
||
@keyframes urgent-flash {
|
||
0%, 50% {
|
||
filter: hue-rotate(120deg) saturate(2) brightness(0.8);
|
||
}
|
||
25%, 75% {
|
||
filter: hue-rotate(120deg) saturate(2.5) brightness(1.5) drop-shadow(0 0 10px red);
|
||
}
|
||
}
|
||
|
||
/* Red marker style (base state for urgent) */
|
||
.red-marker {
|
||
filter: hue-rotate(120deg) saturate(2) brightness(0.8);
|
||
}
|
||
|
||
/* Green marker style for PHCC */
|
||
.phcc-marker {
|
||
filter: hue-rotate(-120deg) saturate(1.3) brightness(1.1);
|
||
}
|
||
|
||
.leaflet-popup {
|
||
z-index: 2000 !important;
|
||
}
|
||
|
||
.leaflet-tooltip {
|
||
z-index: 2000 !important;
|
||
}
|
||
`})]})};class GM{getItems(t,a,s=20,i=0){return oe(this,null,function*(){var d;try{const c=new URLSearchParams;t&&c.append("filters",JSON.stringify(t)),a&&c.append("fields",JSON.stringify(a)),c.append("limit_page_length",s.toString()),c.append("limit_start",i.toString());const f=yield rt.apiCall(`/api/resource/Item?${c.toString()}`),g=((d=f.data)==null?void 0:d.length)||0;return{data:f.data||[],total:g}}catch(c){throw console.error("Error fetching items:",c),c}})}getItem(t){return oe(this,null,function*(){try{return(yield rt.apiCall(`/api/resource/Item/${t}`)).data}catch(a){throw console.error("Error fetching item:",a),a}})}createItem(t){return oe(this,null,function*(){try{return(yield rt.apiCall("/api/resource/Item",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).data}catch(a){throw console.error("Error creating item:",a),a}})}updateItem(t,a){return oe(this,null,function*(){try{return(yield rt.apiCall(`/api/resource/Item/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).data}catch(s){throw console.error("Error updating item:",s),s}})}deleteItem(t){return oe(this,null,function*(){try{yield rt.apiCall(`/api/resource/Item/${t}`,{method:"DELETE"})}catch(a){throw console.error("Error deleting item:",a),a}})}submitItem(t){return oe(this,null,function*(){try{return(yield rt.apiCall(`/api/resource/Item/${t}/submit`,{method:"POST"})).data}catch(a){throw console.error("Error submitting item:",a),a}})}cancelItem(t){return oe(this,null,function*(){try{return(yield rt.apiCall(`/api/resource/Item/${t}/cancel`,{method:"POST"})).data}catch(a){throw console.error("Error cancelling item:",a),a}})}}const xc=new GM;function ZM(e,t=20,a=0,s){const[i,d]=j.useState([]),[c,f]=j.useState(0),[g,p]=j.useState(!1),[x,y]=j.useState(!0),[_,k]=j.useState(null),[T,N]=j.useState(0),S=j.useRef(!1),O=JSON.stringify(e);j.useEffect(()=>{if(S.current&&_)return;let A=!1;return S.current=!0,oe(null,null,function*(){try{y(!0);const I=["name","item_code","item_name","item_group","stock_uom","disabled","is_stock_item","custom_hospital_name","opening_stock","valuation_rate","standard_rate","creation","modified","owner","docstatus"],ee=yield xc.getItems(e,I,t,a);A||(d(ee.data),f(ee.total),p(ee.data.length===t),k(null))}catch(I){if(!A){const ee=I instanceof Error?I.message:"Failed to fetch items";k(ee),d([]),f(0),p(!1)}}finally{A||y(!1)}}),()=>{A=!0}},[O,t,a,s,T]);const C=j.useCallback(()=>{S.current=!1,N(A=>A+1)},[]);return{items:i,totalCount:c,hasMore:g,loading:x,error:_,refetch:C}}function qM(e){const[t,a]=j.useState(null),[s,i]=j.useState(!0),[d,c]=j.useState(null),f=j.useCallback(()=>oe(null,null,function*(){if(!e){a(null),i(!1);return}try{i(!0),c(null);const p=yield xc.getItem(e);a(p)}catch(p){c(p instanceof Error?p.message:"Failed to fetch item details")}finally{i(!1)}}),[e]);j.useEffect(()=>{f()},[f]);const g=j.useCallback(()=>{f()},[f]);return{item:t,loading:s,error:d,refetch:g}}function dk(){const[e,t]=j.useState(!1),[a,s]=j.useState(null),i=j.useCallback(g=>oe(null,null,function*(){try{return t(!0),s(null),yield xc.createItem(g)}catch(p){const x=p instanceof Error?p.message:"Failed to create item";throw s(x),p}finally{t(!1)}}),[]),d=j.useCallback((g,p)=>oe(null,null,function*(){try{return t(!0),s(null),yield xc.updateItem(g,p)}catch(x){const y=x instanceof Error?x.message:"Failed to update item";throw s(y),x}finally{t(!1)}}),[]),c=j.useCallback(g=>oe(null,null,function*(){try{t(!0),s(null),yield xc.deleteItem(g)}catch(p){const x=p instanceof Error?p.message:"Failed to delete item";throw s(x),p}finally{t(!1)}}),[]),f=j.useCallback(g=>oe(null,null,function*(){try{return t(!0),s(null),yield xc.submitItem(g)}catch(p){const x=p instanceof Error?p.message:"Failed to submit item";throw s(x),p}finally{t(!1)}}),[]);return{createItem:i,updateItem:d,deleteItem:c,submitItem:f,loading:e,error:a}}const YM=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const{t:g}=Qa(),[p,x]=j.useState(a>0?"selected":"all_with_filters"),[y,_]=j.useState("csv"),[k,T]=j.useState(f.filter(C=>C.default).map(C=>C.key));j.useEffect(()=>{a>0?x("selected"):x("all_with_filters")},[a]);const N=C=>{T(A=>A.includes(C)?A.filter(P=>P!==C):[...A,C])},S=()=>{T(f.map(C=>C.key))},O=()=>{T(f.filter(C=>C.default).map(C=>C.key))};return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qr,{className:"text-white text-xl"}),r.jsxs("h3",{className:"text-lg font-semibold text-white",children:[g("listPages.export")," Items"]})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(vt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Select Data to Export"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:p==="selected",onChange:()=>x("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected item",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:p==="all_on_page",onChange:()=>x("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," item",i!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[i," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${p==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:p==="all_with_filters",onChange:()=>x("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," item",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${y==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:y==="csv",onChange:()=>_("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Ac,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${y==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:y==="excel",onChange:()=>_("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Oc,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:O,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(C=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${k.includes(C.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:k.includes(C.key),onChange:()=>N(C.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:C.label})]},C.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[k.length," column",k.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[p==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,p==="all_on_page"&&`Exporting ${i} row${i!==1?"s":""} from current page`,p==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>d(p,y,k),disabled:k.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_i,{}),"Export"]})})]})]})]})}):null},XM=()=>{const{t:e}=Qa(),t=Na(),[a,s]=j.useState(0),[i,d]=j.useState(null),c=20,f=[{key:"name",label:"Item ID",default:!0},{key:"item_code",label:"Item Code",default:!0},{key:"item_name",label:"Item Name",default:!0},{key:"item_group",label:"Item Group",default:!0},{key:"custom_hospital_name",label:"Hospital",default:!0},{key:"stock_uom",label:"Stock UOM",default:!1},{key:"custom_part_description",label:"Part Description",default:!1},{key:"brand",label:"Brand",default:!1},{key:"valuation_rate",label:"Valuation Rate",default:!1},{key:"opening_stock",label:"Opening Stock",default:!1},{key:"custom_last_calibration_date",label:"Last Calibration Date",default:!1},{key:"custom_next_due_calibration_date",label:"Next Calibration Date",default:!1},{key:"description",label:"Description",default:!1},{key:"creation",label:"Created On",default:!1},{key:"modified",label:"Modified On",default:!0},{key:"owner",label:"Created By",default:!1},{key:"modified_by",label:"Modified By",default:!1}],[g,p]=j.useState(!1),[x,y]=j.useState(new Set),[_,k]=j.useState(!1),[T,N]=j.useState(!1),[S,O]=j.useState(""),[C,A]=j.useState(""),[P,I]=j.useState(""),[ee,B]=j.useState(""),[H,Y]=j.useState(!0),[ue,xe]=j.useState(0),[le,ge]=j.useState([]),[be,me]=j.useState(!1),[ae,Z]=j.useState(""),[K,te]=j.useState(""),se=j.useRef(null);j.useEffect(()=>{const je=localStorage.getItem("itemFilterPresets");je&&ge(JSON.parse(je))},[]),j.useEffect(()=>{const je=[S,C,P,ee].filter(Boolean).length;xe(je)},[S,C,P,ee]);const F={};S&&(F.name=S),C&&(F.item_group=C),P&&(F.custom_hospital_name=P),ee&&(F.item_name=["like",`%${ee}%`]);const{items:D,totalCount:W,hasMore:G,loading:J,error:de,refetch:De}=ZM(Object.keys(F).length>0?F:void 0,c,a*c,"creation desc"),{deleteItem:Ne,loading:$e}=dk();j.useEffect(()=>{!J&&!g&&p(!0)},[J,g]),j.useEffect(()=>{a!==0&&s(0)},[S,C,P,ee]),j.useEffect(()=>{y(new Set)},[S,C,P,ee,a]);const Ve=je=>{te(je),se.current&&clearTimeout(se.current),se.current=window.setTimeout(()=>{B(je)},800)},st=je=>{je.key==="Enter"&&(je.preventDefault(),se.current&&clearTimeout(se.current),B(K))},gt=()=>{if(!ae.trim()){alert("Please enter a filter name");return}const je={id:Date.now(),name:ae,filters:{filterItemId:S,filterItemGroup:C,filterCompany:P,filterItemName:ee}},ut=[...le,je];ge(ut),Z(""),me(!1),localStorage.setItem("itemFilterPresets",JSON.stringify(ut))},zt=je=>{const ut=je.filters;O(ut.filterItemId||""),A(ut.filterItemGroup||""),I(ut.filterCompany||""),B(ut.filterItemName||""),te(ut.filterItemName||"")},Ge=je=>{const ut=le.filter(jt=>jt.id!==je);ge(ut),localStorage.setItem("itemFilterPresets",JSON.stringify(ut))};j.useEffect(()=>()=>{se.current&&clearTimeout(se.current)},[]);const Ct=()=>{O(""),A(""),I(""),B(""),te(""),se.current&&clearTimeout(se.current)},St=S||C||P||ee,Ue=je=>je?new Date(je).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",ce=je=>{y(ut=>{const jt=new Set(ut);return jt.has(je)?jt.delete(je):jt.add(je),jt})},we=()=>{x.size===D.length?y(new Set):y(new Set(D.map(je=>je.name)))},Ie=D.length>0&&x.size===D.length,lt=x.size>0&&x.size<D.length,ft=j.useCallback(()=>oe(null,null,function*(){const je=[];let ut=0;const jt=100;let $t=!0;for(;$t;)try{const dt=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Item",filters:F,fields:["*"],limit_start:ut*jt,limit_page_length:jt,order_by:"creation desc"})})).json()).message||[];je.push(...dt),dt.length<jt?$t=!1:ut++,ut>100&&(console.warn("Export safety limit reached"),$t=!1)}catch(Fe){throw console.error("Error fetching items for export:",Fe),Fe}return je}),[F]),Ze=(je,ut,jt)=>oe(null,null,function*(){N(!0);try{let $t=[];switch(je){case"selected":$t=D.filter(ot=>x.has(ot.name));break;case"all_on_page":$t=D;break;case"all_with_filters":$t=yield ft();break}if($t.length===0){alert("No data to export");return}const Fe=jt.map(ot=>{const dt=f.find(wt=>wt.key===ot);return(dt==null?void 0:dt.label)||ot});if(ut==="csv"){const ot=[Fe.join(","),...$t.map(la=>jt.map(Je=>{let Lt=la[Je]||"";return typeof Lt=="string"&&(Lt.includes(",")||Lt.includes('"')||Lt.includes(`
|
||
`))&&(Lt=`"${Lt.replace(/"/g,'""')}"`),Lt}).join(","))].join(`
|
||
`),dt=new Blob(["\uFEFF"+ot],{type:"text/csv;charset=utf-8;"}),wt=URL.createObjectURL(dt),Ft=document.createElement("a");Ft.href=wt,Ft.download=`items_export_${new Date().toISOString().split("T")[0]}.csv`,Ft.click(),URL.revokeObjectURL(wt)}else if(ut==="excel"){const ot=[Fe,...$t.map(Ft=>jt.map(la=>Ft[la]||""))],dt=kr.aoa_to_sheet(ot),wt=kr.book_new();kr.book_append_sheet(wt,dt,"Items"),Ic(wt,`items_export_${new Date().toISOString().split("T")[0]}.xlsx`)}k(!1),y(new Set)}catch($t){console.error("Export failed:",$t),alert(`Export failed: ${$t instanceof Error?$t.message:"Unknown error"}`)}finally{N(!1)}}),ze=()=>{t("/inventory/new")},bt=je=>{t(`/inventory/${je}`)},Nt=je=>{t(`/inventory/${je}`)},Ot=je=>oe(null,null,function*(){try{yield Ne(je),d(null),De(),alert("Item deleted successfully!")}catch(ut){alert(`Failed to delete: ${ut instanceof Error?ut.message:"Unknown error"}`)}}),Pt=je=>{t(`/inventory/new?duplicate=${je}`)};return J&&!g?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading items..."})]})}):de?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"⚠️ Error Loading Items"}),r.jsxs("div",{className:"text-red-700 dark:text-red-400 space-y-3",children:[r.jsx("p",{children:r.jsx("strong",{children:"Failed to load items."})}),r.jsxs("div",{className:"mt-4 flex gap-3",children:[r.jsx("button",{onClick:()=>t("/inventory/new"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Create New Item"}),r.jsx("button",{onClick:De,className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded",children:"Try Again"})]})]}),r.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded border border-red-300 dark:border-red-700",children:r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[r.jsx("strong",{children:"Technical Error:"})," ",de]})})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:"Inventory"}),r.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:["Total: ",W," item",W!==1?"s":"",x.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",x.size," selected"]}),J&&g&&r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[r.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:()=>k(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:W===0,children:[r.jsx(Qr,{}),r.jsx("span",{className:"font-medium",children:e("listPages.export")}),x.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:x.size})]}),r.jsxs("button",{onClick:ze,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(ts,{}),r.jsx("span",{className:"font-medium",children:"Add Item"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[r.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 dark:from-blue-600 dark:to-blue-700 px-4 py-3 rounded-t-lg",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[r.jsx("button",{onClick:()=>Y(!H),className:"text-white hover:bg-white/20 p-2 rounded-lg transition-all",children:H?r.jsx(m0,{size:14}):r.jsx(Ec,{size:14})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"text-white",size:16}),r.jsx("h3",{className:"text-white font-semibold text-sm",children:e("listPages.filters")})]}),ue>0&&r.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:ue})]}),St&&r.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:r.jsxs("div",{className:"flex items-center gap-2 py-1",children:[S&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-blue-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Item ID:"})," ",S,r.jsx("button",{onClick:je=>{je.stopPropagation(),O("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),ee&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-cyan-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Name:"})," ",ee,r.jsx("button",{onClick:je=>{je.stopPropagation(),B(""),te("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),P&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-green-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",P,r.jsx("button",{onClick:je=>{je.stopPropagation(),I("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]}),C&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-purple-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Item Group:"})," ",C,r.jsx("button",{onClick:je=>{je.stopPropagation(),A("")},className:"hover:text-red-500 transition-colors",children:r.jsx(vt,{className:"text-[9px]"})})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[ue>0&&r.jsxs("button",{onClick:()=>me(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(jr,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),St&&r.jsxs("button",{onClick:Ct,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(vt,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),H&&r.jsxs("div",{className:"p-4",children:[le.length>0&&r.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[r.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:le.map(je=>r.jsxs("div",{className:"group relative inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-100 to-blue-100 dark:from-purple-900/30 dark:to-blue-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:shadow-md transition-all",children:[r.jsx("button",{onClick:()=>zt(je),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:je.name}),r.jsx("button",{onClick:()=>Ge(je.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:r.jsx(ha,{size:10})})]},je.id))})]}),r.jsx("div",{className:"space-y-5",children:r.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(kt,{label:"Item",doctype:"Item",value:S,onChange:je=>O(je),placeholder:"Select Item",disabled:!1,compact:!0}),S&&r.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Item Name"}),r.jsx("input",{type:"text",value:K,onChange:je=>Ve(je.target.value),onKeyDown:st,placeholder:"Type to search...",className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),K&&K!==ee&&r.jsx("span",{className:"absolute right-2 top-6 text-[9px] text-blue-500 animate-pulse",children:"typing..."}),ee&&r.jsx("button",{onClick:()=>{B(""),te("")},className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[59]",children:[r.jsx(kt,{label:"Hospital",doctype:"Company",value:P,onChange:je=>I(je),placeholder:"Select Hospital",disabled:!1,compact:!0,filters:{domain:"Healthcare"}}),P&&r.jsx("button",{onClick:()=>I(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[58]",children:[r.jsx(kt,{label:"Item Group",doctype:"Item Group",value:C,onChange:je=>A(je),placeholder:"Select Item Group",disabled:!1,compact:!0}),C&&r.jsx("button",{onClick:()=>A(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]})]})})})]})]}),be&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),r.jsx("input",{type:"text",value:ae,onChange:je=>Z(je.target.value),onKeyDown:je=>{je.key==="Enter"&&(je.preventDefault(),gt())},placeholder:"Enter filter name (e.g., 'Medical Supplies')",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{me(!1),Z("")},className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:gt,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors flex items-center gap-2",children:[r.jsx(jr,{size:12}),"Save Filter"]})]})]})}),r.jsx(YM,{isOpen:_,onClose:()=>k(!1),selectedCount:x.size,totalCount:W,pageCount:D.length,onExport:Ze,isExporting:T,exportColumns:f}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden relative",children:[J&&g&&r.jsx("div",{className:"absolute inset-0 bg-white/60 dark:bg-gray-800/60 flex items-center justify-center z-10 backdrop-blur-[1px]",children:r.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:we,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:Ie?"Deselect all":"Select all",children:Ie?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):lt?r.jsxs("div",{className:"relative",children:[r.jsx(wr,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(wr,{size:18})})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Item Code"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Item Name"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Item Group"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Hospital"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Updated On"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:D.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:7,className:"px-6 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(vS,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No items found"}),St?r.jsx("button",{onClick:Ct,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Clear filters"}):r.jsx("button",{onClick:ze,className:"mt-4 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"Create your first item"})]})})}):D.map(je=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors cursor-pointer ${x.has(je.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>bt(je.name),children:[r.jsx("td",{className:"px-4 py-4",onClick:ut=>ut.stopPropagation(),children:r.jsx("button",{onClick:()=>ce(je.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:x.has(je.name)?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):r.jsx(wr,{size:18})})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:je.item_code||je.name})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:je.item_name||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:je.item_group||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:je.custom_hospital_name||"-"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:Ue(je.modified)})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:ut=>ut.stopPropagation(),children:[r.jsx("button",{onClick:()=>bt(je.name),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:"View Details",children:r.jsx(hl,{})}),r.jsx("button",{onClick:()=>Nt(je.name),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:"Edit Item",children:r.jsx(Rr,{})}),r.jsx("button",{onClick:()=>Pt(je.name),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:"Duplicate Item",children:r.jsx(Cc,{})}),r.jsx("button",{onClick:()=>d(je.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete Item",disabled:$e,children:r.jsx(ha,{})})]})})]},je.name))})]})}),(G||a>0)&&r.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",a*c+1," to ",Math.min((a+1)*c,W)," of ",W," results"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>s(Math.max(0,a-1)),disabled:a===0,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),r.jsx("button",{onClick:()=>s(a+1),disabled:!G,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]}),i&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(ha,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Item"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this item? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Item ID:"})," ",i]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>d(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",disabled:$e,children:"Cancel"}),r.jsx("button",{onClick:()=>Ot(i),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50",disabled:$e,children:$e?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Deleting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ha,{}),"Delete Item"]})})]})]})]})})}),r.jsx("style",{children:`
|
||
@keyframes scale-in {
|
||
from {
|
||
transform: scale(0.95);
|
||
opacity: 0;
|
||
}
|
||
to {
|
||
transform: scale(1);
|
||
opacity: 1;
|
||
}
|
||
}
|
||
.animate-scale-in {
|
||
animation: scale-in 0.2s ease-out;
|
||
}
|
||
|
||
.scrollbar-hide {
|
||
-ms-overflow-style: none;
|
||
scrollbar-width: none;
|
||
}
|
||
.scrollbar-hide::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
`})]})},JM=()=>{var ge;const{itemName:e}=ul(),t=Na(),[a]=fl(),s=a.get("duplicate"),i=e==="new",d=i&&!!s,[c,f]=j.useState(0),[g,p]=j.useState(!1),[x,y]=j.useState({item_code:"",item_name:"",item_group:"",custom_hospital_name:"",custom_part_description:"",stock_uom:"Nos",custom_item_cost_per_unit:0,disabled:0,is_stock_item:1,opening_stock:0,valuation_rate:0,standard_rate:0,custom_last_calibration_date:"",custom_next_due_calibration_date:"",description:"",brand:"",custom_warranty_in_months:"",valuation_method:"",has_batch_no:0,has_serial_no:0,is_purchase_item:1,is_sales_item:1,country_of_origin:"Saudi Arabia"}),{item:_,loading:k,error:T,refetch:N}=qM(d?s:i?null:e||null),{createItem:S,updateItem:O,loading:C}=dk(),[A,P]=j.useState(i),I=(ge=_==null?void 0:_.docstatus)!=null?ge:0,ee=I===1,B=I===2,H=I===0,Y=x.item_group==="Tools",ue=j.useCallback(be=>oe(null,null,function*(){var me;if(be){p(!0);try{let ae=null;typeof window!="undefined"&&window.csrf_token&&(ae=window.csrf_token);const Z=JSON.stringify([["item_code","=",be]]),K=JSON.stringify(["actual_qty","warehouse"]),te=`${Bt.BASE_URL}/api/resource/Bin?filters=${encodeURIComponent(Z)}&fields=${encodeURIComponent(K)}&limit_page_length=0`,se={Accept:"application/json","Content-Type":"application/json"};ae&&(se["X-Frappe-CSRF-Token"]=ae);const F=yield fetch(te,{method:"GET",headers:se,credentials:"include"});if(!F.ok)throw new Error(`HTTP error! status: ${F.status}`);const W=((me=(yield F.json()).data)==null?void 0:me.reduce((G,J)=>G+(J.actual_qty||0),0))||0;f(W)}catch(ae){console.error("Failed to fetch balance qty:",ae),f(0)}finally{p(!1)}}}),[]);j.useEffect(()=>{!i&&(_!=null&&_.item_code)&&ue(_.item_code)},[i,_==null?void 0:_.item_code,ue]),j.useEffect(()=>{var be,me,ae,Z,K,te;_&&!d?(y({item_code:_.item_code||"",item_name:_.item_name||"",item_group:_.item_group||"",custom_hospital_name:_.custom_hospital_name||"",custom_part_description:_.custom_part_description||"",stock_uom:_.stock_uom||"Nos",custom_item_cost_per_unit:_.custom_item_cost_per_unit||0,disabled:_.disabled||0,is_stock_item:(be=_.is_stock_item)!=null?be:1,opening_stock:_.opening_stock||0,valuation_rate:_.valuation_rate||0,standard_rate:_.standard_rate||0,custom_last_calibration_date:_.custom_last_calibration_date||"",custom_next_due_calibration_date:_.custom_next_due_calibration_date||"",description:_.description||"",brand:_.brand||"",custom_warranty_in_months:_.custom_warranty_in_months||"",valuation_method:_.valuation_method||"",has_batch_no:_.has_batch_no||0,has_serial_no:_.has_serial_no||0,is_purchase_item:(me=_.is_purchase_item)!=null?me:1,is_sales_item:(ae=_.is_sales_item)!=null?ae:1,country_of_origin:_.country_of_origin||"Saudi Arabia",uoms:_.uoms||[],item_defaults:_.item_defaults||[]}),P(!1)):d&&_&&y({item_code:"",item_name:_.item_name||"",item_group:_.item_group||"",custom_hospital_name:_.custom_hospital_name||"",custom_part_description:_.custom_part_description||"",stock_uom:_.stock_uom||"Nos",custom_item_cost_per_unit:_.custom_item_cost_per_unit||0,disabled:0,is_stock_item:(Z=_.is_stock_item)!=null?Z:1,opening_stock:_.opening_stock||0,valuation_rate:_.valuation_rate||0,standard_rate:_.standard_rate||0,custom_last_calibration_date:_.custom_last_calibration_date||"",custom_next_due_calibration_date:_.custom_next_due_calibration_date||"",description:_.description||"",brand:_.brand||"",custom_warranty_in_months:_.custom_warranty_in_months||"",valuation_method:_.valuation_method||"",has_batch_no:_.has_batch_no||0,has_serial_no:_.has_serial_no||0,is_purchase_item:(K=_.is_purchase_item)!=null?K:1,is_sales_item:(te=_.is_sales_item)!=null?te:1,country_of_origin:_.country_of_origin||"Saudi Arabia",uoms:_.uoms||[],item_defaults:_.item_defaults||[]})},[_,d]);const xe=()=>oe(null,null,function*(){try{if(i){const be=yield S(x);t(`/inventory/${be.name}`)}else yield O(e,x),yield N(),x.item_code&&ue(x.item_code),P(!1),alert("Item updated successfully!")}catch(be){alert(`Failed to save: ${be instanceof Error?be.message:"Unknown error"}`)}}),le=j.useCallback(be=>!!(!A||B||ee),[A,B,ee]);return k?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading item..."})]})}):T&&!i?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Item"}),r.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:T}),r.jsx("button",{onClick:()=>t("/inventory"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Back to Inventory"})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("button",{onClick:()=>t("/inventory"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:r.jsx(Gs,{size:20})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-800 dark:text-white",children:i?"New Item":(_==null?void 0:_.item_name)||(_==null?void 0:_.item_code)||"Item"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:i?"Create a new item":`Item Code: ${(_==null?void 0:_.item_code)||e}`})]})]}),r.jsxs("div",{className:"flex gap-3",children:[!i&&!A&&H&&r.jsxs("button",{onClick:()=>P(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Rr,{}),"Edit"]}),A&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{i?t("/inventory"):(P(!1),N())},className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:"Cancel"}),r.jsxs("button",{onClick:xe,disabled:C,className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(jr,{}),C?"Saving...":"Save"]})]})]})]}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Basic Information"})}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Item Code ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",value:x.item_code,onChange:be=>y(Ee(ie({},x),{item_code:be.target.value})),disabled:le("item_code")||!i,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800",required:!0})]}),r.jsx("div",{children:r.jsx(kt,{label:"Hospital",doctype:"Company",value:x.custom_hospital_name||"",onChange:be=>y(Ee(ie({},x),{custom_hospital_name:be})),disabled:le("custom_hospital_name"),placeholder:"Select Hospital",filters:{domain:"Healthcare"}})}),r.jsx("div",{children:r.jsx(kt,{label:"Item Group",doctype:"Item Group",value:x.item_group||"",onChange:be=>y(Ee(ie({},x),{item_group:be})),disabled:le("item_group"),placeholder:"Select item group"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Stock UOM"}),r.jsx("input",{type:"text",value:x.stock_uom,onChange:be=>y(Ee(ie({},x),{stock_uom:be.target.value})),disabled:le("stock_uom"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Part Description"}),r.jsx("input",{type:"text",value:x.custom_part_description,onChange:be=>y(Ee(ie({},x),{custom_part_description:be.target.value})),disabled:le("custom_part_description"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),r.jsx("div",{className:"md:col-span-2 mt-6",children:r.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Stock Information"})}),r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-end",children:[r.jsxs("div",{className:"flex items-center gap-2 h-[42px]",children:[r.jsx("input",{type:"checkbox",id:"is_stock_item",checked:x.is_stock_item===1,onChange:be=>y(Ee(ie({},x),{is_stock_item:be.target.checked?1:0})),disabled:le("is_stock_item"),className:"w-4 h-4"}),r.jsx("label",{htmlFor:"is_stock_item",className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Is Stock Item"})]}),i&&x.is_stock_item===1&&r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Opening Stock"}),r.jsx("input",{type:"number",value:x.opening_stock,onChange:be=>y(Ee(ie({},x),{opening_stock:parseFloat(be.target.value)||0})),disabled:le("opening_stock"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),i&&x.is_stock_item===1&&r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Valuation Rate"}),r.jsx("input",{type:"number",step:"0.01",value:x.valuation_rate,onChange:be=>y(Ee(ie({},x),{valuation_rate:parseFloat(be.target.value)||0})),disabled:le("valuation_rate"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),!i&&x.is_stock_item===1&&r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Balance Qty"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"number",value:c,readOnly:!0,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white cursor-not-allowed"}),r.jsx("button",{type:"button",onClick:()=>x.item_code&&ue(x.item_code),disabled:g,className:"p-2 text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 disabled:opacity-50",title:"Refresh Balance Qty",children:r.jsx(mp,{className:g?"animate-spin":""})})]})]})]})}),Y&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"md:col-span-2 mt-6",children:r.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Calibration Information"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Last Calibration Date"}),r.jsx("input",{type:"date",value:x.custom_last_calibration_date,onChange:be=>y(Ee(ie({},x),{custom_last_calibration_date:be.target.value})),disabled:le("custom_last_calibration_date"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Next Due Calibration Date"}),r.jsx("input",{type:"date",value:x.custom_next_due_calibration_date,onChange:be=>y(Ee(ie({},x),{custom_next_due_calibration_date:be.target.value})),disabled:le("custom_next_due_calibration_date"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]})]}),r.jsx("div",{className:"md:col-span-2 mt-6",children:r.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white mb-4",children:"Additional Information"})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description"}),r.jsx("textarea",{value:x.description,onChange:be=>y(Ee(ie({},x),{description:be.target.value})),disabled:le("description"),rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Warranty (Months)"}),r.jsx("input",{type:"text",value:x.custom_warranty_in_months,onChange:be=>y(Ee(ie({},x),{custom_warranty_in_months:be.target.value})),disabled:le("custom_warranty_in_months"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800"})]})]})})]})};const KM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),QM=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,s)=>s?s.toUpperCase():a.toLowerCase()),qv=e=>{const t=QM(e);return t.charAt(0).toUpperCase()+t.slice(1)},uk=(...e)=>e.filter((t,a,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===a).join(" ").trim(),eL=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var tL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const aL=j.forwardRef((p,g)=>{var x=p,{color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:s,className:i="",children:d,iconNode:c}=x,f=fn(x,["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"]);return j.createElement("svg",ie(ie(Ee(ie({ref:g},tL),{width:t,height:t,stroke:e,strokeWidth:s?Number(a)*24/Number(t):a,className:uk("lucide",i)}),!d&&!eL(f)&&{"aria-hidden":"true"}),f),[...c.map(([y,_])=>j.createElement(y,_)),...Array.isArray(d)?d:[d]])});const Sr=(e,t)=>{const a=j.forwardRef((c,d)=>{var f=c,{className:s}=f,i=fn(f,["className"]);return j.createElement(aL,ie({ref:d,iconNode:t,className:uk(`lucide-${KM(qv(e))}`,`lucide-${e}`,s)},i))});return a.displayName=qv(e),a};const rL=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],nL=Sr("bell",rL);const sL=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]],iL=Sr("calendar-check",sL);const lL=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],oL=Sr("calendar",lL);const cL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],dL=Sr("circle-question-mark",cL);const uL=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],fL=Sr("clipboard-list",uL);const hL=[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]],mL=Sr("construction",hL);const gL=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],pL=Sr("file-text",gL);const xL=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],yL=Sr("languages",xL);const bL=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],vL=Sr("layout-dashboard",bL);const _L=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],wL=Sr("log-out",_L);const kL=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],NL=Sr("map",kL);const jL=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],SL=Sr("menu",jL);const TL=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],EL=Sr("moon",TL);const CL=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Yv=Sr("package",CL);const AL=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],OL=Sr("shopping-cart",AL);const ML=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],LL=Sr("sun",ML);const DL=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],PL=Sr("users",DL);const RL=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],FL=Sr("x",RL),Xv=({title:e="Coming Soon"})=>r.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900 p-4",children:r.jsxs("div",{className:"text-center max-w-md",children:[r.jsx("div",{className:"mb-6 flex justify-center",children:r.jsx("div",{className:"bg-blue-100 dark:bg-blue-900/30 p-6 rounded-full",children:r.jsx(mL,{size:64,className:"text-blue-600 dark:text-blue-400"})})}),r.jsx("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-4",children:e}),r.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 mb-8",children:"This feature is currently under development and will be available soon."}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 shadow-lg",children:r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"We're working hard to bring you the best experience. Stay tuned for updates!"})})]})}),IL=({userEmail:e})=>{const[t,a]=j.useState(!1),s=Vs(),{isRTL:i}=up(),{t:d}=Qa(),c="/assets/asm_ui_app/asm_app/",f="?v=1765196376",g="?v=1765198405",p=c.endsWith("/")?`${c}sidebar-background.jpg${f}`:`${c}/sidebar-background.jpg${f}`,x=e==="financemanager@gmail.com",y=e&&(e.startsWith("enduser1-kash")||e.startsWith("enduser1-dajh")||e.startsWith("enduser1-th")),_=!x&&!y,k=!x&&!y,T=!x&&!y,S=[{id:"dashboard",title:d("common.dashboard"),icon:r.jsx(vL,{size:20}),path:"/dashboard",visible:!0},{id:"assets",title:d("common.assets"),icon:r.jsx(Yv,{size:20}),path:"/assets",visible:_},{id:"inventory",title:"Inventory",icon:r.jsx(Yv,{size:20}),path:"/inventory",visible:!0},{id:"work-orders",title:d("common.workOrders"),icon:r.jsx(fL,{size:20}),path:"/work-orders",visible:T},{id:"ppm-planner",title:"PPM Planner",icon:r.jsx(iL,{size:20}),path:"/ppm-planner",visible:k},{id:"maintenance-calendar",title:"Maintenance Calendar",icon:r.jsx(oL,{size:20}),path:"/maintenance-calendar",visible:k},{id:"active-map",title:"Active Map",icon:r.jsx(NL,{size:20}),path:"/active-map",visible:!0},{id:"maintenance-teams",title:"Maintenance Team",icon:r.jsx(PL,{size:20}),path:"/maintenance-teams",visible:!0},{id:"procurement",title:"Procurement",icon:r.jsx(OL,{size:20}),path:"/procurement",visible:!0},{id:"sla",title:"Service Level Agreement (SLA)",icon:r.jsx(pL,{size:20}),path:"/sla",visible:!0},{id:"support",title:"Support",icon:r.jsx(dL,{size:20}),path:"/support",visible:!0}].filter(C=>C.visible),O=C=>s.pathname===C;return r.jsxs("div",{className:`
|
||
relative
|
||
h-screen
|
||
transition-all
|
||
duration-300
|
||
ease-in-out
|
||
flex
|
||
flex-col
|
||
shadow-xl
|
||
border-r border-gray-200 dark:border-gray-700
|
||
${t?"w-16":"w-64"}
|
||
`,style:{backgroundImage:`url(${p})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"},children:[r.jsx("div",{className:"absolute inset-0 bg-black/60 dark:bg-black/70 z-0"}),r.jsxs("div",{className:"relative z-10 flex flex-col h-full bg-white/0 dark:bg-white/0",children:[r.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200/30 dark:border-gray-700/30",children:[!t&&r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsxs("div",{className:"w-10 h-10 flex items-center justify-center bg-white/20 dark:bg-white/20 rounded-lg p-1 backdrop-blur-sm",children:[r.jsx("img",{src:`${c}${c.endsWith("/")?"":"/"}seera-logo.png${g}`,alt:"Seera-ASM",className:"w-full h-full object-contain",onError:C=>{var A;C.currentTarget.style.display="none",(A=C.currentTarget.nextElementSibling)==null||A.classList.remove("hidden")}}),r.jsxs("svg",{className:"w-6 h-6 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"#6366F1",fillOpacity:"0.9"}),r.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"#8B5CF6",fillOpacity:"0.7"}),r.jsx("path",{d:"M12 12V17",stroke:"#A855F7",strokeWidth:"2",strokeLinecap:"round"})]})]}),r.jsx("h1",{className:"text-white dark:text-white text-lg font-semibold drop-shadow-lg",children:d("sidebar.title")})]}),t&&r.jsxs("div",{className:"w-8 h-8 flex items-center justify-center bg-white dark:bg-gray-700 rounded-lg p-1",children:[r.jsx("img",{src:`${c}${c.endsWith("/")?"":"/"}seera-logo.png?v=1765198405${g}`,alt:"Seera-ASM",className:"w-full h-full object-contain",onError:C=>{var A;C.currentTarget.style.display="none",(A=C.currentTarget.nextElementSibling)==null||A.classList.remove("hidden")}}),r.jsxs("svg",{className:"w-5 h-5 hidden",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"#6366F1",fillOpacity:"0.9"}),r.jsx("path",{d:"M2 17L12 22L22 17V12L12 17L2 12V17Z",fill:"#8B5CF6",fillOpacity:"0.7"}),r.jsx("path",{d:"M12 12V17",stroke:"#A855F7",strokeWidth:"2",strokeLinecap:"round"})]})]}),r.jsx("button",{onClick:()=>a(!t),className:"text-white dark:text-white hover:bg-white/20 dark:hover:bg-white/20 p-2 rounded-lg transition-colors",children:t?r.jsx(SL,{size:20}):r.jsx(FL,{size:20})})]}),r.jsx("nav",{className:"flex-1 overflow-y-auto py-4",children:S.map(C=>r.jsxs(dp,{to:C.path,className:`
|
||
flex
|
||
items-center
|
||
px-4
|
||
py-3
|
||
text-white dark:text-white
|
||
hover:bg-white/20 dark:hover:bg-white/20
|
||
hover:text-white dark:hover:text-white
|
||
transition-all
|
||
duration-200
|
||
${O(C.path)?"bg-white/30 dark:bg-white/30 text-white dark:text-white border-l-4 border-white":""}
|
||
${t?"justify-center":""}
|
||
`,title:t?C.title:"",children:[r.jsx("span",{children:C.icon}),!t&&r.jsx("span",{className:`${i?"mr-4":"ml-4"} font-medium`,children:C.title})]},C.id))}),r.jsxs("div",{className:`${t?"p-2":"p-4"} border-t border-white/10 backdrop-blur-sm bg-white/5 space-y-3 relative z-10`,children:[!t&&e&&r.jsxs("div",{children:[r.jsx("div",{className:"text-white/80 dark:text-white/80 text-xs truncate",children:d("sidebar.loggedInAs")}),r.jsx("div",{className:"text-white dark:text-white text-sm font-medium truncate",children:e})]}),!t&&r.jsx("div",{className:"text-xs text-white/70 dark:text-white/70 text-center",children:d("sidebar.version")})]})]})]})},fk=j.createContext(void 0),zL=({children:e})=>{const[t,a]=j.useState(()=>localStorage.getItem("theme")||"light");j.useEffect(()=>{const i=document.documentElement;localStorage.setItem("theme",t),t==="dark"?i.classList.add("dark"):i.classList.remove("dark")},[t]);const s=()=>{a(i=>i==="light"?"dark":"light")};return r.jsx(fk.Provider,{value:{theme:t,toggleTheme:s},children:e})},BL=()=>{const e=j.useContext(fk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e};class UL{getNotifications(t=50,a=0){return oe(this,null,function*(){var d,c,f,g;const s=localStorage.getItem("user"),i=s?JSON.parse(s).email:"";if(!i)return[];try{const p=JSON.stringify([["for_user","=",i]]),x=JSON.stringify(["name","subject","email_content","document_type","document_name","read","creation","from_user","type"]),y=yield rt.apiCall(`/api/resource/Notification Log?filters=${encodeURIComponent(p)}&fields=${encodeURIComponent(x)}&order_by=creation desc&limit=${t}&offset=${a}`);return console.log("[NotificationService] Fetched notifications:",y==null?void 0:y.data),((d=y==null?void 0:y.data)==null?void 0:d.length)>0&&console.log("[NotificationService] First notification sample:",y.data[0]),(y==null?void 0:y.data)||[]}catch(p){return(c=p==null?void 0:p.message)!=null&&c.includes("417")||(f=p==null?void 0:p.message)!=null&&f.includes("EXPECTATION FAILED")?[]:((g=p==null?void 0:p.message)!=null&&g.includes("417")||console.warn("Notifications API not available:",(p==null?void 0:p.message)||"Unknown error"),[])}})}markAsRead(t){return oe(this,null,function*(){var a,s,i,d;try{return yield rt.apiCall(`/api/resource/Notification Log/${t}`,{method:"PUT",body:JSON.stringify({read:1})})}catch(c){if((a=c==null?void 0:c.message)!=null&&a.includes("417")||(s=c==null?void 0:c.message)!=null&&s.includes("EXPECTATION FAILED")||(i=c==null?void 0:c.message)!=null&&i.includes("PermissionError")||(d=c==null?void 0:c.message)!=null&&d.includes("Insufficient Permission"))return console.warn("[NotificationService] Cannot mark as read (permissions)"),{success:!1,reason:"permission_denied"};throw console.warn("Error marking notification as read:",(c==null?void 0:c.message)||"Unknown error"),c}})}markAllAsRead(){return oe(this,null,function*(){try{const a=(yield this.getNotifications(1e3)).filter(i=>!i.read);let s=0;for(const i of a)try{const d=yield this.markAsRead(i.name);(d==null?void 0:d.success)!==!1&&s++}catch(d){console.error(`Error marking notification ${i.name} as read:`,d)}return{success:!0,marked:s,total:a.length}}catch(t){return console.error("Error marking all notifications as read:",t),{success:!1,marked:0,total:0}}})}getUnreadCount(){return oe(this,null,function*(){try{return(yield this.getNotifications(1e3)).filter(a=>!a.read).length}catch(t){return console.error("Error getting unread count:",t),0}})}}const Dg=new UL;function HL(){const[e,t]=j.useState([]),[a,s]=j.useState(0),[i,d]=j.useState(!0),[c,f]=j.useState(null),g=j.useCallback(()=>oe(null,null,function*(){var y,_;try{d(!0),f(null);const k=yield Dg.getNotifications();t(k),s(k.filter(T=>!T.read).length)}catch(k){if((y=k==null?void 0:k.message)!=null&&y.includes("417")||(_=k==null?void 0:k.message)!=null&&_.includes("EXPECTATION FAILED"))t([]),s(0),f(null);else{const T=k instanceof Error?k.message:"Failed to fetch notifications";f(T),console.warn("Error fetching notifications:",k)}}finally{d(!1)}}),[]);j.useEffect(()=>{g();const y=setInterval(g,3e4);return()=>clearInterval(y)},[g]);const p=j.useCallback(y=>oe(null,null,function*(){try{yield Dg.markAsRead(y),t(_=>_.map(k=>k.name===y?Ee(ie({},k),{read:1}):k)),s(_=>Math.max(0,_-1))}catch(_){throw console.error("Error marking notification as read:",_),_}}),[]),x=j.useCallback(()=>oe(null,null,function*(){try{yield Dg.markAllAsRead(),t(y=>y.map(_=>Ee(ie({},_),{read:1}))),s(0)}catch(y){throw console.error("Error marking all notifications as read:",y),y}}),[]);return{notifications:e,unreadCount:a,loading:i,error:c,markAsRead:p,markAllAsRead:x,refetch:g}}const $L=()=>{const{notifications:e,unreadCount:t,markAsRead:a,markAllAsRead:s}=HL(),[i,d]=j.useState(!1),c=j.useRef(null),f=Na();j.useEffect(()=>{const _=k=>{c.current&&!c.current.contains(k.target)&&d(!1)};return i&&document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[i]);const g=_=>oe(null,null,function*(){if(console.log("[NotificationBell] Clicked notification:",_),console.log("[NotificationBell] document_type:",_.document_type),console.log("[NotificationBell] document_name:",_.document_name),!_.read)try{yield a(_.name)}catch(k){console.warn("[NotificationBell] Could not mark as read (permission issue):",k)}if(_.document_type&&_.document_name){const k=_.document_type,T=_.document_name,N=k.replace(/_/g," ").trim();if(console.log("[NotificationBell] Normalized type:",N),console.log("[NotificationBell] Document name:",T),N==="Asset Maintenance Log"||N==="Asset Maintenance")console.log("[NotificationBell] Navigating to maintenance:",`/maintenance/${T}`),f(`/maintenance/${T}`);else if(N==="Work Order"||N==="Asset Repair")console.log("[NotificationBell] Navigating to work order:",`/work-orders/${T}`),f(`/work-orders/${T}`);else if(N==="Asset")console.log("[NotificationBell] Navigating to asset:",`/assets/${T}`),f(`/assets/${T}`);else if(N==="PM Schedule Generator"||N==="PM Schedule")console.log("[NotificationBell] Navigating to PPM planner:",`/ppm-planner/${T}`),f(`/ppm-planner/${T}`);else if(N==="PPM")console.log("[NotificationBell] Navigating to PPM:",`/ppm/${T}`),f(`/ppm/${T}`);else if(N==="Item")console.log("[NotificationBell] Navigating to inventory:",`/inventory/${T}`),f(`/inventory/${T}`);else{console.warn(`[NotificationBell] Unknown document type: ${k}, opening in Frappe`);const S=k.toLowerCase().replace(/\s+/g,"-").replace(/_/g,"-");window.open(`/app/${S}/${T}`,"_blank")}}else console.warn("[NotificationBell] No document_type or document_name found:",{document_type:_.document_type,document_name:_.document_name,notification:_});d(!1)}),p=_=>{const k=new Date(_),N=new Date().getTime()-k.getTime(),S=Math.floor(N/6e4),O=Math.floor(N/36e5),C=Math.floor(N/864e5);return S<1?"Just now":S<60?`${S}m ago`:O<24?`${O}h ago`:C<7?`${C}d ago`:k.toLocaleDateString()},x=e.filter(_=>!_.read),y=e.filter(_=>_.read).slice(0,10);return r.jsxs("div",{className:"relative",ref:c,children:[r.jsxs("button",{onClick:()=>d(!i),className:"relative p-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Notifications",children:[r.jsx(nL,{size:20}),t>0&&r.jsx("span",{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 rounded-full",children:t>9?"9+":t})]}),i&&r.jsxs("div",{className:"absolute right-0 mt-2 w-80 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 z-[9999] max-h-96 overflow-hidden flex flex-col",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("h3",{className:"font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[r.jsx(R1,{}),"Notifications",t>0&&r.jsxs("span",{className:"text-xs bg-red-500 text-white px-2 py-0.5 rounded-full",children:[t," new"]})]}),t>0&&r.jsx("button",{onClick:s,className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300",children:"Mark all read"})]}),r.jsx("div",{className:"overflow-y-auto flex-1",children:e.length===0?r.jsxs("div",{className:"p-8 text-center text-gray-500 dark:text-gray-400",children:[r.jsx(R1,{className:"mx-auto text-3xl mb-2 opacity-50"}),r.jsx("p",{children:"No notifications"})]}):r.jsxs(r.Fragment,{children:[x.length>0&&r.jsxs("div",{className:"p-2",children:[r.jsx("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 px-2 mb-1",children:"NEW"}),x.map(_=>r.jsx("div",{onClick:()=>g(_),className:"p-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-900/20",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:_.subject||_.document_type||"Notification"}),_.email_content&&r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1 line-clamp-2",children:_.email_content}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mt-1",children:p(_.creation)})]}),r.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full flex-shrink-0 mt-1"})]})},_.name))]}),y.length>0&&r.jsxs("div",{className:"p-2 border-t border-gray-200 dark:border-gray-700",children:[x.length>0&&r.jsx("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 px-2 mb-1",children:"EARLIER"}),y.map(_=>r.jsx("div",{onClick:()=>g(_),className:"p-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer",children:r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 truncate",children:_.subject||_.document_type||"Notification"}),_.email_content&&r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 line-clamp-2",children:_.email_content}),r.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:p(_.creation)})]})})},_.name))]})]})})]})]})},WL=({userEmail:e})=>{const t=Na(),{theme:a,toggleTheme:s}=BL(),{language:i,changeLanguage:d}=up(),{t:c}=Qa(),f=()=>{localStorage.removeItem("user"),localStorage.removeItem("sid"),t("/login")};return r.jsxs("header",{className:"h-14 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 flex items-center justify-end gap-2 flex-shrink-0",children:[e&&r.jsx("div",{className:"hidden md:block text-sm text-gray-600 dark:text-gray-400 mr-2",children:e}),r.jsx("div",{className:"relative",children:r.jsx($L,{})}),r.jsx("button",{onClick:()=>d(i==="en"?"ar":"en"),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-gray-700 dark:text-gray-300",title:c("common.language"),children:r.jsx(yL,{size:20})}),r.jsx("button",{onClick:s,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-gray-700 dark:text-gray-300",title:c(a==="light"?"common.darkMode":"common.lightMode"),children:a==="light"?r.jsx(EL,{size:20}):r.jsx(LL,{size:20})}),r.jsx("button",{onClick:f,className:"p-2 rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors text-red-600 dark:text-red-400",title:c("common.logout"),children:r.jsx(wL,{size:20})})]})};class VL{constructor(){Kn(this,"baseURL");this.baseURL=Bt.BASE_URL}getCSRFToken(){return oe(this,null,function*(){try{return typeof window!="undefined"&&window.csrf_token?window.csrf_token:null}catch(t){return null}})}getHeaders(){return oe(this,null,function*(){const t={Accept:"application/json","Content-Type":"application/json"},a=yield this.getCSRFToken();return a&&(t["X-Frappe-CSRF-Token"]=a),t})}getIssues(){return oe(this,arguments,function*(t={}){const{filters:a={},fields:s=["name","subject","raised_by","status","priority","issue_type","opening_date","company","contact","creation","modified","first_responded_on","resolution_date","resolution_by"],limit_start:i=0,limit_page_length:d=20,order_by:c="creation desc"}=t,f=new URLSearchParams;if(f.append("fields",JSON.stringify(s)),f.append("limit_start",i.toString()),f.append("limit_page_length",d.toString()),f.append("order_by",c),Object.keys(a).length>0){const x=Object.entries(a).map(([y,_])=>[y,"=",_]);f.append("filters",JSON.stringify(x))}const g=yield fetch(`${this.baseURL}/api/resource/Issue?${f.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);return{data:(yield g.json()).data||[]}})}getIssue(t){return oe(this,null,function*(){const a=yield fetch(`${this.baseURL}/api/resource/Issue/${encodeURIComponent(t)}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return(yield a.json()).data})}createIssue(t){return oe(this,null,function*(){const a=yield fetch(`${this.baseURL}/api/resource/Issue`,{method:"POST",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(t)});if(!a.ok){const i=yield a.json().catch(()=>({}));throw new Error(i.message||`HTTP error! status: ${a.status}`)}return(yield a.json()).data})}updateIssue(t,a){return oe(this,null,function*(){const s=yield fetch(`${this.baseURL}/api/resource/Issue/${encodeURIComponent(t)}`,{method:"PUT",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(a)});if(!s.ok){const d=yield s.json().catch(()=>({}));throw new Error(d.message||`HTTP error! status: ${s.status}`)}return(yield s.json()).data})}deleteIssue(t){return oe(this,null,function*(){const a=yield fetch(`${this.baseURL}/api/resource/Issue/${encodeURIComponent(t)}`,{method:"DELETE",headers:yield this.getHeaders(),credentials:"include"});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`)})}getIssueCount(){return oe(this,arguments,function*(t={}){var d,c;const a=new URLSearchParams;if(a.append("fields",JSON.stringify(["count(name) as count"])),Object.keys(t).length>0){const f=Object.entries(t).map(([g,p])=>[g,"=",p]);a.append("filters",JSON.stringify(f))}const s=yield fetch(`${this.baseURL}/api/resource/Issue?${a.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return((c=(d=(yield s.json()).data)==null?void 0:d[0])==null?void 0:c.count)||0})}}const wc=new VL,GL=(e={})=>{const[t,a]=j.useState([]),[s,i]=j.useState(!0),[d,c]=j.useState(null),[f,g]=j.useState(0),p=j.useCallback(()=>oe(null,null,function*(){try{i(!0),c(null);const x=yield wc.getIssues(e);a(x.data);const y=yield wc.getIssueCount(e.filters);g(y)}catch(x){c(x instanceof Error?x.message:"Failed to fetch issues")}finally{i(!1)}}),[JSON.stringify(e)]);return j.useEffect(()=>{p()},[p]),{issues:t,loading:s,error:d,totalCount:f,refetch:p}},ZL=e=>{const[t,a]=j.useState(null),[s,i]=j.useState(!1),[d,c]=j.useState(null),f=j.useCallback(()=>oe(null,null,function*(){if(!e){a(null);return}try{i(!0),c(null);const g=yield wc.getIssue(e);a(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch issue details")}finally{i(!1)}}),[e]);return j.useEffect(()=>{f()},[f]),{issue:t,loading:s,error:d,refetch:f}},qL=()=>{const[e,t]=j.useState(!1),[a,s]=j.useState(null);return{createIssue:f=>oe(null,null,function*(){try{return t(!0),s(null),yield wc.createIssue(f)}catch(g){const p=g instanceof Error?g.message:"Failed to create issue";throw s(p),g}finally{t(!1)}}),updateIssue:(f,g)=>oe(null,null,function*(){try{return t(!0),s(null),yield wc.updateIssue(f,g)}catch(p){const x=p instanceof Error?p.message:"Failed to update issue";throw s(x),p}finally{t(!1)}}),deleteIssue:f=>oe(null,null,function*(){try{t(!0),s(null),yield wc.deleteIssue(f)}catch(g){const p=g instanceof Error?g.message:"Failed to delete issue";throw s(p),g}finally{t(!1)}}),loading:e,error:a}},YL=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const[g,p]=j.useState(a>0?"selected":"all_with_filters"),[x,y]=j.useState("csv"),[_,k]=j.useState(f.filter(O=>O.default).map(O=>O.key));j.useEffect(()=>{a>0?p("selected"):p("all_with_filters")},[a]);const T=O=>{k(C=>C.includes(O)?C.filter(A=>A!==O):[...C,O])},N=()=>k(f.map(O=>O.key)),S=()=>k(f.filter(O=>O.default).map(O=>O.key));return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qr,{className:"text-white text-xl"}),r.jsx("h3",{className:"text-lg font-semibold text-white",children:"Export Issues"})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(vt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Select Data to Export"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>p("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected issue",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>p("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," issue",i!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[i," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>p("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," issue",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${x==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:x==="csv",onChange:()=>y("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Ac,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${x==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:x==="excel",onChange:()=>y("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Oc,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:N,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(O=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${_.includes(O.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:_.includes(O.key),onChange:()=>T(O.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:O.label})]},O.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[_.length," column",_.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,g==="all_on_page"&&`Exporting ${i} row${i!==1?"s":""} from current page`,g==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>d(g,x,_),disabled:_.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_i,{}),"Export"]})})]})]})]})}):null},XL=e=>{switch(e==null?void 0:e.toLowerCase()){case"open":return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300";case"replied":return"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300";case"on hold":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300";case"resolved":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300";case"closed":return"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";default:return"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}},JL=e=>{switch(e==null?void 0:e.toLowerCase()){case"high":return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300";case"medium":return"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300";case"low":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300";default:return"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}},KL=()=>{const{t:e}=Qa(),t=Na(),a=[{key:"name",label:e("issues.issueId"),default:!0},{key:"subject",label:e("issues.subject"),default:!0},{key:"status",label:e("commonFields.status"),default:!0},{key:"priority",label:e("commonFields.priority"),default:!0},{key:"raised_by",label:e("issues.raisedBy"),default:!0},{key:"company",label:e("commonFields.company"),default:!0},{key:"contact",label:e("issues.contact"),default:!1},{key:"issue_type",label:e("issues.issueType"),default:!1},{key:"opening_date",label:e("issues.openingDate"),default:!0},{key:"resolution_date",label:e("issues.resolutionDate"),default:!1},{key:"resolution_by",label:e("issues.resolvedBy"),default:!1},{key:"first_responded_on",label:e("issues.firstRespondedOn"),default:!1},{key:"description",label:e("commonFields.description"),default:!1},{key:"resolution_details",label:e("issues.resolutionDetails"),default:!1},{key:"creation",label:e("commonFields.createdOn"),default:!1},{key:"modified",label:e("commonFields.modifiedOn"),default:!1},{key:"owner",label:e("commonFields.createdBy"),default:!1}],[s,i]=j.useState(1),[d]=j.useState(20),[c,f]=j.useState(!1),[g,p]=j.useState(new Set),[x,y]=j.useState(!1),[_,k]=j.useState(!1),[T,N]=j.useState(null),[S,O]=j.useState(""),[C,A]=j.useState(""),[P,I]=j.useState(""),[ee,B]=j.useState(""),[H,Y]=j.useState(!1),[ue,xe]=j.useState(0),[le,ge]=j.useState([]),[be,me]=j.useState(!1),[ae,Z]=j.useState("");j.useEffect(()=>{const ce=localStorage.getItem("issueFilterPresets");ce&&ge(JSON.parse(ce))},[]),j.useEffect(()=>{const ce=[S,C,P,ee].filter(Boolean).length;xe(ce)},[S,C,P,ee]);const K=j.useMemo(()=>{const ce={};return S&&(ce.status=S),C&&(ce.priority=C),P&&(ce.company=P),ee&&(ce.name=ee),ce},[S,C,P,ee]),{issues:te,loading:se,error:F,totalCount:D,refetch:W}=GL({filters:K,limit_start:(s-1)*d,limit_page_length:d,order_by:"creation desc"});j.useEffect(()=>{!se&&!c&&f(!0)},[se,c]),j.useEffect(()=>{s!==1&&i(1)},[S,C,P,ee]),j.useEffect(()=>{p(new Set)},[S,C,P,ee,s]);const G=Math.ceil(D/d),J=ce=>ce?new Date(ce).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"-",de=()=>{O(""),A(""),I(""),B(""),i(1)},De=S||C||P||ee,Ne=()=>{if(!ae.trim()){alert("Please enter a filter name");return}const ce={id:Date.now(),name:ae,filters:{statusFilter:S,priorityFilter:C,companyFilter:P,issueIdFilter:ee}},we=[...le,ce];ge(we),Z(""),me(!1),localStorage.setItem("issueFilterPresets",JSON.stringify(we))},$e=ce=>{const we=ce.filters;O(we.statusFilter||""),A(we.priorityFilter||""),I(we.companyFilter||""),B(we.issueIdFilter||"")},Ve=ce=>{const we=le.filter(Ie=>Ie.id!==ce);ge(we),localStorage.setItem("issueFilterPresets",JSON.stringify(we))},st=ce=>{p(we=>{const Ie=new Set(we);return Ie.has(ce)?Ie.delete(ce):Ie.add(ce),Ie})},gt=()=>{g.size===te.length?p(new Set):p(new Set(te.map(ce=>ce.name)))},zt=te.length>0&&g.size===te.length,Ge=g.size>0&&g.size<te.length,Ct=j.useCallback(()=>oe(null,null,function*(){const ce=[];let we=0;const Ie=100;let lt=!0;for(;lt;)try{const ze=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Issue",filters:K,fields:["*"],limit_start:we*Ie,limit_page_length:Ie,order_by:"creation desc"})})).json()).message||[];ce.push(...ze),ze.length<Ie?lt=!1:we++,we>100&&(console.warn("Export safety limit reached"),lt=!1)}catch(ft){throw console.error("Error fetching issues for export:",ft),ft}return ce}),[K]),St=(ce,we,Ie)=>oe(null,null,function*(){k(!0);try{let lt=[];switch(ce){case"selected":lt=te.filter(Ze=>g.has(Ze.name));break;case"all_on_page":lt=te;break;case"all_with_filters":lt=yield Ct();break}if(lt.length===0){alert("No data to export");return}const ft=Ie.map(Ze=>{var ze;return((ze=a.find(bt=>bt.key===Ze))==null?void 0:ze.label)||Ze});if(we==="csv"){const Ze=[ft.join(","),...lt.map(Ot=>Ie.map(Pt=>{let je=Ot[Pt]||"";return typeof je=="string"&&(je.includes(",")||je.includes('"')||je.includes(`
|
||
`))&&(je=`"${je.replace(/"/g,'""')}"`),je}).join(","))].join(`
|
||
`),ze=new Blob(["\uFEFF"+Ze],{type:"text/csv;charset=utf-8;"}),bt=URL.createObjectURL(ze),Nt=document.createElement("a");Nt.href=bt,Nt.download=`issues_export_${new Date().toISOString().split("T")[0]}.csv`,Nt.click(),URL.revokeObjectURL(bt)}else if(we==="excel"){const Ze=[ft,...lt.map(Nt=>Ie.map(Ot=>Nt[Ot]||""))],ze=kr.aoa_to_sheet(Ze),bt=kr.book_new();kr.book_append_sheet(bt,ze,"Issues"),Ic(bt,`issues_export_${new Date().toISOString().split("T")[0]}.xlsx`)}y(!1),p(new Set)}catch(lt){console.error("Export failed:",lt),alert(`Export failed: ${lt instanceof Error?lt.message:"Unknown error"}`)}finally{k(!1)}}),Ue=ce=>oe(null,null,function*(){try{if(!(yield fetch(`/api/resource/Issue/${ce}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to delete");N(null),W(),alert("Issue deleted successfully!")}catch(we){alert(`Failed to delete: ${we instanceof Error?we.message:"Unknown error"}`)}});return se&&!c?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading issues..."})]})}):F?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Issues"}),r.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:F}),r.jsx("button",{onClick:W,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Again"})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsx("div",{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(I1,{className:"text-3xl text-blue-600 dark:text-blue-400"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:"Support Issues"}),r.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Total: ",D," issue",D!==1?"s":"",g.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",g.size," selected"]}),se&&c&&r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[r.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]})]})}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:()=>Y(!H),className:`px-4 py-2 rounded-lg flex items-center gap-2 transition-colors ${H||De?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:[r.jsx(ws,{}),"Filters",ue>0&&r.jsx("span",{className:"bg-blue-600 text-white text-xs px-1.5 py-0.5 rounded-full",children:ue})]}),r.jsxs("button",{onClick:W,disabled:se,className:"px-4 py-2 rounded-lg bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 flex items-center gap-2 disabled:opacity-50",children:[r.jsx(mp,{className:se?"animate-spin":""}),"Refresh"]}),r.jsxs("button",{onClick:()=>y(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:D===0,children:[r.jsx(Qr,{}),r.jsx("span",{className:"font-medium",children:"Export"}),g.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:g.size})]}),r.jsxs("button",{onClick:()=>t("/support/new"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(ts,{}),r.jsx("span",{className:"font-medium",children:"New Issue"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-4",children:[r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Total Issues"}),r.jsx("p",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:D})]}),r.jsx(jS,{className:"text-3xl text-blue-500"})]})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Open"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:te.filter(ce=>ce.status==="Open").length})]}),r.jsx(ll,{className:"text-3xl text-blue-500"})]})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Resolved"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:te.filter(ce=>ce.status==="Resolved").length})]}),r.jsx(Ja,{className:"text-3xl text-green-500"})]})}),r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Closed"}),r.jsx("p",{className:"text-2xl font-bold text-gray-600 dark:text-gray-300",children:te.filter(ce=>ce.status==="Closed").length})]}),r.jsx(hn,{className:"text-3xl text-gray-500"})]})})]}),H&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[r.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-blue-600 dark:from-blue-600 dark:to-blue-700 px-4 py-3 rounded-t-lg",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ws,{className:"text-white",size:16}),r.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"}),ue>0&&r.jsx("span",{className:"bg-white text-blue-600 px-2 py-0.5 rounded-full text-xs font-bold",children:ue})]}),De&&r.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:r.jsxs("div",{className:"flex items-center gap-2 py-1",children:[ee&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-blue-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Issue:"})," ",ee,r.jsx("button",{onClick:()=>B(""),className:"hover:text-red-500",children:r.jsx(vt,{className:"text-[9px]"})})]}),S&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-green-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Status:"})," ",S,r.jsx("button",{onClick:()=>O(""),className:"hover:text-red-500",children:r.jsx(vt,{className:"text-[9px]"})})]}),C&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-orange-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Priority:"})," ",C,r.jsx("button",{onClick:()=>A(""),className:"hover:text-red-500",children:r.jsx(vt,{className:"text-[9px]"})})]}),P&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-purple-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Company:"})," ",P,r.jsx("button",{onClick:()=>I(""),className:"hover:text-red-500",children:r.jsx(vt,{className:"text-[9px]"})})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[ue>0&&r.jsxs("button",{onClick:()=>me(!0),className:"px-3 py-1.5 bg-white text-blue-600 hover:bg-blue-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(jr,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),De&&r.jsxs("button",{onClick:de,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(vt,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),r.jsxs("div",{className:"p-4",children:[le.length>0&&r.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[r.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:le.map(ce=>r.jsxs("div",{className:"group relative inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-100 to-blue-100 dark:from-purple-900/30 dark:to-blue-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:shadow-md transition-all",children:[r.jsx("button",{onClick:()=>$e(ce),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:ce.name}),r.jsx("button",{onClick:()=>Ve(ce.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:r.jsx(ha,{size:10})})]},ce.id))})]}),r.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(kt,{label:"Issue",doctype:"Issue",value:ee,onChange:ce=>{B(ce),i(1)},placeholder:"Select Issue",disabled:!1,compact:!0}),ee&&r.jsx("button",{onClick:()=>B(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("label",{className:"block text-[10px] font-medium text-gray-700 dark:text-gray-300 mb-0.5",children:"Status"}),r.jsxs("select",{value:S,onChange:ce=>{O(ce.target.value),i(1)},className:"w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[r.jsx("option",{value:"",children:"All Statuses"}),r.jsx("option",{value:"Open",children:"Open"}),r.jsx("option",{value:"Replied",children:"Replied"}),r.jsx("option",{value:"On Hold",children:"On Hold"}),r.jsx("option",{value:"Resolved",children:"Resolved"}),r.jsx("option",{value:"Closed",children:"Closed"})]})]}),r.jsxs("div",{className:"relative z-[59]",children:[r.jsx(kt,{label:e("commonFields.priority"),doctype:"Issue Priority",value:C,onChange:ce=>{A(ce),i(1)},placeholder:e("issues.allPriorities"),disabled:!1,compact:!0}),C&&r.jsx("button",{onClick:()=>A(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[58]",children:[r.jsx(kt,{label:e("commonFields.company"),doctype:"Company",value:P,onChange:ce=>{I(ce),i(1)},placeholder:e("issues.allCompanies"),disabled:!1,compact:!0}),P&&r.jsx("button",{onClick:()=>I(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]})]})})]})]}),be&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Save Filter Preset"}),r.jsx("input",{type:"text",value:ae,onChange:ce=>Z(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&(ce.preventDefault(),Ne())},placeholder:"Enter filter name (e.g., 'Open High Priority')",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{me(!1),Z("")},className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:Ne,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors flex items-center gap-2",children:[r.jsx(jr,{size:12}),"Save Filter"]})]})]})}),r.jsx(YL,{isOpen:x,onClose:()=>y(!1),selectedCount:g.size,totalCount:D,pageCount:te.length,onExport:St,isExporting:_,exportColumns:a}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700 overflow-hidden relative",children:[se&&c&&r.jsx("div",{className:"absolute inset-0 bg-white/60 dark:bg-gray-800/60 flex items-center justify-center z-10 backdrop-blur-[1px]",children:r.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"}),r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Filtering..."})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:gt,className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",title:e(zt?"listPages.deselectAllTitle":"listPages.selectAllTitle"),children:zt?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):Ge?r.jsxs("div",{className:"relative",children:[r.jsx(wr,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(wr,{size:18})})}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("issues.issueId")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("issues.subject")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("commonFields.status")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("commonFields.priority")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("commonFields.company")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("issues.openingDate")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("listPages.actions")})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:te.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"px-4 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(I1,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:"No issues found"}),De?r.jsx("button",{onClick:de,className:"mt-4 text-blue-600 dark:text-blue-400 hover:underline",children:"Clear filters"}):r.jsx("button",{onClick:()=>t("/support/new"),className:"mt-4 text-blue-600 dark:text-blue-400 hover:underline",children:"Create your first issue"})]})})}):te.map(ce=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 cursor-pointer transition-colors ${g.has(ce.name)?"bg-blue-50 dark:bg-blue-900/20":""}`,onClick:()=>t(`/support/${ce.name}`),children:[r.jsx("td",{className:"px-4 py-3",onClick:we=>we.stopPropagation(),children:r.jsx("button",{onClick:()=>st(ce.name),className:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors",children:g.has(ce.name)?r.jsx(Fn,{className:"text-blue-600 dark:text-blue-400",size:18}):r.jsx(wr,{size:18})})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-400",children:ce.name})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("span",{className:"text-sm text-gray-900 dark:text-white line-clamp-1",children:ce.subject||"-"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-medium rounded-full ${XL(ce.status)}`,children:ce.status||"-"})}),r.jsx("td",{className:"px-4 py-3",children:ce.priority?r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-medium rounded-full ${JL(ce.priority)}`,children:ce.priority}):r.jsx("span",{className:"text-gray-400",children:"-"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 line-clamp-1",children:ce.company||"-"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:J(ce.opening_date)})}),r.jsx("td",{className:"px-4 py-3",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:we=>we.stopPropagation(),children:[r.jsx("button",{onClick:()=>t(`/support/${ce.name}`),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:e("issues.viewDetails"),children:r.jsx(hl,{})}),r.jsx("button",{onClick:()=>t(`/support/${ce.name}`),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:e("issues.editIssue"),children:r.jsx(Rr,{})}),r.jsx("button",{onClick:()=>N(ce.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:e("issues.deleteIssue"),children:r.jsx(ha,{})})]})})]},ce.name))})]})}),G>1&&r.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Showing ",(s-1)*d+1," to ",Math.min(s*d,D)," of ",D," issues"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>i(ce=>Math.max(1,ce-1)),disabled:s===1,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50 dark:hover:bg-gray-700",children:r.jsx(Vf,{})}),r.jsxs("span",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:["Page ",s," of ",G]}),r.jsx("button",{onClick:()=>i(ce=>Math.min(G,ce+1)),disabled:s===G,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50 dark:hover:bg-gray-700",children:r.jsx(Gf,{})})]})]})]}),T&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(ha,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Issue"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this issue? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Issue ID:"})," ",T]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>N(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:()=>Ue(T),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2",children:[r.jsx(ha,{}),"Delete Issue"]})]})]})]})})}),r.jsx("style",{children:`
|
||
@keyframes scale-in { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
|
||
.animate-scale-in { animation: scale-in 0.2s ease-out; }
|
||
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
|
||
.scrollbar-hide::-webkit-scrollbar { display: none; }
|
||
`})]})},QL=()=>new Date().toISOString().split("T")[0],eD=()=>new Date().toTimeString().split(" ")[0],tD=e=>{switch(e==null?void 0:e.toLowerCase()){case"open":return{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-800 dark:text-blue-300",border:"border-blue-200 dark:border-blue-800"};case"replied":return{bg:"bg-purple-100 dark:bg-purple-900/30",text:"text-purple-800 dark:text-purple-300",border:"border-purple-200 dark:border-purple-800"};case"on hold":return{bg:"bg-yellow-100 dark:bg-yellow-900/30",text:"text-yellow-800 dark:text-yellow-300",border:"border-yellow-200 dark:border-yellow-800"};case"resolved":return{bg:"bg-green-100 dark:bg-green-900/30",text:"text-green-800 dark:text-green-300",border:"border-green-200 dark:border-green-800"};case"closed":return{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-800 dark:text-gray-300",border:"border-gray-200 dark:border-gray-600"};default:return{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-800 dark:text-gray-300",border:"border-gray-200 dark:border-gray-600"}}},aD=()=>{const{t:e}=Qa(),{issueName:t}=ul(),a=Na(),s=t==="new",[i,d]=j.useState({subject:"",raised_by:"",status:"Open",priority:"",issue_type:"",description:"",contact:"",company:"",customer:"",project:"",resolution_details:"",opening_date:s?QL():"",opening_time:s?eD():"",first_responded_on:"",resolution_date:"",resolution_by:""}),{issue:c,loading:f,error:g,refetch:p}=ZL(s?null:t||null),{createIssue:x,updateIssue:y,deleteIssue:_,loading:k}=qL(),[T,N]=j.useState(s),[S,O]=j.useState(!1);j.useEffect(()=>{c&&!s&&(d({subject:c.subject||"",raised_by:c.raised_by||"",status:c.status||"Open",priority:c.priority||"",issue_type:c.issue_type||"",description:c.description||"",contact:c.contact||"",company:c.company||"",customer:c.customer||"",project:c.project||"",resolution_details:c.resolution_details||"",opening_date:c.opening_date||"",opening_time:c.opening_time||"",first_responded_on:c.first_responded_on?c.first_responded_on.split(" ")[0]:"",resolution_date:c.resolution_date?c.resolution_date.split(" ")[0]:"",resolution_by:c.resolution_by||""}),N(!1))},[c,s]);const C=Y=>{const{name:ue,value:xe}=Y.target;d(le=>Ee(ie({},le),{[ue]:xe}))},A=()=>oe(null,null,function*(){if(!i.subject){Et.error("Please enter a subject",{position:"top-right",autoClose:4e3,icon:r.jsx(hn,{})});return}try{if(s){const Y=yield x(i);Et.success("Issue created successfully!",{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),a(`/support/${Y.name}`)}else yield y(t,i),Et.success("Issue updated successfully!",{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),N(!1),p()}catch(Y){const ue=Y instanceof Error?Y.message:"Unknown error";Et.error(`Failed to save: ${ue}`,{position:"top-right",autoClose:6e3,icon:r.jsx(hn,{})})}}),P=()=>oe(null,null,function*(){try{yield _(t),Et.success("Issue deleted successfully!",{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),a("/support")}catch(Y){const ue=Y instanceof Error?Y.message:"Unknown error";Et.error(`Failed to delete: ${ue}`,{position:"top-right",autoClose:6e3,icon:r.jsx(hn,{})})}}),I=j.useCallback(Y=>!!(!T||["opening_date","opening_time"].includes(Y)&&!s),[T,s]),ee=Y=>Y?new Date(Y).toLocaleString():"-";if(f)return r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading issue details..."})]})});if(g&&!s)return r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Issue"}),r.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:g}),r.jsx("button",{onClick:()=>a("/support"),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Back to Issues"})]})});const B=(c==null?void 0:c.status)||i.status||"Open",H=tD(B);return r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[r.jsx(Hp,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:fh}),r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("button",{onClick:()=>a("/support"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:r.jsx(Gs,{size:20})}),r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white flex items-center gap-3",children:[s?e("issues.newIssue"):(c==null?void 0:c.name)||e("issues.issueDetails"),!s&&r.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${H.bg} ${H.text} ${H.border} border`,children:B})]}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:s?e("issues.createNewIssue"):i.subject})]})]}),r.jsxs("div",{className:"flex gap-3",children:[!s&&!T&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>N(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Rr,{}),e("common.edit")]}),r.jsxs("button",{onClick:()=>O(!0),className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(ha,{}),e("common.delete")]})]}),T&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{s?a("/support"):(N(!1),p())},className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:e("common.cancel")}),r.jsxs("button",{onClick:A,disabled:k,className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(jr,{}),e(k?"common.saving":"common.save")]})]})]})]}),S&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[r.jsx(yr,{className:"text-red-500 text-xl mt-0.5"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Delete Issue"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Are you sure you want to delete this issue? This action cannot be undone."})]})]}),r.jsxs("div",{className:"flex justify-end gap-3",children:[r.jsx("button",{onClick:()=>O(!1),className:"px-4 py-2 bg-gray-300 hover:bg-gray-400 text-gray-700 rounded-lg",children:"Cancel"}),r.jsx("button",{onClick:P,disabled:k,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg disabled:opacity-50",children:k?"Deleting...":"Delete"})]})]})}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(kS,{className:"text-blue-500"}),e("issues.issueDetails")]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[e("issues.subject")," ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"subject",value:i.subject,onChange:C,disabled:I("subject"),placeholder:e("issues.enterSubject"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("commonFields.status")}),r.jsxs("select",{name:"status",value:i.status,onChange:C,disabled:I("status"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"Open",children:"Open"}),r.jsx("option",{value:"Replied",children:"Replied"}),r.jsx("option",{value:"On Hold",children:"On Hold"}),r.jsx("option",{value:"Resolved",children:"Resolved"}),r.jsx("option",{value:"Closed",children:"Closed"})]})]}),r.jsx("div",{children:r.jsx(kt,{label:e("commonFields.priority"),doctype:"Issue Priority",value:i.priority||"",onChange:Y=>d(Ee(ie({},i),{priority:Y})),disabled:I("priority"),placeholder:e("issues.selectPriority")})})]}),r.jsx("div",{children:r.jsx(kt,{label:e("issues.issueType"),doctype:"Issue Type",value:i.issue_type||"",onChange:Y=>d(Ee(ie({},i),{issue_type:Y})),disabled:I("issue_type"),placeholder:e("issues.selectIssueType")})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("commonFields.description")}),r.jsx("textarea",{name:"description",value:i.description,onChange:C,disabled:I("description"),placeholder:e("issues.describeIssue"),rows:5,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(R_,{className:"text-green-500"}),e("issues.contactInformation")]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("issues.raisedBy")}),r.jsxs("div",{className:"relative",children:[r.jsx(NS,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"email",name:"raised_by",value:i.raised_by,onChange:C,disabled:I("raised_by"),placeholder:e("common.email"),className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),r.jsx("div",{children:r.jsx(kt,{label:e("commonFields.company"),doctype:"Company",value:i.company||"",onChange:Y=>d(Ee(ie({},i),{company:Y})),disabled:I("company"),placeholder:e("issues.selectCompany")})})]})]}),!s&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(Ja,{className:"text-purple-500"}),e("issues.resolution")]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("issues.firstRespondedOn")}),r.jsx("input",{type:"date",name:"first_responded_on",value:i.first_responded_on||"",onChange:C,disabled:I("first_responded_on"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("issues.resolutionDate")}),r.jsx("input",{type:"date",name:"resolution_date",value:i.resolution_date||"",onChange:C,disabled:I("resolution_date"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),r.jsx("div",{children:r.jsx(kt,{label:e("issues.resolvedBy"),doctype:"User",value:i.resolution_by||"",onChange:Y=>d(Ee(ie({},i),{resolution_by:Y})),disabled:I("resolution_by"),placeholder:e("maintenance.selectUser")})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("issues.resolutionDetails")}),r.jsx("textarea",{name:"resolution_details",value:i.resolution_details,onChange:C,disabled:I("resolution_details"),placeholder:e("issues.describeResolution"),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"})]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(AS,{className:"text-orange-500"}),e("issues.statusInformation")]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:`p-4 rounded-lg border ${H.bg} ${H.border}`,children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("issues.currentStatus")}),r.jsx("p",{className:`text-xl font-semibold ${H.text}`,children:B})]}),i.priority&&r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("commonFields.priority")}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:i.priority})]}),i.issue_type&&r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("issues.issueType")}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:i.issue_type})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(xi,{className:"text-teal-500"}),e("issues.timeline")]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("issues.openingDate")}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:i.opening_date||"-"})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Opening Time"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:i.opening_time||"-"})]}),!s&&c&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:ee(c.creation)})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Last Modified"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:ee(c.modified)})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Modified By"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:c.modified_by||"-"})]})]})]})]}),i.company&&!s&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(hp,{className:"text-indigo-500"}),"Company"]}),r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:i.company})})]})]})]})]})};class rD{constructor(){Kn(this,"baseURL");this.baseURL=Bt.BASE_URL}getCSRFToken(){return oe(this,null,function*(){try{return typeof window!="undefined"&&window.csrf_token?window.csrf_token:null}catch(t){return null}})}getHeaders(){return oe(this,null,function*(){const t={Accept:"application/json","Content-Type":"application/json"},a=yield this.getCSRFToken();return a&&(t["X-Frappe-CSRF-Token"]=a),t})}getMaintenanceTeams(){return oe(this,arguments,function*(t={}){const{filters:a={},fields:s=["name","maintenance_team_name","maintenance_manager","maintenance_manager_name","company","custom_expertise","creation","modified"],limit_start:i=0,limit_page_length:d=20,order_by:c="creation desc"}=t,f=new URLSearchParams;if(f.append("fields",JSON.stringify(s)),f.append("limit_start",i.toString()),f.append("limit_page_length",d.toString()),f.append("order_by",c),Object.keys(a).length>0){const x=Object.entries(a).map(([y,_])=>[y,"=",_]);f.append("filters",JSON.stringify(x))}const g=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team?${f.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);return{data:(yield g.json()).data||[]}})}getMaintenanceTeam(t){return oe(this,null,function*(){const a=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team/${encodeURIComponent(t)}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return(yield a.json()).data})}createMaintenanceTeam(t){return oe(this,null,function*(){const a=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team`,{method:"POST",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(t)});if(!a.ok){const i=yield a.json().catch(()=>({}));throw new Error(i.message||`HTTP error! status: ${a.status}`)}return(yield a.json()).data})}updateMaintenanceTeam(t,a){return oe(this,null,function*(){const s=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team/${encodeURIComponent(t)}`,{method:"PUT",headers:yield this.getHeaders(),credentials:"include",body:JSON.stringify(a)});if(!s.ok){const d=yield s.json().catch(()=>({}));throw new Error(d.message||`HTTP error! status: ${s.status}`)}return(yield s.json()).data})}deleteMaintenanceTeam(t){return oe(this,null,function*(){const a=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team/${encodeURIComponent(t)}`,{method:"DELETE",headers:yield this.getHeaders(),credentials:"include"});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`)})}getMaintenanceTeamCount(){return oe(this,arguments,function*(t={}){var d,c;const a=new URLSearchParams;if(a.append("fields",JSON.stringify(["count(name) as count"])),Object.keys(t).length>0){const f=Object.entries(t).map(([g,p])=>[g,"=",p]);a.append("filters",JSON.stringify(f))}const s=yield fetch(`${this.baseURL}/api/resource/Asset Maintenance Team?${a.toString()}`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return((c=(d=(yield s.json()).data)==null?void 0:d[0])==null?void 0:c.count)||0})}getUserFullName(t){return oe(this,null,function*(){var a;try{const s=yield fetch(`${this.baseURL}/api/resource/User/${encodeURIComponent(t)}?fields=["full_name"]`,{method:"GET",headers:yield this.getHeaders(),credentials:"include"});return s.ok&&((a=(yield s.json()).data)==null?void 0:a.full_name)||""}catch(s){return""}})}}const eo=new rD,nD=(e={})=>{const[t,a]=j.useState([]),[s,i]=j.useState(!0),[d,c]=j.useState(null),[f,g]=j.useState(0),p=j.useCallback(()=>oe(null,null,function*(){try{i(!0),c(null);const x=yield eo.getMaintenanceTeams(e);a(x.data);const y=yield eo.getMaintenanceTeamCount(e.filters);g(y)}catch(x){c(x instanceof Error?x.message:"Failed to fetch maintenance teams")}finally{i(!1)}}),[JSON.stringify(e)]);return j.useEffect(()=>{p()},[p]),{teams:t,loading:s,error:d,totalCount:f,refetch:p}},sD=e=>{const[t,a]=j.useState(null),[s,i]=j.useState(!1),[d,c]=j.useState(null),f=j.useCallback(()=>oe(null,null,function*(){if(!e){a(null);return}try{i(!0),c(null);const g=yield eo.getMaintenanceTeam(e);a(g)}catch(g){c(g instanceof Error?g.message:"Failed to fetch maintenance team details")}finally{i(!1)}}),[e]);return j.useEffect(()=>{f()},[f]),{team:t,loading:s,error:d,refetch:f}},iD=()=>{const[e,t]=j.useState(!1),[a,s]=j.useState(null);return{createTeam:g=>oe(null,null,function*(){try{return t(!0),s(null),yield eo.createMaintenanceTeam(g)}catch(p){const x=p instanceof Error?p.message:"Failed to create maintenance team";throw s(x),p}finally{t(!1)}}),updateTeam:(g,p)=>oe(null,null,function*(){try{return t(!0),s(null),yield eo.updateMaintenanceTeam(g,p)}catch(x){const y=x instanceof Error?x.message:"Failed to update maintenance team";throw s(y),x}finally{t(!1)}}),deleteTeam:g=>oe(null,null,function*(){try{t(!0),s(null),yield eo.deleteMaintenanceTeam(g)}catch(p){const x=p instanceof Error?p.message:"Failed to delete maintenance team";throw s(x),p}finally{t(!1)}}),getUserFullName:g=>oe(null,null,function*(){return yield eo.getUserFullName(g)}),loading:e,error:a}},lD=({isOpen:e,onClose:t,selectedCount:a,totalCount:s,pageCount:i,onExport:d,isExporting:c,exportColumns:f})=>{const[g,p]=j.useState(a>0?"selected":"all_with_filters"),[x,y]=j.useState("csv"),[_,k]=j.useState(f.filter(O=>O.default).map(O=>O.key));j.useEffect(()=>{p(a>0?"selected":"all_with_filters")},[a]);const T=O=>k(C=>C.includes(O)?C.filter(A=>A!==O):[...C,O]),N=()=>k(f.map(O=>O.key)),S=()=>k(f.filter(O=>O.default).map(O=>O.key));return e?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70] p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden animate-scale-in",children:[r.jsx("div",{className:"bg-gradient-to-r from-green-500 to-green-600 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qr,{className:"text-white text-xl"}),r.jsx("h3",{className:"text-lg font-semibold text-white",children:"Export Maintenance Teams"})]}),r.jsx("button",{onClick:t,className:"text-white/80 hover:text-white transition-colors",disabled:c,children:r.jsx(vt,{size:20})})]})}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-180px)]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Select Data to Export"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="selected"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${a===0?"opacity-50 cursor-not-allowed":""}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"selected",checked:g==="selected",onChange:()=>p("selected"),disabled:a===0,className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Selected Rows"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",a," selected team",a!==1?"s":""]})]}),a>0&&r.jsxs("span",{className:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 px-2 py-1 rounded text-xs font-medium",children:[a," selected"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_on_page"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_on_page",checked:g==="all_on_page",onChange:()=>p("all_on_page"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Current Page"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export ",i," team",i!==1?"s":""," on current page"]})]}),r.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-2 py-1 rounded text-xs font-medium",children:[i," rows"]})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${g==="all_with_filters"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"scope",value:"all_with_filters",checked:g==="all_with_filters",onChange:()=>p("all_with_filters"),className:"text-green-600 focus:ring-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"All Records (with current filters)"}),r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Export all ",s," team",s!==1?"s":""," matching current filters"]})]}),r.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/40 text-purple-700 dark:text-purple-300 px-2 py-1 rounded text-xs font-medium",children:[s," total"]})]})]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Export Format"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${x==="csv"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"csv",checked:x==="csv",onChange:()=>y("csv"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Ac,{className:"text-green-600 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"CSV"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated values"})]})]}),r.jsxs("label",{className:`flex-1 flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-all ${x==="excel"?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[r.jsx("input",{type:"radio",name:"format",value:"excel",checked:x==="excel",onChange:()=>y("excel"),className:"text-green-600 focus:ring-green-500"}),r.jsx(Oc,{className:"text-green-700 text-xl"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:"Excel"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"XLSX spreadsheet"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Columns to Export"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:N,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Select All"}),r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),r.jsx("button",{onClick:S,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:"Reset to Default"})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-48 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg",children:f.map(O=>r.jsxs("label",{className:`flex items-center gap-2 p-2 rounded cursor-pointer transition-all ${_.includes(O.key)?"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-400"}`,children:[r.jsx("input",{type:"checkbox",checked:_.includes(O.key),onChange:()=>T(O.key),className:"rounded text-green-600 focus:ring-green-500"}),r.jsx("span",{className:"text-sm truncate",children:O.label})]},O.key))}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:[_.length," column",_.length!==1?"s":""," selected"]})]})]}),r.jsxs("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[r.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[g==="selected"&&`Exporting ${a} selected row${a!==1?"s":""}`,g==="all_on_page"&&`Exporting ${i} row${i!==1?"s":""} from current page`,g==="all_with_filters"&&`Exporting all ${s} row${s!==1?"s":""}`]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",disabled:c,children:"Cancel"}),r.jsx("button",{onClick:()=>d(g,x,_),disabled:_.length===0||c,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 hover:bg-green-700 rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Exporting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_i,{}),"Export"]})})]})]})]})}):null},oD=()=>{const{t:e}=Qa(),t=Na(),a=[{key:"name",label:e("maintenance.teamId"),default:!0},{key:"maintenance_team_name",label:e("maintenance.teamName"),default:!0},{key:"maintenance_manager",label:e("maintenance.managerEmail"),default:!0},{key:"maintenance_manager_name",label:e("maintenance.managerName"),default:!0},{key:"company",label:e("commonFields.hospital"),default:!0},{key:"custom_expertise",label:e("maintenance.expertise"),default:!0},{key:"creation",label:e("commonFields.createdOn"),default:!1},{key:"modified",label:e("commonFields.modifiedOn"),default:!1}],[s,i]=j.useState(1),[d]=j.useState(20),[c,f]=j.useState(!1),[g,p]=j.useState(new Set),[x,y]=j.useState(!1),[_,k]=j.useState(!1),[T,N]=j.useState(null),[S,O]=j.useState(""),[C,A]=j.useState(""),[P,I]=j.useState(!1),[ee,B]=j.useState(0),[H,Y]=j.useState([]),[ue,xe]=j.useState(!1),[le,ge]=j.useState("");j.useEffect(()=>{const Ge=localStorage.getItem("maintenanceTeamFilterPresets");Ge&&Y(JSON.parse(Ge))},[]),j.useEffect(()=>{const Ge=[S,C].filter(Boolean).length;B(Ge)},[S,C]);const be=j.useMemo(()=>{const Ge={};return S&&(Ge.company=S),C&&(Ge.name=C),Ge},[S,C]),{teams:me,loading:ae,error:Z,totalCount:K,refetch:te}=nD({filters:be,limit_start:(s-1)*d,limit_page_length:d,order_by:"creation desc"});j.useEffect(()=>{!ae&&!c&&f(!0)},[ae,c]),j.useEffect(()=>{s!==1&&i(1)},[S,C]),j.useEffect(()=>{p(new Set)},[S,C,s]);const se=Math.ceil(K/d),F=Ge=>Ge?new Date(Ge).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"-",D=()=>{O(""),A(""),i(1)},W=S||C,G=()=>{if(!le.trim()){alert("Please enter a filter name");return}const Ge={id:Date.now(),name:le,filters:{companyFilter:S,teamNameFilter:C}},Ct=[...H,Ge];Y(Ct),ge(""),xe(!1),localStorage.setItem("maintenanceTeamFilterPresets",JSON.stringify(Ct))},J=Ge=>{const Ct=Ge.filters;O(Ct.companyFilter||""),A(Ct.teamNameFilter||"")},de=Ge=>{const Ct=H.filter(St=>St.id!==Ge);Y(Ct),localStorage.setItem("maintenanceTeamFilterPresets",JSON.stringify(Ct))},De=Ge=>{p(Ct=>{const St=new Set(Ct);return St.has(Ge)?St.delete(Ge):St.add(Ge),St})},Ne=()=>{g.size===me.length?p(new Set):p(new Set(me.map(Ge=>Ge.name)))},$e=me.length>0&&g.size===me.length,Ve=g.size>0&&g.size<me.length,st=j.useCallback(()=>oe(null,null,function*(){const Ge=[];let Ct=0;const St=100;let Ue=!0;for(;Ue;)try{const Ie=(yield(yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doctype:"Asset Maintenance Team",filters:be,fields:["*"],limit_start:Ct*St,limit_page_length:St,order_by:"creation desc"})})).json()).message||[];Ge.push(...Ie),Ie.length<St?Ue=!1:Ct++,Ct>100&&(console.warn("Export safety limit reached"),Ue=!1)}catch(ce){throw console.error("Error fetching teams for export:",ce),ce}return Ge}),[be]),gt=(Ge,Ct,St)=>oe(null,null,function*(){k(!0);try{let Ue=[];switch(Ge){case"selected":Ue=me.filter(we=>g.has(we.name));break;case"all_on_page":Ue=me;break;case"all_with_filters":Ue=yield st();break}if(Ue.length===0){alert("No data to export");return}const ce=St.map(we=>{var Ie;return((Ie=a.find(lt=>lt.key===we))==null?void 0:Ie.label)||we});if(Ct==="csv"){const we=[ce.join(","),...Ue.map(Ze=>St.map(ze=>{let bt=Ze[ze]||"";return typeof bt=="string"&&(bt.includes(",")||bt.includes('"')||bt.includes(`
|
||
`))&&(bt=`"${bt.replace(/"/g,'""')}"`),bt}).join(","))].join(`
|
||
`),Ie=new Blob(["\uFEFF"+we],{type:"text/csv;charset=utf-8;"}),lt=URL.createObjectURL(Ie),ft=document.createElement("a");ft.href=lt,ft.download=`maintenance_teams_export_${new Date().toISOString().split("T")[0]}.csv`,ft.click(),URL.revokeObjectURL(lt)}else if(Ct==="excel"){const we=[ce,...Ue.map(ft=>St.map(Ze=>ft[Ze]||""))],Ie=kr.aoa_to_sheet(we),lt=kr.book_new();kr.book_append_sheet(lt,Ie,"Maintenance Teams"),Ic(lt,`maintenance_teams_export_${new Date().toISOString().split("T")[0]}.xlsx`)}y(!1),p(new Set)}catch(Ue){console.error("Export failed:",Ue),alert(`Export failed: ${Ue instanceof Error?Ue.message:"Unknown error"}`)}finally{k(!1)}}),zt=Ge=>oe(null,null,function*(){try{if(!(yield fetch(`/api/resource/Asset Maintenance Team/${encodeURIComponent(Ge)}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to delete");N(null),te(),alert("Maintenance Team deleted successfully!")}catch(Ct){alert(`Failed to delete: ${Ct instanceof Error?Ct.message:"Unknown error"}`)}});return ae&&!c?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance teams..."})]})}):Z?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:"Error Loading Maintenance Teams"}),r.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:Z}),r.jsx("button",{onClick:te,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded",children:"Try Again"})]})}):r.jsxs("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:[r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsx("div",{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Zd,{className:"text-3xl text-indigo-600 dark:text-indigo-400"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white",children:"Maintenance Teams"}),r.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Total: ",K," team",K!==1?"s":"",g.size>0&&r.jsxs("span",{className:"ml-2 text-blue-600 dark:text-blue-400",children:["• ",g.size," selected"]}),ae&&c&&r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400",children:[r.jsx("div",{className:"animate-spin rounded-full h-3 w-3 border-b-2 border-blue-500"}),"Updating..."]})]})]})]})}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{onClick:()=>I(!P),className:`px-4 py-2 rounded-lg flex items-center gap-2 transition-colors ${P||W?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:[r.jsx(ws,{}),"Filters",ee>0&&r.jsx("span",{className:"bg-blue-600 text-white text-xs px-1.5 py-0.5 rounded-full",children:ee})]}),r.jsxs("button",{onClick:te,disabled:ae,className:"px-4 py-2 rounded-lg bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 flex items-center gap-2 disabled:opacity-50",children:[r.jsx(mp,{className:ae?"animate-spin":""}),"Refresh"]}),r.jsxs("button",{onClick:()=>y(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow transition-all",disabled:K===0,children:[r.jsx(Qr,{}),r.jsx("span",{className:"font-medium",children:"Export"}),g.size>0&&r.jsx("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-xs",children:g.size})]}),r.jsxs("button",{onClick:()=>t("/maintenance-teams/new"),className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 shadow-lg transition-all hover:shadow-xl",children:[r.jsx(ts,{}),r.jsx("span",{className:"font-medium",children:"New Team"})]})]})]}),P&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 mb-4",children:[r.jsx("div",{className:"bg-gradient-to-r from-indigo-500 to-indigo-600 dark:from-indigo-600 dark:to-indigo-700 px-4 py-3 rounded-t-lg",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ws,{className:"text-white",size:16}),r.jsx("h3",{className:"text-white font-semibold text-sm",children:"Filters"}),ee>0&&r.jsx("span",{className:"bg-white text-indigo-600 px-2 py-0.5 rounded-full text-xs font-bold",children:ee})]}),W&&r.jsx("div",{className:"flex-1 overflow-x-auto scrollbar-hide mx-2",children:r.jsxs("div",{className:"flex items-center gap-2 py-1",children:[S&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-green-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Hospital:"})," ",S,r.jsx("button",{onClick:()=>O(""),className:"hover:text-red-500",children:r.jsx(vt,{className:"text-[9px]"})})]}),C&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-white/90 text-indigo-700 rounded-full text-[10px] font-medium whitespace-nowrap shadow-sm",children:[r.jsx("span",{className:"font-semibold",children:"Team:"})," ",C,r.jsx("button",{onClick:()=>A(""),className:"hover:text-red-500",children:r.jsx(vt,{className:"text-[9px]"})})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[ee>0&&r.jsxs("button",{onClick:()=>xe(!0),className:"px-3 py-1.5 bg-white text-indigo-600 hover:bg-indigo-50 rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(jr,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),W&&r.jsxs("button",{onClick:D,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-md text-xs font-medium transition-all flex items-center gap-1.5",children:[r.jsx(vt,{size:12}),r.jsx("span",{className:"hidden sm:inline",children:"Clear"})]})]})]})}),r.jsxs("div",{className:"p-4",children:[H.length>0&&r.jsxs("div",{className:"mb-4 pb-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[r.jsx(p0,{className:"text-yellow-500",size:12}),"Saved Filters"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:H.map(Ge=>r.jsxs("div",{className:"group relative inline-flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-100 to-indigo-100 dark:from-purple-900/30 dark:to-indigo-900/30 border border-purple-200 dark:border-purple-700 rounded-lg hover:shadow-md transition-all",children:[r.jsx("button",{onClick:()=>J(Ge),className:"text-xs font-medium text-purple-700 dark:text-purple-300",children:Ge.name}),r.jsx("button",{onClick:()=>de(Ge.id),className:"opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 transition-opacity",children:r.jsx(ha,{size:10})})]},Ge.id))})]}),r.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-lg",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[r.jsxs("div",{className:"relative z-[60]",children:[r.jsx(kt,{label:"Hospital",doctype:"Company",value:S,onChange:Ge=>{O(Ge),i(1)},placeholder:"Select Hospital",disabled:!1,compact:!0}),S&&r.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]}),r.jsxs("div",{className:"relative z-[59]",children:[r.jsx(kt,{label:e("maintenance.teamName"),doctype:"Asset Maintenance Team",value:C,onChange:Ge=>{A(Ge),i(1)},placeholder:e("maintenance.selectTeam"),disabled:!1,compact:!0}),C&&r.jsx("button",{onClick:()=>A(""),className:"absolute right-2 top-6 text-gray-400 hover:text-red-500 transition-colors z-10",children:r.jsx(vt,{size:10})})]})]})})]})]}),ue&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 animate-scale-in",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:e("listPages.saveFilterPreset")}),r.jsx("input",{type:"text",value:le,onChange:Ge=>ge(Ge.target.value),onKeyDown:Ge=>{Ge.key==="Enter"&&(Ge.preventDefault(),G())},placeholder:e("listPages.enterFilterName"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{xe(!1),ge("")},className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",children:e("common.cancel")}),r.jsxs("button",{onClick:G,className:"px-4 py-2 text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 rounded-md transition-colors flex items-center gap-2",children:[r.jsx(jr,{size:12}),e("listPages.saveFilter")]})]})]})}),r.jsx(lD,{isOpen:x,onClose:()=>y(!1),selectedCount:g.size,totalCount:K,pageCount:me.length,onExport:gt,isExporting:_,exportColumns:a}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700 overflow-hidden relative",children:[ae&&c&&r.jsx("div",{className:"absolute inset-0 bg-white/60 dark:bg-gray-800/60 flex items-center justify-center z-10 backdrop-blur-[1px]",children:r.jsxs("div",{className:"flex items-center gap-3 bg-white dark:bg-gray-700 px-4 py-2 rounded-lg shadow-lg",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-indigo-500"}),r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:e("listPages.filtering")})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-100 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("button",{onClick:Ne,className:"text-gray-500 dark:text-gray-400 hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors",title:e($e?"listPages.deselectAllTitle":"listPages.selectAllTitle"),children:$e?r.jsx(Fn,{className:"text-indigo-600 dark:text-indigo-400",size:18}):Ve?r.jsxs("div",{className:"relative",children:[r.jsx(wr,{size:18}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-2 h-0.5 bg-current"})})]}):r.jsx(wr,{size:18})})}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("maintenance.teamName")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("maintenance.managerName")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("commonFields.hospital")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("maintenance.expertise")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("commonFields.createdOn")}),r.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e("listPages.actions")})]})}),r.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:me.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:7,className:"px-4 py-12 text-center text-gray-500 dark:text-gray-400",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Zd,{className:"text-4xl text-gray-300 dark:text-gray-600 mb-2"}),r.jsx("p",{children:e("listPages.noMaintenanceTeamsFound")}),W?r.jsx("button",{onClick:D,className:"mt-4 text-indigo-600 dark:text-indigo-400 hover:underline",children:e("listPages.clearFilters")}):r.jsx("button",{onClick:()=>t("/maintenance-teams/new"),className:"mt-4 text-indigo-600 dark:text-indigo-400 hover:underline",children:e("listPages.createFirstTeam")})]})})}):me.map(Ge=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 cursor-pointer transition-colors ${g.has(Ge.name)?"bg-indigo-50 dark:bg-indigo-900/20":""}`,onClick:()=>t(`/maintenance-teams/${Ge.name}`),children:[r.jsx("td",{className:"px-4 py-3",onClick:Ct=>Ct.stopPropagation(),children:r.jsx("button",{onClick:()=>De(Ge.name),className:"text-gray-500 dark:text-gray-400 hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors",children:g.has(Ge.name)?r.jsx(Fn,{className:"text-indigo-600 dark:text-indigo-400",size:18}):r.jsx(wr,{size:18})})}),r.jsxs("td",{className:"px-4 py-3",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Ge.maintenance_team_name}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:Ge.name})]}),r.jsxs("td",{className:"px-4 py-3",children:[r.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:Ge.maintenance_manager_name||"-"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:Ge.maintenance_manager||"-"})]}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:Ge.company||"-"})}),r.jsx("td",{className:"px-4 py-3",children:Ge.custom_expertise?r.jsx("span",{className:"inline-flex px-2 py-1 text-xs font-medium rounded-full bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-300",children:Ge.custom_expertise}):r.jsx("span",{className:"text-gray-400",children:"-"})}),r.jsx("td",{className:"px-4 py-3",children:r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:F(Ge.creation)})}),r.jsx("td",{className:"px-4 py-3",children:r.jsxs("div",{className:"flex items-center gap-1",onClick:Ct=>Ct.stopPropagation(),children:[r.jsx("button",{onClick:()=>t(`/maintenance-teams/${Ge.name}`),className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-2 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded transition-colors",title:e("maintenance.viewDetails"),children:r.jsx(hl,{})}),r.jsx("button",{onClick:()=>t(`/maintenance-teams/${Ge.name}`),className:"text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 p-2 hover:bg-green-50 dark:hover:bg-green-900/30 rounded transition-colors",title:e("maintenance.editTeam"),children:r.jsx(Rr,{})}),r.jsx("button",{onClick:()=>t(`/maintenance-teams/new?duplicate=${Ge.name}`),className:"text-purple-600 dark:text-purple-400 hover:text-purple-900 dark:hover:text-purple-300 p-2 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded transition-colors",title:e("maintenance.duplicateTeam"),children:r.jsx(Cc,{})}),r.jsx("button",{onClick:()=>N(Ge.name),className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-2 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:e("maintenance.deleteTeam"),children:r.jsx(ha,{})})]})})]},Ge.name))})]})}),se>1&&r.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Showing ",(s-1)*d+1," to ",Math.min(s*d,K)," of ",K," teams"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>i(Ge=>Math.max(1,Ge-1)),disabled:s===1,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50 dark:hover:bg-gray-700",children:r.jsx(Vf,{})}),r.jsxs("span",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:["Page ",s," of ",se]}),r.jsx("button",{onClick:()=>i(Ge=>Math.min(se,Ge+1)),disabled:s===se,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50 dark:hover:bg-gray-700",children:r.jsx(Gf,{})})]})]})]}),T&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:r.jsx(ha,{className:"text-red-600 dark:text-red-400 text-xl"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Delete Maintenance Team"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Are you sure you want to delete this maintenance team? This action cannot be undone."}),r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-3 mb-4",children:r.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:[r.jsx("strong",{children:"Team:"})," ",T]})}),r.jsxs("div",{className:"flex gap-3 justify-end",children:[r.jsx("button",{onClick:()=>N(null),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",children:"Cancel"}),r.jsxs("button",{onClick:()=>zt(T),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors flex items-center gap-2",children:[r.jsx(ha,{}),"Delete Team"]})]})]})]})})}),r.jsx("style",{children:`
|
||
@keyframes scale-in { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
|
||
.animate-scale-in { animation: scale-in 0.2s ease-out; }
|
||
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
|
||
.scrollbar-hide::-webkit-scrollbar { display: none; }
|
||
`})]})},cD=()=>{var se;const{t:e}=Qa(),{teamName:t}=ul(),[a]=fl(),s=Na(),i=t==="new",d=a.get("duplicate"),[c,f]=j.useState({maintenance_team_name:"",maintenance_manager:"",maintenance_manager_name:"",company:"",custom_expertise:"",maintenance_team_members:[]}),{team:g,loading:p,error:x,refetch:y}=sD(i?d||null:t||null),{createTeam:_,updateTeam:k,deleteTeam:T,getUserFullName:N,loading:S}=iD(),[O,C]=j.useState(i),[A,P]=j.useState(!1),[I,ee]=j.useState(null),[B,H]=j.useState(null),Y=F=>oe(null,null,function*(){if(!F)return{exists:!1};try{const D=yield fetch("/api/method/frappe.client.get_list",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include",body:JSON.stringify({doctype:"Asset Maintenance Team",filters:{},fields:["name","maintenance_team_name","maintenance_team_members.team_member"],limit_page_length:0})});if(!D.ok)return yield ue(F);const G=(yield D.json()).message||[];for(const J of G)if(!(J.name===t||J.name===(g==null?void 0:g.name))&&J["maintenance_team_members.team_member"]===F)return{exists:!0,teamName:J.maintenance_team_name||J.name};return yield ue(F)}catch(D){return console.error("Error checking member in other teams:",D),yield ue(F)}}),ue=F=>oe(null,null,function*(){var D,W;try{const G=yield fetch('/api/resource/Asset Maintenance Team?fields=["name","maintenance_team_name"]&limit_page_length=0',{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!G.ok)return{exists:!1};const de=(yield G.json()).data||[];for(const De of de){if(De.name===t||De.name===(g==null?void 0:g.name))continue;const Ne=yield fetch(`/api/resource/Asset Maintenance Team/${encodeURIComponent(De.name)}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!Ne.ok)continue;const $e=yield Ne.json();if((((D=$e.data)==null?void 0:D.maintenance_team_members)||[]).some(gt=>gt.team_member===F))return{exists:!0,teamName:((W=$e.data)==null?void 0:W.maintenance_team_name)||De.name}}return{exists:!1}}catch(G){return console.error("Fallback check failed:",G),{exists:!1}}});j.useEffect(()=>{var F;g&&(f({maintenance_team_name:i&&d?`${g.maintenance_team_name} (Copy)`:g.maintenance_team_name||"",maintenance_manager:g.maintenance_manager||"",maintenance_manager_name:g.maintenance_manager_name||"",company:g.company||"",custom_expertise:g.custom_expertise||"",maintenance_team_members:((F=g.maintenance_team_members)==null?void 0:F.map((D,W)=>Ee(ie({},D),{idx:W+1,name:i?void 0:D.name})))||[]}),i||C(!1))},[g,i,d]);const xe=F=>{const{name:D,value:W}=F.target;f(G=>Ee(ie({},G),{[D]:W}))},le=F=>oe(null,null,function*(){if(f(D=>Ee(ie({},D),{maintenance_manager:F})),F){const D=yield N(F);f(W=>Ee(ie({},W),{maintenance_manager_name:D}))}else f(D=>Ee(ie({},D),{maintenance_manager_name:""}))}),ge=(F,D,W)=>oe(null,null,function*(){var G;if(D==="team_member"&&W){if((G=c.maintenance_team_members)==null?void 0:G.some((Ve,st)=>st!==F&&Ve.team_member===W)){Et.error("This member is already added to this team!",{position:"top-right",autoClose:4e3,icon:r.jsx(hn,{})});return}H(F),Et.info("Checking member availability...",{position:"top-right",autoClose:2e3,icon:()=>r.jsx("span",{children:"🔍"})});const{exists:de,teamName:De}=yield Y(W);if(H(null),de){Et.error(r.jsxs("div",{children:[r.jsx("strong",{children:"Cannot add member!"}),r.jsx("br",{}),r.jsxs("span",{className:"text-sm",children:["This member is already assigned to: ",r.jsx("b",{children:De})]})]}),{position:"top-right",autoClose:5e3,icon:r.jsx(hn,{})});return}const Ne=yield N(W),$e=[...c.maintenance_team_members||[]];$e[F]=Ee(ie({},$e[F]),{team_member:W,full_name:Ne}),f(Ve=>Ee(ie({},Ve),{maintenance_team_members:$e})),Et.success("Member added successfully!",{position:"top-right",autoClose:2e3,icon:r.jsx(Ja,{})})}else{const J=[...c.maintenance_team_members||[]];J[F]=Ee(ie({},J[F]),{[D]:W}),f(de=>Ee(ie({},de),{maintenance_team_members:J}))}}),be=()=>{var D;const F={team_member:"",full_name:"",maintenance_role:"",idx:(((D=c.maintenance_team_members)==null?void 0:D.length)||0)+1};f(W=>Ee(ie({},W),{maintenance_team_members:[...W.maintenance_team_members||[],F]}))},me=F=>{var W;const D=((W=c.maintenance_team_members)==null?void 0:W.filter((G,J)=>J!==F))||[];D.forEach((G,J)=>{G.idx=J+1}),f(G=>Ee(ie({},G),{maintenance_team_members:D})),ee(null)},ae=()=>oe(null,null,function*(){var F;if(!c.maintenance_team_name){Et.error("Please enter a team name",{position:"top-right",autoClose:4e3,icon:r.jsx(hn,{})});return}try{const D=Ee(ie({},c),{maintenance_team_members:(F=c.maintenance_team_members)==null?void 0:F.map(W=>({team_member:W.team_member,full_name:W.full_name,maintenance_role:W.maintenance_role})).filter(W=>W.team_member)});if(i){const W=yield _(D);Et.success("Maintenance Team created successfully!",{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),s(`/maintenance-teams/${W.name}`)}else yield k(t,D),Et.success("Maintenance Team updated successfully!",{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),C(!1),y()}catch(D){const W=D instanceof Error?D.message:"Unknown error";Et.error(`Failed to save: ${W}`,{position:"top-right",autoClose:6e3,icon:r.jsx(hn,{})})}}),Z=()=>oe(null,null,function*(){try{yield T(t),Et.success("Maintenance Team deleted successfully!",{position:"top-right",autoClose:3e3,icon:r.jsx(Ja,{})}),s("/maintenance-teams")}catch(F){const D=F instanceof Error?F.message:"Unknown error";Et.error(`Failed to delete: ${D}`,{position:"top-right",autoClose:6e3,icon:r.jsx(hn,{})})}}),K=j.useCallback(F=>!O,[O]),te=F=>F?new Date(F).toLocaleString():"-";return p?r.jsx("div",{className:"flex items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading maintenance team..."})]})}):x&&!i?r.jsx("div",{className:"p-6 bg-gray-50 dark:bg-gray-900 min-h-screen",children:r.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6",children:[r.jsx("h2",{className:"text-xl font-bold text-red-800 dark:text-red-300 mb-4",children:e("maintenance.errorLoadingTeam")}),r.jsx("p",{className:"text-red-700 dark:text-red-400 mb-4",children:x}),r.jsx("button",{onClick:()=>s("/maintenance-teams"),className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded",children:e("maintenance.backToTeams")})]})}):r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:[r.jsx(Hp,{position:"top-right",autoClose:4e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"colored",transition:fh}),r.jsxs("div",{className:"mb-6 flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("button",{onClick:()=>s("/maintenance-teams"),className:"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200",children:r.jsx(Gs,{size:20})}),r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold text-gray-800 dark:text-white flex items-center gap-3",children:[r.jsx(Zd,{className:"text-indigo-500"}),i?"New Maintenance Team":(g==null?void 0:g.maintenance_team_name)||"Maintenance Team"]}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:i?"Create a new maintenance team":g==null?void 0:g.name})]})]}),r.jsxs("div",{className:"flex gap-3",children:[!i&&!O&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>C(!0),className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(Rr,{}),e("common.edit")]}),r.jsxs("button",{onClick:()=>P(!0),className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[r.jsx(ha,{}),e("common.delete")]})]}),O&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>{i?s("/maintenance-teams"):(C(!1),y())},className:"bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:e("common.cancel")}),r.jsxs("button",{onClick:ae,disabled:S,className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50",children:[r.jsx(jr,{}),e(S?"common.saving":"common.save")]})]})]})]}),A&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[r.jsx(yr,{className:"text-red-500 text-xl mt-0.5"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:e("maintenance.deleteTeam")}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:e("confirmations.cannotUndo")})]})]}),r.jsxs("div",{className:"flex justify-end gap-3",children:[r.jsx("button",{onClick:()=>P(!1),className:"px-4 py-2 bg-gray-300 hover:bg-gray-400 text-gray-700 rounded-lg",children:e("common.cancel")}),r.jsx("button",{onClick:Z,disabled:S,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg disabled:opacity-50",children:e(S?"common.deleting":"common.delete")})]})]})}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(Zd,{className:"text-indigo-500"}),e("maintenance.teamInformation")]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"md:col-span-2",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[e("maintenance.teamName")," ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{type:"text",name:"maintenance_team_name",value:c.maintenance_team_name,onChange:xe,disabled:K("maintenance_team_name"),placeholder:e("maintenance.enterTeamName"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white disabled:bg-gray-100 dark:disabled:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-indigo-500"})]}),r.jsx("div",{children:r.jsx(kt,{label:e("commonFields.hospital"),doctype:"Company",value:c.company||"",onChange:F=>f(Ee(ie({},c),{company:F})),disabled:K("company"),placeholder:e("maintenance.selectHospital")})}),r.jsx("div",{children:r.jsx(kt,{label:e("maintenance.expertise"),doctype:"Issue Type",value:c.custom_expertise||"",onChange:F=>f(Ee(ie({},c),{custom_expertise:F})),disabled:K("custom_expertise"),placeholder:e("maintenance.selectExpertise")})}),r.jsx("div",{children:r.jsx(kt,{label:e("maintenance.manager"),doctype:"User",value:c.maintenance_manager||"",onChange:le,disabled:K("maintenance_manager"),placeholder:e("maintenance.selectManager")})}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("maintenance.managerName")}),r.jsx("input",{type:"text",value:c.maintenance_manager_name||"",disabled:!0,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400"})]})]})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 pb-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white flex items-center gap-2",children:[r.jsx(MS,{className:"text-green-500"}),"Team Members"]}),O&&r.jsxs("button",{onClick:be,disabled:B!==null,className:"bg-green-600 hover:bg-green-700 text-white px-3 py-1.5 rounded-lg flex items-center gap-2 text-sm disabled:opacity-50 disabled:cursor-not-allowed",children:[r.jsx(ts,{size:12}),"Add Member"]})]}),c.maintenance_team_members&&c.maintenance_team_members.length>0?r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:"#"}),r.jsxs("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:["Team Member",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Full Name"}),r.jsxs("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:["Role",r.jsx("span",{className:"text-red-500",children:"*"})]}),O&&r.jsx("th",{className:"px-3 py-2 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:"Action"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:c.maintenance_team_members.map((F,D)=>r.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 ${B===D?"opacity-70":""}`,children:[r.jsx("td",{className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-400",children:D+1}),r.jsx("td",{className:"px-3 py-2",children:O?r.jsxs("div",{className:"relative",children:[r.jsx(kt,{label:"",doctype:"User",value:F.team_member||"",onChange:W=>ge(D,"team_member",W),disabled:B!==null,placeholder:e("maintenance.selectUser"),compact:!0}),B===D&&r.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-indigo-500"})})]}):r.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:F.team_member||"-"})}),r.jsx("td",{className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-300",children:F.full_name||"-"}),r.jsx("td",{className:"px-3 py-2",children:O?r.jsx(kt,{label:"",doctype:"Role",value:F.maintenance_role||"",onChange:W=>ge(D,"maintenance_role",W),disabled:B!==null,placeholder:e("maintenance.selectRole"),compact:!0}):r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:F.maintenance_role||"-"})}),O&&r.jsx("td",{className:"px-3 py-2 text-center",children:r.jsx("button",{onClick:()=>ee(D),className:"text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 p-1.5 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors",title:e("maintenance.removeMember"),children:r.jsx(ha,{size:14})})})]},D))})]})}):r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[r.jsx(Zd,{className:"text-4xl mx-auto mb-2 text-gray-300 dark:text-gray-600"}),r.jsx("p",{children:e("maintenance.noTeamMembersYet")}),O&&r.jsxs("button",{onClick:be,className:"mt-3 text-indigo-600 dark:text-indigo-400 hover:underline",children:["+ ",e("maintenance.addFirstMember")]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(LS,{className:"text-blue-500"}),e("maintenance.teamSummary")]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-4 bg-indigo-50 dark:bg-indigo-900/30 rounded-lg border border-indigo-200 dark:border-indigo-800",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("maintenance.totalMembers")}),r.jsx("p",{className:"text-2xl font-bold text-indigo-600 dark:text-indigo-300",children:((se=c.maintenance_team_members)==null?void 0:se.filter(F=>F.team_member).length)||0})]}),c.maintenance_manager_name&&r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:e("maintenance.manager")}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:c.maintenance_manager_name})]}),c.company&&r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Hospital"}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:c.company})]}),c.custom_expertise&&r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Expertise"}),r.jsx("span",{className:"inline-flex px-2 py-1 text-xs font-medium rounded-full bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-300",children:c.custom_expertise})]})]})]}),!i&&g&&r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border border-gray-200 dark:border-gray-700",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white mb-4 pb-2 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[r.jsx(hp,{className:"text-teal-500"}),"Details"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:te(g.creation)})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Last Modified"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:te(g.modified)})]}),r.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Modified By"}),r.jsx("p",{className:"text-sm text-gray-900 dark:text-white",children:g.modified_by||"-"})]})]})]})]})]}),I!==null&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-sm w-full mx-4 shadow-xl",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[r.jsx(yr,{className:"text-orange-500 text-xl mt-0.5"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:"Remove Team Member"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Are you sure you want to remove this team member?"})]})]}),r.jsxs("div",{className:"flex justify-end gap-3",children:[r.jsx("button",{onClick:()=>ee(null),className:"px-4 py-2 bg-gray-300 hover:bg-gray-400 text-gray-700 rounded-lg",children:"Cancel"}),r.jsx("button",{onClick:()=>me(I),className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg",children:"Remove"})]})]})})]})},Pa=({children:e})=>{const t=localStorage.getItem("user"),a=t?JSON.parse(t).email:"";return r.jsxs("div",{className:"flex h-screen overflow-hidden bg-gray-50 dark:bg-gray-900",children:[r.jsx(IL,{userEmail:a}),r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r.jsx(WL,{userEmail:a}),r.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 dark:bg-gray-900",children:e})]})]})},Ra=({children:e})=>localStorage.getItem("user")?r.jsx(r.Fragment,{children:e}):r.jsx(Bg,{to:"/login",replace:!0}),dD=()=>r.jsx(Fj,{basename:"/asm_app",children:r.jsxs(hj,{children:[r.jsx(ga,{path:"/login",element:r.jsx(Xj,{})}),r.jsx(ga,{path:"/dashboard",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(DS,{})})})}),r.jsx(ga,{path:"/assets",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(oO,{})})})}),r.jsx(ga,{path:"/assets/:assetName",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(uO,{})})})}),r.jsx(ga,{path:"/work-orders",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(hO,{})})})}),r.jsx(ga,{path:"/work-orders/:workOrderName",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(aM,{})})})}),r.jsx(ga,{path:"/maintenance",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(rM,{})})})}),r.jsx(ga,{path:"/maintenance/:logName",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(iM,{})})})}),r.jsx(ga,{path:"/ppm",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(dM,{})})})}),r.jsx(ga,{path:"/ppm/:ppmName",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(uM,{})})})}),r.jsx(ga,{path:"/ppm-planner",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(xM,{})})})}),r.jsx(ga,{path:"/ppm-planner/new",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(hM,{})})})}),r.jsx(ga,{path:"/ppm-planner/:scheduleName",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(yM,{})})})}),r.jsx(ga,{path:"/maintenance-calendar",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(Gv,{})})})}),r.jsx(ga,{path:"/maintenance-calendar/month-view",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(vM,{})})})}),r.jsx(ga,{path:"/yearly-ppm-planner",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(Gv,{})})})}),r.jsx(ga,{path:"/active-map",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(VM,{})})})}),r.jsx(ga,{path:"/inventory",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(XM,{})})})}),r.jsx(ga,{path:"/inventory/:itemName",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(JM,{})})})}),r.jsx(ga,{path:"/users",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(p5,{})})})}),r.jsx(ga,{path:"/events",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(x5,{})})})}),r.jsx(ga,{path:"/old-dashboard",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(aS,{})})})}),r.jsx(ga,{path:"/maintenance-teams",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(oD,{})})})}),r.jsx(ga,{path:"/maintenance-teams/:teamName",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(cD,{})})})}),r.jsx(ga,{path:"/procurement",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(Xv,{title:"Procurement"})})})}),r.jsx(ga,{path:"/sla",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(Xv,{title:"Service Level Agreement (SLA)"})})})}),r.jsx(ga,{path:"/support",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(KL,{})})})}),r.jsx(ga,{path:"/support/:issueName",element:r.jsx(Ra,{children:r.jsx(Pa,{children:r.jsx(aD,{})})})}),r.jsx(ga,{path:"/",element:r.jsx(Bg,{to:"/login",replace:!0})}),r.jsx(ga,{path:"*",element:r.jsx(Bg,{to:"/login",replace:!0})})]})});H4.createRoot(document.getElementById("root")).render(r.jsx(j.StrictMode,{children:r.jsx(Yj,{children:r.jsx(zL,{children:r.jsx(dD,{})})})}))});export default uD();
|